diff --git a/sdk/aks/azure-mgmt-devspaces/CHANGELOG.md b/sdk/aks/azure-mgmt-devspaces/CHANGELOG.md new file mode 100644 index 000000000000..249d5ace8cfc --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/CHANGELOG.md @@ -0,0 +1,50 @@ +# Release History + +## 1.0.0b1 (2021-05-26) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 0.2.0 (2019-05-23) + +**Features** + + - Model ControllerUpdateParameters has a new parameter + target_container_host_credentials_base64 + - Added operation group ContainerHostMappingsOperations + +**Breaking changes** + + - Operation ControllersOperations.list_connection_details has a new + signature + - Operation ControllersOperations.update has a new signature + - Model ControllerConnectionDetails has a new signature + +## 0.1.0 (2018-07-12) + + - Initial Release \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/MANIFEST.in b/sdk/aks/azure-mgmt-devspaces/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/aks/azure-mgmt-devspaces/README.md b/sdk/aks/azure-mgmt-devspaces/README.md new file mode 100644 index 000000000000..95f807c981ac --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Devspaces Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Devspaces Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-devspaces%2FREADME.png) diff --git a/sdk/aks/azure-mgmt-devspaces/_meta.json b/sdk/aks/azure-mgmt-devspaces/_meta.json new file mode 100644 index 000000000000..032c625e52b0 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.0", + "@autorest/modelerfour@4.19.1" + ], + "commit": "ae6770af3f89e13b00b15f5e643dc3ff31d8ddbd", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/devspaces/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "readme": "specification/devspaces/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/azure/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/__init__.py new file mode 100644 index 000000000000..589ce06a1985 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._dev_spaces_management_client import DevSpacesManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['DevSpacesManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_configuration.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_configuration.py new file mode 100644 index 000000000000..9b1cbfea3f64 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class DevSpacesManagementClientConfiguration(Configuration): + """Configuration for DevSpacesManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(DevSpacesManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-devspaces/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_dev_spaces_management_client.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_dev_spaces_management_client.py new file mode 100644 index 000000000000..a78312a16f69 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_dev_spaces_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import DevSpacesManagementClientConfiguration +from .operations import ContainerHostMappingsOperations +from .operations import Operations +from .operations import ControllersOperations +from . import models + + +class DevSpacesManagementClient(object): + """Dev Spaces Client. + + :ivar container_host_mappings: ContainerHostMappingsOperations operations + :vartype container_host_mappings: dev_spaces_management_client.operations.ContainerHostMappingsOperations + :ivar operations: Operations operations + :vartype operations: dev_spaces_management_client.operations.Operations + :ivar controllers: ControllersOperations operations + :vartype controllers: dev_spaces_management_client.operations.ControllersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = DevSpacesManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.container_host_mappings = ContainerHostMappingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.controllers = ControllersOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> DevSpacesManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_metadata.json b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_metadata.json new file mode 100644 index 000000000000..1523320e09ad --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_metadata.json @@ -0,0 +1,105 @@ +{ + "chosen_version": "2019-04-01", + "total_api_version_list": ["2019-04-01"], + "client": { + "name": "DevSpacesManagementClient", + "filename": "_dev_spaces_management_client", + "description": "Dev Spaces Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DevSpacesManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DevSpacesManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "container_host_mappings": "ContainerHostMappingsOperations", + "operations": "Operations", + "controllers": "ControllersOperations" + } +} \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_version.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/__init__.py new file mode 100644 index 000000000000..f83a54d3e0e4 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._dev_spaces_management_client import DevSpacesManagementClient +__all__ = ['DevSpacesManagementClient'] diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_configuration.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_configuration.py new file mode 100644 index 000000000000..c1bd9bf5e064 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DevSpacesManagementClientConfiguration(Configuration): + """Configuration for DevSpacesManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(DevSpacesManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-devspaces/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_dev_spaces_management_client.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_dev_spaces_management_client.py new file mode 100644 index 000000000000..0f50b0af87cf --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/_dev_spaces_management_client.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import DevSpacesManagementClientConfiguration +from .operations import ContainerHostMappingsOperations +from .operations import Operations +from .operations import ControllersOperations +from .. import models + + +class DevSpacesManagementClient(object): + """Dev Spaces Client. + + :ivar container_host_mappings: ContainerHostMappingsOperations operations + :vartype container_host_mappings: dev_spaces_management_client.aio.operations.ContainerHostMappingsOperations + :ivar operations: Operations operations + :vartype operations: dev_spaces_management_client.aio.operations.Operations + :ivar controllers: ControllersOperations operations + :vartype controllers: dev_spaces_management_client.aio.operations.ControllersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = DevSpacesManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.container_host_mappings = ContainerHostMappingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.controllers = ControllersOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DevSpacesManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/__init__.py new file mode 100644 index 000000000000..8d97a1b50859 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_host_mappings_operations import ContainerHostMappingsOperations +from ._operations import Operations +from ._controllers_operations import ControllersOperations + +__all__ = [ + 'ContainerHostMappingsOperations', + 'Operations', + 'ControllersOperations', +] diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_container_host_mappings_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_container_host_mappings_operations.py new file mode 100644 index 000000000000..928f17fdf0c2 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_container_host_mappings_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerHostMappingsOperations: + """ContainerHostMappingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_container_host_mapping( + self, + resource_group_name: str, + location: str, + container_host_mapping: "_models.ContainerHostMapping", + **kwargs: Any + ) -> Optional["_models.ContainerHostMapping"]: + """Returns container host mapping object for a container host resource ID if an associated controller exists. + + Returns container host mapping object for a container host resource ID if an associated + controller exists. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param location: Location of the container host. + :type location: str + :param container_host_mapping: + :type container_host_mapping: ~dev_spaces_management_client.models.ContainerHostMapping + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerHostMapping, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.ContainerHostMapping or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContainerHostMapping"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.get_container_host_mapping.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(container_host_mapping, 'ContainerHostMapping') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContainerHostMapping', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_host_mapping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_controllers_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_controllers_operations.py new file mode 100644 index 000000000000..685b87b45041 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_controllers_operations.py @@ -0,0 +1,635 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ControllersOperations: + """ControllersOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.Controller": + """Gets an Azure Dev Spaces Controller. + + Gets the properties for an Azure Dev Spaces Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Controller, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.Controller + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + name: str, + controller: "_models.Controller", + **kwargs: Any + ) -> "_models.Controller": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(controller, 'Controller') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Controller', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + name: str, + controller: "_models.Controller", + **kwargs: Any + ) -> AsyncLROPoller["_models.Controller"]: + """Creates an Azure Dev Spaces Controller. + + Creates an Azure Dev Spaces Controller with the specified create parameters. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param controller: Controller create parameters. + :type controller: ~dev_spaces_management_client.models.Controller + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Controller or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~dev_spaces_management_client.models.Controller] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + 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_initial( + resource_group_name=resource_group_name, + name=name, + controller=controller, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + 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', {})) + api_version = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an Azure Dev Spaces Controller. + + Deletes an existing Azure Dev Spaces Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + async def update( + self, + resource_group_name: str, + name: str, + controller_update_parameters: "_models.ControllerUpdateParameters", + **kwargs: Any + ) -> "_models.Controller": + """Updates an Azure Dev Spaces Controller. + + Updates the properties of an existing Azure Dev Spaces Controller with the specified update + parameters. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param controller_update_parameters: Parameters for updating the Azure Dev Spaces Controller. + :type controller_update_parameters: ~dev_spaces_management_client.models.ControllerUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Controller, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.Controller + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(controller_update_parameters, 'ControllerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Controller', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ControllerList"]: + """Lists the Azure Dev Spaces Controllers in a resource group. + + Lists all the Azure Dev Spaces Controllers with their properties in the specified resource + group and subscription. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ControllerList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~dev_spaces_management_client.models.ControllerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ControllerList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ControllerList"]: + """Lists the Azure Dev Spaces Controllers in a subscription. + + Lists all the Azure Dev Spaces Controllers with their properties in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ControllerList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~dev_spaces_management_client.models.ControllerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ControllerList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers'} # type: ignore + + async def list_connection_details( + self, + resource_group_name: str, + name: str, + list_connection_details_parameters: "_models.ListConnectionDetailsParameters", + **kwargs: Any + ) -> "_models.ControllerConnectionDetailsList": + """Lists connection details for an Azure Dev Spaces Controller. + + Lists connection details for the underlying container resources of an Azure Dev Spaces + Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param list_connection_details_parameters: Parameters for listing connection details of Azure + Dev Spaces Controller. + :type list_connection_details_parameters: ~dev_spaces_management_client.models.ListConnectionDetailsParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ControllerConnectionDetailsList, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.ControllerConnectionDetailsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerConnectionDetailsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list_connection_details.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(list_connection_details_parameters, 'ListConnectionDetailsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ControllerConnectionDetailsList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}/listConnectionDetails'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_operations.py new file mode 100644 index 000000000000..07619762537e --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/aio/operations/_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceProviderOperationList"]: + """Lists operations for the resource provider. + + Lists all the supported operations by the Microsoft.DevSpaces resource provider along with + their description. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~dev_spaces_management_client.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.DevSpaces/operations'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/__init__.py new file mode 100644 index 000000000000..9a9eda31e360 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/__init__.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ContainerHostMapping + from ._models_py3 import Controller + from ._models_py3 import ControllerConnectionDetails + from ._models_py3 import ControllerConnectionDetailsList + from ._models_py3 import ControllerList + from ._models_py3 import ControllerUpdateParameters + from ._models_py3 import DevSpacesErrorResponse + from ._models_py3 import ErrorDetails + from ._models_py3 import KubernetesConnectionDetails + from ._models_py3 import ListConnectionDetailsParameters + from ._models_py3 import OrchestratorSpecificConnectionDetails + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperationDefinition + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceProviderOperationList + from ._models_py3 import Sku + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import ContainerHostMapping # type: ignore + from ._models import Controller # type: ignore + from ._models import ControllerConnectionDetails # type: ignore + from ._models import ControllerConnectionDetailsList # type: ignore + from ._models import ControllerList # type: ignore + from ._models import ControllerUpdateParameters # type: ignore + from ._models import DevSpacesErrorResponse # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import KubernetesConnectionDetails # type: ignore + from ._models import ListConnectionDetailsParameters # type: ignore + from ._models import OrchestratorSpecificConnectionDetails # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceProviderOperationDefinition # type: ignore + from ._models import ResourceProviderOperationDisplay # type: ignore + from ._models import ResourceProviderOperationList # type: ignore + from ._models import Sku # type: ignore + from ._models import TrackedResource # type: ignore + +from ._dev_spaces_management_client_enums import ( + ProvisioningState, + SkuName, + SkuTier, +) + +__all__ = [ + 'ContainerHostMapping', + 'Controller', + 'ControllerConnectionDetails', + 'ControllerConnectionDetailsList', + 'ControllerList', + 'ControllerUpdateParameters', + 'DevSpacesErrorResponse', + 'ErrorDetails', + 'KubernetesConnectionDetails', + 'ListConnectionDetailsParameters', + 'OrchestratorSpecificConnectionDetails', + 'Resource', + 'ResourceProviderOperationDefinition', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'Sku', + 'TrackedResource', + 'ProvisioningState', + 'SkuName', + 'SkuTier', +] diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_dev_spaces_management_client_enums.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_dev_spaces_management_client_enums.py new file mode 100644 index 000000000000..91cc9134cc8e --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_dev_spaces_management_client_enums.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Azure Dev Spaces Controller. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + CREATING = "Creating" + DELETING = "Deleting" + DELETED = "Deleted" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU for Azure Dev Spaces Controller. + """ + + S1 = "S1" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The tier of the SKU for Azure Dev Spaces Controller. + """ + + STANDARD = "Standard" diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models.py new file mode 100644 index 000000000000..f7623462b9f9 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models.py @@ -0,0 +1,547 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ContainerHostMapping(msrest.serialization.Model): + """Container host mapping object specifying the Container host resource ID and its associated Controller resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param container_host_resource_id: ARM ID of the Container Host resource. + :type container_host_resource_id: str + :ivar mapped_controller_resource_id: ARM ID of the mapped Controller resource. + :vartype mapped_controller_resource_id: str + """ + + _validation = { + 'mapped_controller_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'container_host_resource_id': {'key': 'containerHostResourceId', 'type': 'str'}, + 'mapped_controller_resource_id': {'key': 'mappedControllerResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ContainerHostMapping, self).__init__(**kwargs) + self.container_host_resource_id = kwargs.get('container_host_resource_id', None) + self.mapped_controller_resource_id = None + + +class Resource(msrest.serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Tags for the Azure resource. + :type tags: dict[str, str] + :param location: Region where the Azure resource is located. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class Controller(TrackedResource): + """Controller. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Tags for the Azure resource. + :type tags: dict[str, str] + :param location: Region where the Azure resource is located. + :type location: str + :param sku: Required. Model representing SKU for Azure Dev Spaces Controller. + :type sku: ~dev_spaces_management_client.models.Sku + :ivar provisioning_state: Provisioning state of the Azure Dev Spaces Controller. Possible + values include: "Succeeded", "Failed", "Canceled", "Updating", "Creating", "Deleting", + "Deleted". + :vartype provisioning_state: str or ~dev_spaces_management_client.models.ProvisioningState + :ivar host_suffix: DNS suffix for public endpoints running in the Azure Dev Spaces Controller. + :vartype host_suffix: str + :ivar data_plane_fqdn: DNS name for accessing DataPlane services. + :vartype data_plane_fqdn: str + :ivar target_container_host_api_server_fqdn: DNS of the target container host's API server. + :vartype target_container_host_api_server_fqdn: str + :param target_container_host_resource_id: Required. Resource ID of the target container host. + :type target_container_host_resource_id: str + :param target_container_host_credentials_base64: Required. Credentials of the target container + host (base64). + :type target_container_host_credentials_base64: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'host_suffix': {'readonly': True}, + 'data_plane_fqdn': {'readonly': True}, + 'target_container_host_api_server_fqdn': {'readonly': True}, + 'target_container_host_resource_id': {'required': True}, + 'target_container_host_credentials_base64': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'host_suffix': {'key': 'properties.hostSuffix', 'type': 'str'}, + 'data_plane_fqdn': {'key': 'properties.dataPlaneFqdn', 'type': 'str'}, + 'target_container_host_api_server_fqdn': {'key': 'properties.targetContainerHostApiServerFqdn', 'type': 'str'}, + 'target_container_host_resource_id': {'key': 'properties.targetContainerHostResourceId', 'type': 'str'}, + 'target_container_host_credentials_base64': {'key': 'properties.targetContainerHostCredentialsBase64', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Controller, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.provisioning_state = None + self.host_suffix = None + self.data_plane_fqdn = None + self.target_container_host_api_server_fqdn = None + self.target_container_host_resource_id = kwargs['target_container_host_resource_id'] + self.target_container_host_credentials_base64 = kwargs['target_container_host_credentials_base64'] + + +class ControllerConnectionDetails(msrest.serialization.Model): + """ControllerConnectionDetails. + + :param orchestrator_specific_connection_details: Base class for types that supply values used + to connect to container orchestrators. + :type orchestrator_specific_connection_details: + ~dev_spaces_management_client.models.OrchestratorSpecificConnectionDetails + """ + + _attribute_map = { + 'orchestrator_specific_connection_details': {'key': 'orchestratorSpecificConnectionDetails', 'type': 'OrchestratorSpecificConnectionDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ControllerConnectionDetails, self).__init__(**kwargs) + self.orchestrator_specific_connection_details = kwargs.get('orchestrator_specific_connection_details', None) + + +class ControllerConnectionDetailsList(msrest.serialization.Model): + """ControllerConnectionDetailsList. + + :param connection_details_list: List of Azure Dev Spaces Controller connection details. + :type connection_details_list: + list[~dev_spaces_management_client.models.ControllerConnectionDetails] + """ + + _attribute_map = { + 'connection_details_list': {'key': 'connectionDetailsList', 'type': '[ControllerConnectionDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(ControllerConnectionDetailsList, self).__init__(**kwargs) + self.connection_details_list = kwargs.get('connection_details_list', None) + + +class ControllerList(msrest.serialization.Model): + """ControllerList. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Azure Dev Spaces Controllers. + :type value: list[~dev_spaces_management_client.models.Controller] + :ivar next_link: The URI that can be used to request the next page for list of Azure Dev Spaces + Controllers. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Controller]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ControllerList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ControllerUpdateParameters(msrest.serialization.Model): + """Parameters for updating an Azure Dev Spaces Controller. + + :param tags: A set of tags. Tags for the Azure Dev Spaces Controller. + :type tags: dict[str, str] + :param target_container_host_credentials_base64: Credentials of the target container host + (base64). + :type target_container_host_credentials_base64: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'target_container_host_credentials_base64': {'key': 'properties.targetContainerHostCredentialsBase64', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ControllerUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.target_container_host_credentials_base64 = kwargs.get('target_container_host_credentials_base64', None) + + +class DevSpacesErrorResponse(msrest.serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~dev_spaces_management_client.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(DevSpacesErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorDetails(msrest.serialization.Model): + """ErrorDetails. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Status code for the error. + :vartype code: str + :ivar message: Error message describing the error in detail. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class OrchestratorSpecificConnectionDetails(msrest.serialization.Model): + """Base class for types that supply values used to connect to container orchestrators. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: KubernetesConnectionDetails. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Required. Gets the Instance type.Constant filled by server. + :vartype instance_type: str + """ + + _validation = { + 'instance_type': {'required': True, 'readonly': True}, + } + + _attribute_map = { + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + } + + _subtype_map = { + 'instance_type': {'Kubernetes': 'KubernetesConnectionDetails'} + } + + def __init__( + self, + **kwargs + ): + super(OrchestratorSpecificConnectionDetails, self).__init__(**kwargs) + self.instance_type = None # type: Optional[str] + + +class KubernetesConnectionDetails(OrchestratorSpecificConnectionDetails): + """Contains information used to connect to a Kubernetes cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Required. Gets the Instance type.Constant filled by server. + :vartype instance_type: str + :param kube_config: Gets the kubeconfig for the cluster. + :type kube_config: str + """ + + _validation = { + 'instance_type': {'required': True, 'readonly': True}, + } + + _attribute_map = { + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'kube_config': {'key': 'kubeConfig', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KubernetesConnectionDetails, self).__init__(**kwargs) + self.instance_type = 'Kubernetes' # type: str + self.kube_config = kwargs.get('kube_config', None) + + +class ListConnectionDetailsParameters(msrest.serialization.Model): + """Parameters for listing connection details of an Azure Dev Spaces Controller. + + All required parameters must be populated in order to send to Azure. + + :param target_container_host_resource_id: Required. Resource ID of the target container host + mapped to the Azure Dev Spaces Controller. + :type target_container_host_resource_id: str + """ + + _validation = { + 'target_container_host_resource_id': {'required': True}, + } + + _attribute_map = { + 'target_container_host_resource_id': {'key': 'targetContainerHostResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListConnectionDetailsParameters, self).__init__(**kwargs) + self.target_container_host_resource_id = kwargs['target_container_host_resource_id'] + + +class ResourceProviderOperationDefinition(msrest.serialization.Model): + """ResourceProviderOperationDefinition. + + :param name: Resource provider operation name. + :type name: str + :param display: + :type display: ~dev_spaces_management_client.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """ResourceProviderOperationDisplay. + + :param provider: Name of the resource provider. + :type provider: str + :param resource: Name of the resource type. + :type resource: str + :param operation: Name of the resource provider operation. + :type operation: str + :param description: Description of the resource provider operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourceProviderOperationList(msrest.serialization.Model): + """ResourceProviderOperationList. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Resource provider operations list. + :type value: list[~dev_spaces_management_client.models.ResourceProviderOperationDefinition] + :ivar next_link: The URI that can be used to request the next page for list of Azure + operations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class Sku(msrest.serialization.Model): + """Model representing SKU for Azure Dev Spaces Controller. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU for Azure Dev Spaces Controller. Possible values + include: "S1". + :type name: str or ~dev_spaces_management_client.models.SkuName + :param tier: The tier of the SKU for Azure Dev Spaces Controller. Possible values include: + "Standard". + :type tier: str or ~dev_spaces_management_client.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models_py3.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models_py3.py new file mode 100644 index 000000000000..9a9dddf77895 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models_py3.py @@ -0,0 +1,590 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._dev_spaces_management_client_enums import * + + +class ContainerHostMapping(msrest.serialization.Model): + """Container host mapping object specifying the Container host resource ID and its associated Controller resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param container_host_resource_id: ARM ID of the Container Host resource. + :type container_host_resource_id: str + :ivar mapped_controller_resource_id: ARM ID of the mapped Controller resource. + :vartype mapped_controller_resource_id: str + """ + + _validation = { + 'mapped_controller_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'container_host_resource_id': {'key': 'containerHostResourceId', 'type': 'str'}, + 'mapped_controller_resource_id': {'key': 'mappedControllerResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + container_host_resource_id: Optional[str] = None, + **kwargs + ): + super(ContainerHostMapping, self).__init__(**kwargs) + self.container_host_resource_id = container_host_resource_id + self.mapped_controller_resource_id = None + + +class Resource(msrest.serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Tags for the Azure resource. + :type tags: dict[str, str] + :param location: Region where the Azure resource is located. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Controller(TrackedResource): + """Controller. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Tags for the Azure resource. + :type tags: dict[str, str] + :param location: Region where the Azure resource is located. + :type location: str + :param sku: Required. Model representing SKU for Azure Dev Spaces Controller. + :type sku: ~dev_spaces_management_client.models.Sku + :ivar provisioning_state: Provisioning state of the Azure Dev Spaces Controller. Possible + values include: "Succeeded", "Failed", "Canceled", "Updating", "Creating", "Deleting", + "Deleted". + :vartype provisioning_state: str or ~dev_spaces_management_client.models.ProvisioningState + :ivar host_suffix: DNS suffix for public endpoints running in the Azure Dev Spaces Controller. + :vartype host_suffix: str + :ivar data_plane_fqdn: DNS name for accessing DataPlane services. + :vartype data_plane_fqdn: str + :ivar target_container_host_api_server_fqdn: DNS of the target container host's API server. + :vartype target_container_host_api_server_fqdn: str + :param target_container_host_resource_id: Required. Resource ID of the target container host. + :type target_container_host_resource_id: str + :param target_container_host_credentials_base64: Required. Credentials of the target container + host (base64). + :type target_container_host_credentials_base64: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'host_suffix': {'readonly': True}, + 'data_plane_fqdn': {'readonly': True}, + 'target_container_host_api_server_fqdn': {'readonly': True}, + 'target_container_host_resource_id': {'required': True}, + 'target_container_host_credentials_base64': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'host_suffix': {'key': 'properties.hostSuffix', 'type': 'str'}, + 'data_plane_fqdn': {'key': 'properties.dataPlaneFqdn', 'type': 'str'}, + 'target_container_host_api_server_fqdn': {'key': 'properties.targetContainerHostApiServerFqdn', 'type': 'str'}, + 'target_container_host_resource_id': {'key': 'properties.targetContainerHostResourceId', 'type': 'str'}, + 'target_container_host_credentials_base64': {'key': 'properties.targetContainerHostCredentialsBase64', 'type': 'str'}, + } + + def __init__( + self, + *, + sku: "Sku", + target_container_host_resource_id: str, + target_container_host_credentials_base64: str, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): + super(Controller, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.provisioning_state = None + self.host_suffix = None + self.data_plane_fqdn = None + self.target_container_host_api_server_fqdn = None + self.target_container_host_resource_id = target_container_host_resource_id + self.target_container_host_credentials_base64 = target_container_host_credentials_base64 + + +class ControllerConnectionDetails(msrest.serialization.Model): + """ControllerConnectionDetails. + + :param orchestrator_specific_connection_details: Base class for types that supply values used + to connect to container orchestrators. + :type orchestrator_specific_connection_details: + ~dev_spaces_management_client.models.OrchestratorSpecificConnectionDetails + """ + + _attribute_map = { + 'orchestrator_specific_connection_details': {'key': 'orchestratorSpecificConnectionDetails', 'type': 'OrchestratorSpecificConnectionDetails'}, + } + + def __init__( + self, + *, + orchestrator_specific_connection_details: Optional["OrchestratorSpecificConnectionDetails"] = None, + **kwargs + ): + super(ControllerConnectionDetails, self).__init__(**kwargs) + self.orchestrator_specific_connection_details = orchestrator_specific_connection_details + + +class ControllerConnectionDetailsList(msrest.serialization.Model): + """ControllerConnectionDetailsList. + + :param connection_details_list: List of Azure Dev Spaces Controller connection details. + :type connection_details_list: + list[~dev_spaces_management_client.models.ControllerConnectionDetails] + """ + + _attribute_map = { + 'connection_details_list': {'key': 'connectionDetailsList', 'type': '[ControllerConnectionDetails]'}, + } + + def __init__( + self, + *, + connection_details_list: Optional[List["ControllerConnectionDetails"]] = None, + **kwargs + ): + super(ControllerConnectionDetailsList, self).__init__(**kwargs) + self.connection_details_list = connection_details_list + + +class ControllerList(msrest.serialization.Model): + """ControllerList. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Azure Dev Spaces Controllers. + :type value: list[~dev_spaces_management_client.models.Controller] + :ivar next_link: The URI that can be used to request the next page for list of Azure Dev Spaces + Controllers. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Controller]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Controller"]] = None, + **kwargs + ): + super(ControllerList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ControllerUpdateParameters(msrest.serialization.Model): + """Parameters for updating an Azure Dev Spaces Controller. + + :param tags: A set of tags. Tags for the Azure Dev Spaces Controller. + :type tags: dict[str, str] + :param target_container_host_credentials_base64: Credentials of the target container host + (base64). + :type target_container_host_credentials_base64: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'target_container_host_credentials_base64': {'key': 'properties.targetContainerHostCredentialsBase64', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + target_container_host_credentials_base64: Optional[str] = None, + **kwargs + ): + super(ControllerUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.target_container_host_credentials_base64 = target_container_host_credentials_base64 + + +class DevSpacesErrorResponse(msrest.serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~dev_spaces_management_client.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetails"] = None, + **kwargs + ): + super(DevSpacesErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorDetails(msrest.serialization.Model): + """ErrorDetails. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Status code for the error. + :vartype code: str + :ivar message: Error message describing the error in detail. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class OrchestratorSpecificConnectionDetails(msrest.serialization.Model): + """Base class for types that supply values used to connect to container orchestrators. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: KubernetesConnectionDetails. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Required. Gets the Instance type.Constant filled by server. + :vartype instance_type: str + """ + + _validation = { + 'instance_type': {'required': True, 'readonly': True}, + } + + _attribute_map = { + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + } + + _subtype_map = { + 'instance_type': {'Kubernetes': 'KubernetesConnectionDetails'} + } + + def __init__( + self, + **kwargs + ): + super(OrchestratorSpecificConnectionDetails, self).__init__(**kwargs) + self.instance_type = None # type: Optional[str] + + +class KubernetesConnectionDetails(OrchestratorSpecificConnectionDetails): + """Contains information used to connect to a Kubernetes cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar instance_type: Required. Gets the Instance type.Constant filled by server. + :vartype instance_type: str + :param kube_config: Gets the kubeconfig for the cluster. + :type kube_config: str + """ + + _validation = { + 'instance_type': {'required': True, 'readonly': True}, + } + + _attribute_map = { + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'kube_config': {'key': 'kubeConfig', 'type': 'str'}, + } + + def __init__( + self, + *, + kube_config: Optional[str] = None, + **kwargs + ): + super(KubernetesConnectionDetails, self).__init__(**kwargs) + self.instance_type = 'Kubernetes' # type: str + self.kube_config = kube_config + + +class ListConnectionDetailsParameters(msrest.serialization.Model): + """Parameters for listing connection details of an Azure Dev Spaces Controller. + + All required parameters must be populated in order to send to Azure. + + :param target_container_host_resource_id: Required. Resource ID of the target container host + mapped to the Azure Dev Spaces Controller. + :type target_container_host_resource_id: str + """ + + _validation = { + 'target_container_host_resource_id': {'required': True}, + } + + _attribute_map = { + 'target_container_host_resource_id': {'key': 'targetContainerHostResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + target_container_host_resource_id: str, + **kwargs + ): + super(ListConnectionDetailsParameters, self).__init__(**kwargs) + self.target_container_host_resource_id = target_container_host_resource_id + + +class ResourceProviderOperationDefinition(msrest.serialization.Model): + """ResourceProviderOperationDefinition. + + :param name: Resource provider operation name. + :type name: str + :param display: + :type display: ~dev_spaces_management_client.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + **kwargs + ): + super(ResourceProviderOperationDefinition, self).__init__(**kwargs) + self.name = name + self.display = display + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """ResourceProviderOperationDisplay. + + :param provider: Name of the resource provider. + :type provider: str + :param resource: Name of the resource type. + :type resource: str + :param operation: Name of the resource provider operation. + :type operation: str + :param description: Description of the resource provider operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(msrest.serialization.Model): + """ResourceProviderOperationList. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Resource provider operations list. + :type value: list[~dev_spaces_management_client.models.ResourceProviderOperationDefinition] + :ivar next_link: The URI that can be used to request the next page for list of Azure + operations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperationDefinition"]] = None, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Sku(msrest.serialization.Model): + """Model representing SKU for Azure Dev Spaces Controller. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU for Azure Dev Spaces Controller. Possible values + include: "S1". + :type name: str or ~dev_spaces_management_client.models.SkuName + :param tier: The tier of the SKU for Azure Dev Spaces Controller. Possible values include: + "Standard". + :type tier: str or ~dev_spaces_management_client.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + tier: Optional[Union[str, "SkuTier"]] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/__init__.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/__init__.py new file mode 100644 index 000000000000..8d97a1b50859 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_host_mappings_operations import ContainerHostMappingsOperations +from ._operations import Operations +from ._controllers_operations import ControllersOperations + +__all__ = [ + 'ContainerHostMappingsOperations', + 'Operations', + 'ControllersOperations', +] diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_container_host_mappings_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_container_host_mappings_operations.py new file mode 100644 index 000000000000..dd08aca59fa4 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_container_host_mappings_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ContainerHostMappingsOperations(object): + """ContainerHostMappingsOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_container_host_mapping( + self, + resource_group_name, # type: str + location, # type: str + container_host_mapping, # type: "_models.ContainerHostMapping" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ContainerHostMapping"] + """Returns container host mapping object for a container host resource ID if an associated controller exists. + + Returns container host mapping object for a container host resource ID if an associated + controller exists. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param location: Location of the container host. + :type location: str + :param container_host_mapping: + :type container_host_mapping: ~dev_spaces_management_client.models.ContainerHostMapping + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerHostMapping, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.ContainerHostMapping or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContainerHostMapping"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.get_container_host_mapping.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(container_host_mapping, 'ContainerHostMapping') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContainerHostMapping', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_container_host_mapping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_controllers_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_controllers_operations.py new file mode 100644 index 000000000000..d32f88fa2c66 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_controllers_operations.py @@ -0,0 +1,648 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ControllersOperations(object): + """ControllersOperations 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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Controller" + """Gets an Azure Dev Spaces Controller. + + Gets the properties for an Azure Dev Spaces Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Controller, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.Controller + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + name, # type: str + controller, # type: "_models.Controller" + **kwargs # type: Any + ): + # type: (...) -> "_models.Controller" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(controller, 'Controller') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Controller', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + name, # type: str + controller, # type: "_models.Controller" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Controller"] + """Creates an Azure Dev Spaces Controller. + + Creates an Azure Dev Spaces Controller with the specified create parameters. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param controller: Controller create parameters. + :type controller: ~dev_spaces_management_client.models.Controller + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Controller or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~dev_spaces_management_client.models.Controller] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + 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_initial( + resource_group_name=resource_group_name, + name=name, + controller=controller, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an Azure Dev Spaces Controller. + + Deletes an existing Azure Dev Spaces Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + name, # type: str + controller_update_parameters, # type: "_models.ControllerUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Controller" + """Updates an Azure Dev Spaces Controller. + + Updates the properties of an existing Azure Dev Spaces Controller with the specified update + parameters. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param controller_update_parameters: Parameters for updating the Azure Dev Spaces Controller. + :type controller_update_parameters: ~dev_spaces_management_client.models.ControllerUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Controller, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.Controller + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Controller"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(controller_update_parameters, 'ControllerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Controller', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Controller', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ControllerList"] + """Lists the Azure Dev Spaces Controllers in a resource group. + + Lists all the Azure Dev Spaces Controllers with their properties in the specified resource + group and subscription. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ControllerList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~dev_spaces_management_client.models.ControllerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ControllerList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ControllerList"] + """Lists the Azure Dev Spaces Controllers in a subscription. + + Lists all the Azure Dev Spaces Controllers with their properties in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ControllerList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~dev_spaces_management_client.models.ControllerList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ControllerList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers'} # type: ignore + + def list_connection_details( + self, + resource_group_name, # type: str + name, # type: str + list_connection_details_parameters, # type: "_models.ListConnectionDetailsParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ControllerConnectionDetailsList" + """Lists connection details for an Azure Dev Spaces Controller. + + Lists connection details for the underlying container resources of an Azure Dev Spaces + Controller. + + :param resource_group_name: Resource group to which the resource belongs. + :type resource_group_name: str + :param name: Name of the resource. + :type name: str + :param list_connection_details_parameters: Parameters for listing connection details of Azure + Dev Spaces Controller. + :type list_connection_details_parameters: ~dev_spaces_management_client.models.ListConnectionDetailsParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ControllerConnectionDetailsList, or the result of cls(response) + :rtype: ~dev_spaces_management_client.models.ControllerConnectionDetailsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ControllerConnectionDetailsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.list_connection_details.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'name': self._serialize.url("name", name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]([_-]*[a-zA-Z0-9])*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(list_connection_details_parameters, 'ListConnectionDetailsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DevSpacesErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ControllerConnectionDetailsList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_connection_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}/listConnectionDetails'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_operations.py b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_operations.py new file mode 100644 index 000000000000..3f3439c24c3d --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/operations/_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~dev_spaces_management_client.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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + """Lists operations for the resource provider. + + Lists all the supported operations by the Microsoft.DevSpaces resource provider along with + their description. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~dev_spaces_management_client.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.DevSpaces/operations'} # type: ignore diff --git a/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/py.typed b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/aks/azure-mgmt-devspaces/sdk_packaging.toml b/sdk/aks/azure-mgmt-devspaces/sdk_packaging.toml new file mode 100644 index 000000000000..e694299fc128 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-devspaces" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Devspaces Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/aks/azure-mgmt-devspaces/setup.cfg b/sdk/aks/azure-mgmt-devspaces/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/aks/azure-mgmt-devspaces/setup.py b/sdk/aks/azure-mgmt-devspaces/setup.py new file mode 100644 index 000000000000..ca3f8cb74599 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-devspaces" +PACKAGE_PPRINT_NAME = "Devspaces Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/aks/ci.yml b/sdk/aks/ci.yml index adaa1e7a7606..7fc4626d85ed 100644 --- a/sdk/aks/ci.yml +++ b/sdk/aks/ci.yml @@ -30,4 +30,6 @@ extends: parameters: ServiceDirectory: aks Artifacts: + - name: azure-mgmt-devspaces + safeName: azuremgmtdevspaces diff --git a/shared_requirements.txt b/shared_requirements.txt index e10969ae4b5e..17f8d4256744 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -289,6 +289,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-agfood msrest>=0.6.21 #override azure-mgmt-sqlvirtualmachine msrest>=0.6.21 #override azure-mgmt-msi msrest>=0.6.21 +#override azure-mgmt-devspaces msrest>=0.6.21 #override azure-mgmt-netapp msrest>=0.6.21 #override azure-mgmt-datadog msrest>=0.6.21 #override azure-mgmt-confluent msrest>=0.6.21