diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json index a07299930846..0255dbaf556f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "805e16a53f0a725471e0caa6007b48986c7722d9", + "commit": "5dda818bcffc594911a9394d45476877254de568", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py index 9a3fa295d786..6bea6bf5c3e5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ServiceFabricManagedClustersManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 ffacc8044f11..615cca3efa85 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -29,7 +29,7 @@ class ServiceFabricManagedClustersManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 f9854688fcb5..370832901cbb 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 @@ -67,7 +67,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=too-man :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 "2022-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-06-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 @@ -88,19 +88,45 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.application_types = ApplicationTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.application_type_versions = ApplicationTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_version = ManagedClusterVersionOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_type_skus = NodeTypeSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_types = ApplicationTypesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.application_type_versions = ApplicationTypeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_version = ManagedClusterVersionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_types = NodeTypesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_type_skus = NodeTypeSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 e32dc6ec4218..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.0b1" +VERSION = "0.1.0" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py index 5332d0c615c1..1fddfa63c4fe 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ServiceFabricManagedClustersManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 c2ad88951627..eb9ffe92d031 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 @@ -29,7 +29,7 @@ class ServiceFabricManagedClustersManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,7 +41,7 @@ def __init__( **kwargs: Any ) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str 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 09f513f8c754..19d6ea540d0f 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 @@ -67,7 +67,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=too-man :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 "2022-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-06-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 @@ -88,19 +88,45 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.application_types = ApplicationTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.application_type_versions = ApplicationTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_version = ManagedClusterVersionOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_type_skus = NodeTypeSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_types = ApplicationTypesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.application_type_versions = ApplicationTypeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_version = ManagedClusterVersionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_types = NodeTypesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.node_type_skus = NodeTypeSkusOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 03d5bfe84af0..7b3626f30b84 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 @@ -20,6 +20,9 @@ from ._node_types_operations import NodeTypesOperations from ._node_type_skus_operations import NodeTypeSkusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ApplicationTypesOperations', 'ApplicationTypeVersionsOperations', @@ -35,3 +38,5 @@ 'NodeTypesOperations', 'NodeTypeSkusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 0f7b49498df4..de68df72f0db 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationTypeVersionsOperations: - """ApplicationTypeVersionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_type_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -55,7 +54,7 @@ async def get( application_type_name: str, version: str, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": + ) -> _models.ApplicationTypeVersionResource: """Gets a Service Fabric managed application type version resource. Get a Service Fabric managed application type version resource created or in the process of @@ -74,13 +73,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] request = build_get_request( @@ -91,11 +93,13 @@ async def get( version=version, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -123,17 +127,20 @@ async def _create_or_update_initial( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] + ) -> _models.ApplicationTypeVersionResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') @@ -147,11 +154,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -183,9 +192,9 @@ async def begin_create_or_update( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ApplicationTypeVersionResource"]: + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: """Creates or updates a Service Fabric managed application type version resource. Create or update a Service Fabric managed application type version resource with the specified @@ -216,17 +225,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, @@ -235,20 +247,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -268,9 +287,9 @@ async def update( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionUpdateParameters", + parameters: _models.ApplicationTypeVersionUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": + ) -> _models.ApplicationTypeVersionResource: """Updates the tags of an application type version resource of a given managed cluster. Updates the tags of an application type version resource of a given managed cluster. @@ -291,14 +310,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] _json = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') @@ -312,11 +334,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -346,13 +370,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements version: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -363,11 +390,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements version=version, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -417,22 +446,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -442,8 +476,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -463,7 +503,7 @@ def list_by_application_types( cluster_name: str, application_type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationTypeVersionResourceList"]: + ) -> AsyncIterable[_models.ApplicationTypeVersionResourceList]: """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. @@ -483,13 +523,16 @@ def list_by_application_types( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -500,9 +543,11 @@ def prepare_request(next_link=None): application_type_name=application_type_name, api_version=api_version, template_url=self.list_by_application_types.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -513,9 +558,11 @@ def prepare_request(next_link=None): application_type_name=application_type_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 4358f6803aa9..a8920eb86032 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationTypesOperations: - """ApplicationTypesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -54,7 +53,7 @@ async def get( cluster_name: str, application_type_name: str, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Gets a Service Fabric managed application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -71,13 +70,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] request = build_get_request( @@ -87,11 +89,13 @@ async def get( application_type_name=application_type_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -119,9 +123,9 @@ async def create_or_update( resource_group_name: str, cluster_name: str, application_type_name: str, - parameters: "_models.ApplicationTypeResource", + parameters: _models.ApplicationTypeResource, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Creates or updates a Service Fabric managed application type name resource. Create or update a Service Fabric managed application type name resource with the specified @@ -140,14 +144,17 @@ async def create_or_update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] _json = self._serialize.body(parameters, 'ApplicationTypeResource') @@ -160,11 +167,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -192,9 +201,9 @@ async def update( resource_group_name: str, cluster_name: str, application_type_name: str, - parameters: "_models.ApplicationTypeUpdateParameters", + parameters: _models.ApplicationTypeUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Updates the tags of an application type resource of a given managed cluster. Updates the tags of an application type resource of a given managed cluster. @@ -213,14 +222,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] _json = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') @@ -233,11 +245,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -266,13 +280,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements application_type_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -282,11 +299,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements application_type_name=application_type_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -333,21 +352,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -357,8 +381,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -377,7 +407,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationTypeResourceList"]: + ) -> AsyncIterable[_models.ApplicationTypeResourceList]: """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. @@ -395,13 +425,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -411,9 +444,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -423,9 +458,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 2e8578ca4635..03e0ddf1b2dc 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationsOperations: - """ApplicationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -54,7 +53,7 @@ async def get( cluster_name: str, application_name: str, **kwargs: Any - ) -> "_models.ApplicationResource": + ) -> _models.ApplicationResource: """Gets a Service Fabric managed application resource. Get a Service Fabric managed application resource created or in the process of being created in @@ -71,13 +70,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] request = build_get_request( @@ -87,11 +89,13 @@ async def get( application_name=application_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -118,17 +122,20 @@ async def _create_or_update_initial( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> "_models.ApplicationResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] _json = self._serialize.body(parameters, 'ApplicationResource') @@ -141,11 +148,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def begin_create_or_update( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ApplicationResource"]: + ) -> AsyncLROPoller[_models.ApplicationResource]: """Creates or updates a Service Fabric managed application resource. Create or update a Service Fabric managed application resource with the specified name. @@ -205,17 +214,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -223,20 +235,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -255,9 +274,9 @@ async def update( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationUpdateParameters", + parameters: _models.ApplicationUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationResource": + ) -> _models.ApplicationResource: """Updates the tags of an application resource of a given managed cluster. Updates the tags of an application resource of a given managed cluster. @@ -275,14 +294,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] _json = self._serialize.body(parameters, 'ApplicationUpdateParameters') @@ -295,11 +317,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -328,13 +352,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements application_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -344,11 +371,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements application_name=application_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -395,21 +424,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -419,8 +453,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -439,7 +479,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationResourceList"]: + ) -> AsyncIterable[_models.ApplicationResourceList]: """Gets the list of managed application resources created in the specified Service Fabric cluster resource. @@ -457,13 +497,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -473,9 +516,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -485,9 +530,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py index 712e804dad8e..014c72486f2d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedAzResiliencyStatusOperations: - """ManagedAzResiliencyStatusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_az_resiliency_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ManagedAzResiliencyStatus": + ) -> _models.ManagedAzResiliencyStatus: """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric Managed Clusters. @@ -65,13 +64,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedAzResiliencyStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedAzResiliencyStatus] request = build_get_request( @@ -80,11 +82,13 @@ async def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py index 36c4e97841f1..ecf24e6ebe36 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClusterVersionOperations: - """ManagedClusterVersionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_cluster_version` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def get( location: str, cluster_version: str, **kwargs: Any - ) -> "_models.ManagedClusterCodeVersionResult": + ) -> _models.ManagedClusterCodeVersionResult: """Gets information about a Service Fabric managed cluster code version available in the specified location. @@ -65,13 +64,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterCodeVersionResult] request = build_get_request( @@ -80,11 +82,13 @@ async def get( cluster_version=cluster_version, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get_by_environment( environment: Union[str, "_models.ManagedClusterVersionEnvironment"], cluster_version: str, **kwargs: Any - ) -> "_models.ManagedClusterCodeVersionResult": + ) -> _models.ManagedClusterCodeVersionResult: """Gets information about a Service Fabric cluster code version available for the specified environment. @@ -132,13 +136,16 @@ async def get_by_environment( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterCodeVersionResult] request = build_get_by_environment_request( @@ -148,11 +155,13 @@ async def get_by_environment( cluster_version=cluster_version, api_version=api_version, template_url=self.get_by_environment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -179,7 +188,7 @@ async def list( self, location: str, **kwargs: Any - ) -> List["_models.ManagedClusterCodeVersionResult"]: + ) -> List[_models.ManagedClusterCodeVersionResult]: """Gets the list of Service Fabric cluster code versions available for the specified location. Gets all available code versions for Service Fabric cluster resources by location. @@ -192,13 +201,16 @@ async def list( :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.ManagedClusterCodeVersionResult]] request = build_list_request( @@ -206,11 +218,13 @@ async def list( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -238,7 +252,7 @@ async def list_by_environment( location: str, environment: Union[str, "_models.ManagedClusterVersionEnvironment"], **kwargs: Any - ) -> List["_models.ManagedClusterCodeVersionResult"]: + ) -> List[_models.ManagedClusterCodeVersionResult]: """Gets the list of Service Fabric cluster code versions available for the specified environment. Gets all available code versions for Service Fabric cluster resources by environment. @@ -254,13 +268,16 @@ async def list_by_environment( :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.ManagedClusterCodeVersionResult]] request = build_list_by_environment_request( @@ -269,11 +286,13 @@ async def list_by_environment( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_environment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 5733020436cd..54966d317528 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,33 +27,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets the list of Service Fabric cluster resources created in the specified resource group. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -67,13 +66,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -82,9 +84,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -93,9 +97,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -133,7 +139,7 @@ async def get_next(next_link=None): def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets the list of Service Fabric cluster resources created in the specified subscription. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -146,13 +152,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -160,9 +169,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -170,9 +181,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -212,7 +225,7 @@ async def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a Service Fabric managed cluster resource. Get a Service Fabric managed cluster resource created or in the process of being created in the @@ -227,13 +240,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -242,11 +258,13 @@ async def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,17 +290,20 @@ async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -294,11 +315,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -328,9 +351,9 @@ async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a Service Fabric managed cluster resource. Create or update a Service Fabric managed cluster resource with the specified name. @@ -355,37 +378,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -403,9 +436,9 @@ async def update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedClusterUpdateParameters", + parameters: _models.ManagedClusterUpdateParameters, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Updates the tags of of a Service Fabric managed cluster resource. Update the tags of of a Service Fabric managed cluster resource with the specified name. @@ -422,14 +455,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') @@ -441,11 +477,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,13 +511,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -488,11 +529,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -536,20 +579,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -559,8 +607,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py index 3943e8e14cbf..08520159906d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 @@ -24,33 +25,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedUnsupportedVMSizesOperations: - """ManagedUnsupportedVMSizesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_unsupported_vm_sizes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list( self, location: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedVMSizesResult"]: + ) -> AsyncIterable[_models.ManagedVMSizesResult]: """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. @@ -65,13 +64,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSizesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedVMSizesResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSizesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -80,9 +82,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -91,9 +95,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -133,7 +139,7 @@ async def get( location: str, vm_size: str, **kwargs: Any - ) -> "_models.ManagedVMSize": + ) -> _models.ManagedVMSize: """Get unsupported vm size for Service Fabric Managed Clusters. Get unsupported vm size for Service Fabric Managed Clusters. @@ -148,13 +154,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSize"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedVMSize] request = build_get_request( @@ -163,11 +172,13 @@ async def get( vm_size=vm_size, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py index 9ad639491709..371c2c71622e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse 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 @@ -23,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class NodeTypeSkusOperations: - """NodeTypeSkusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_type_skus` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list( @@ -51,7 +50,7 @@ def list( cluster_name: str, node_type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NodeTypeListSkuResult"]: + ) -> AsyncIterable[_models.NodeTypeListSkuResult]: """Gets a Service Fabric node type SKUs. Get a Service Fabric node type supported SKUs. @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeListSkuResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeTypeListSkuResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListSkuResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -86,9 +88,11 @@ def prepare_request(next_link=None): node_type_name=node_type_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -99,9 +103,11 @@ def prepare_request(next_link=None): node_type_name=node_type_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 0bf6b6be149b..480f4fefd68c 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class NodeTypesOperations: - """NodeTypesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list_by_managed_clusters( @@ -53,7 +52,7 @@ def list_by_managed_clusters( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NodeTypeListResult"]: + ) -> AsyncIterable[_models.NodeTypeListResult]: """Gets the list of Node types of the specified managed cluster. Gets all Node types of the specified managed cluster. @@ -68,13 +67,16 @@ def list_by_managed_clusters( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeTypeListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list_by_managed_clusters.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,17 +143,20 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -160,11 +169,13 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -187,7 +198,7 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Restarts one or more nodes on the node type. @@ -215,17 +226,20 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._restart_initial( + raw_result = await self._restart_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -233,6 +247,8 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -242,8 +258,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -261,17 +283,20 @@ async def _reimage_initial( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -284,11 +309,13 @@ async def _reimage_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -311,7 +338,7 @@ async def begin_reimage( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Reimages one or more nodes on the node type. @@ -339,17 +366,20 @@ async def begin_reimage( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reimage_initial( + raw_result = await self._reimage_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -357,6 +387,8 @@ async def begin_reimage( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -366,8 +398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -385,17 +423,20 @@ async def _delete_node_initial( # pylint: disable=inconsistent-return-statement resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -408,11 +449,13 @@ async def _delete_node_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._delete_node_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -435,7 +478,7 @@ async def begin_delete_node( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes one or more nodes on the node type. @@ -463,17 +506,20 @@ async def begin_delete_node( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_node_initial( + raw_result = await self._delete_node_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -481,6 +527,8 @@ async def begin_delete_node( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -490,8 +538,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -511,7 +565,7 @@ async def get( cluster_name: str, node_type_name: str, **kwargs: Any - ) -> "_models.NodeType": + ) -> _models.NodeType: """Gets a Service Fabric node type. Get a Service Fabric node type of a given managed cluster. @@ -527,13 +581,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] request = build_get_request( @@ -543,11 +600,13 @@ async def get( node_type_name=node_type_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -574,17 +633,20 @@ async def _create_or_update_initial( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeType", + parameters: _models.NodeType, **kwargs: Any - ) -> "_models.NodeType": - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + ) -> _models.NodeType: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] _json = self._serialize.body(parameters, 'NodeType') @@ -597,11 +659,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -632,9 +696,9 @@ async def begin_create_or_update( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeType", + parameters: _models.NodeType, **kwargs: Any - ) -> AsyncLROPoller["_models.NodeType"]: + ) -> AsyncLROPoller[_models.NodeType]: """Creates or updates a Service Fabric node type. Create or update a Service Fabric node type of a given managed cluster. @@ -661,17 +725,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -679,20 +746,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('NodeType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -711,9 +785,9 @@ async def update( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeUpdateParameters", + parameters: _models.NodeTypeUpdateParameters, **kwargs: Any - ) -> "_models.NodeType": + ) -> _models.NodeType: """Update the tags of a node type resource of a given managed cluster. Update the configuration of a node type of a given managed cluster, only updating tags. @@ -731,14 +805,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] _json = self._serialize.body(parameters, 'NodeTypeUpdateParameters') @@ -751,11 +828,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -784,13 +863,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements node_type_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -800,11 +882,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements node_type_name=node_type_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -851,21 +935,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -875,8 +964,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( 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 10dd3f69215c..c798919e060b 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 @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OperationResultsOperations: - """OperationResultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( # pylint: disable=inconsistent-return-statements @@ -64,13 +63,16 @@ async def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_get_request( @@ -79,11 +81,13 @@ async def get( # pylint: disable=inconsistent-return-statements operation_id=operation_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py index 6cbdf199903f..2ba59e0b05ab 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OperationStatusOperations: - """OperationStatusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def get( location: str, operation_id: str, **kwargs: Any - ) -> "_models.LongRunningOperationResult": + ) -> _models.LongRunningOperationResult: """Get long running operation status. Get long running operation status. @@ -64,13 +63,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LongRunningOperationResult] request = build_get_request( @@ -79,11 +81,13 @@ async def get( operation_id=operation_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py index 0f646f4e1186..8daec2f1cd1e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Service Fabric resource provider API operations. Get the list of available Service Fabric resource provider API operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 c103bd871da1..a4b45811df72 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,7 +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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations: - """ServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -55,7 +54,7 @@ async def get( application_name: str, service_name: str, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Gets a Service Fabric managed service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -75,13 +74,16 @@ async def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] request = build_get_request( @@ -92,11 +94,13 @@ async def get( service_name=service_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -124,17 +128,20 @@ async def _create_or_update_initial( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] _json = self._serialize.body(parameters, 'ServiceResource') @@ -148,11 +155,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -184,9 +193,9 @@ async def begin_create_or_update( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: + ) -> AsyncLROPoller[_models.ServiceResource]: """Creates or updates a Service Fabric managed service resource. Create or update a Service Fabric managed service resource with the specified name. @@ -216,17 +225,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -235,20 +247,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -268,9 +287,9 @@ async def update( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceUpdateParameters", + parameters: _models.ServiceUpdateParameters, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Updates the tags of a service resource of a given managed cluster. Updates the tags of a service resource of a given managed cluster. @@ -291,14 +310,17 @@ async def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] _json = self._serialize.body(parameters, 'ServiceUpdateParameters') @@ -312,11 +334,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -346,13 +370,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -363,11 +390,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -418,22 +447,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -443,8 +477,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -464,7 +504,7 @@ def list_by_applications( cluster_name: str, application_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceList"]: + ) -> AsyncIterable[_models.ServiceResourceList]: """Gets the list of service resources created in the specified Service Fabric managed application resource. @@ -483,13 +523,16 @@ def list_by_applications( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -500,9 +543,11 @@ def prepare_request(next_link=None): application_name=application_name, api_version=api_version, template_url=self.list_by_applications.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -513,9 +558,11 @@ def prepare_request(next_link=None): application_name=application_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 bcb1a73b3ced..e72b27c36b4e 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 @@ -104,6 +104,7 @@ ClusterUpgradeMode, Direction, DiskType, + EvictionPolicyType, FailureAction, IPAddressType, ManagedClusterAddOnFeature, @@ -129,7 +130,9 @@ ServiceScalingTriggerKind, SkuName, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AddRemoveIncrementalNamedPartitionScalingMechanism', 'ApplicationHealthPolicy', @@ -226,6 +229,7 @@ 'ClusterUpgradeMode', 'Direction', 'DiskType', + 'EvictionPolicyType', 'FailureAction', 'IPAddressType', 'ManagedClusterAddOnFeature', @@ -251,3 +255,5 @@ 'ServiceScalingTriggerKind', 'SkuName', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 20f2070bc612..b9cb4c3d838b 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 @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._service_fabric_managed_clusters_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class ScalingMechanism(msrest.serialization.Model): @@ -24,7 +26,7 @@ class ScalingMechanism(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + filled by server. Known values are: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind @@ -58,7 +60,7 @@ class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + filled by server. Known values are: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind @@ -153,8 +155,8 @@ def __init__( *, consider_warning_as_error: bool, max_percent_unhealthy_deployed_applications: int, - default_service_type_health_policy: Optional["ServiceTypeHealthPolicy"] = None, - service_type_health_policy_map: Optional[Dict[str, "ServiceTypeHealthPolicy"]] = None, + default_service_type_health_policy: Optional["_models.ServiceTypeHealthPolicy"] = None, + service_type_health_policy_map: Optional[Dict[str, "_models.ServiceTypeHealthPolicy"]] = None, **kwargs ): """ @@ -308,11 +310,11 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedIdentity"] = None, + identity: Optional["_models.ManagedIdentity"] = None, version: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, - managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, **kwargs ): """ @@ -368,7 +370,7 @@ class ApplicationResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationResource"]] = None, + value: Optional[List["_models.ApplicationResource"]] = None, **kwargs ): """ @@ -460,7 +462,7 @@ class ApplicationTypeResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationTypeResource"]] = None, + value: Optional[List["_models.ApplicationTypeResource"]] = None, **kwargs ): """ @@ -586,7 +588,7 @@ class ApplicationTypeVersionResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationTypeVersionResource"]] = None, + value: Optional[List["_models.ApplicationTypeVersionResource"]] = None, **kwargs ): """ @@ -702,7 +704,7 @@ class ApplicationUpgradePolicy(msrest.serialization.Model): a non-zero delay duration configured in the service description. :vartype instance_close_delay_duration: long :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". + Monitored, and UnmonitoredAuto. Known values are: "Monitored", "UnmonitoredAuto". :vartype upgrade_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an @@ -729,11 +731,11 @@ class ApplicationUpgradePolicy(msrest.serialization.Model): def __init__( self, *, - application_health_policy: Optional["ApplicationHealthPolicy"] = None, + application_health_policy: Optional["_models.ApplicationHealthPolicy"] = None, force_restart: Optional[bool] = False, - rolling_upgrade_monitoring_policy: Optional["RollingUpgradeMonitoringPolicy"] = None, + rolling_upgrade_monitoring_policy: Optional["_models.RollingUpgradeMonitoringPolicy"] = None, instance_close_delay_duration: Optional[int] = None, - upgrade_mode: Optional[Union[str, "RollingUpgradeMode"]] = None, + upgrade_mode: Optional[Union[str, "_models.RollingUpgradeMode"]] = None, upgrade_replica_set_check_timeout: Optional[int] = None, recreate_application: Optional[bool] = None, **kwargs @@ -756,7 +758,7 @@ def __init__( which have a non-zero delay duration configured in the service description. :paramtype instance_close_delay_duration: long :keyword upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". + Monitored, and UnmonitoredAuto. Known values are: "Monitored", "UnmonitoredAuto". :paramtype upgrade_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of @@ -873,7 +875,7 @@ class ScalingTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled - by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + by server. Known values are: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind """ @@ -905,7 +907,7 @@ class AveragePartitionLoadScalingTrigger(ScalingTrigger): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled - by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + by server. Known values are: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind :ivar metric_name: Required. The name of the metric for which usage should be tracked. :vartype metric_name: str @@ -972,7 +974,7 @@ class AverageServiceLoadScalingTrigger(ScalingTrigger): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled - by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + by server. Known values are: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind :ivar metric_name: Required. The name of the metric for which usage should be tracked. :vartype metric_name: str @@ -1195,7 +1197,7 @@ class ErrorModel(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorModelError"] = None, + error: Optional["_models.ErrorModelError"] = None, **kwargs ): """ @@ -1242,7 +1244,7 @@ class FrontendConfiguration(msrest.serialization.Model): """Describes the frontend configurations for the node type. :ivar ip_address_type: The IP address type of this frontend configuration. If omitted the - default value is IPv4. Possible values include: "IPv4", "IPv6". Default value: "IPv4". + default value is IPv4. Known values are: "IPv4", "IPv6". Default value: "IPv4". :vartype ip_address_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.IPAddressType :ivar load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend address pool that the VM instances of the node type are associated with. The format of the @@ -1264,14 +1266,14 @@ class FrontendConfiguration(msrest.serialization.Model): def __init__( self, *, - ip_address_type: Optional[Union[str, "IPAddressType"]] = "IPv4", + ip_address_type: Optional[Union[str, "_models.IPAddressType"]] = "IPv4", load_balancer_backend_address_pool_id: Optional[str] = None, load_balancer_inbound_nat_pool_id: Optional[str] = None, **kwargs ): """ :keyword ip_address_type: The IP address type of this frontend configuration. If omitted the - default value is IPv4. Possible values include: "IPv4", "IPv6". Default value: "IPv4". + default value is IPv4. Known values are: "IPv4", "IPv6". Default value: "IPv4". :paramtype ip_address_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.IPAddressType :keyword load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend @@ -1342,13 +1344,13 @@ class LoadBalancingRule(msrest.serialization.Model): Acceptable values are between 1 and 65535. :vartype backend_port: int :ivar protocol: Required. The reference to the transport protocol used by the load balancing - rule. Possible values include: "tcp", "udp". + rule. Known values are: "tcp", "udp". :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.Protocol :ivar probe_port: The prob port used by the load balancing rule. Acceptable values are between 1 and 65535. :vartype probe_port: int :ivar probe_protocol: Required. the reference to the load balancer probe used by the load - balancing rule. Possible values include: "tcp", "http", "https". + balancing rule. Known values are: "tcp", "http", "https". :vartype probe_protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol :ivar probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. :vartype probe_request_path: str @@ -1379,8 +1381,8 @@ def __init__( *, frontend_port: int, backend_port: int, - protocol: Union[str, "Protocol"], - probe_protocol: Union[str, "ProbeProtocol"], + protocol: Union[str, "_models.Protocol"], + probe_protocol: Union[str, "_models.ProbeProtocol"], probe_port: Optional[int] = None, probe_request_path: Optional[str] = None, load_distribution: Optional[str] = None, @@ -1394,13 +1396,13 @@ def __init__( Acceptable values are between 1 and 65535. :paramtype backend_port: int :keyword protocol: Required. The reference to the transport protocol used by the load balancing - rule. Possible values include: "tcp", "udp". + rule. Known values are: "tcp", "udp". :paramtype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.Protocol :keyword probe_port: The prob port used by the load balancing rule. Acceptable values are between 1 and 65535. :paramtype probe_port: int :keyword probe_protocol: Required. the reference to the load balancer probe used by the load - balancing rule. Possible values include: "tcp", "http", "https". + balancing rule. Known values are: "tcp", "http", "https". :paramtype probe_protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol :keyword probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. :paramtype probe_request_path: str @@ -1451,7 +1453,7 @@ def __init__( end_time: Optional[datetime.datetime] = None, percent_complete: Optional[float] = None, status: Optional[str] = None, - error: Optional["ErrorModelError"] = None, + error: Optional["_models.ErrorModelError"] = None, **kwargs ): """ @@ -1501,7 +1503,7 @@ class ManagedAzResiliencyStatus(msrest.serialization.Model): def __init__( self, *, - base_resource_status: Optional[List["ResourceAzStatus"]] = None, + base_resource_status: Optional[List["_models.ResourceAzStatus"]] = None, **kwargs ): """ @@ -1611,8 +1613,8 @@ class ManagedCluster(Resource): :vartype ipv4_address: str :ivar cluster_id: A service generated unique identifier for the cluster resource. :vartype cluster_id: str - :ivar cluster_state: The current state of the cluster. Possible values include: - "WaitingForNodes", "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", "Ready". + :ivar cluster_state: The current state of the cluster. Known values are: "WaitingForNodes", + "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", "Ready". :vartype cluster_state: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterState :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. :vartype cluster_certificate_thumbprints: list[str] @@ -1644,9 +1646,9 @@ class ManagedCluster(Resource): :ivar fabric_settings: The list of custom fabric settings to configure the cluster. :vartype fabric_settings: list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsSectionDescription] - :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible - values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", - "Deleting", "Deleted", "Other". + :ivar provisioning_state: The provisioning state of the managed cluster resource. Known values + are: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", + "Deleted", "Other". :vartype provisioning_state: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property is @@ -1655,13 +1657,12 @@ class ManagedCluster(Resource): list of available version for existing clusters use **availableClusterVersions**. :vartype cluster_code_version: str :ivar cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime - version is available. Possible values include: "Automatic", "Manual". Default value: - "Automatic". + version is available. Known values are: "Automatic", "Manual". Default value: "Automatic". :vartype cluster_upgrade_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode :ivar cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** - is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". + is set to 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". :vartype cluster_upgrade_cadence: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence :ivar addon_features: List of add-on features to enable on the cluster. @@ -1763,31 +1764,31 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, + sku: Optional["_models.Sku"] = None, dns_name: Optional[str] = None, client_connection_port: Optional[int] = 19000, http_gateway_connection_port: Optional[int] = 19080, admin_user_name: Optional[str] = None, admin_password: Optional[str] = None, - load_balancing_rules: Optional[List["LoadBalancingRule"]] = None, + load_balancing_rules: Optional[List["_models.LoadBalancingRule"]] = None, allow_rdp_access: Optional[bool] = None, - network_security_rules: Optional[List["NetworkSecurityRule"]] = None, - clients: Optional[List["ClientCertificate"]] = None, - azure_active_directory: Optional["AzureActiveDirectory"] = None, - fabric_settings: Optional[List["SettingsSectionDescription"]] = None, + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, + clients: Optional[List["_models.ClientCertificate"]] = None, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = None, cluster_code_version: Optional[str] = None, - cluster_upgrade_mode: Optional[Union[str, "ClusterUpgradeMode"]] = "Automatic", - cluster_upgrade_cadence: Optional[Union[str, "ClusterUpgradeCadence"]] = None, - addon_features: Optional[List[Union[str, "ManagedClusterAddOnFeature"]]] = None, + cluster_upgrade_mode: Optional[Union[str, "_models.ClusterUpgradeMode"]] = "Automatic", + cluster_upgrade_cadence: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = None, + addon_features: Optional[List[Union[str, "_models.ManagedClusterAddOnFeature"]]] = None, enable_auto_os_upgrade: Optional[bool] = None, zonal_resiliency: Optional[bool] = False, - application_type_versions_cleanup_policy: Optional["ApplicationTypeVersionsCleanupPolicy"] = None, + application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = None, enable_ipv6: Optional[bool] = None, subnet_id: Optional[str] = None, - ip_tags: Optional[List["IPTag"]] = None, + ip_tags: Optional[List["_models.IPTag"]] = None, enable_service_public_ip: Optional[bool] = None, - auxiliary_subnets: Optional[List["Subnet"]] = None, - service_endpoints: Optional[List["ServiceEndpoint"]] = None, + auxiliary_subnets: Optional[List["_models.Subnet"]] = None, + service_endpoints: Optional[List["_models.ServiceEndpoint"]] = None, **kwargs ): """ @@ -1833,13 +1834,12 @@ def __init__( list of available version for existing clusters use **availableClusterVersions**. :paramtype cluster_code_version: str :keyword cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime - version is available. Possible values include: "Automatic", "Manual". Default value: - "Automatic". + version is available. Known values are: "Automatic", "Manual". Default value: "Automatic". :paramtype cluster_upgrade_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode :keyword cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** - is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". + is set to 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". :paramtype cluster_upgrade_cadence: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence :keyword addon_features: List of add-on features to enable on the cluster. @@ -1923,7 +1923,7 @@ class ManagedClusterCodeVersionResult(msrest.serialization.Model): :vartype cluster_code_version: str :ivar support_expiry_utc: The date of expiry of support of the version. :vartype support_expiry_utc: str - :ivar os_type: Cluster operating system, the default will be Windows. Possible values include: + :ivar os_type: Cluster operating system, the default will be Windows. Known values are: "Windows". :vartype os_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.OsType """ @@ -1945,7 +1945,7 @@ def __init__( type: Optional[str] = None, cluster_code_version: Optional[str] = None, support_expiry_utc: Optional[str] = None, - os_type: Optional[Union[str, "OsType"]] = None, + os_type: Optional[Union[str, "_models.OsType"]] = None, **kwargs ): """ @@ -1959,8 +1959,8 @@ def __init__( :paramtype cluster_code_version: str :keyword support_expiry_utc: The date of expiry of support of the version. :paramtype support_expiry_utc: str - :keyword os_type: Cluster operating system, the default will be Windows. Possible values - include: "Windows". + :keyword os_type: Cluster operating system, the default will be Windows. Known values are: + "Windows". :paramtype os_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.OsType """ super(ManagedClusterCodeVersionResult, self).__init__(**kwargs) @@ -1989,7 +1989,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2040,7 +2040,7 @@ class ManagedIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :ivar type: The type of managed identity for the resource. Possible values include: "None", + :ivar type: The type of managed identity for the resource. Known values are: "None", "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The @@ -2065,12 +2065,12 @@ class ManagedIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ManagedIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ - :keyword type: The type of managed identity for the resource. Possible values include: "None", + :keyword type: The type of managed identity for the resource. Known values are: "None", "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". :paramtype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. @@ -2201,7 +2201,7 @@ class ManagedVMSizesResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedVMSize"]] = None, + value: Optional[List["_models.ManagedVMSize"]] = None, **kwargs ): """ @@ -2222,7 +2222,7 @@ class Partition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". + server. Known values are: "Singleton", "UniformInt64Range", "Named". :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme """ @@ -2255,7 +2255,7 @@ class NamedPartitionScheme(Partition): All required parameters must be populated in order to send to Azure. :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". + server. Known values are: "Singleton", "UniformInt64Range", "Named". :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme :ivar names: Required. Array for the names of the partitions. @@ -2296,8 +2296,8 @@ class NetworkSecurityRule(msrest.serialization.Model): :vartype name: str :ivar description: Network security rule description. :vartype description: str - :ivar protocol: Required. Network protocol this rule applies to. Possible values include: - "http", "https", "tcp", "udp", "icmp", "ah", "esp". + :ivar protocol: Required. Network protocol this rule applies to. Known values are: "http", + "https", "tcp", "udp", "icmp", "ah", "esp". :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol :ivar source_address_prefixes: The CIDR or source IP ranges. :vartype source_address_prefixes: list[str] @@ -2322,15 +2322,15 @@ class NetworkSecurityRule(msrest.serialization.Model): :ivar destination_port_range: he destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. :vartype destination_port_range: str - :ivar access: Required. The network traffic is allowed or denied. Possible values include: - "allow", "deny". + :ivar access: Required. The network traffic is allowed or denied. Known values are: "allow", + "deny". :vartype access: str or ~azure.mgmt.servicefabricmanagedclusters.models.Access :ivar priority: Required. The priority of the rule. The value can be in the range 1000 to 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. :vartype priority: int - :ivar direction: Required. Network security rule direction. Possible values include: "inbound", + :ivar direction: Required. Network security rule direction. Known values are: "inbound", "outbound". :vartype direction: str or ~azure.mgmt.servicefabricmanagedclusters.models.Direction """ @@ -2364,10 +2364,10 @@ def __init__( self, *, name: str, - protocol: Union[str, "NsgProtocol"], - access: Union[str, "Access"], + protocol: Union[str, "_models.NsgProtocol"], + access: Union[str, "_models.Access"], priority: int, - direction: Union[str, "Direction"], + direction: Union[str, "_models.Direction"], description: Optional[str] = None, source_address_prefixes: Optional[List[str]] = None, destination_address_prefixes: Optional[List[str]] = None, @@ -2384,8 +2384,8 @@ def __init__( :paramtype name: str :keyword description: Network security rule description. :paramtype description: str - :keyword protocol: Required. Network protocol this rule applies to. Possible values include: - "http", "https", "tcp", "udp", "icmp", "ah", "esp". + :keyword protocol: Required. Network protocol this rule applies to. Known values are: "http", + "https", "tcp", "udp", "icmp", "ah", "esp". :paramtype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol :keyword source_address_prefixes: The CIDR or source IP ranges. :paramtype source_address_prefixes: list[str] @@ -2410,16 +2410,16 @@ def __init__( :keyword destination_port_range: he destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. :paramtype destination_port_range: str - :keyword access: Required. The network traffic is allowed or denied. Possible values include: - "allow", "deny". + :keyword access: Required. The network traffic is allowed or denied. Known values are: "allow", + "deny". :paramtype access: str or ~azure.mgmt.servicefabricmanagedclusters.models.Access :keyword priority: Required. The priority of the rule. The value can be in the range 1000 to 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. :paramtype priority: int - :keyword direction: Required. Network security rule direction. Possible values include: - "inbound", "outbound". + :keyword direction: Required. Network security rule direction. Known values are: "inbound", + "outbound". :paramtype direction: str or ~azure.mgmt.servicefabricmanagedclusters.models.Direction """ super(NetworkSecurityRule, self).__init__(**kwargs) @@ -2467,8 +2467,8 @@ class NodeType(ManagedProxyResource): GBs. :vartype data_disk_size_gb: int :ivar data_disk_type: Managed data disk type. Specifies the storage account type for the - managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". - Default value: "StandardSSD_LRS". + managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default + value: "StandardSSD_LRS". :vartype data_disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType :ivar data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D and it can not change after created. @@ -2532,9 +2532,9 @@ class NodeType(ManagedProxyResource): disk at host itself. Default: The Encryption at host will be disabled unless this property is set to true for the resource. :vartype enable_encryption_at_host: bool - :ivar provisioning_state: The provisioning state of the node type resource. Possible values - include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", - "Deleting", "Deleted", "Other". + :ivar provisioning_state: The provisioning state of the node type resource. Known values are: + "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", + "Deleted", "Other". :vartype provisioning_state: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated @@ -2561,6 +2561,19 @@ class NodeType(ManagedProxyResource): :ivar is_spot_vm: Indicates whether the node type will be Spot Virtual Machines. Azure will allocate the VMs if there is capacity available and the VMs can be evicted at any time. :vartype is_spot_vm: bool + :ivar host_group_id: Specifies the full host group resource Id. This property is used for + deploying on azure dedicated hosts. + :vartype host_group_id: str + :ivar use_ephemeral_os_disk: Indicates whether to use ephemeral os disk. The sku selected on + the vmSize property needs to support this feature. + :vartype use_ephemeral_os_disk: bool + :ivar spot_restore_timeout: Indicates the time duration after which the platform will not try + to restore the VMSS SPOT instances specified as ISO 8601. + :vartype spot_restore_timeout: str + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a SPOT node type. + Default is Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". + :vartype eviction_policy: str or + ~azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType """ _validation = { @@ -2610,35 +2623,39 @@ class NodeType(ManagedProxyResource): 'enable_over_provisioning': {'key': 'properties.enableOverProvisioning', 'type': 'bool'}, 'zones': {'key': 'properties.zones', 'type': '[str]'}, 'is_spot_vm': {'key': 'properties.isSpotVM', 'type': 'bool'}, + 'host_group_id': {'key': 'properties.hostGroupId', 'type': 'str'}, + 'use_ephemeral_os_disk': {'key': 'properties.useEphemeralOSDisk', 'type': 'bool'}, + 'spot_restore_timeout': {'key': 'properties.spotRestoreTimeout', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, - sku: Optional["NodeTypeSku"] = None, + sku: Optional["_models.NodeTypeSku"] = None, is_primary: Optional[bool] = None, vm_instance_count: Optional[int] = None, data_disk_size_gb: Optional[int] = None, - data_disk_type: Optional[Union[str, "DiskType"]] = "StandardSSD_LRS", + data_disk_type: Optional[Union[str, "_models.DiskType"]] = "StandardSSD_LRS", data_disk_letter: Optional[str] = None, placement_properties: Optional[Dict[str, str]] = None, capacities: Optional[Dict[str, str]] = None, - application_ports: Optional["EndpointRangeDescription"] = None, - ephemeral_ports: Optional["EndpointRangeDescription"] = None, + application_ports: Optional["_models.EndpointRangeDescription"] = None, + ephemeral_ports: Optional["_models.EndpointRangeDescription"] = None, vm_size: Optional[str] = None, vm_image_publisher: Optional[str] = None, vm_image_offer: Optional[str] = None, vm_image_sku: Optional[str] = None, vm_image_version: Optional[str] = None, - vm_secrets: Optional[List["VaultSecretGroup"]] = None, - vm_extensions: Optional[List["VMSSExtension"]] = None, - vm_managed_identity: Optional["VmManagedIdentity"] = None, + vm_secrets: Optional[List["_models.VaultSecretGroup"]] = None, + vm_extensions: Optional[List["_models.VMSSExtension"]] = None, + vm_managed_identity: Optional["_models.VmManagedIdentity"] = None, is_stateless: Optional[bool] = False, multiple_placement_groups: Optional[bool] = False, - frontend_configurations: Optional[List["FrontendConfiguration"]] = None, - network_security_rules: Optional[List["NetworkSecurityRule"]] = None, - additional_data_disks: Optional[List["VmssDataDisk"]] = None, + frontend_configurations: Optional[List["_models.FrontendConfiguration"]] = None, + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, + additional_data_disks: Optional[List["_models.VmssDataDisk"]] = None, enable_encryption_at_host: Optional[bool] = False, enable_accelerated_networking: Optional[bool] = None, use_default_public_load_balancer: Optional[bool] = None, @@ -2646,6 +2663,10 @@ def __init__( enable_over_provisioning: Optional[bool] = None, zones: Optional[List[str]] = None, is_spot_vm: Optional[bool] = None, + host_group_id: Optional[str] = None, + use_ephemeral_os_disk: Optional[bool] = None, + spot_restore_timeout: Optional[str] = None, + eviction_policy: Optional[Union[str, "_models.EvictionPolicyType"]] = "Delete", **kwargs ): """ @@ -2664,8 +2685,8 @@ def __init__( in GBs. :paramtype data_disk_size_gb: int :keyword data_disk_type: Managed data disk type. Specifies the storage account type for the - managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". - Default value: "StandardSSD_LRS". + managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default + value: "StandardSSD_LRS". :paramtype data_disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType :keyword data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D and it can not change after created. @@ -2754,6 +2775,19 @@ def __init__( :keyword is_spot_vm: Indicates whether the node type will be Spot Virtual Machines. Azure will allocate the VMs if there is capacity available and the VMs can be evicted at any time. :paramtype is_spot_vm: bool + :keyword host_group_id: Specifies the full host group resource Id. This property is used for + deploying on azure dedicated hosts. + :paramtype host_group_id: str + :keyword use_ephemeral_os_disk: Indicates whether to use ephemeral os disk. The sku selected on + the vmSize property needs to support this feature. + :paramtype use_ephemeral_os_disk: bool + :keyword spot_restore_timeout: Indicates the time duration after which the platform will not + try to restore the VMSS SPOT instances specified as ISO 8601. + :paramtype spot_restore_timeout: str + :keyword eviction_policy: Specifies the eviction policy for virtual machines in a SPOT node + type. Default is Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType """ super(NodeType, self).__init__(tags=tags, **kwargs) self.sku = sku @@ -2787,6 +2821,10 @@ def __init__( self.enable_over_provisioning = enable_over_provisioning self.zones = zones self.is_spot_vm = is_spot_vm + self.host_group_id = host_group_id + self.use_ephemeral_os_disk = use_ephemeral_os_disk + self.spot_restore_timeout = spot_restore_timeout + self.eviction_policy = eviction_policy class NodeTypeActionParameters(msrest.serialization.Model): @@ -2882,7 +2920,7 @@ class NodeTypeListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["NodeType"]] = None, + value: Optional[List["_models.NodeType"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2914,7 +2952,7 @@ class NodeTypeListSkuResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["NodeTypeAvailableSku"]] = None, + value: Optional[List["_models.NodeTypeAvailableSku"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2993,7 +3031,7 @@ class NodeTypeSkuCapacity(msrest.serialization.Model): :vartype maximum: int :ivar default: Default node count in a node type. :vartype default: int - :ivar scale_type: Node type capacity scale type. Possible values include: "None", "Manual", + :ivar scale_type: Node type capacity scale type. Known values are: "None", "Manual", "Automatic". Default value: "None". :vartype scale_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuScaleType @@ -3077,7 +3115,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - sku: Optional["NodeTypeSku"] = None, + sku: Optional["_models.NodeTypeSku"] = None, **kwargs ): """ @@ -3114,7 +3152,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OperationResult"]] = None, + value: Optional[List["_models.OperationResult"]] = None, **kwargs ): """ @@ -3154,7 +3192,7 @@ def __init__( *, name: Optional[str] = None, is_data_action: Optional[bool] = None, - display: Optional["AvailableOperationDisplay"] = None, + display: Optional["_models.AvailableOperationDisplay"] = None, origin: Optional[str] = None, next_link: Optional[str] = None, **kwargs @@ -3185,7 +3223,7 @@ class PartitionInstanceCountScaleMechanism(ScalingMechanism): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + filled by server. Known values are: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind @@ -3281,8 +3319,8 @@ class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): :ivar failure_action: Required. 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. Possible values - include: "Rollback", "Manual". + indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Known values are: + "Rollback", "Manual". :vartype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction :ivar health_check_wait_duration: Required. The amount of time to wait after completing an upgrade domain before applying health policies. It is interpreted as a string representing an @@ -3327,7 +3365,7 @@ class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): def __init__( self, *, - failure_action: Union[str, "FailureAction"], + failure_action: Union[str, "_models.FailureAction"], health_check_wait_duration: str, health_check_stable_duration: str, health_check_retry_timeout: str, @@ -3339,8 +3377,8 @@ def __init__( :keyword failure_action: Required. 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. Possible values - include: "Rollback", "Manual". + indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Known values are: + "Rollback", "Manual". :paramtype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction :keyword health_check_wait_duration: Required. The amount of time to wait after completing an upgrade domain before applying health policies. It is interpreted as a string representing an @@ -3396,8 +3434,8 @@ class ScalingPolicy(msrest.serialization.Model): def __init__( self, *, - scaling_mechanism: "ScalingMechanism", - scaling_trigger: "ScalingTrigger", + scaling_mechanism: "_models.ScalingMechanism", + scaling_trigger: "_models.ScalingTrigger", **kwargs ): """ @@ -3418,8 +3456,8 @@ class ServiceCorrelation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar scheme: Required. The ServiceCorrelationScheme which describes the relationship between - this service and the service specified via ServiceName. Possible values include: - "AlignedAffinity", "NonAlignedAffinity". + this service and the service specified via ServiceName. Known values are: "AlignedAffinity", + "NonAlignedAffinity". :vartype scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme :ivar service_name: Required. The Arm Resource ID of the service that the correlation @@ -3440,13 +3478,13 @@ class ServiceCorrelation(msrest.serialization.Model): def __init__( self, *, - scheme: Union[str, "ServiceCorrelationScheme"], + scheme: Union[str, "_models.ServiceCorrelationScheme"], service_name: str, **kwargs ): """ :keyword scheme: Required. The ServiceCorrelationScheme which describes the relationship - between this service and the service specified via ServiceName. Possible values include: + between this service and the service specified via ServiceName. Known values are: "AlignedAffinity", "NonAlignedAffinity". :paramtype scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme @@ -3507,7 +3545,7 @@ class ServiceLoadMetric(msrest.serialization.Model): that metric names are case sensitive. :vartype name: str :ivar weight: The service load metric relative weight, compared to other metrics configured for - this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". + this service, as a number. Known values are: "Zero", "Low", "Medium", "High". :vartype weight: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight :ivar primary_default_load: Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Primary replica. @@ -3536,7 +3574,7 @@ def __init__( self, *, name: str, - weight: Optional[Union[str, "ServiceLoadMetricWeight"]] = None, + weight: Optional[Union[str, "_models.ServiceLoadMetricWeight"]] = None, primary_default_load: Optional[int] = None, secondary_default_load: Optional[int] = None, default_load: Optional[int] = None, @@ -3548,7 +3586,7 @@ def __init__( that metric names are case sensitive. :paramtype name: str :keyword weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". + for this service, as a number. Known values are: "Zero", "Low", "Medium", "High". :paramtype weight: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight :keyword primary_default_load: Used only for Stateful services. The default amount of load, as @@ -3578,7 +3616,7 @@ class ServicePlacementPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3613,7 +3651,7 @@ class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3653,7 +3691,7 @@ class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3691,7 +3729,7 @@ class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3733,7 +3771,7 @@ class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3783,7 +3821,7 @@ class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", + the possible values.Constant filled by server. Known values are: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". :vartype type: str or @@ -3862,7 +3900,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ServiceResourceProperties"] = None, + properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs ): """ @@ -3901,7 +3939,7 @@ class ServiceResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ServiceResource"]] = None, + value: Optional[List["_models.ServiceResource"]] = None, **kwargs ): """ @@ -3933,8 +3971,8 @@ class ServiceResourcePropertiesBase(msrest.serialization.Model): other services. :vartype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :ivar scaling_policies: Scaling policies for this service. :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] @@ -3953,11 +3991,11 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, - scaling_policies: Optional[List["ScalingPolicy"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, **kwargs ): """ @@ -3978,8 +4016,8 @@ def __init__( other services. :paramtype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :keyword scaling_policies: Scaling policies for this service. :paramtype scaling_policies: @@ -4021,8 +4059,8 @@ class ServiceResourceProperties(ServiceResourcePropertiesBase): other services. :vartype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :ivar scaling_policies: Scaling policies for this service. :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] @@ -4030,14 +4068,14 @@ class ServiceResourceProperties(ServiceResourcePropertiesBase): the response. :vartype provisioning_state: str :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". + server. Known values are: "Stateless", "Stateful". :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind :ivar service_type_name: Required. The name of the service type. :vartype service_type_name: str :ivar partition_description: Required. Describes how the service is partitioned. :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode """ @@ -4071,14 +4109,14 @@ def __init__( self, *, service_type_name: str, - partition_description: "Partition", + partition_description: "_models.Partition", placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, - scaling_policies: Optional[List["ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, **kwargs ): """ @@ -4099,8 +4137,8 @@ def __init__( other services. :paramtype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :keyword scaling_policies: Scaling policies for this service. :paramtype scaling_policies: @@ -4109,8 +4147,8 @@ def __init__( :paramtype service_type_name: str :keyword partition_description: Required. Describes how the service is partitioned. :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". :paramtype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode """ @@ -4313,7 +4351,7 @@ def __init__( self, *, name: str, - parameters: List["SettingsParameterDescription"], + parameters: List["_models.SettingsParameterDescription"], **kwargs ): """ @@ -4334,7 +4372,7 @@ class SingletonPartitionScheme(Partition): All required parameters must be populated in order to send to Azure. :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". + server. Known values are: "Singleton", "UniformInt64Range", "Named". :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme """ @@ -4362,7 +4400,7 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Sku Name. Possible values include: "Basic", "Standard". + :ivar name: Required. Sku Name. Known values are: "Basic", "Standard". :vartype name: str or ~azure.mgmt.servicefabricmanagedclusters.models.SkuName """ @@ -4377,11 +4415,11 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - name: Union[str, "SkuName"], + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword name: Required. Sku Name. Possible values include: "Basic", "Standard". + :keyword name: Required. Sku Name. Known values are: "Basic", "Standard". :paramtype name: str or ~azure.mgmt.servicefabricmanagedclusters.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -4412,8 +4450,8 @@ class StatefulServiceProperties(ServiceResourceProperties): other services. :vartype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :ivar scaling_policies: Scaling policies for this service. :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] @@ -4421,14 +4459,14 @@ class StatefulServiceProperties(ServiceResourceProperties): the response. :vartype provisioning_state: str :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". + server. Known values are: "Stateless", "Stateful". :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind :ivar service_type_name: Required. The name of the service type. :vartype service_type_name: str :ivar partition_description: Required. Describes how the service is partitioned. :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode :ivar has_persisted_state: A flag indicating whether this is a persistent service which stores @@ -4486,14 +4524,14 @@ def __init__( self, *, service_type_name: str, - partition_description: "Partition", + partition_description: "_models.Partition", placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, - scaling_policies: Optional[List["ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, has_persisted_state: Optional[bool] = None, target_replica_set_size: Optional[int] = None, min_replica_set_size: Optional[int] = None, @@ -4521,8 +4559,8 @@ def __init__( other services. :paramtype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :keyword scaling_policies: Scaling policies for this service. :paramtype scaling_policies: @@ -4531,8 +4569,8 @@ def __init__( :paramtype service_type_name: str :keyword partition_description: Required. Describes how the service is partitioned. :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". :paramtype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode :keyword has_persisted_state: A flag indicating whether this is a persistent service which @@ -4591,8 +4629,8 @@ class StatelessServiceProperties(ServiceResourceProperties): other services. :vartype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :ivar scaling_policies: Scaling policies for this service. :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] @@ -4600,14 +4638,14 @@ class StatelessServiceProperties(ServiceResourceProperties): the response. :vartype provisioning_state: str :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". + server. Known values are: "Stateless", "Stateful". :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind :ivar service_type_name: Required. The name of the service type. :vartype service_type_name: str :ivar partition_description: Required. Describes how the service is partitioned. :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode :ivar instance_count: Required. The instance count. @@ -4657,15 +4695,15 @@ def __init__( self, *, service_type_name: str, - partition_description: "Partition", + partition_description: "_models.Partition", instance_count: int, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, - scaling_policies: Optional[List["ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, min_instance_count: Optional[int] = None, min_instance_percentage: Optional[int] = None, **kwargs @@ -4688,8 +4726,8 @@ def __init__( other services. :paramtype service_placement_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost :keyword scaling_policies: Scaling policies for this service. :paramtype scaling_policies: @@ -4698,8 +4736,8 @@ def __init__( :paramtype service_type_name: str :keyword partition_description: Required. Describes how the service is partitioned. :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". :paramtype service_package_activation_mode: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode :keyword instance_count: Required. The instance count. @@ -4737,11 +4775,11 @@ class Subnet(msrest.serialization.Model): same configuration as the cluster. :vartype enable_ipv6: bool :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Possible values include: "enabled", "disabled". + end point in the subnet. Known values are: "enabled", "disabled". :vartype private_endpoint_network_policies: str or ~azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies :ivar private_link_service_network_policies: Enable or Disable apply network policies on - private link service in the subnet. Possible values include: "enabled", "disabled". + private link service in the subnet. Known values are: "enabled", "disabled". :vartype private_link_service_network_policies: str or ~azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies :ivar network_security_group_id: Full resource id for the network security group. @@ -4765,8 +4803,8 @@ def __init__( *, name: str, enable_ipv6: Optional[bool] = None, - private_endpoint_network_policies: Optional[Union[str, "PrivateEndpointNetworkPolicies"]] = None, - private_link_service_network_policies: Optional[Union[str, "PrivateLinkServiceNetworkPolicies"]] = None, + private_endpoint_network_policies: Optional[Union[str, "_models.PrivateEndpointNetworkPolicies"]] = None, + private_link_service_network_policies: Optional[Union[str, "_models.PrivateLinkServiceNetworkPolicies"]] = None, network_security_group_id: Optional[str] = None, **kwargs ): @@ -4777,11 +4815,11 @@ def __init__( same configuration as the cluster. :paramtype enable_ipv6: bool :keyword private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Possible values include: "enabled", "disabled". + end point in the subnet. Known values are: "enabled", "disabled". :paramtype private_endpoint_network_policies: str or ~azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies :keyword private_link_service_network_policies: Enable or Disable apply network policies on - private link service in the subnet. Possible values include: "enabled", "disabled". + private link service in the subnet. Known values are: "enabled", "disabled". :paramtype private_link_service_network_policies: str or ~azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies :keyword network_security_group_id: Full resource id for the network security group. @@ -4886,7 +4924,7 @@ class UniformInt64RangePartitionScheme(Partition): All required parameters must be populated in order to send to Azure. :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". + server. Known values are: "Singleton", "UniformInt64Range", "Named". :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme :ivar count: Required. The number of partitions. @@ -5058,8 +5096,8 @@ class VaultSecretGroup(msrest.serialization.Model): def __init__( self, *, - source_vault: "SubResource", - vault_certificates: List["VaultCertificate"], + source_vault: "_models.SubResource", + vault_certificates: List["_models.VaultCertificate"], **kwargs ): """ @@ -5144,8 +5182,8 @@ class VmssDataDisk(msrest.serialization.Model): :ivar disk_size_gb: Required. Disk size for each vm in the node type in GBs. :vartype disk_size_gb: int :ivar disk_type: Required. Managed data disk type. Specifies the storage account type for the - managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". - Default value: "StandardSSD_LRS". + managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default + value: "StandardSSD_LRS". :vartype disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType :ivar disk_letter: Required. Managed data disk letter. It can not use the reserved letter C or D and it can not change after created. @@ -5171,7 +5209,7 @@ def __init__( *, lun: int, disk_size_gb: int, - disk_type: Union[str, "DiskType"] = "StandardSSD_LRS", + disk_type: Union[str, "_models.DiskType"] = "StandardSSD_LRS", disk_letter: str, **kwargs ): @@ -5183,8 +5221,8 @@ def __init__( :keyword disk_size_gb: Required. Disk size for each vm in the node type in GBs. :paramtype disk_size_gb: int :keyword disk_type: Required. Managed data disk type. Specifies the storage account type for - the managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". - Default value: "StandardSSD_LRS". + the managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default + value: "StandardSSD_LRS". :paramtype disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType :keyword disk_letter: Required. Managed data disk letter. It can not use the reserved letter C or D and it can not change after created. diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 73dd5e51df3d..245e3cfeefec 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 @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class Access(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Access(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The network traffic is allowed or denied. """ ALLOW = "allow" DENY = "deny" -class ClusterState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of the cluster. """ @@ -38,7 +37,7 @@ class ClusterState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Indicates that the cluster is in a stable state. READY = "Ready" -class ClusterUpgradeCadence(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterUpgradeCadence(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. """ @@ -53,7 +52,7 @@ class ClusterUpgradeCadence(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: clusters. WAVE2 = "Wave2" -class ClusterUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ClusterUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The upgrade mode of the cluster when new Service Fabric runtime version is available. """ @@ -65,14 +64,14 @@ class ClusterUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. MANUAL = "Manual" -class Direction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network security rule direction. """ INBOUND = "inbound" OUTBOUND = "outbound" -class DiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Managed data disk type. IOPS and throughput are given by the disk size, to see more information go to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types. """ @@ -85,7 +84,16 @@ class DiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. PREMIUM_LRS = "Premium_LRS" -class FailureAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EvictionPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the eviction policy for virtual machines in a SPOT node type. + """ + + #: Eviction policy will be Delete for SPOT vms. + DELETE = "Delete" + #: Eviction policy will be Deallocate for SPOT vms. + DEALLOCATE = "Deallocate" + +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 @@ -99,7 +107,7 @@ class FailureAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: fails. Service Fabric will not proceed to the next upgrade domain automatically. MANUAL = "Manual" -class IPAddressType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IPAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP address type. """ @@ -108,7 +116,7 @@ class IPAddressType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: IPv6 address type. I_PV6 = "IPv6" -class ManagedClusterAddOnFeature(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterAddOnFeature(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Available cluster add-on features """ @@ -119,11 +127,11 @@ class ManagedClusterAddOnFeature(with_metaclass(CaseInsensitiveEnumMeta, str, En #: Resource monitor service. RESOURCE_MONITOR_SERVICE = "ResourceMonitorService" -class ManagedClusterVersionEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterVersionEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS = "Windows" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of managed identity for the resource. """ @@ -137,7 +145,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: resource. SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class ManagedResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the managed resource. """ @@ -152,7 +160,7 @@ class ManagedResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, s DELETED = "Deleted" OTHER = "Other" -class MoveCost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MoveCost(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the move cost for the service. """ @@ -165,7 +173,7 @@ class MoveCost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Specifies the move cost of the service as High. The value is 3. HIGH = "High" -class NodeTypeSkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NodeTypeSkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Node type capacity scale type. """ @@ -176,7 +184,7 @@ class NodeTypeSkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Automatic scale is allowed. AUTOMATIC = "Automatic" -class NsgProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NsgProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network protocol this rule applies to. """ @@ -188,14 +196,14 @@ class NsgProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AH = "ah" ESP = "esp" -class OsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Cluster operating system, the default will be Windows """ #: Indicates os is Windows. WINDOWS = "Windows" -class PartitionScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PartitionScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enumerates the ways that a service can be partitioned. """ @@ -209,21 +217,21 @@ class PartitionScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The value is 2. NAMED = "Named" -class PrivateEndpointNetworkPolicies(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enable or Disable apply network policies on private end point in the subnet. """ ENABLED = "enabled" DISABLED = "disabled" -class PrivateLinkServiceNetworkPolicies(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkServiceNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enable or Disable apply network policies on private link service in the subnet. """ ENABLED = "enabled" DISABLED = "disabled" -class ProbeProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProbeProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """the reference to the load balancer probe used by the load balancing rule. """ @@ -231,14 +239,14 @@ class ProbeProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP = "http" HTTPS = "https" -class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reference to the transport protocol used by the load balancing rule. """ TCP = "tcp" UDP = "udp" -class RollingUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RollingUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto. """ @@ -250,7 +258,7 @@ class RollingUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: 1. UNMONITORED_AUTO = "UnmonitoredAuto" -class ServiceCorrelationScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceCorrelationScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The service correlation scheme. """ @@ -263,7 +271,7 @@ class ServiceCorrelationScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum #: be collocated. The value is 1. NON_ALIGNED_AFFINITY = "NonAlignedAffinity" -class ServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of service (Stateless or Stateful). """ @@ -273,7 +281,7 @@ class ServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: value is 1. STATEFUL = "Stateful" -class ServiceLoadMetricWeight(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceLoadMetricWeight(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the metric weight relative to the other metrics that are configured for this service. During runtime, if two metrics end up in conflict, the Cluster Resource Manager prefers the metric with the higher weight. @@ -288,7 +296,7 @@ class ServiceLoadMetricWeight(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) #: Specifies the metric weight of the service load as High. The value is 3. HIGH = "High" -class ServicePackageActivationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServicePackageActivationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The activation Mode of the service package """ @@ -297,7 +305,7 @@ class ServicePackageActivationMode(with_metaclass(CaseInsensitiveEnumMeta, str, #: Indicates the application package activation mode will use exclusive process. EXCLUSIVE_PROCESS = "ExclusiveProcess" -class ServicePlacementPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServicePlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of placement policy for a service fabric service. Following are the possible values. """ @@ -324,7 +332,7 @@ class ServicePlacementPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, En #: replicas of a particular partition of the service should be placed atomically. The value is 4. NON_PARTIALLY_PLACE_SERVICE = "NonPartiallyPlaceService" -class ServiceScalingMechanismKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceScalingMechanismKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enumerates the ways that a service can be partitioned. """ @@ -335,7 +343,7 @@ class ServiceScalingMechanismKind(with_metaclass(CaseInsensitiveEnumMeta, str, E #: The value is 1. ADD_REMOVE_INCREMENTAL_NAMED_PARTITION = "AddRemoveIncrementalNamedPartition" -class ServiceScalingTriggerKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceScalingTriggerKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enumerates the ways that a service can be partitioned. """ @@ -346,7 +354,7 @@ class ServiceScalingTriggerKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enu #: value is 1. AVERAGE_SERVICE_LOAD_TRIGGER = "AverageServiceLoadTrigger" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sku Name. """ 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 03d5bfe84af0..7b3626f30b84 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 @@ -20,6 +20,9 @@ from ._node_types_operations import NodeTypesOperations from ._node_type_skus_operations import NodeTypeSkusOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ApplicationTypesOperations', 'ApplicationTypeVersionsOperations', @@ -35,3 +38,5 @@ 'NodeTypesOperations', 'NodeTypeSkusOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 c35e62dc0a36..066c505175e2 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -37,9 +37,12 @@ def build_get_request( version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,18 +56,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -76,14 +77,17 @@ def build_create_or_update_request_initial( application_type_name: str, version: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationTypeVersionResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -124,14 +126,17 @@ def build_update_request( application_type_name: str, version: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationTypeVersionUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { @@ -145,20 +150,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -173,9 +176,12 @@ def build_delete_request_initial( version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +195,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -212,9 +216,12 @@ def build_list_by_application_types_request( application_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions") # pylint: disable=line-too-long path_format_arguments = { @@ -227,42 +234,38 @@ def build_list_by_application_types_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ApplicationTypeVersionsOperations(object): - """ApplicationTypeVersionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ApplicationTypeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_type_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -272,7 +275,7 @@ def get( application_type_name: str, version: str, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": + ) -> _models.ApplicationTypeVersionResource: """Gets a Service Fabric managed application type version resource. Get a Service Fabric managed application type version resource created or in the process of @@ -291,13 +294,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] request = build_get_request( @@ -308,11 +314,13 @@ def get( version=version, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,17 +348,20 @@ def _create_or_update_initial( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] + ) -> _models.ApplicationTypeVersionResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') @@ -364,11 +375,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,9 +413,9 @@ def begin_create_or_update( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> LROPoller["_models.ApplicationTypeVersionResource"]: + ) -> LROPoller[_models.ApplicationTypeVersionResource]: """Creates or updates a Service Fabric managed application type version resource. Create or update a Service Fabric managed application type version resource with the specified @@ -433,17 +446,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, @@ -452,20 +468,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -485,9 +508,9 @@ def update( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionUpdateParameters", + parameters: _models.ApplicationTypeVersionUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": + ) -> _models.ApplicationTypeVersionResource: """Updates the tags of an application type version resource of a given managed cluster. Updates the tags of an application type version resource of a given managed cluster. @@ -508,14 +531,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] _json = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') @@ -529,11 +555,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,13 +591,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements version: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -580,11 +611,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements version=version, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -634,22 +667,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -659,8 +697,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -680,7 +724,7 @@ def list_by_application_types( cluster_name: str, application_type_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationTypeVersionResourceList"]: + ) -> Iterable[_models.ApplicationTypeVersionResourceList]: """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. @@ -700,13 +744,16 @@ def list_by_application_types( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -717,9 +764,11 @@ def prepare_request(next_link=None): application_type_name=application_type_name, api_version=api_version, template_url=self.list_by_application_types.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -730,9 +779,11 @@ def prepare_request(next_link=None): application_type_name=application_type_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 9b282ff2a16f..1e8d32ea3139 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( application_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_or_update_request( cluster_name: str, application_type_name: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationTypeResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request( cluster_name: str, application_type_name: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationTypeUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -139,20 +144,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( application_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes") # pylint: disable=line-too-long path_format_arguments = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ApplicationTypesOperations(object): - """ApplicationTypesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ApplicationTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -261,7 +264,7 @@ def get( cluster_name: str, application_type_name: str, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Gets a Service Fabric managed application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -278,13 +281,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] request = build_get_request( @@ -294,11 +300,13 @@ def get( application_type_name=application_type_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -326,9 +334,9 @@ def create_or_update( resource_group_name: str, cluster_name: str, application_type_name: str, - parameters: "_models.ApplicationTypeResource", + parameters: _models.ApplicationTypeResource, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Creates or updates a Service Fabric managed application type name resource. Create or update a Service Fabric managed application type name resource with the specified @@ -347,14 +355,17 @@ def create_or_update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] _json = self._serialize.body(parameters, 'ApplicationTypeResource') @@ -367,11 +378,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -399,9 +412,9 @@ def update( resource_group_name: str, cluster_name: str, application_type_name: str, - parameters: "_models.ApplicationTypeUpdateParameters", + parameters: _models.ApplicationTypeUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Updates the tags of an application type resource of a given managed cluster. Updates the tags of an application type resource of a given managed cluster. @@ -420,14 +433,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] _json = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') @@ -440,11 +456,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,13 +491,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements application_type_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -489,11 +510,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements application_type_name=application_type_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -540,21 +563,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -564,8 +592,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -584,7 +618,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationTypeResourceList"]: + ) -> Iterable[_models.ApplicationTypeResourceList]: """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. @@ -602,13 +636,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -618,9 +655,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -630,9 +669,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 cd2903406379..e1f6558e0527 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - 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 = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_create_or_update_request_initial( cluster_name: str, application_name: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - 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 = { @@ -93,20 +97,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,14 +121,17 @@ def build_update_request( cluster_name: str, application_name: str, *, - json: JSONType = None, + json: Optional[_models.ApplicationUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - 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 = { @@ -139,20 +144,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -166,9 +169,12 @@ def build_delete_request_initial( application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - 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 = { @@ -181,18 +187,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -203,9 +207,12 @@ def build_list_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - 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 = { @@ -217,42 +224,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ApplicationsOperations(object): - """ApplicationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -261,7 +264,7 @@ def get( cluster_name: str, application_name: str, **kwargs: Any - ) -> "_models.ApplicationResource": + ) -> _models.ApplicationResource: """Gets a Service Fabric managed application resource. Get a Service Fabric managed application resource created or in the process of being created in @@ -278,13 +281,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] request = build_get_request( @@ -294,11 +300,13 @@ def get( application_name=application_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,17 +333,20 @@ def _create_or_update_initial( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> "_models.ApplicationResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] _json = self._serialize.body(parameters, 'ApplicationResource') @@ -348,11 +359,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -383,9 +396,9 @@ def begin_create_or_update( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> LROPoller["_models.ApplicationResource"]: + ) -> LROPoller[_models.ApplicationResource]: """Creates or updates a Service Fabric managed application resource. Create or update a Service Fabric managed application resource with the specified name. @@ -412,17 +425,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -430,20 +446,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -462,9 +485,9 @@ def update( resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationUpdateParameters", + parameters: _models.ApplicationUpdateParameters, **kwargs: Any - ) -> "_models.ApplicationResource": + ) -> _models.ApplicationResource: """Updates the tags of an application resource of a given managed cluster. Updates the tags of an application resource of a given managed cluster. @@ -482,14 +505,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] _json = self._serialize.body(parameters, 'ApplicationUpdateParameters') @@ -502,11 +528,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -535,13 +563,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements application_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -551,11 +582,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements application_name=application_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -602,21 +635,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -626,8 +664,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -646,7 +690,7 @@ def list( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationResourceList"]: + ) -> Iterable[_models.ApplicationResourceList]: """Gets the list of managed application resources created in the specified Service Fabric cluster resource. @@ -664,13 +708,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -680,9 +727,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -692,9 +741,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 b3a914cae827..4c6b0b978e81 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 @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getazresiliencystatus") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedAzResiliencyStatusOperations(object): - """ManagedAzResiliencyStatusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedAzResiliencyStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_az_resiliency_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ManagedAzResiliencyStatus": + ) -> _models.ManagedAzResiliencyStatus: """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric Managed Clusters. @@ -104,13 +104,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedAzResiliencyStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedAzResiliencyStatus] request = build_get_request( @@ -119,11 +122,13 @@ def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 050753e604b5..849a35ad7df3 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 @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_get_request( cluster_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +49,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -68,9 +70,12 @@ def build_get_by_environment_request( cluster_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -83,18 +88,16 @@ def build_get_by_environment_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +107,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +123,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +143,12 @@ def build_list_by_environment_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -153,42 +160,38 @@ def build_list_by_environment_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClusterVersionOperations(object): - """ManagedClusterVersionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClusterVersionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_cluster_version` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -196,7 +199,7 @@ def get( location: str, cluster_version: str, **kwargs: Any - ) -> "_models.ManagedClusterCodeVersionResult": + ) -> _models.ManagedClusterCodeVersionResult: """Gets information about a Service Fabric managed cluster code version available in the specified location. @@ -212,13 +215,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterCodeVersionResult] request = build_get_request( @@ -227,11 +233,13 @@ def get( cluster_version=cluster_version, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -260,7 +268,7 @@ def get_by_environment( environment: Union[str, "_models.ManagedClusterVersionEnvironment"], cluster_version: str, **kwargs: Any - ) -> "_models.ManagedClusterCodeVersionResult": + ) -> _models.ManagedClusterCodeVersionResult: """Gets information about a Service Fabric cluster code version available for the specified environment. @@ -279,13 +287,16 @@ def get_by_environment( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterCodeVersionResult] request = build_get_by_environment_request( @@ -295,11 +306,13 @@ def get_by_environment( cluster_version=cluster_version, api_version=api_version, template_url=self.get_by_environment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -326,7 +339,7 @@ def list( self, location: str, **kwargs: Any - ) -> List["_models.ManagedClusterCodeVersionResult"]: + ) -> List[_models.ManagedClusterCodeVersionResult]: """Gets the list of Service Fabric cluster code versions available for the specified location. Gets all available code versions for Service Fabric cluster resources by location. @@ -339,13 +352,16 @@ def list( :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.ManagedClusterCodeVersionResult]] request = build_list_request( @@ -353,11 +369,13 @@ def list( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -385,7 +403,7 @@ def list_by_environment( location: str, environment: Union[str, "_models.ManagedClusterVersionEnvironment"], **kwargs: Any - ) -> List["_models.ManagedClusterCodeVersionResult"]: + ) -> List[_models.ManagedClusterCodeVersionResult]: """Gets the list of Service Fabric cluster code versions available for the specified environment. Gets all available code versions for Service Fabric cluster resources by environment. @@ -401,13 +419,16 @@ def list_by_environment( :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.ManagedClusterCodeVersionResult]] request = build_list_by_environment_request( @@ -416,11 +437,13 @@ def list_by_environment( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_environment.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 e1f2d060d948..aad193307a0e 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -67,9 +68,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters") path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( cluster_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_request( cluster_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -225,9 +230,12 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,49 +247,45 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets the list of Service Fabric cluster resources created in the specified resource group. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -296,13 +300,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -311,9 +318,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -322,9 +331,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -362,7 +373,7 @@ def get_next(next_link=None): def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets the list of Service Fabric cluster resources created in the specified subscription. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -375,13 +386,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -389,9 +403,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -399,9 +415,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -441,7 +459,7 @@ def get( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a Service Fabric managed cluster resource. Get a Service Fabric managed cluster resource created or in the process of being created in the @@ -456,13 +474,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -471,11 +492,13 @@ def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -501,17 +524,20 @@ def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -523,11 +549,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -557,9 +585,9 @@ def begin_create_or_update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a Service Fabric managed cluster resource. Create or update a Service Fabric managed cluster resource with the specified name. @@ -584,37 +612,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -632,9 +670,9 @@ def update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ManagedClusterUpdateParameters", + parameters: _models.ManagedClusterUpdateParameters, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Updates the tags of of a Service Fabric managed cluster resource. Update the tags of of a Service Fabric managed cluster resource with the specified name. @@ -651,14 +689,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') @@ -670,11 +711,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,13 +745,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cluster_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -717,11 +763,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -765,20 +813,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -788,8 +841,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( 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 ca243d7a4b1d..f53d16b1201a 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 @@ -16,6 +16,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes") # pylint: disable=line-too-long path_format_arguments = { @@ -44,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +68,12 @@ def build_get_request( vm_size: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}") # pylint: disable=line-too-long path_format_arguments = { @@ -80,49 +85,45 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedUnsupportedVMSizesOperations(object): - """ManagedUnsupportedVMSizesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedUnsupportedVMSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_unsupported_vm_sizes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, location: str, **kwargs: Any - ) -> Iterable["_models.ManagedVMSizesResult"]: + ) -> Iterable[_models.ManagedVMSizesResult]: """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. @@ -137,13 +138,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSizesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedVMSizesResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSizesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +156,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +169,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -205,7 +213,7 @@ def get( location: str, vm_size: str, **kwargs: Any - ) -> "_models.ManagedVMSize": + ) -> _models.ManagedVMSize: """Get unsupported vm size for Service Fabric Managed Clusters. Get unsupported vm size for Service Fabric Managed Clusters. @@ -220,13 +228,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSize"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedVMSize] request = build_get_request( @@ -235,11 +246,13 @@ def get( vm_size=vm_size, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 15e257dd12d8..cedc58511996 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 @@ -16,6 +16,7 @@ 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 @@ -33,9 +34,12 @@ def build_list_request( node_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus") # pylint: disable=line-too-long path_format_arguments = { @@ -48,42 +52,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class NodeTypeSkusOperations(object): - """NodeTypeSkusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class NodeTypeSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_type_skus` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -92,7 +92,7 @@ def list( cluster_name: str, node_type_name: str, **kwargs: Any - ) -> Iterable["_models.NodeTypeListSkuResult"]: + ) -> Iterable[_models.NodeTypeListSkuResult]: """Gets a Service Fabric node type SKUs. Get a Service Fabric node type supported SKUs. @@ -110,13 +110,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeListSkuResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeTypeListSkuResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListSkuResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -127,9 +130,11 @@ def prepare_request(next_link=None): node_type_name=node_type_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -140,9 +145,11 @@ def prepare_request(next_link=None): node_type_name=node_type_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request 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 b9290ffbb5b7..d841011caded 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_managed_clusters_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_managed_clusters_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,14 +72,17 @@ def build_restart_request_initial( cluster_name: str, node_type_name: str, *, - json: JSONType = None, + json: Optional[_models.NodeTypeActionParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart") # pylint: disable=line-too-long path_format_arguments = { @@ -91,20 +95,18 @@ def build_restart_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -117,14 +119,17 @@ def build_reimage_request_initial( cluster_name: str, node_type_name: str, *, - json: JSONType = None, + json: Optional[_models.NodeTypeActionParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage") # pylint: disable=line-too-long path_format_arguments = { @@ -137,20 +142,18 @@ def build_reimage_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -163,14 +166,17 @@ def build_delete_node_request_initial( cluster_name: str, node_type_name: str, *, - json: JSONType = None, + json: Optional[_models.NodeTypeActionParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode") # pylint: disable=line-too-long path_format_arguments = { @@ -183,20 +189,18 @@ def build_delete_node_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -210,9 +214,12 @@ def build_get_request( node_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +232,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,14 +252,17 @@ def build_create_or_update_request_initial( cluster_name: str, node_type_name: str, *, - json: JSONType = None, + json: Optional[_models.NodeType] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -267,20 +275,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -293,14 +299,17 @@ def build_update_request( cluster_name: str, node_type_name: str, *, - json: JSONType = None, + json: Optional[_models.NodeTypeUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -313,20 +322,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -340,9 +347,12 @@ def build_delete_request_initial( node_type_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}") # pylint: disable=line-too-long path_format_arguments = { @@ -355,42 +365,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class NodeTypesOperations(object): - """NodeTypesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class NodeTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_managed_clusters( @@ -398,7 +404,7 @@ def list_by_managed_clusters( resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.NodeTypeListResult"]: + ) -> Iterable[_models.NodeTypeListResult]: """Gets the list of Node types of the specified managed cluster. Gets all Node types of the specified managed cluster. @@ -413,13 +419,16 @@ def list_by_managed_clusters( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeTypeListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -429,9 +438,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=self.list_by_managed_clusters.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -441,9 +452,11 @@ def prepare_request(next_link=None): cluster_name=cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -482,17 +495,20 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -505,11 +521,13 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,7 +550,7 @@ def begin_restart( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> LROPoller[None]: """Restarts one or more nodes on the node type. @@ -560,17 +578,20 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._restart_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -578,6 +599,8 @@ def begin_restart( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -587,8 +610,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -606,17 +635,20 @@ def _reimage_initial( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -629,11 +661,13 @@ def _reimage_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -656,7 +690,7 @@ def begin_reimage( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> LROPoller[None]: """Reimages one or more nodes on the node type. @@ -684,17 +718,20 @@ def begin_reimage( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reimage_initial( + raw_result = self._reimage_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -702,6 +739,8 @@ def begin_reimage( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -711,8 +750,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -730,17 +775,20 @@ def _delete_node_initial( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'NodeTypeActionParameters') @@ -753,11 +801,13 @@ def _delete_node_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._delete_node_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -780,7 +830,7 @@ def begin_delete_node( # pylint: disable=inconsistent-return-statements resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeActionParameters", + parameters: _models.NodeTypeActionParameters, **kwargs: Any ) -> LROPoller[None]: """Deletes one or more nodes on the node type. @@ -808,17 +858,20 @@ def begin_delete_node( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_node_initial( + raw_result = self._delete_node_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -826,6 +879,8 @@ def begin_delete_node( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -835,8 +890,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -856,7 +917,7 @@ def get( cluster_name: str, node_type_name: str, **kwargs: Any - ) -> "_models.NodeType": + ) -> _models.NodeType: """Gets a Service Fabric node type. Get a Service Fabric node type of a given managed cluster. @@ -872,13 +933,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] request = build_get_request( @@ -888,11 +952,13 @@ def get( node_type_name=node_type_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -919,17 +985,20 @@ def _create_or_update_initial( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeType", + parameters: _models.NodeType, **kwargs: Any - ) -> "_models.NodeType": - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + ) -> _models.NodeType: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] _json = self._serialize.body(parameters, 'NodeType') @@ -942,11 +1011,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -977,9 +1048,9 @@ def begin_create_or_update( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeType", + parameters: _models.NodeType, **kwargs: Any - ) -> LROPoller["_models.NodeType"]: + ) -> LROPoller[_models.NodeType]: """Creates or updates a Service Fabric node type. Create or update a Service Fabric node type of a given managed cluster. @@ -1004,17 +1075,20 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, @@ -1022,20 +1096,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('NodeType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1054,9 +1135,9 @@ def update( resource_group_name: str, cluster_name: str, node_type_name: str, - parameters: "_models.NodeTypeUpdateParameters", + parameters: _models.NodeTypeUpdateParameters, **kwargs: Any - ) -> "_models.NodeType": + ) -> _models.NodeType: """Update the tags of a node type resource of a given managed cluster. Update the configuration of a node type of a given managed cluster, only updating tags. @@ -1074,14 +1155,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeType] _json = self._serialize.body(parameters, 'NodeTypeUpdateParameters') @@ -1094,11 +1178,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1127,13 +1213,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements node_type_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1143,11 +1232,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements node_type_name=node_type_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1194,21 +1285,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, node_type_name=node_type_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1218,8 +1314,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( 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 a5a011a67c36..b1c17307e7aa 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 @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OperationResultsOperations(object): - """OperationResultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( # pylint: disable=inconsistent-return-statements @@ -103,13 +103,16 @@ def get( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_get_request( @@ -118,11 +121,13 @@ def get( # pylint: disable=inconsistent-return-statements operation_id=operation_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 8a89962eb8b9..2e78888b5349 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 @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OperationStatusOperations(object): - """OperationStatusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def get( location: str, operation_id: str, **kwargs: Any - ) -> "_models.LongRunningOperationResult": + ) -> _models.LongRunningOperationResult: """Get long running operation status. Get long running operation status. @@ -103,13 +103,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LongRunningOperationResult] request = build_get_request( @@ -118,11 +121,13 @@ def get( operation_id=operation_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs 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 5b1e0aefc317..1ccd3676bda9 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 @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceFabric/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Service Fabric resource provider API operations. Get the list of available Service Fabric resource provider API operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 ba4ff5c9df10..85c320348516 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,7 +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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -37,9 +37,12 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,18 +56,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -76,14 +77,17 @@ def build_create_or_update_request_initial( application_name: str, service_name: str, *, - json: JSONType = None, + json: Optional[_models.ServiceResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -124,14 +126,17 @@ def build_update_request( application_name: str, service_name: str, *, - json: JSONType = None, + json: Optional[_models.ServiceUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -145,20 +150,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -173,9 +176,12 @@ def build_delete_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +195,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -212,9 +216,12 @@ def build_list_by_applications_request( application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services") # pylint: disable=line-too-long path_format_arguments = { @@ -227,42 +234,38 @@ def build_list_by_applications_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ServicesOperations(object): - """ServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabricmanagedclusters.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -272,7 +275,7 @@ def get( application_name: str, service_name: str, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Gets a Service Fabric managed service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -292,13 +295,16 @@ def get( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] request = build_get_request( @@ -309,11 +315,13 @@ def get( service_name=service_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -341,17 +349,20 @@ def _create_or_update_initial( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] _json = self._serialize.body(parameters, 'ServiceResource') @@ -365,11 +376,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -401,9 +414,9 @@ def begin_create_or_update( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + ) -> LROPoller[_models.ServiceResource]: """Creates or updates a Service Fabric managed service resource. Create or update a Service Fabric managed service resource with the specified name. @@ -433,17 +446,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -452,20 +468,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -485,9 +508,9 @@ def update( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceUpdateParameters", + parameters: _models.ServiceUpdateParameters, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Updates the tags of a service resource of a given managed cluster. Updates the tags of a service resource of a given managed cluster. @@ -508,14 +531,17 @@ def update( :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] _json = self._serialize.body(parameters, 'ServiceUpdateParameters') @@ -529,11 +555,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,13 +591,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -580,11 +611,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,22 +668,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -660,8 +698,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -681,7 +725,7 @@ def list_by_applications( cluster_name: str, application_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + ) -> Iterable[_models.ServiceResourceList]: """Gets the list of service resources created in the specified Service Fabric managed application resource. @@ -700,13 +744,16 @@ def list_by_applications( ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -717,9 +764,11 @@ def prepare_request(next_link=None): application_name=application_name, api_version=api_version, template_url=self.list_by_applications.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -730,9 +779,11 @@ def prepare_request(next_link=None): application_name=application_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request