diff --git a/sdk/quantum/azure-mgmt-quantum/CHANGELOG.md b/sdk/quantum/azure-mgmt-quantum/CHANGELOG.md new file mode 100644 index 000000000000..ae9b105d26c3 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-01-28) + +* Initial Release diff --git a/sdk/quantum/azure-mgmt-quantum/MANIFEST.in b/sdk/quantum/azure-mgmt-quantum/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/quantum/azure-mgmt-quantum/README.md b/sdk/quantum/azure-mgmt-quantum/README.md new file mode 100644 index 000000000000..f1228bb1aa05 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Quantum 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 [Quantum 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-quantum%2FREADME.png) diff --git a/sdk/quantum/azure-mgmt-quantum/azure/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/__init__.py new file mode 100644 index 000000000000..ecf2e7c67cdf --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/__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 ._azure_quantum_management_client import AzureQuantumManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AzureQuantumManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py new file mode 100644 index 000000000000..b21ae2bc5432 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py @@ -0,0 +1,79 @@ +# 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 ._configuration import AzureQuantumManagementClientConfiguration +from .operations import WorkspacesOperations +from .operations import OfferingsOperations +from .operations import Operations +from . import models + + +class AzureQuantumManagementClient(object): + """AzureQuantumManagementClient. + + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.quantum.operations.WorkspacesOperations + :ivar offerings: OfferingsOperations operations + :vartype offerings: azure.mgmt.quantum.operations.OfferingsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.quantum.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The 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 = AzureQuantumManagementClientConfiguration(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._deserialize = Deserializer(client_models) + + self.workspaces = WorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.offerings = OfferingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureQuantumManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py new file mode 100644 index 000000000000..e8b4b8dec359 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_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 AzureQuantumManagementClientConfiguration(Configuration): + """Configuration for AzureQuantumManagementClient. + + 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: The 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(AzureQuantumManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-11-04-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-quantum/{}'.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/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_metadata.json b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_metadata.json new file mode 100644 index 000000000000..504f92265452 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_metadata.json @@ -0,0 +1,63 @@ +{ + "chosen_version": "2019-11-04-preview", + "total_api_version_list": ["2019-11-04-preview"], + "client": { + "name": "AzureQuantumManagementClient", + "filename": "_azure_quantum_management_client", + "description": "AzureQuantumManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "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": "The Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"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, # type: str", + "description": "The Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "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 + }, + "operation_groups": { + "workspaces": "WorkspacesOperations", + "offerings": "OfferingsOperations", + "operations": "Operations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_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/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/__init__.py new file mode 100644 index 000000000000..7927c1da8d35 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/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 ._azure_quantum_management_client import AzureQuantumManagementClient +__all__ = ['AzureQuantumManagementClient'] diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py new file mode 100644 index 000000000000..9bf183a96b59 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +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 AzureQuantumManagementClientConfiguration +from .operations import WorkspacesOperations +from .operations import OfferingsOperations +from .operations import Operations +from .. import models + + +class AzureQuantumManagementClient(object): + """AzureQuantumManagementClient. + + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.quantum.aio.operations.WorkspacesOperations + :ivar offerings: OfferingsOperations operations + :vartype offerings: azure.mgmt.quantum.aio.operations.OfferingsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.quantum.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The 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 = AzureQuantumManagementClientConfiguration(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._deserialize = Deserializer(client_models) + + self.workspaces = WorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.offerings = OfferingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureQuantumManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py new file mode 100644 index 000000000000..35fc3b1c23c1 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/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 AzureQuantumManagementClientConfiguration(Configuration): + """Configuration for AzureQuantumManagementClient. + + 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: The 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(AzureQuantumManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-11-04-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-quantum/{}'.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/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/__init__.py new file mode 100644 index 000000000000..be714f399997 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/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 ._workspaces_operations import WorkspacesOperations +from ._offerings_operations import OfferingsOperations +from ._operations import Operations + +__all__ = [ + 'WorkspacesOperations', + 'OfferingsOperations', + 'Operations', +] diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_offerings_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_offerings_operations.py new file mode 100644 index 000000000000..5c35e84f52fb --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_offerings_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, 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 OfferingsOperations: + """OfferingsOperations 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: ~azure.mgmt.quantum.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, + location_name: str, + **kwargs + ) -> AsyncIterable["_models.OfferingsListResult"]: + """Returns the list of all provider offerings available for the given location. + + :param location_name: Location. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OfferingsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.quantum.models.OfferingsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OfferingsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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'), + 'locationName': self._serialize.url("location_name", location_name, '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('OfferingsListResult', 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(_models.ErrorResponse, 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.Quantum/locations/{locationName}/offerings'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_operations.py new file mode 100644 index 000000000000..186b25d86f33 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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: ~azure.mgmt.quantum.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 + ) -> AsyncIterable["_models.OperationsList"]: + """Returns list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.quantum.models.OperationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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('OperationsList', 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(_models.ErrorResponse, 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': '/providers/Microsoft.Quantum/operations'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py new file mode 100644 index 000000000000..5518dc84bb9e --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py @@ -0,0 +1,546 @@ +# 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 WorkspacesOperations: + """WorkspacesOperations 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: ~azure.mgmt.quantum.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, + workspace_name: str, + **kwargs + ) -> "_models.QuantumWorkspace": + """Returns the Workspace resource associated with the given name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuantumWorkspace, or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.QuantumWorkspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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['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(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + quantum_workspace: "_models.QuantumWorkspace", + **kwargs + ) -> "_models.QuantumWorkspace": + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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(quantum_workspace, 'QuantumWorkspace') + 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(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + quantum_workspace: "_models.QuantumWorkspace", + **kwargs + ) -> AsyncLROPoller["_models.QuantumWorkspace"]: + """Creates or updates a workspace resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :param quantum_workspace: Workspace details. + :type quantum_workspace: ~azure.mgmt.quantum.models.QuantumWorkspace + :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: True for ARMPolling, False for no polling, or a + polling object for 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 QuantumWorkspace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.quantum.models.QuantumWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + quantum_workspace=quantum_workspace, + 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('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + async def update_tags( + self, + resource_group_name: str, + workspace_name: str, + workspace_tags: "_models.TagsObject", + **kwargs + ) -> "_models.QuantumWorkspace": + """Updates an existing workspace's tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :param workspace_tags: Parameters supplied to update tags. + :type workspace_tags: ~azure.mgmt.quantum.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuantumWorkspace, or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.QuantumWorkspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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(workspace_tags, 'TagsObject') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> 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-11-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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['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(_models.ErrorResponse, 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.Quantum/workspaces/{workspaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Workspace resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_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: True for ARMPolling, False for no polling, or a + polling object for 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, + workspace_name=workspace_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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + + 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.Quantum/workspaces/{workspaceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.WorkspaceListResult"]: + """Gets the list of Workspaces within a Subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.quantum.models.WorkspaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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_subscription.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('WorkspaceListResult', 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(_models.ErrorResponse, 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_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.WorkspaceListResult"]: + """Gets the list of Workspaces within a resource group. + + :param resource_group_name: The name of the resource group. + :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 WorkspaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.quantum.models.WorkspaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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('WorkspaceListResult', 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(_models.ErrorResponse, 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.Quantum/workspaces'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py new file mode 100644 index 000000000000..04204a4f788c --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py @@ -0,0 +1,93 @@ +# 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 ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import OfferingsListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationsList + from ._models_py3 import PricingDetail + from ._models_py3 import PricingDimension + from ._models_py3 import Provider + from ._models_py3 import ProviderDescription + from ._models_py3 import ProviderProperties + from ._models_py3 import ProviderPropertiesAad + from ._models_py3 import ProviderPropertiesManagedApplication + from ._models_py3 import QuantumWorkspace + from ._models_py3 import QuantumWorkspaceIdentity + from ._models_py3 import QuotaDimension + from ._models_py3 import Resource + from ._models_py3 import SkuDescription + from ._models_py3 import TagsObject + from ._models_py3 import TargetDescription + from ._models_py3 import TrackedResource + from ._models_py3 import WorkspaceListResult +except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import OfferingsListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationsList # type: ignore + from ._models import PricingDetail # type: ignore + from ._models import PricingDimension # type: ignore + from ._models import Provider # type: ignore + from ._models import ProviderDescription # type: ignore + from ._models import ProviderProperties # type: ignore + from ._models import ProviderPropertiesAad # type: ignore + from ._models import ProviderPropertiesManagedApplication # type: ignore + from ._models import QuantumWorkspace # type: ignore + from ._models import QuantumWorkspaceIdentity # type: ignore + from ._models import QuotaDimension # type: ignore + from ._models import Resource # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import TagsObject # type: ignore + from ._models import TargetDescription # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import WorkspaceListResult # type: ignore + +from ._azure_quantum_management_client_enums import ( + ProvisioningStatus, + ResourceIdentityType, + Status, + UsableStatus, +) + +__all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'OfferingsListResult', + 'Operation', + 'OperationDisplay', + 'OperationsList', + 'PricingDetail', + 'PricingDimension', + 'Provider', + 'ProviderDescription', + 'ProviderProperties', + 'ProviderPropertiesAad', + 'ProviderPropertiesManagedApplication', + 'QuantumWorkspace', + 'QuantumWorkspaceIdentity', + 'QuotaDimension', + 'Resource', + 'SkuDescription', + 'TagsObject', + 'TargetDescription', + 'TrackedResource', + 'WorkspaceListResult', + 'ProvisioningStatus', + 'ResourceIdentityType', + 'Status', + 'UsableStatus', +] diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py new file mode 100644 index 000000000000..9b40201cad9e --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py @@ -0,0 +1,64 @@ +# 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 ProvisioningStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning status field + """ + + SUCCEEDED = "Succeeded" + PROVIDER_LAUNCHING = "ProviderLaunching" + PROVIDER_UPDATING = "ProviderUpdating" + PROVIDER_DELETING = "ProviderDeleting" + PROVIDER_PROVISIONING = "ProviderProvisioning" + FAILED = "Failed" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + NONE = "None" + +class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning status field + """ + + SUCCEEDED = "Succeeded" + LAUNCHING = "Launching" + UPDATING = "Updating" + DELETING = "Deleting" + DELETED = "Deleted" + FAILED = "Failed" + +class UsableStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether the current workspace is ready to accept Jobs. + """ + + YES = "Yes" + NO = "No" + PARTIAL = "Partial" diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models.py new file mode 100644 index 000000000000..71c3bc82a792 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models.py @@ -0,0 +1,811 @@ +# 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 ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.quantum.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.quantum.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.quantum.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class OfferingsListResult(msrest.serialization.Model): + """The response of a list Providers operation. + + :param value: Result of a list Providers operation. + :type value: list[~azure.mgmt.quantum.models.ProviderDescription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Providers. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProviderDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OfferingsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Operation(msrest.serialization.Model): + """Operation provided by provider. + + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Properties of the operation. + :type display: ~azure.mgmt.quantum.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """Properties of the operation. + + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + :param operation: Operation name. + :type operation: str + :param description: Description of the 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(OperationDisplay, 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 OperationsList(msrest.serialization.Model): + """Lists the operations available. + + All required parameters must be populated in order to send to Azure. + + :param next_link: Url to follow for getting next page of operations. + :type next_link: str + :param value: Required. Array of operations. + :type value: list[~azure.mgmt.quantum.models.Operation] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationsList, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs['value'] + + +class PricingDetail(msrest.serialization.Model): + """Detailed pricing information for an sku. + + :param id: Unique id for this pricing information. + :type id: str + :param value: The unit cost of this sku. + :type value: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PricingDetail, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.value = kwargs.get('value', None) + + +class PricingDimension(msrest.serialization.Model): + """Information about pricing dimension. + + :param id: Unique id of this pricing dimension. + :type id: str + :param name: The display name of this pricing dimension. + :type name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PricingDimension, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + + +class Provider(msrest.serialization.Model): + """Information about a Provider. A Provider is an entity that offers Targets to run Azure Quantum Jobs. + + :param provider_id: Unique id of this provider. + :type provider_id: str + :param provider_sku: The sku associated with pricing information for this provider. + :type provider_sku: str + :param instance_uri: A Uri identifying the specific instance of this provider. + :type instance_uri: str + :param application_name: The provider's marketplace application display name. + :type application_name: str + :param provisioning_state: Provisioning status field. Possible values include: "Succeeded", + "Launching", "Updating", "Deleting", "Deleted", "Failed". + :type provisioning_state: str or ~azure.mgmt.quantum.models.Status + :param resource_usage_id: Id to track resource usage for the provider. + :type resource_usage_id: str + """ + + _attribute_map = { + 'provider_id': {'key': 'providerId', 'type': 'str'}, + 'provider_sku': {'key': 'providerSku', 'type': 'str'}, + 'instance_uri': {'key': 'instanceUri', 'type': 'str'}, + 'application_name': {'key': 'applicationName', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_usage_id': {'key': 'resourceUsageId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.provider_id = kwargs.get('provider_id', None) + self.provider_sku = kwargs.get('provider_sku', None) + self.instance_uri = kwargs.get('instance_uri', None) + self.application_name = kwargs.get('application_name', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.resource_usage_id = kwargs.get('resource_usage_id', None) + + +class ProviderDescription(msrest.serialization.Model): + """Information about an offering. A provider offering is an entity that offers Targets to run Azure Quantum Jobs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Unique provider's id. + :type id: str + :ivar name: Provider's display name. + :vartype name: str + :param properties: A list of provider-specific properties. + :type properties: ~azure.mgmt.quantum.models.ProviderProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ProviderProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderDescription, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = None + self.properties = kwargs.get('properties', None) + + +class ProviderProperties(msrest.serialization.Model): + """Provider properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: A description about this provider. + :vartype description: str + :ivar provider_type: Provider type. + :vartype provider_type: str + :ivar company: Company name. + :vartype company: str + :ivar default_endpoint: Provider's default endpoint. + :vartype default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~azure.mgmt.quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info. + :type managed_application: ~azure.mgmt.quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider. + :type targets: list[~azure.mgmt.quantum.models.TargetDescription] + :param skus: The list of skus available from this provider. + :type skus: list[~azure.mgmt.quantum.models.SkuDescription] + :param quota_dimensions: The list of quota dimensions from the provider. + :type quota_dimensions: list[~azure.mgmt.quantum.models.QuotaDimension] + :param pricing_dimensions: The list of pricing dimensions from the provider. + :type pricing_dimensions: list[~azure.mgmt.quantum.models.PricingDimension] + """ + + _validation = { + 'description': {'readonly': True}, + 'provider_type': {'readonly': True}, + 'company': {'readonly': True}, + 'default_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'company': {'key': 'company', 'type': 'str'}, + 'default_endpoint': {'key': 'defaultEndpoint', 'type': 'str'}, + 'aad': {'key': 'aad', 'type': 'ProviderPropertiesAad'}, + 'managed_application': {'key': 'managedApplication', 'type': 'ProviderPropertiesManagedApplication'}, + 'targets': {'key': 'targets', 'type': '[TargetDescription]'}, + 'skus': {'key': 'skus', 'type': '[SkuDescription]'}, + 'quota_dimensions': {'key': 'quotaDimensions', 'type': '[QuotaDimension]'}, + 'pricing_dimensions': {'key': 'pricingDimensions', 'type': '[PricingDimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderProperties, self).__init__(**kwargs) + self.description = None + self.provider_type = None + self.company = None + self.default_endpoint = None + self.aad = kwargs.get('aad', None) + self.managed_application = kwargs.get('managed_application', None) + self.targets = kwargs.get('targets', None) + self.skus = kwargs.get('skus', None) + self.quota_dimensions = kwargs.get('quota_dimensions', None) + self.pricing_dimensions = kwargs.get('pricing_dimensions', None) + + +class ProviderPropertiesAad(msrest.serialization.Model): + """Azure Active Directory info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar application_id: Provider's application id. + :vartype application_id: str + :ivar tenant_id: Provider's tenant id. + :vartype tenant_id: str + """ + + _validation = { + 'application_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderPropertiesAad, self).__init__(**kwargs) + self.application_id = None + self.tenant_id = None + + +class ProviderPropertiesManagedApplication(msrest.serialization.Model): + """Provider's Managed-Application info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar publisher_id: Provider's publisher id. + :vartype publisher_id: str + :ivar offer_id: Provider's offer id. + :vartype offer_id: str + """ + + _validation = { + 'publisher_id': {'readonly': True}, + 'offer_id': {'readonly': True}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'offer_id': {'key': 'offerId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderPropertiesManagedApplication, self).__init__(**kwargs) + self.publisher_id = None + self.offer_id = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class QuantumWorkspace(TrackedResource): + """The resource proxy definition object for quantum workspace. + + 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param identity: Managed Identity information. + :type identity: ~azure.mgmt.quantum.models.QuantumWorkspaceIdentity + :param providers: List of Providers selected for this Workspace. + :type providers: list[~azure.mgmt.quantum.models.Provider] + :ivar usable: Whether the current workspace is ready to accept Jobs. Possible values include: + "Yes", "No", "Partial". + :vartype usable: str or ~azure.mgmt.quantum.models.UsableStatus + :ivar provisioning_state: Provisioning status field. Possible values include: "Succeeded", + "ProviderLaunching", "ProviderUpdating", "ProviderDeleting", "ProviderProvisioning", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.quantum.models.ProvisioningStatus + :param storage_account: ARM Resource Id of the storage account associated with this workspace. + :type storage_account: str + :ivar endpoint_uri: The URI of the workspace endpoint. + :vartype endpoint_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'usable': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'endpoint_uri': {'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'}, + 'identity': {'key': 'identity', 'type': 'QuantumWorkspaceIdentity'}, + 'providers': {'key': 'properties.providers', 'type': '[Provider]'}, + 'usable': {'key': 'properties.usable', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'endpoint_uri': {'key': 'properties.endpointUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuantumWorkspace, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.providers = kwargs.get('providers', None) + self.usable = None + self.provisioning_state = None + self.storage_account = kwargs.get('storage_account', None) + self.endpoint_uri = None + + +class QuantumWorkspaceIdentity(msrest.serialization.Model): + """Managed Identity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.quantum.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuantumWorkspaceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class QuotaDimension(msrest.serialization.Model): + """Information about a specific quota dimension. + + :param id: Unique id of this dimension. + :type id: str + :param scope: The scope of this quota dimension. + :type scope: str + :param period: The reset period of this quota dimension. + :type period: str + :param quota: The max limit of this dimension. + :type quota: float + :param name: The display name of this quota dimension. + :type name: str + :param description: A description about this quota dimension. + :type description: str + :param unit: The standard unit of measurement used for this quota dimension. + :type unit: str + :param unit_plural: The standard unit of measurement used for this quota dimension in plural + form. + :type unit_plural: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'period': {'key': 'period', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'float'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_plural': {'key': 'unitPlural', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaDimension, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.scope = kwargs.get('scope', None) + self.period = kwargs.get('period', None) + self.quota = kwargs.get('quota', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.unit = kwargs.get('unit', None) + self.unit_plural = kwargs.get('unit_plural', None) + + +class SkuDescription(msrest.serialization.Model): + """Information about a specific sku. + + :param id: Unique sku id. + :type id: str + :param name: Display name of this sku. + :type name: str + :param description: Description about this sku. + :type description: str + :param targets: The list of targets available for this sku. + :type targets: list[str] + :param quota_dimensions: The list of quota dimensions for this sku. + :type quota_dimensions: list[~azure.mgmt.quantum.models.QuotaDimension] + :param pricing_details: The list of pricing details for the sku. + :type pricing_details: list[~azure.mgmt.quantum.models.PricingDetail] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[str]'}, + 'quota_dimensions': {'key': 'quotaDimensions', 'type': '[QuotaDimension]'}, + 'pricing_details': {'key': 'pricingDetails', 'type': '[PricingDetail]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.targets = kwargs.get('targets', None) + self.quota_dimensions = kwargs.get('quota_dimensions', None) + self.pricing_details = kwargs.get('pricing_details', None) + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TargetDescription(msrest.serialization.Model): + """Information about a Target. A target is the component that can process a specific type of Job. + + :param id: Unique target id. + :type id: str + :param name: Display name of this target. + :type name: str + :param description: A description about this target. + :type description: str + :param accepted_data_formats: List of data formats accepted by this target. + :type accepted_data_formats: list[str] + :param accepted_content_encodings: List of content encodings accepted by this target. + :type accepted_content_encodings: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'accepted_data_formats': {'key': 'acceptedDataFormats', 'type': '[str]'}, + 'accepted_content_encodings': {'key': 'acceptedContentEncodings', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetDescription, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.accepted_data_formats = kwargs.get('accepted_data_formats', None) + self.accepted_content_encodings = kwargs.get('accepted_content_encodings', None) + + +class WorkspaceListResult(msrest.serialization.Model): + """The response of a list Workspaces operation. + + :param value: Result of a list Workspaces operation. + :type value: list[~azure.mgmt.quantum.models.QuantumWorkspace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Workspaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuantumWorkspace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkspaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py new file mode 100644 index 000000000000..2089259c3ddf --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py @@ -0,0 +1,893 @@ +# 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 ._azure_quantum_management_client_enums import * + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.quantum.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.quantum.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.quantum.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class OfferingsListResult(msrest.serialization.Model): + """The response of a list Providers operation. + + :param value: Result of a list Providers operation. + :type value: list[~azure.mgmt.quantum.models.ProviderDescription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Providers. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProviderDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProviderDescription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OfferingsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Operation(msrest.serialization.Model): + """Operation provided by provider. + + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Properties of the operation. + :type display: ~azure.mgmt.quantum.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """Properties of the operation. + + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + :param operation: Operation name. + :type operation: str + :param description: Description of the 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(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationsList(msrest.serialization.Model): + """Lists the operations available. + + All required parameters must be populated in order to send to Azure. + + :param next_link: Url to follow for getting next page of operations. + :type next_link: str + :param value: Required. Array of operations. + :type value: list[~azure.mgmt.quantum.models.Operation] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: List["Operation"], + next_link: Optional[str] = None, + **kwargs + ): + super(OperationsList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class PricingDetail(msrest.serialization.Model): + """Detailed pricing information for an sku. + + :param id: Unique id for this pricing information. + :type id: str + :param value: The unit cost of this sku. + :type value: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(PricingDetail, self).__init__(**kwargs) + self.id = id + self.value = value + + +class PricingDimension(msrest.serialization.Model): + """Information about pricing dimension. + + :param id: Unique id of this pricing dimension. + :type id: str + :param name: The display name of this pricing dimension. + :type name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + super(PricingDimension, self).__init__(**kwargs) + self.id = id + self.name = name + + +class Provider(msrest.serialization.Model): + """Information about a Provider. A Provider is an entity that offers Targets to run Azure Quantum Jobs. + + :param provider_id: Unique id of this provider. + :type provider_id: str + :param provider_sku: The sku associated with pricing information for this provider. + :type provider_sku: str + :param instance_uri: A Uri identifying the specific instance of this provider. + :type instance_uri: str + :param application_name: The provider's marketplace application display name. + :type application_name: str + :param provisioning_state: Provisioning status field. Possible values include: "Succeeded", + "Launching", "Updating", "Deleting", "Deleted", "Failed". + :type provisioning_state: str or ~azure.mgmt.quantum.models.Status + :param resource_usage_id: Id to track resource usage for the provider. + :type resource_usage_id: str + """ + + _attribute_map = { + 'provider_id': {'key': 'providerId', 'type': 'str'}, + 'provider_sku': {'key': 'providerSku', 'type': 'str'}, + 'instance_uri': {'key': 'instanceUri', 'type': 'str'}, + 'application_name': {'key': 'applicationName', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_usage_id': {'key': 'resourceUsageId', 'type': 'str'}, + } + + def __init__( + self, + *, + provider_id: Optional[str] = None, + provider_sku: Optional[str] = None, + instance_uri: Optional[str] = None, + application_name: Optional[str] = None, + provisioning_state: Optional[Union[str, "Status"]] = None, + resource_usage_id: Optional[str] = None, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.provider_id = provider_id + self.provider_sku = provider_sku + self.instance_uri = instance_uri + self.application_name = application_name + self.provisioning_state = provisioning_state + self.resource_usage_id = resource_usage_id + + +class ProviderDescription(msrest.serialization.Model): + """Information about an offering. A provider offering is an entity that offers Targets to run Azure Quantum Jobs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Unique provider's id. + :type id: str + :ivar name: Provider's display name. + :vartype name: str + :param properties: A list of provider-specific properties. + :type properties: ~azure.mgmt.quantum.models.ProviderProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ProviderProperties'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + properties: Optional["ProviderProperties"] = None, + **kwargs + ): + super(ProviderDescription, self).__init__(**kwargs) + self.id = id + self.name = None + self.properties = properties + + +class ProviderProperties(msrest.serialization.Model): + """Provider properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: A description about this provider. + :vartype description: str + :ivar provider_type: Provider type. + :vartype provider_type: str + :ivar company: Company name. + :vartype company: str + :ivar default_endpoint: Provider's default endpoint. + :vartype default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~azure.mgmt.quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info. + :type managed_application: ~azure.mgmt.quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider. + :type targets: list[~azure.mgmt.quantum.models.TargetDescription] + :param skus: The list of skus available from this provider. + :type skus: list[~azure.mgmt.quantum.models.SkuDescription] + :param quota_dimensions: The list of quota dimensions from the provider. + :type quota_dimensions: list[~azure.mgmt.quantum.models.QuotaDimension] + :param pricing_dimensions: The list of pricing dimensions from the provider. + :type pricing_dimensions: list[~azure.mgmt.quantum.models.PricingDimension] + """ + + _validation = { + 'description': {'readonly': True}, + 'provider_type': {'readonly': True}, + 'company': {'readonly': True}, + 'default_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'company': {'key': 'company', 'type': 'str'}, + 'default_endpoint': {'key': 'defaultEndpoint', 'type': 'str'}, + 'aad': {'key': 'aad', 'type': 'ProviderPropertiesAad'}, + 'managed_application': {'key': 'managedApplication', 'type': 'ProviderPropertiesManagedApplication'}, + 'targets': {'key': 'targets', 'type': '[TargetDescription]'}, + 'skus': {'key': 'skus', 'type': '[SkuDescription]'}, + 'quota_dimensions': {'key': 'quotaDimensions', 'type': '[QuotaDimension]'}, + 'pricing_dimensions': {'key': 'pricingDimensions', 'type': '[PricingDimension]'}, + } + + def __init__( + self, + *, + aad: Optional["ProviderPropertiesAad"] = None, + managed_application: Optional["ProviderPropertiesManagedApplication"] = None, + targets: Optional[List["TargetDescription"]] = None, + skus: Optional[List["SkuDescription"]] = None, + quota_dimensions: Optional[List["QuotaDimension"]] = None, + pricing_dimensions: Optional[List["PricingDimension"]] = None, + **kwargs + ): + super(ProviderProperties, self).__init__(**kwargs) + self.description = None + self.provider_type = None + self.company = None + self.default_endpoint = None + self.aad = aad + self.managed_application = managed_application + self.targets = targets + self.skus = skus + self.quota_dimensions = quota_dimensions + self.pricing_dimensions = pricing_dimensions + + +class ProviderPropertiesAad(msrest.serialization.Model): + """Azure Active Directory info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar application_id: Provider's application id. + :vartype application_id: str + :ivar tenant_id: Provider's tenant id. + :vartype tenant_id: str + """ + + _validation = { + 'application_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderPropertiesAad, self).__init__(**kwargs) + self.application_id = None + self.tenant_id = None + + +class ProviderPropertiesManagedApplication(msrest.serialization.Model): + """Provider's Managed-Application info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar publisher_id: Provider's publisher id. + :vartype publisher_id: str + :ivar offer_id: Provider's offer id. + :vartype offer_id: str + """ + + _validation = { + 'publisher_id': {'readonly': True}, + 'offer_id': {'readonly': True}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'offer_id': {'key': 'offerId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderPropertiesManagedApplication, self).__init__(**kwargs) + self.publisher_id = None + self.offer_id = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class QuantumWorkspace(TrackedResource): + """The resource proxy definition object for quantum workspace. + + 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param identity: Managed Identity information. + :type identity: ~azure.mgmt.quantum.models.QuantumWorkspaceIdentity + :param providers: List of Providers selected for this Workspace. + :type providers: list[~azure.mgmt.quantum.models.Provider] + :ivar usable: Whether the current workspace is ready to accept Jobs. Possible values include: + "Yes", "No", "Partial". + :vartype usable: str or ~azure.mgmt.quantum.models.UsableStatus + :ivar provisioning_state: Provisioning status field. Possible values include: "Succeeded", + "ProviderLaunching", "ProviderUpdating", "ProviderDeleting", "ProviderProvisioning", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.quantum.models.ProvisioningStatus + :param storage_account: ARM Resource Id of the storage account associated with this workspace. + :type storage_account: str + :ivar endpoint_uri: The URI of the workspace endpoint. + :vartype endpoint_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'usable': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'endpoint_uri': {'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'}, + 'identity': {'key': 'identity', 'type': 'QuantumWorkspaceIdentity'}, + 'providers': {'key': 'properties.providers', 'type': '[Provider]'}, + 'usable': {'key': 'properties.usable', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'endpoint_uri': {'key': 'properties.endpointUri', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["QuantumWorkspaceIdentity"] = None, + providers: Optional[List["Provider"]] = None, + storage_account: Optional[str] = None, + **kwargs + ): + super(QuantumWorkspace, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.providers = providers + self.usable = None + self.provisioning_state = None + self.storage_account = storage_account + self.endpoint_uri = None + + +class QuantumWorkspaceIdentity(msrest.serialization.Model): + """Managed Identity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.quantum.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + **kwargs + ): + super(QuantumWorkspaceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class QuotaDimension(msrest.serialization.Model): + """Information about a specific quota dimension. + + :param id: Unique id of this dimension. + :type id: str + :param scope: The scope of this quota dimension. + :type scope: str + :param period: The reset period of this quota dimension. + :type period: str + :param quota: The max limit of this dimension. + :type quota: float + :param name: The display name of this quota dimension. + :type name: str + :param description: A description about this quota dimension. + :type description: str + :param unit: The standard unit of measurement used for this quota dimension. + :type unit: str + :param unit_plural: The standard unit of measurement used for this quota dimension in plural + form. + :type unit_plural: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'period': {'key': 'period', 'type': 'str'}, + 'quota': {'key': 'quota', 'type': 'float'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_plural': {'key': 'unitPlural', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + scope: Optional[str] = None, + period: Optional[str] = None, + quota: Optional[float] = None, + name: Optional[str] = None, + description: Optional[str] = None, + unit: Optional[str] = None, + unit_plural: Optional[str] = None, + **kwargs + ): + super(QuotaDimension, self).__init__(**kwargs) + self.id = id + self.scope = scope + self.period = period + self.quota = quota + self.name = name + self.description = description + self.unit = unit + self.unit_plural = unit_plural + + +class SkuDescription(msrest.serialization.Model): + """Information about a specific sku. + + :param id: Unique sku id. + :type id: str + :param name: Display name of this sku. + :type name: str + :param description: Description about this sku. + :type description: str + :param targets: The list of targets available for this sku. + :type targets: list[str] + :param quota_dimensions: The list of quota dimensions for this sku. + :type quota_dimensions: list[~azure.mgmt.quantum.models.QuotaDimension] + :param pricing_details: The list of pricing details for the sku. + :type pricing_details: list[~azure.mgmt.quantum.models.PricingDetail] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[str]'}, + 'quota_dimensions': {'key': 'quotaDimensions', 'type': '[QuotaDimension]'}, + 'pricing_details': {'key': 'pricingDetails', 'type': '[PricingDetail]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + targets: Optional[List[str]] = None, + quota_dimensions: Optional[List["QuotaDimension"]] = None, + pricing_details: Optional[List["PricingDetail"]] = None, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.id = id + self.name = name + self.description = description + self.targets = targets + self.quota_dimensions = quota_dimensions + self.pricing_details = pricing_details + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = tags + + +class TargetDescription(msrest.serialization.Model): + """Information about a Target. A target is the component that can process a specific type of Job. + + :param id: Unique target id. + :type id: str + :param name: Display name of this target. + :type name: str + :param description: A description about this target. + :type description: str + :param accepted_data_formats: List of data formats accepted by this target. + :type accepted_data_formats: list[str] + :param accepted_content_encodings: List of content encodings accepted by this target. + :type accepted_content_encodings: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'accepted_data_formats': {'key': 'acceptedDataFormats', 'type': '[str]'}, + 'accepted_content_encodings': {'key': 'acceptedContentEncodings', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + accepted_data_formats: Optional[List[str]] = None, + accepted_content_encodings: Optional[List[str]] = None, + **kwargs + ): + super(TargetDescription, self).__init__(**kwargs) + self.id = id + self.name = name + self.description = description + self.accepted_data_formats = accepted_data_formats + self.accepted_content_encodings = accepted_content_encodings + + +class WorkspaceListResult(msrest.serialization.Model): + """The response of a list Workspaces operation. + + :param value: Result of a list Workspaces operation. + :type value: list[~azure.mgmt.quantum.models.QuantumWorkspace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Workspaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuantumWorkspace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["QuantumWorkspace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(WorkspaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/__init__.py new file mode 100644 index 000000000000..be714f399997 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/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 ._workspaces_operations import WorkspacesOperations +from ._offerings_operations import OfferingsOperations +from ._operations import Operations + +__all__ = [ + 'WorkspacesOperations', + 'OfferingsOperations', + 'Operations', +] diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py new file mode 100644 index 000000000000..9a0e323773c4 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_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.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 OfferingsOperations(object): + """OfferingsOperations 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: ~azure.mgmt.quantum.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, + location_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OfferingsListResult"] + """Returns the list of all provider offerings available for the given location. + + :param location_name: Location. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OfferingsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.quantum.models.OfferingsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OfferingsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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'), + 'locationName': self._serialize.url("location_name", location_name, '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('OfferingsListResult', 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(_models.ErrorResponse, 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.Quantum/locations/{locationName}/offerings'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py new file mode 100644 index 000000000000..c8bea18553b3 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py @@ -0,0 +1,110 @@ +# 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: ~azure.mgmt.quantum.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.OperationsList"] + """Returns list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.quantum.models.OperationsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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('OperationsList', 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(_models.ErrorResponse, 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': '/providers/Microsoft.Quantum/operations'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py new file mode 100644 index 000000000000..5e624f657ecf --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py @@ -0,0 +1,558 @@ +# 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 WorkspacesOperations(object): + """WorkspacesOperations 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: ~azure.mgmt.quantum.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 + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.QuantumWorkspace" + """Returns the Workspace resource associated with the given name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuantumWorkspace, or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.QuantumWorkspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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['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(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + quantum_workspace, # type: "_models.QuantumWorkspace" + **kwargs # type: Any + ): + # type: (...) -> "_models.QuantumWorkspace" + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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(quantum_workspace, 'QuantumWorkspace') + 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(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + quantum_workspace, # type: "_models.QuantumWorkspace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.QuantumWorkspace"] + """Creates or updates a workspace resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :param quantum_workspace: Workspace details. + :type quantum_workspace: ~azure.mgmt.quantum.models.QuantumWorkspace + :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: True for ARMPolling, False for no polling, or a + polling object for 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 QuantumWorkspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.quantum.models.QuantumWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + quantum_workspace=quantum_workspace, + 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('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + def update_tags( + self, + resource_group_name, # type: str + workspace_name, # type: str + workspace_tags, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.QuantumWorkspace" + """Updates an existing workspace's tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_name: str + :param workspace_tags: Parameters supplied to update tags. + :type workspace_tags: ~azure.mgmt.quantum.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuantumWorkspace, or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.QuantumWorkspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuantumWorkspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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(workspace_tags, 'TagsObject') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuantumWorkspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + workspace_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-11-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, '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['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(_models.ErrorResponse, 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.Quantum/workspaces/{workspaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Workspace resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. + :type workspace_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: True for ARMPolling, False for no polling, or a + polling object for 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, + workspace_name=workspace_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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + + 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.Quantum/workspaces/{workspaceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceListResult"] + """Gets the list of Workspaces within a Subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.quantum.models.WorkspaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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_subscription.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('WorkspaceListResult', 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(_models.ErrorResponse, 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_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceListResult"] + """Gets the list of Workspaces within a resource group. + + :param resource_group_name: The name of the resource group. + :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 WorkspaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.quantum.models.WorkspaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-04-preview" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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('WorkspaceListResult', 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(_models.ErrorResponse, 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.Quantum/workspaces'} # type: ignore diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/py.typed b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/quantum/azure-mgmt-quantum/sdk_packaging.toml b/sdk/quantum/azure-mgmt-quantum/sdk_packaging.toml new file mode 100644 index 000000000000..34268fa04dfd --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/sdk_packaging.toml @@ -0,0 +1,6 @@ +[packaging] +package_name = "azure-mgmt-quantum" +package_pprint_name = "Quantum Management" +package_doc_id = "" +is_stable = false +is_arm = true diff --git a/sdk/quantum/azure-mgmt-quantum/setup.cfg b/sdk/quantum/azure-mgmt-quantum/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/quantum/azure-mgmt-quantum/setup.py b/sdk/quantum/azure-mgmt-quantum/setup.py new file mode 100644 index 000000000000..74a055488d25 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/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-quantum" +PACKAGE_PPRINT_NAME = "Quantum 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.5.0', + '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/quantum/ci.yml b/sdk/quantum/ci.yml new file mode 100644 index 000000000000..b5af5f81f21f --- /dev/null +++ b/sdk/quantum/ci.yml @@ -0,0 +1,32 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/quantum/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/quantum/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: quantum + Artifacts: + - name: azure_mgmt_quantum + safeName: azuremgmtquantum \ No newline at end of file