diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6949a9723c3..7df73bd5492 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -99,3 +99,5 @@ /src/hpc-cache/ @qianwens /src/account/ @zikalino + +/src/azext_quantum/ @anpaz-msft diff --git a/src/quantum/HISTORY.rst b/src/quantum/HISTORY.rst new file mode 100644 index 00000000000..711c940ac30 --- /dev/null +++ b/src/quantum/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.11.2906.2 +++++++ +* Initial release. Version intended to work with Azure Quantum Private Preview + and with QDK version 0.11.2906.* \ No newline at end of file diff --git a/src/quantum/README.rst b/src/quantum/README.rst new file mode 100644 index 00000000000..0dfa9304465 --- /dev/null +++ b/src/quantum/README.rst @@ -0,0 +1,14 @@ +Microsoft Azure CLI 'quantum' Extension +========================================== + +Azure Quantum is the first open Quantum computing platform. It offers a range of services +from quantum hardware to full-state simulators and quantum inspired optimizations, +providing developers and customers access to the most competitive quantum offering +on the market. + +To learn more about azure quantum visit: +https://azure.microsoft.com/en-us/services/quantum/ + +To learn more about quantum computing and Microsoft's Quantum Development Kit visit: +https://docs.microsoft.com/quantum/ + diff --git a/src/quantum/azext_quantum/__init__.py b/src/quantum/azext_quantum/__init__.py new file mode 100644 index 00000000000..abc38ff7cac --- /dev/null +++ b/src/quantum/azext_quantum/__init__.py @@ -0,0 +1,26 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=import-outside-toplevel +from azure.cli.core import AzCommandsLoader + +import azext_quantum._help # pylint: disable=unused-import + +class QuantumCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + super(QuantumCommandsLoader, self).__init__(cli_ctx=cli_ctx) + + def load_command_table(self, args): + from azext_quantum.commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_quantum._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = QuantumCommandsLoader diff --git a/src/quantum/azext_quantum/_client_factory.py b/src/quantum/azext_quantum/_client_factory.py new file mode 100644 index 00000000000..261ac02015d --- /dev/null +++ b/src/quantum/azext_quantum/_client_factory.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=import-outside-toplevel,line-too-long + +import os + +def is_env(name): + return 'AZURE_QUANTUM_ENV' in os.environ and os.environ['AZURE_QUANTUM_ENV'] == name + +def base_url(): + if 'AZURE_QUANTUM_BASEURL' in os.environ: + return os.environ['AZURE_QUANTUM_BASEURL'] + if is_env('canary'): + return "https://app-jobs-canarysouthcentralus.azurewebsites.net/" + return "https://app-jobscheduler-prod.azurewebsites.net/" + +def _get_data_credentials(cli_ctx, subscription_id=None): + from azure.cli.core._profile import Profile + profile = Profile(cli_ctx=cli_ctx) + creds, _, _ = profile.get_login_credentials(subscription_id=subscription_id, resource="https://quantum.microsoft.com") + return creds + +def cf_quantum(cli_ctx, subscription_id=None, resource_group_name=None, workspace_name=None): + from .vendored_sdks.azure_quantum import QuantumClient + creds = _get_data_credentials(cli_ctx, subscription_id) + return QuantumClient(creds, subscription_id, resource_group_name, workspace_name, base_url=base_url()) + +def cf_quantum_mgmt(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from .vendored_sdks.azure_mgmt_quantum import QuantumManagementClient + return get_mgmt_service_client(cli_ctx, QuantumManagementClient) + +def cf_workspaces(cli_ctx, *_): + return cf_quantum_mgmt(cli_ctx).workspaces + +def cf_providers(cli_ctx, subscription_id=None, resource_group_name=None, workspace_name=None): + return cf_quantum(cli_ctx, subscription_id, resource_group_name, workspace_name).providers + +def cf_jobs(cli_ctx, subscription_id=None, resource_group_name=None, workspace_name=None): + return cf_quantum(cli_ctx, subscription_id, resource_group_name, workspace_name).jobs diff --git a/src/quantum/azext_quantum/_help.py b/src/quantum/azext_quantum/_help.py new file mode 100644 index 00000000000..acfa1e9f540 --- /dev/null +++ b/src/quantum/azext_quantum/_help.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------------------------- + +from knack.help_files import helps # pylint: disable=unused-import + +helps['quantum'] = """ + type: group + short-summary: Manage Azure Quantum Workspaces and submit jobs to Azure Quantum Providers. +""" + +helps['quantum job'] = """ +type: group +short-summary: Manage jobs for Azure Quantum. +""" + +helps['quantum target'] = """ +type: group +short-summary: Manage execution targets for Azure Quantum workspaces. +""" + +helps['quantum workspace'] = """ +type: group +short-summary: Manage Azure Quantum workspaces. +""" diff --git a/src/quantum/azext_quantum/_params.py b/src/quantum/azext_quantum/_params.py new file mode 100644 index 00000000000..d6362a6f05a --- /dev/null +++ b/src/quantum/azext_quantum/_params.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long + +from knack.arguments import CLIArgumentType + +def load_arguments(self, _): + workspace_name_type = CLIArgumentType(options_list=['--workspace-name', '-w'], help='Name of the Quantum Workspace. You can configure the default workspace using `az quantum workspace set`.', id_part=None, required=False) + program_args = CLIArgumentType(nargs='*', help='List of arguments expected by the Q# operation specified as --name=value after `--`.') + target_id = CLIArgumentType(options_list=['--target-id', '-t'], help='Target id.') + project = CLIArgumentType(help='The location of the Q# project to submit. Defaults to current folder.') + job_name = CLIArgumentType(help='A friendly name to give to this execution of the program.') + shots = CLIArgumentType(help='The number of times to execute the Q# program on the given target.') + no_build = CLIArgumentType(help='If specified, the Q# program is not built before submitting.') + + with self.argument_context('quantum workspace') as c: + c.argument('workspace_name', workspace_name_type) + + with self.argument_context('quantum target') as c: + c.argument('workspace_name', workspace_name_type) + c.argument('target_id', options_list=['--target-id', '-t'], help='Target id.') + + with self.argument_context('quantum job') as c: + c.argument('workspace_name', workspace_name_type) + c.argument('job_id', options_list=['--job-id', '-id'], help='Job id.') + c.argument('target_id', target_id) + c.argument('project', project) + c.argument('job_name', job_name) + c.argument('shots', shots) + c.argument('no_build', no_build) + + with self.argument_context('quantum job submit') as c: + c.positional('program_args', program_args) + + with self.argument_context('quantum execute') as c: + c.argument('workspace_name', workspace_name_type) + c.argument('target_id', target_id) + c.argument('project', project) + c.argument('job_name', job_name) + c.argument('shots', shots) + c.argument('no_build', no_build) + c.positional('program_args', program_args) diff --git a/src/quantum/azext_quantum/_validators.py b/src/quantum/azext_quantum/_validators.py new file mode 100644 index 00000000000..9a3be025928 --- /dev/null +++ b/src/quantum/azext_quantum/_validators.py @@ -0,0 +1,51 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long + +import os + +from .operations.workspace import WorkspaceInfo +from .operations.target import TargetInfo + +def validate_workspace_info(cmd, namespace): + """ + Makes sure all parameters for a workspace are available. + """ + group = getattr(namespace, 'resource_group_name', None) + name = getattr(namespace, 'workspace_name', None) + ws = WorkspaceInfo(cmd, group, name) + + if not ws.subscription: + raise ValueError("Missing subscription argument") + if not ws.resource_group: + raise ValueError("Missing resource-group argument") + if not ws.name: + raise ValueError("Missing workspace-name argument") + + +def validate_target_info(cmd, namespace): + """ + Makes sure all parameters for a target are available. + """ + target_id = getattr(namespace, 'target_id', None) + target = TargetInfo(cmd, target_id) + + if not target.target_id: + raise ValueError("Missing target-id argument") + + +def validate_workspace_and_target_info(cmd, namespace): + """ + Makes sure all parameters for both, a workspace and a target are available. + """ + validate_workspace_info(cmd, namespace) + validate_target_info(cmd, namespace) + + # For the time being (Private Preview), we also need the AZURE_QUANTUM_STORAGE env variable populated + # with the Azure Storage connection string to use to upload the program. + if not 'AZURE_QUANTUM_STORAGE' in os.environ: + raise ValueError(f"Please set the AZURE_QUANTUM_STORAGE environment variable with an Azure Storage's connection string.") + diff --git a/src/quantum/azext_quantum/azext_metadata.json b/src/quantum/azext_quantum/azext_metadata.json new file mode 100644 index 00000000000..44a31e479f5 --- /dev/null +++ b/src/quantum/azext_quantum/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.5.1" +} diff --git a/src/quantum/azext_quantum/commands.py b/src/quantum/azext_quantum/commands.py new file mode 100644 index 00000000000..ae7a6b73644 --- /dev/null +++ b/src/quantum/azext_quantum/commands.py @@ -0,0 +1,104 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long + +from collections import OrderedDict +from azure.cli.core.commands import CliCommandType +from ._validators import validate_workspace_info, validate_target_info, validate_workspace_and_target_info + + +def transform_targets(providers): + def one(provider, target): + return OrderedDict([ + ('Provider', provider), + ('Target-id', target['id']), + ('Current Availability', target['currentAvailability']), + ('Average Queue Time', target['averageQueueTime']) + ]) + + return [ + one(provider['id'], target) + for provider in providers + for target in provider['targets'] + ] + +def transform_job(result): + result = OrderedDict([ + ('Id', result['id']), + ('Status', result['status']), + ('Target', result['target']), + ('Submission time', result['creationTime']), + ('Completion time', result['endExecutionTime']) + ]) + return result + +def transform_jobs(results): + def creation(job): + return job['creationTime'] + + return [transform_job(job) for job in sorted(results, key=creation, reverse=True)] + + +def transform_output(results): + def one(key, value): + repeat = round(20 * value) + barra = "\u2588" * repeat + return OrderedDict([ + ('Result', key), + ('Frequency', f"{value:10.8f}"), + ('', f"\u2590{barra:<22} |"), + ]) + + if 'Histogram' in results: + histogram = results['Histogram'] + # The Histogram serialization is odd entries are key and even entries values + # Make sure we have even entries + if (len(histogram) % 2) == 0: + table = [] + items = range(0, len(histogram), 2) + for i in items: + key = histogram[i] + value = histogram[i+1] + table.append(one(key, value)) + return table + + elif 'histogram' in results: + histogram = results['histogram'] + return [one(key, histogram[key]) for key in histogram] + + return results + + +def load_command_table(self, _): + + workspace_ops = CliCommandType(operations_tmpl='azext_quantum.operations.workspace#{}') + job_ops = CliCommandType(operations_tmpl='azext_quantum.operations.job#{}') + target_ops = CliCommandType(operations_tmpl='azext_quantum.operations.target#{}') + + with self.command_group('quantum workspace', workspace_ops) as w: + w.command('list', 'list') + w.command('show', 'show', validator=validate_workspace_info) ## TODO: argument list/help + w.command('set', 'set', validator=validate_workspace_info) + w.command('clear', 'clear') + + + with self.command_group('quantum target', target_ops) as w: + w.command('list', 'list', validator=validate_workspace_info, table_transformer=transform_targets) + w.command('show', 'show', validator=validate_target_info) + w.command('set', 'set', validator=validate_target_info) + w.command('clear', 'clear') + + + with self.command_group('quantum job', job_ops) as j: + j.command('list', 'list', validator=validate_workspace_info, table_transformer=transform_jobs) + j.command('show', 'show', validator=validate_workspace_info, table_transformer=transform_job) + j.command('submit', 'submit', validator=validate_workspace_and_target_info, table_transformer=transform_job) + j.command('wait', 'wait', validator=validate_workspace_info, table_transformer=transform_job) + j.command('output', 'output', validator=validate_workspace_info, table_transformer=transform_output) + + + with self.command_group('quantum', job_ops, is_preview=True) as q: + q.command('execute', 'execute', validator=validate_workspace_and_target_info, table_transformer=transform_output) diff --git a/src/quantum/azext_quantum/operations/__init__.py b/src/quantum/azext_quantum/operations/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/quantum/azext_quantum/operations/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/quantum/azext_quantum/operations/job.py b/src/quantum/azext_quantum/operations/job.py new file mode 100644 index 00000000000..2836d7b0b59 --- /dev/null +++ b/src/quantum/azext_quantum/operations/job.py @@ -0,0 +1,235 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=import-outside-toplevel + +import logging + +from knack.util import CLIError + +from .._client_factory import cf_jobs, _get_data_credentials, base_url +from .workspace import WorkspaceInfo +from .target import TargetInfo + +logger = logging.getLogger(__name__) + +# pylint: disable=redefined-builtin +def list(cmd, resource_group_name=None, workspace_name=None): + """ + Returns the list of jobs in a Quantum Workspace. + """ + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + client = cf_jobs(cmd.cli_ctx, info.subscription, info.resource_group, info.name) + return client.list() + + +def show(cmd, job_id, resource_group_name=None, workspace_name=None): + """ + Shows the job's status and details. + """ + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + client = cf_jobs(cmd.cli_ctx, info.subscription, info.resource_group, info.name) + return client.get(job_id) + + +def build(cmd, target_id=None, project=None): + """ + Compiles a Q# program for execution to Azure Quantum. + """ + target = TargetInfo(cmd, target_id) + + args = ["dotnet", "build"] + + args.append(f"-property:ExecutionTarget={target.target_id}") + + if project: + args.append("--project") + args.append(project) + + logger.debug("Building project with arguments:") + logger.debug(args) + + import subprocess + result = subprocess.run(args, stdout=subprocess.PIPE, check=False) + + if result.returncode == 0: + return {'result': 'ok'} + + raise CLIError("Failed to compile program.") + + +def _generate_submit_args(program_args, ws, target, token, project, job_name, shots): + """ Generates the list of arguments for calling submit on a Q# project """ + import os + + args = ["dotnet", "run", "--no-build"] + + if project: + args.append("--project") + args.append(project) + + args.append("--") + args.append("submit") + + args.append("--subscription") + args.append(ws.subscription) + + args.append("--resource-group") + args.append(ws.resource_group) + + args.append("--workspace") + args.append(ws.name) + + args.append("--target") + args.append(target.target_id) + + if job_name: + args.append("--job-name") + args.append(job_name) + + if shots: + args.append("--shots") + args.append(shots) + + args.append("--output") + args.append("Id") + + args.append("--storage") + args.append(os.environ['AZURE_QUANTUM_STORAGE']) + + args.append("--aad-token") + args.append(token) + + args.append("--base-uri") + args.append(base_url()) + + args.extend(program_args) + + logger.debug("Running project with arguments:") + logger.debug(args) + + return args + +def submit(cmd, program_args, resource_group_name=None, workspace_name=None, target_id=None, project=None, + job_name=None, shots=None, no_build=False): + """ + Submits a Q# project for execution to Azure Quantum. + """ + + # We first build and then call run. + # Can't call run directly because it fails to understand the + # `ExecutionTarget` property when passed in the command line + if not no_build: + build(cmd, target_id=target_id, project=project) + + logger.info("Project built successfully.") + + ws = WorkspaceInfo(cmd, resource_group_name, workspace_name) + target = TargetInfo(cmd, target_id) + token = _get_data_credentials(cmd.cli_ctx, ws.subscription).get_token().token + + args = _generate_submit_args(program_args, ws, target, token, project, job_name, shots) + + import subprocess + result = subprocess.run(args, stdout=subprocess.PIPE, check=False) + + if result.returncode == 0: + job_id = result.stdout.decode('ascii').strip() + return show(cmd, job_id, resource_group_name, workspace_name) + + raise CLIError("Failed to submit job.") + + +def _parse_blob_url(url): + from urllib.parse import urlparse + o = urlparse(url) + + account_name = o.netloc.split('.')[0] + container = o.path.split('/')[-2] + blob = o.path.split('/')[-1] + sas_token = o.query + + return { + "account_name": account_name, + "container": container, + "blob": blob, + "sas_token": sas_token + } + +def output(cmd, job_id, resource_group_name=None, workspace_name=None): + """ Returns back the results of a Q# execution """ + import tempfile + import json + import os + from azure.cli.command_modules.storage._client_factory import blob_data_service_factory + + path = os.path.join(tempfile.gettempdir(), job_id) + + if os.path.exists(path): + logger.debug(f"Using existing blob from {path}") + else: + logger.debug(f"Downloading job results blob into {path}") + + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + client = cf_jobs(cmd.cli_ctx, info.subscription, info.resource_group, info.name) + job = client.get(job_id) + + if job.status != "Succeeded": + return f"Job status: {job.status}. Output only available if Succeeded." + + args = _parse_blob_url(job.output_data_uri) + blob_service = blob_data_service_factory(cmd.cli_ctx, args) + blob_service.get_blob_to_path(args['container'], args['blob'], path) + + with open(path) as json_file: + data = json.load(json_file) + return data + + +def wait(cmd, job_id, resource_group_name=None, workspace_name=None, max_poll_wait_secs=5): + """ + Place the CLI in a waiting state until the job finishes execution. + """ + import time + + def has_completed(job): + return job.status in ("Succeeded", "Failed", "Cancelled") + + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + client = cf_jobs(cmd.cli_ctx, info.subscription, info.resource_group, info.name) + + # TODO: LROPoller... + w = False + poll_wait = 0.2 + job = client.get(job_id) + + while not has_completed(job): + print('.', end='', flush=True) + w = True + time.sleep(poll_wait) + job = client.get(job_id) + poll_wait = max_poll_wait_secs if poll_wait >= max_poll_wait_secs else poll_wait * 1.5 + + if w: + print("") + + return job + +def execute(cmd, program_args, resource_group_name=None, workspace_name=None, target_id=None, project=None, + job_name=None, shots=None, no_build=False): + """ + Submits a job for quantum execution on Azure Quantum, and waits for the result. + """ + job = submit(cmd, program_args, resource_group_name, workspace_name, target_id, project, job_name, shots, no_build) + print("Job id:", job.id) + logger.debug(job) + + job = wait(cmd, job.id, resource_group_name, workspace_name) + logger.debug(job) + + if not job.status == "Succeeded": + return job + + return output(cmd, job.id, resource_group_name, workspace_name) diff --git a/src/quantum/azext_quantum/operations/target.py b/src/quantum/azext_quantum/operations/target.py new file mode 100644 index 00000000000..eaa330bd6e2 --- /dev/null +++ b/src/quantum/azext_quantum/operations/target.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=import-outside-toplevel,line-too-long,redefined-builtin + +from .._client_factory import cf_providers +from .workspace import WorkspaceInfo + +class TargetInfo(object): + def __init__(self, cmd, target_id=None): + + def select_value(key, value): + if not value is None: + return value + value = cmd.cli_ctx.config.get('quantum', key, None) + if not value is None: + return value + value = cmd.cli_ctx.config.get(cmd.cli_ctx.config.defaults_section_name, key, None) + if not value is None: + return value + + self.target_id = select_value('target_id', target_id) + + def clear(self): + self.target_id = '' + + def save(self, cmd): + from azure.cli.core.util import ConfiguredDefaultSetter + + with ConfiguredDefaultSetter(cmd.cli_ctx.config, False): + cmd.cli_ctx.config.set_value('quantum', 'target_id', self.target_id) + + +def show(cmd, target_id=None): + """ + Returns the details of the given (or current) target to use when submitting jobs to Azure Quantum. + """ + info = TargetInfo(cmd, target_id) + return info + +def set(cmd, target_id=None): + """ + Selects the default target to use when submitting jobs to Azure Quantum. + """ + info = TargetInfo(cmd, target_id) + if info: + info.save(cmd) + return info + +def list(cmd, resource_group_name=None, workspace_name=None): + """ + Returns the list of providers and their targets in a Quantum Workspace. + """ + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + client = cf_providers(cmd.cli_ctx, info.subscription, info.resource_group, info.name) + return client.get_status() + +def clear(cmd): + """ + Unsets the default target-id. + """ + info = TargetInfo(cmd) + info.clear() + info.save(cmd) diff --git a/src/quantum/azext_quantum/operations/workspace.py b/src/quantum/azext_quantum/operations/workspace.py new file mode 100644 index 00000000000..f14b60eef86 --- /dev/null +++ b/src/quantum/azext_quantum/operations/workspace.py @@ -0,0 +1,82 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=import-outside-toplevel,line-too-long,redefined-builtin + +from knack.util import CLIError + +from .._client_factory import cf_workspaces + +class WorkspaceInfo(object): + def __init__(self, cmd, resource_group_name=None, workspace_name=None): + from azure.cli.core.commands.client_factory import get_subscription_id + + # Hierarchically selects the value for the given key. + # First tries the value provided as argument, as that represents the value from the command line + # then it checks if the key exists in the 'quantum' section in config, and uses that if available. + # finally, it checks in the 'global' section in the config. + def select_value(key, value): + if not value is None: + return value + value = cmd.cli_ctx.config.get('quantum', key, None) + if not value is None: + return value + value = cmd.cli_ctx.config.get(cmd.cli_ctx.config.defaults_section_name, key, None) + if not value is None: + return value + + self.subscription = get_subscription_id(cmd.cli_ctx) + self.resource_group = select_value('group', resource_group_name) + self.name = select_value('workspace', workspace_name) + + def clear(self): + self.subscription = '' + self.resource_group = '' + self.name = '' + + def save(self, cmd): + from azure.cli.core.util import ConfiguredDefaultSetter + + with ConfiguredDefaultSetter(cmd.cli_ctx.config, False): + cmd.cli_ctx.config.set_value('quantum', 'group', self.resource_group) + cmd.cli_ctx.config.set_value('quantum', 'workspace', self.name) + + +def list(cmd, resource_group_name=None, tag=None, location=None): + """ + Returns the list of Quantum Workspaces available. + """ + from azure.cli.command_modules.resource.custom import list_resources + return list_resources(cmd, resource_group_name=resource_group_name, resource_type="Microsoft.Quantum/Workspaces", tag=tag, location=location) + +def show(cmd, resource_group_name=None, workspace_name=None): + """ + Returns the details of the given (or current) Quantum Workspace. + """ + client = cf_workspaces(cmd.cli_ctx) + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + if (not info.resource_group) or (not info.name): + raise CLIError("Please run 'az quantum workspace set' first to select a default Quantum Workspace.") + ws = client.get(info.resource_group, info.name) + return ws + +def set(cmd, workspace_name, resource_group_name=None): + """ + Sets the default Quantum Workspace. + """ + client = cf_workspaces(cmd.cli_ctx) + info = WorkspaceInfo(cmd, resource_group_name, workspace_name) + ws = client.get(info.resource_group, info.name) + if ws: + info.save(cmd) + return ws + +def clear(cmd): + """ + Unsets the default Quantum Workspace. + """ + info = WorkspaceInfo(cmd) + info.clear() + info.save(cmd) diff --git a/src/quantum/azext_quantum/profiles.py b/src/quantum/azext_quantum/profiles.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/quantum/azext_quantum/profiles.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/quantum/azext_quantum/tests/__init__.py b/src/quantum/azext_quantum/tests/__init__.py new file mode 100644 index 00000000000..721049fe1af --- /dev/null +++ b/src/quantum/azext_quantum/tests/__init__.py @@ -0,0 +1,9 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- + +# To run these tests from the command line: +# az account set -s 677fc922-91d0-4bf6-9b06-4274d319a0fa +# azdev test quantum --live diff --git a/src/quantum/azext_quantum/tests/latest/__init__.py b/src/quantum/azext_quantum/tests/latest/__init__.py new file mode 100644 index 00000000000..721049fe1af --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/__init__.py @@ -0,0 +1,9 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- + +# To run these tests from the command line: +# az account set -s 677fc922-91d0-4bf6-9b06-4274d319a0fa +# azdev test quantum --live diff --git a/src/quantum/azext_quantum/tests/latest/recordings/test_targets.yaml b/src/quantum/azext_quantum/tests/latest/recordings/test_targets.yaml new file mode 100644 index 00000000000..63b65810eec --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/recordings/test_targets.yaml @@ -0,0 +1,133 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace set + Connection: + - keep-alive + ParameterSetName: + - -g -w + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + quantummanagementclient/2019-11-04-preview Azure-SDK-For-Python AZURECLI/2.7.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus?api-version=2019-11-04-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus","name":"validator-workspace-westus","type":"microsoft.quantum/workspaces","location":"westus","identity":null,"properties":{"providers":[{"providerId":"Microsoft","providerSku":"Basic","applicationName":"validator-workspace-westus-Microsoft","provisioningState":"Succeeded"}],"provisioningState":"Succeeded","usable":"Yes"}}' + headers: + cache-control: + - no-cache + content-length: + - '489' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:18:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + quantumclient/2019-11-04-preview Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://app-jobscheduler-prod.azurewebsites.net/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/Microsoft.Quantum/workspaces/validator-workspace-westus/providerStatus + response: + body: + string: '{"value":[{"id":"Microsoft","currentAvailability":"Available","targets":[{"id":"p2","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"p3","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"s2","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"s3","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"a_s","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"a_p","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering-parameterfree.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing-parameterfree.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering.fpga","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing.fpga","currentAvailability":"Available","averageQueueTime":0,"statusPage":null}]}],"nextLink":null}' + headers: + content-length: + - '1321' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:01 GMT + request-context: + - appId=cid-v1:4d6ac272-7369-45c6-9036-63d733c8519f + server: + - Microsoft-IIS/10.0 + set-cookie: + - ARRAffinity=08e31a4953421e4acc8f85a9de4c15a37fb2c04b2d4bea64f09dfa61db9f7085;Path=/;HttpOnly;Domain=app-jobscheduler-prod.azurewebsites.net + strict-transport-security: + - max-age=2592000 + vary: + - Accept-Encoding + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + quantumclient/2019-11-04-preview Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://app-jobscheduler-prod.azurewebsites.net/v1.0/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/Microsoft.Quantum/workspaces/validator-workspace-westus/providerStatus + response: + body: + string: '{"value":[{"id":"Microsoft","currentAvailability":"Available","targets":[{"id":"p2","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"p3","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"s2","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"s3","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"a_s","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"a_p","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering-parameterfree.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing-parameterfree.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing.cpu","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.paralleltempering.fpga","currentAvailability":"Available","averageQueueTime":0,"statusPage":null},{"id":"microsoft.simulatedannealing.fpga","currentAvailability":"Available","averageQueueTime":0,"statusPage":null}]}],"nextLink":null}' + headers: + content-length: + - '1321' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:02 GMT + request-context: + - appId=cid-v1:4d6ac272-7369-45c6-9036-63d733c8519f + server: + - Microsoft-IIS/10.0 + set-cookie: + - ARRAffinity=08e31a4953421e4acc8f85a9de4c15a37fb2c04b2d4bea64f09dfa61db9f7085;Path=/;HttpOnly;Domain=app-jobscheduler-prod.azurewebsites.net + strict-transport-security: + - max-age=2592000 + vary: + - Accept-Encoding + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/quantum/azext_quantum/tests/latest/recordings/test_workspace.yaml b/src/quantum/azext_quantum/tests/latest/recordings/test_workspace.yaml new file mode 100644 index 00000000000..4d214dde941 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/recordings/test_workspace.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace list + Connection: + - keep-alive + ParameterSetName: + - -o + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.7.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=resourceType%20eq%20%27Microsoft.Quantum%2FWorkspaces%27&api-version=2019-07-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/alchocro-test-001/providers/Microsoft.Quantum/Workspaces/test-workspace-001","name":"test-workspace-001","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/anpaz-privpreview/providers/Microsoft.Quantum/Workspaces/anpaz-privpreview","name":"anpaz-privpreview","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/testworkspace","name":"testworkspace","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/validator-workspace-westus","name":"validator-workspace-westus","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/validator-workspae-westus","name":"validator-workspae-westus","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-test/providers/Microsoft.Quantum/Workspaces/demo","name":"demo","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-test/providers/Microsoft.Quantum/Workspaces/test-yinshen","name":"test-yinshen","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ashwinm-test-private-preview/providers/Microsoft.Quantum/Workspaces/aq-private-preview-test","name":"aq-private-preview-test","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ashwinm-test-private-preview/providers/Microsoft.Quantum/Workspaces/aq-private-preview-test-01","name":"aq-private-preview-test-01","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/etperr-test/providers/Microsoft.Quantum/Workspaces/etperr-test","name":"etperr-test","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete","name":"proddelete","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete2","name":"proddelete2","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete3","name":"proddelete3","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/dfDemoNew8","name":"dfDemoNew8","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/mycontoso1","name":"mycontoso1","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/myionq1","name":"myionq1","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew10","name":"dfDemoNew10","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew8","name":"dfDemoNew8","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew9","name":"dfDemoNew9","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/prod1","name":"prod1","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jaz-aq-pp-rg/providers/Microsoft.Quantum/Workspaces/jaz-aq-pp","name":"jaz-aq-pp","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rwolfso/providers/Microsoft.Quantum/Workspaces/rowolfso","name":"rowolfso","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace","name":"testworkspace","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary","name":"testworkspace-canary","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary2","name":"testworkspace-canary2","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-1qbit","name":"testworkspace-canary-1qbit","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-1qbit-ge","name":"testworkspace-canary-1qbit-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-honeywell-ge","name":"testworkspace-canary-honeywell-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-ionq","name":"testworkspace-canary-ionq","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-ionq-ge","name":"testworkspace-canary-ionq-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-microsoft","name":"testworkspace-canary-microsoft","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-microsoft2","name":"testworkspace-canary-microsoft2","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/demo-yinshen","name":"demo-yinshen","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/yinshen-test","name":"yinshen-test","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/yinshen-workspace","name":"yinshen-workspace","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/accepted","name":"accepted","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/new","name":"new","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/yinshen-test-new","name":"yinshen-test-new","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}}]}' + headers: + cache-control: + - no-cache + content-length: + - '9573' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:00 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace list + Connection: + - keep-alive + ParameterSetName: + - -o + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.7.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=resourceType%20eq%20%27Microsoft.Quantum%2FWorkspaces%27&api-version=2019-07-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/alchocro-test-001/providers/Microsoft.Quantum/Workspaces/test-workspace-001","name":"test-workspace-001","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/anpaz-privpreview/providers/Microsoft.Quantum/Workspaces/anpaz-privpreview","name":"anpaz-privpreview","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/testworkspace","name":"testworkspace","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/validator-workspace-westus","name":"validator-workspace-westus","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/Workspaces/validator-workspae-westus","name":"validator-workspae-westus","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-test/providers/Microsoft.Quantum/Workspaces/demo","name":"demo","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-test/providers/Microsoft.Quantum/Workspaces/test-yinshen","name":"test-yinshen","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ashwinm-test-private-preview/providers/Microsoft.Quantum/Workspaces/aq-private-preview-test","name":"aq-private-preview-test","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ashwinm-test-private-preview/providers/Microsoft.Quantum/Workspaces/aq-private-preview-test-01","name":"aq-private-preview-test-01","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/etperr-test/providers/Microsoft.Quantum/Workspaces/etperr-test","name":"etperr-test","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete","name":"proddelete","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete2","name":"proddelete2","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-deletetest/providers/Microsoft.Quantum/Workspaces/proddelete3","name":"proddelete3","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/dfDemoNew8","name":"dfDemoNew8","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/mycontoso1","name":"mycontoso1","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testcanary/providers/Microsoft.Quantum/Workspaces/myionq1","name":"myionq1","type":"Microsoft.Quantum/Workspaces","location":"eastus2euap","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew10","name":"dfDemoNew10","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew8","name":"dfDemoNew8","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/dfDemoNew9","name":"dfDemoNew9","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hay-testRG/providers/Microsoft.Quantum/workspaces/prod1","name":"prod1","type":"Microsoft.Quantum/workspaces","location":"westus","tags":{"department":"MightyMight","company":"Contoso"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jaz-aq-pp-rg/providers/Microsoft.Quantum/Workspaces/jaz-aq-pp","name":"jaz-aq-pp","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rwolfso/providers/Microsoft.Quantum/Workspaces/rowolfso","name":"rowolfso","type":"Microsoft.Quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace","name":"testworkspace","type":"microsoft.quantum/Workspaces","location":"westus"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary","name":"testworkspace-canary","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary2","name":"testworkspace-canary2","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-1qbit","name":"testworkspace-canary-1qbit","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-1qbit-ge","name":"testworkspace-canary-1qbit-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-honeywell-ge","name":"testworkspace-canary-honeywell-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-ionq","name":"testworkspace-canary-ionq","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-ionq-ge","name":"testworkspace-canary-ionq-ge","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-microsoft","name":"testworkspace-canary-microsoft","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/validator-test-rg/providers/microsoft.quantum/Workspaces/testworkspace-canary-microsoft2","name":"testworkspace-canary-microsoft2","type":"microsoft.quantum/Workspaces","location":"eastus2euap"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/demo-yinshen","name":"demo-yinshen","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/yinshen-test","name":"yinshen-test","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test/providers/Microsoft.Quantum/Workspaces/yinshen-workspace","name":"yinshen-workspace","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/accepted","name":"accepted","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/new","name":"new","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yinshen-test-001/providers/Microsoft.Quantum/Workspaces/yinshen-test-new","name":"yinshen-test-new","type":"Microsoft.Quantum/Workspaces","location":"westus","tags":{}}]}' + headers: + cache-control: + - no-cache + content-length: + - '9573' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace set + Connection: + - keep-alive + ParameterSetName: + - -g -w -o + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + quantummanagementclient/2019-11-04-preview Azure-SDK-For-Python AZURECLI/2.7.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus?api-version=2019-11-04-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus","name":"validator-workspace-westus","type":"microsoft.quantum/workspaces","location":"westus","identity":null,"properties":{"providers":[{"providerId":"Microsoft","providerSku":"Basic","applicationName":"validator-workspace-westus-Microsoft","provisioningState":"Succeeded"}],"provisioningState":"Succeeded","usable":"Yes"}}' + headers: + cache-control: + - no-cache + content-length: + - '489' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace show + Connection: + - keep-alive + ParameterSetName: + - -o + User-Agent: + - python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.13 msrest_azure/0.6.3 + quantummanagementclient/2019-11-04-preview Azure-SDK-For-Python AZURECLI/2.7.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus?api-version=2019-11-04-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/aqua-provider-validator/providers/microsoft.quantum/workspaces/validator-workspace-westus","name":"validator-workspace-westus","type":"microsoft.quantum/workspaces","location":"westus","identity":null,"properties":{"providers":[{"providerId":"Microsoft","providerSku":"Basic","applicationName":"validator-workspace-westus-Microsoft","provisioningState":"Succeeded"}],"provisioningState":"Succeeded","usable":"Yes"}}' + headers: + cache-control: + - no-cache + content-length: + - '489' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 11 Jun 2020 09:19:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_jobs.py b/src/quantum/azext_quantum/tests/latest/test_quantum_jobs.py new file mode 100644 index 00000000000..79b8c767c42 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_jobs.py @@ -0,0 +1,87 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) + +from .utils import is_private_preview_subscription, TEST_WORKSPACE, TEST_RG, TEST_SUBS +from ..._client_factory import _get_data_credentials +from ...operations.workspace import WorkspaceInfo +from ...operations.target import TargetInfo +from ...operations.job import _generate_submit_args, _parse_blob_url + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +class QuantumScenarioTest(ScenarioTest): + + def test_targets(self): + # Since azure quantum is still in private preview, we require + # these tests to run in a specific subscription (AzureQuantum-test) + # if running somewhere else, just skip + if not is_private_preview_subscription(self): + self.skipTest(f"Need to run azure quantum tests in subscription {TEST_SUBS}") + + # set current workspace: + self.cmd(f'az quantum workspace set -g {TEST_RG} -w {TEST_WORKSPACE}') + + # list + targets = self.cmd('az quantum target list -o json').get_output_in_json() + assert len(targets) > 0 + + def test_submit_args(self): + # Since azure quantum is still in private preview, we require + # these tests to run in a specific subscription (AzureQuantum-test) + # if running somewhere else, just skip + if not is_private_preview_subscription(self): + self.skipTest(f"Need to run azure quantum tests in subscription {TEST_SUBS}") + + ws = WorkspaceInfo(self, TEST_RG, TEST_WORKSPACE) + target = TargetInfo(self, 'ionq.simulator') + + token = _get_data_credentials(self.cli_ctx, TEST_SUBS).get_token().token + assert len(token) > 0 + + args = _generate_submit_args(["--foo", "--bar"], ws, target, token, project=None, job_name=None, shots=None) + self.assertEquals(args[0], "dotnet") + self.assertEquals(args[1], "run") + self.assertEquals(args[2], "--no-build") + self.assertIn("--", args) + self.assertIn("submit", args) + self.assertIn(TEST_SUBS, args) + self.assertIn(TEST_WORKSPACE, args) + self.assertIn(TEST_RG, args) + self.assertIn("ionq.simulator", args) + self.assertIn("--aad-token", args) + self.assertIn(token, args) + self.assertIn("--foo", args) + self.assertIn("--bar", args) + self.assertNotIn("--project", args) + self.assertNotIn("--job-name", args) + self.assertNotIn("--shots", args) + + args = _generate_submit_args(["--foo", "--bar"], ws, target, token, "../other/path", "job-name", 1234) + self.assertEquals(args[0], "dotnet") + self.assertEquals(args[1], "run") + self.assertEquals(args[2], "--no-build") + self.assertIn("../other/path", args) + self.assertIn("job-name", args) + self.assertIn(1234, args) + self.assertIn("--project", args) + self.assertIn("--job-name", args) + self.assertIn("--shots", args) + + def test_parse_blob_url(self): + sas = "sv=2018-03-28&sr=c&sig=some-sig&sp=racwl" + url = f"https://getest2.blob.core.windows.net/qio/rawOutputData?{sas}" + args = _parse_blob_url(url) + + self.assertEquals(args['account_name'], "getest2") + self.assertEquals(args['container'], "qio") + self.assertEquals(args['blob'], "rawOutputData") + self.assertEquals(args['sas_token'], sas) diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_targets.py b/src/quantum/azext_quantum/tests/latest/test_quantum_targets.py new file mode 100644 index 00000000000..dd0f3359996 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_targets.py @@ -0,0 +1,54 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) + +from .utils import is_private_preview_subscription, TEST_WORKSPACE, TEST_RG, TEST_SUBS + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +class QuantumScenarioTest(ScenarioTest): + + def test_targets(self): + # Since azure quantum is still in private preview, we require + # these tests to run in a specific subscription (AzureQuantum-test) + # if running somewhere else, just skip + if not is_private_preview_subscription(self): + self.skipTest(f"Need to run azure quantum tests in subscription {TEST_SUBS}") + + # set current workspace: + self.cmd(f'az quantum workspace set -g {TEST_RG} -w {TEST_WORKSPACE}') + + # clear current target + self.cmd(f'az quantum target clear') + + # list + targets = self.cmd('az quantum target list -o json').get_output_in_json() + assert len(targets) > 0 + self.cmd('az quantum target list -o json', checks=[ + self.check(f"[?id=='Microsoft'].targets | [0] | [?id=='microsoft.paralleltempering.cpu'].id | [0]", 'microsoft.paralleltempering.cpu') + ]) + + # set + self.cmd(f'az quantum target set -t microsoft.paralleltempering.cpu -o json', checks=[ + self.check("targetId", "microsoft.paralleltempering.cpu") + ]) + + # show + self.cmd(f'az quantum target show -o json', checks=[ + self.check("targetId", "microsoft.paralleltempering.cpu") + ]) + self.cmd(f'az quantum target show -t microsoft.simulatedannealing.cpu -o json', checks=[ + self.check("targetId", "microsoft.simulatedannealing.cpu") + ]) + + # clear + self.cmd(f'az quantum target clear') + diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py new file mode 100644 index 00000000000..d040625f3b5 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) + +from .utils import is_private_preview_subscription, TEST_WORKSPACE, TEST_RG, TEST_SUBS + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +class QuantumScenarioTest(ScenarioTest): + + def test_workspace(self): + # Since azure quantum is still in private preview, we require + # these tests to run in a specific subscription (AzureQuantum-test) + # if running somewhere else, just skip + if not is_private_preview_subscription(self): + self.skipTest(f"Need to run azure quantum tests in subscription {TEST_SUBS}") + + # clear + self.cmd(f'az quantum workspace clear') + + # list + workspaces = self.cmd('az quantum workspace list -o json').get_output_in_json() + assert len(workspaces) > 0 + self.cmd('az quantum workspace list -o json', checks=[ + self.check(f"[?name=='{TEST_WORKSPACE}'].resourceGroup | [0]", TEST_RG) + ]) + + # set + self.cmd(f'az quantum workspace set -g {TEST_RG} -w {TEST_WORKSPACE} -o json', checks=[ + self.check("name", TEST_WORKSPACE) + ]) + + # show + self.cmd(f'az quantum workspace show -o json', checks=[ + self.check("name", TEST_WORKSPACE) + ]) + + # clear + self.cmd(f'az quantum workspace clear') + diff --git a/src/quantum/azext_quantum/tests/latest/utils.py b/src/quantum/azext_quantum/tests/latest/utils.py new file mode 100644 index 00000000000..f89c6024a32 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/utils.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +TEST_SUBS = "677fc922-91d0-4bf6-9b06-4274d319a0fa" +TEST_RG = 'aqua-provider-validator' +TEST_WORKSPACE = 'validator-workspace-westus' + +def is_private_preview_subscription(scenario): + """ Returns True if running in AzureQuantum-test """ + + # Since azure quantum is still in private preview, we require + # tests to run in a specific subscription (AzureQuantum-test) + # this method checks if running in such subscription: + account = scenario.cmd('az account show -o json').get_output_in_json() + return account['id'] == TEST_SUBS diff --git a/src/quantum/azext_quantum/vendored_sdks/__init__.py b/src/quantum/azext_quantum/vendored_sdks/__init__.py new file mode 100644 index 00000000000..a5b81f3bde4 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +__import__('pkg_resources').declare_namespace(__name__) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/__init__.py new file mode 100644 index 00000000000..aad4cbdb96a --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/__init__.py @@ -0,0 +1,18 @@ +# 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 .quantum_management_client import QuantumManagementClient +from .version import VERSION + +__all__ = ['QuantumManagementClient'] + +__version__ = VERSION + diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/__init__.py new file mode 100644 index 00000000000..ce6871a025b --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/__init__.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. +# -------------------------------------------------------------------------- + +try: + from .error_definition_py3 import ErrorDefinition + from .error_response_py3 import ErrorResponse, ErrorResponseException + from .quantum_workspace_py3 import QuantumWorkspace + from .provider_description_properties_py3 import ProviderDescriptionProperties + from .provider_description_py3 import ProviderDescription + from .provider_py3 import Provider + from .workspace_resource_properties_py3 import WorkspaceResourceProperties + from .provider_properties_aad_py3 import ProviderPropertiesAad + from .provider_properties_managed_application_py3 import ProviderPropertiesManagedApplication + from .target_description_py3 import TargetDescription + from .sku_description_py3 import SkuDescription + from .provider_properties_py3 import ProviderProperties +except (SyntaxError, ImportError): + from .error_definition import ErrorDefinition + from .error_response import ErrorResponse, ErrorResponseException + from .quantum_workspace import QuantumWorkspace + from .provider_description_properties import ProviderDescriptionProperties + from .provider_description import ProviderDescription + from .provider import Provider + from .workspace_resource_properties import WorkspaceResourceProperties + from .provider_properties_aad import ProviderPropertiesAad + from .provider_properties_managed_application import ProviderPropertiesManagedApplication + from .target_description import TargetDescription + from .sku_description import SkuDescription + from .provider_properties import ProviderProperties +from .quantum_workspace_paged import QuantumWorkspacePaged +from .provider_description_paged import ProviderDescriptionPaged +from .quantum_management_client_enums import ( + Status, + UsableStatus, + ProvisioningStatus, +) + +__all__ = [ + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'QuantumWorkspace', + 'ProviderDescriptionProperties', + 'ProviderDescription', + 'Provider', + 'WorkspaceResourceProperties', + 'ProviderPropertiesAad', + 'ProviderPropertiesManagedApplication', + 'TargetDescription', + 'SkuDescription', + 'ProviderProperties', + 'QuantumWorkspacePaged', + 'ProviderDescriptionPaged', + 'Status', + 'UsableStatus', + 'ProvisioningStatus', +] diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition.py new file mode 100644 index 00000000000..b5247402dd7 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class ErrorDefinition(Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Service specific error code which serves as the substatus for + the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~quantum.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition_py3.py new file mode 100644 index 00000000000..d83cf343f54 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_definition_py3.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class ErrorDefinition(Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Service specific error code which serves as the substatus for + the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~quantum.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response.py new file mode 100644 index 00000000000..2a582d2396b --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~quantum.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response_py3.py new file mode 100644 index 00000000000..407557ed6fb --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/error_response_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~quantum.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider.py new file mode 100644 index 00000000000..53098659536 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider.py @@ -0,0 +1,47 @@ +# 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 msrest.serialization import Model + + +class Provider(Model): + """Json representation of provider, used for json serialization and + deserialization and save the meta information of provider. + + :param provider_id: partner id field + :type provider_id: str + :param provider_sku: sku field + :type provider_sku: str + :param instance_uri: serviceUri field + :type instance_uri: str + :param application_name: application name field + :type application_name: str + :param provisioning_state: Provisioning status field. Possible values + include: 'Succeeded', 'Launching', 'Updating', 'Deleting', 'Deleted', + 'Failed' + :type provisioning_state: str or ~quantum.models.Status + """ + + _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'}, + } + + 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) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description.py new file mode 100644 index 00000000000..6e2903041ee --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description.py @@ -0,0 +1,36 @@ +# 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 msrest.serialization import Model + + +class ProviderDescription(Model): + """Information about a Provider. + + :param id: Unique Provider's id. + :type id: str + :param name: Provider's display name. + :type name: str + :param properties: A list of Provider-specific properties. + :type properties: ~quantum.models.ProviderDescriptionProperties + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ProviderDescriptionProperties'}, + } + + def __init__(self, **kwargs): + super(ProviderDescription, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_paged.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_paged.py new file mode 100644 index 00000000000..a35e66abb0b --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class ProviderDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ProviderDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ProviderDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(ProviderDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties.py new file mode 100644 index 00000000000..5707dd96992 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties.py @@ -0,0 +1,43 @@ +# 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 .provider_properties import ProviderProperties + + +class ProviderDescriptionProperties(ProviderProperties): + """A list of Provider-specific properties. + + :param description: Description about this Provider. + :type description: str + :param default_endpoint: Provider's default endpoint. + :type default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info + :type managed_application: + ~quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider + :type targets: list[~quantum.models.TargetDescription] + :param skus: The list of skus selected for this provider + :type skus: list[~quantum.models.SkuDescription] + """ + + _attribute_map = { + 'description': {'key': 'description', '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]'}, + } + + def __init__(self, **kwargs): + super(ProviderDescriptionProperties, self).__init__(**kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties_py3.py new file mode 100644 index 00000000000..7c7bba42cf9 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_properties_py3.py @@ -0,0 +1,43 @@ +# 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 .provider_properties_py3 import ProviderProperties + + +class ProviderDescriptionProperties(ProviderProperties): + """A list of Provider-specific properties. + + :param description: Description about this Provider. + :type description: str + :param default_endpoint: Provider's default endpoint. + :type default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info + :type managed_application: + ~quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider + :type targets: list[~quantum.models.TargetDescription] + :param skus: The list of skus selected for this provider + :type skus: list[~quantum.models.SkuDescription] + """ + + _attribute_map = { + 'description': {'key': 'description', '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]'}, + } + + def __init__(self, *, description: str=None, default_endpoint: str=None, aad=None, managed_application=None, targets=None, skus=None, **kwargs) -> None: + super(ProviderDescriptionProperties, self).__init__(description=description, default_endpoint=default_endpoint, aad=aad, managed_application=managed_application, targets=targets, skus=skus, **kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_py3.py new file mode 100644 index 00000000000..3b242ae5de7 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_description_py3.py @@ -0,0 +1,36 @@ +# 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 msrest.serialization import Model + + +class ProviderDescription(Model): + """Information about a Provider. + + :param id: Unique Provider's id. + :type id: str + :param name: Provider's display name. + :type name: str + :param properties: A list of Provider-specific properties. + :type properties: ~quantum.models.ProviderDescriptionProperties + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ProviderDescriptionProperties'}, + } + + def __init__(self, *, id: str=None, name: str=None, properties=None, **kwargs) -> None: + super(ProviderDescription, self).__init__(**kwargs) + self.id = id + self.name = name + self.properties = properties diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties.py new file mode 100644 index 00000000000..2944708c297 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties.py @@ -0,0 +1,49 @@ +# 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 msrest.serialization import Model + + +class ProviderProperties(Model): + """Provider properties. + + :param description: Description about this Provider. + :type description: str + :param default_endpoint: Provider's default endpoint. + :type default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info + :type managed_application: + ~quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider + :type targets: list[~quantum.models.TargetDescription] + :param skus: The list of skus selected for this provider + :type skus: list[~quantum.models.SkuDescription] + """ + + _attribute_map = { + 'description': {'key': 'description', '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]'}, + } + + def __init__(self, **kwargs): + super(ProviderProperties, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.default_endpoint = kwargs.get('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) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad.py new file mode 100644 index 00000000000..0ad843cef1a --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class ProviderPropertiesAad(Model): + """Azure Active Directory info. + + :param application_id: Provider's application id. + :type application_id: str + :param tenant_id: Provider's tenant id. + :type tenant_id: str + """ + + _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 = kwargs.get('application_id', None) + self.tenant_id = kwargs.get('tenant_id', None) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad_py3.py new file mode 100644 index 00000000000..ba454b115a1 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_aad_py3.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class ProviderPropertiesAad(Model): + """Azure Active Directory info. + + :param application_id: Provider's application id. + :type application_id: str + :param tenant_id: Provider's tenant id. + :type tenant_id: str + """ + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, *, application_id: str=None, tenant_id: str=None, **kwargs) -> None: + super(ProviderPropertiesAad, self).__init__(**kwargs) + self.application_id = application_id + self.tenant_id = tenant_id diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application.py new file mode 100644 index 00000000000..26f80f7cf1d --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class ProviderPropertiesManagedApplication(Model): + """Provider's Managed-Application info. + + :param publisher_id: Provider's publisher id + :type publisher_id: str + :param offer_id: Provider's offer id + :type offer_id: str + """ + + _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 = kwargs.get('publisher_id', None) + self.offer_id = kwargs.get('offer_id', None) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application_py3.py new file mode 100644 index 00000000000..bc7386224cf --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_managed_application_py3.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class ProviderPropertiesManagedApplication(Model): + """Provider's Managed-Application info. + + :param publisher_id: Provider's publisher id + :type publisher_id: str + :param offer_id: Provider's offer id + :type offer_id: str + """ + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'offer_id': {'key': 'offerId', 'type': 'str'}, + } + + def __init__(self, *, publisher_id: str=None, offer_id: str=None, **kwargs) -> None: + super(ProviderPropertiesManagedApplication, self).__init__(**kwargs) + self.publisher_id = publisher_id + self.offer_id = offer_id diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_py3.py new file mode 100644 index 00000000000..9876fa656aa --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_properties_py3.py @@ -0,0 +1,49 @@ +# 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 msrest.serialization import Model + + +class ProviderProperties(Model): + """Provider properties. + + :param description: Description about this Provider. + :type description: str + :param default_endpoint: Provider's default endpoint. + :type default_endpoint: str + :param aad: Azure Active Directory info. + :type aad: ~quantum.models.ProviderPropertiesAad + :param managed_application: Provider's Managed-Application info + :type managed_application: + ~quantum.models.ProviderPropertiesManagedApplication + :param targets: The list of targets available from this provider + :type targets: list[~quantum.models.TargetDescription] + :param skus: The list of skus selected for this provider + :type skus: list[~quantum.models.SkuDescription] + """ + + _attribute_map = { + 'description': {'key': 'description', '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]'}, + } + + def __init__(self, *, description: str=None, default_endpoint: str=None, aad=None, managed_application=None, targets=None, skus=None, **kwargs) -> None: + super(ProviderProperties, self).__init__(**kwargs) + self.description = description + self.default_endpoint = default_endpoint + self.aad = aad + self.managed_application = managed_application + self.targets = targets + self.skus = skus diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_py3.py new file mode 100644 index 00000000000..d3fef71d060 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/provider_py3.py @@ -0,0 +1,47 @@ +# 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 msrest.serialization import Model + + +class Provider(Model): + """Json representation of provider, used for json serialization and + deserialization and save the meta information of provider. + + :param provider_id: partner id field + :type provider_id: str + :param provider_sku: sku field + :type provider_sku: str + :param instance_uri: serviceUri field + :type instance_uri: str + :param application_name: application name field + :type application_name: str + :param provisioning_state: Provisioning status field. Possible values + include: 'Succeeded', 'Launching', 'Updating', 'Deleting', 'Deleted', + 'Failed' + :type provisioning_state: str or ~quantum.models.Status + """ + + _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'}, + } + + def __init__(self, *, provider_id: str=None, provider_sku: str=None, instance_uri: str=None, application_name: str=None, provisioning_state=None, **kwargs) -> None: + 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 diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_management_client_enums.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_management_client_enums.py new file mode 100644 index 00000000000..96913d338d0 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_management_client_enums.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class Status(str, Enum): + + succeeded = "Succeeded" + launching = "Launching" + updating = "Updating" + deleting = "Deleting" + deleted = "Deleted" + failed = "Failed" + + +class UsableStatus(str, Enum): + + yes = "Yes" + no = "No" + partial = "Partial" + + +class ProvisioningStatus(str, Enum): + + succeeded = "Succeeded" + provider_launching = "ProviderLaunching" + provider_updating = "ProviderUpdating" + provider_deleting = "ProviderDeleting" + provider_provisioning = "ProviderProvisioning" + deleted = "Deleted" + failed = "Failed" diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace.py new file mode 100644 index 00000000000..a5d34bc5a93 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace.py @@ -0,0 +1,68 @@ +# 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 msrest.serialization import Model + + +class QuantumWorkspace(Model): + """The resource proxy definition object for quantum workspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Gets or sets the id for the resource. + :vartype id: str + :ivar name: Gets or sets the name of the resource definition. + :vartype name: str + :ivar type: Gets or sets the type of the resource definition. + :vartype type: str + :param location: Gets or sets the resource location. + :type location: str + :param providers: Providers selected for a Workspace + :type providers: list[~quantum.models.Provider] + :param usable: Whether the current workspace is usable. Possible values + include: 'Yes', 'No', 'Partial' + :type usable: str or ~quantum.models.UsableStatus + :param provisioning_state: The Workspace's current status. Possible values + include: 'Succeeded', 'ProviderLaunching', 'ProviderUpdating', + 'ProviderDeleting', 'ProviderProvisioning', 'Deleted', 'Failed' + :type provisioning_state: str or ~quantum.models.ProvisioningStatus + :param tags: Gets or sets the tags. + :type tags: object + """ + + _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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'providers': {'key': 'properties.providers', 'type': '[Provider]'}, + 'usable': {'key': 'properties.usable', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(QuantumWorkspace, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.providers = kwargs.get('providers', None) + self.usable = kwargs.get('usable', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.tags = kwargs.get('tags', None) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_paged.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_paged.py new file mode 100644 index 00000000000..c5a0ef3faf2 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class QuantumWorkspacePaged(Paged): + """ + A paging container for iterating over a list of :class:`QuantumWorkspace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[QuantumWorkspace]'} + } + + def __init__(self, *args, **kwargs): + + super(QuantumWorkspacePaged, self).__init__(*args, **kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_py3.py new file mode 100644 index 00000000000..f76acb0cec5 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/quantum_workspace_py3.py @@ -0,0 +1,68 @@ +# 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 msrest.serialization import Model + + +class QuantumWorkspace(Model): + """The resource proxy definition object for quantum workspace. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Gets or sets the id for the resource. + :vartype id: str + :ivar name: Gets or sets the name of the resource definition. + :vartype name: str + :ivar type: Gets or sets the type of the resource definition. + :vartype type: str + :param location: Gets or sets the resource location. + :type location: str + :param providers: Providers selected for a Workspace + :type providers: list[~quantum.models.Provider] + :param usable: Whether the current workspace is usable. Possible values + include: 'Yes', 'No', 'Partial' + :type usable: str or ~quantum.models.UsableStatus + :param provisioning_state: The Workspace's current status. Possible values + include: 'Succeeded', 'ProviderLaunching', 'ProviderUpdating', + 'ProviderDeleting', 'ProviderProvisioning', 'Deleted', 'Failed' + :type provisioning_state: str or ~quantum.models.ProvisioningStatus + :param tags: Gets or sets the tags. + :type tags: object + """ + + _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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'providers': {'key': 'properties.providers', 'type': '[Provider]'}, + 'usable': {'key': 'properties.usable', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + } + + def __init__(self, *, location: str=None, providers=None, usable=None, provisioning_state=None, tags=None, **kwargs) -> None: + super(QuantumWorkspace, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.providers = providers + self.usable = usable + self.provisioning_state = provisioning_state + self.tags = tags diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description.py new file mode 100644 index 00000000000..fdfff1bff9a --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SkuDescription(Model): + """Descript provider's information to end customer. + + :param id: unique sku id + :type id: str + :param name: display name of sku + :type name: str + :param description: Description about this sku + :type description: str + :param targets: list of targets for the sku + :type targets: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[str]'}, + } + + 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) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description_py3.py new file mode 100644 index 00000000000..8e66969bd09 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/sku_description_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SkuDescription(Model): + """Descript provider's information to end customer. + + :param id: unique sku id + :type id: str + :param name: display name of sku + :type name: str + :param description: Description about this sku + :type description: str + :param targets: list of targets for the sku + :type targets: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[str]'}, + } + + def __init__(self, *, id: str=None, name: str=None, description: str=None, targets=None, **kwargs) -> None: + super(SkuDescription, self).__init__(**kwargs) + self.id = id + self.name = name + self.description = description + self.targets = targets diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description.py new file mode 100644 index 00000000000..30800fb768d --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +class TargetDescription(Model): + """Descript provider's target information to end customer. + + :param id: Unique target id + :type id: str + :param name: Display name of target + :type name: str + :param description: Description about this sku + :type description: str + :param accepted_data_formats: List of data formats + :type accepted_data_formats: list[str] + :param accepted_content_encodings: List of content encodings + :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) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description_py3.py new file mode 100644 index 00000000000..1b27f38c47f --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description_py3.py @@ -0,0 +1,44 @@ +# 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 msrest.serialization import Model + + +class TargetDescription(Model): + """Descript provider's target information to end customer. + + :param id: Unique target id + :type id: str + :param name: Display name of target + :type name: str + :param description: Description about this sku + :type description: str + :param accepted_data_formats: List of data formats + :type accepted_data_formats: list[str] + :param accepted_content_encodings: List of content encodings + :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: str=None, name: str=None, description: str=None, accepted_data_formats=None, accepted_content_encodings=None, **kwargs) -> None: + 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 diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties.py new file mode 100644 index 00000000000..e4e8c7e5a27 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties.py @@ -0,0 +1,39 @@ +# 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 msrest.serialization import Model + + +class WorkspaceResourceProperties(Model): + """Properties of a Workspace. + + :param providers: Providers selected for a Workspace + :type providers: list[~quantum.models.Provider] + :param usable: Whether the current workspace is usable. Possible values + include: 'Yes', 'No', 'Partial' + :type usable: str or ~quantum.models.UsableStatus + :param provisioning_state: The Workspace's current status. Possible values + include: 'Succeeded', 'ProviderLaunching', 'ProviderUpdating', + 'ProviderDeleting', 'ProviderProvisioning', 'Deleted', 'Failed' + :type provisioning_state: str or ~quantum.models.ProvisioningStatus + """ + + _attribute_map = { + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'usable': {'key': 'usable', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WorkspaceResourceProperties, self).__init__(**kwargs) + self.providers = kwargs.get('providers', None) + self.usable = kwargs.get('usable', None) + self.provisioning_state = kwargs.get('provisioning_state', None) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties_py3.py new file mode 100644 index 00000000000..aa14119d446 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/workspace_resource_properties_py3.py @@ -0,0 +1,39 @@ +# 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 msrest.serialization import Model + + +class WorkspaceResourceProperties(Model): + """Properties of a Workspace. + + :param providers: Providers selected for a Workspace + :type providers: list[~quantum.models.Provider] + :param usable: Whether the current workspace is usable. Possible values + include: 'Yes', 'No', 'Partial' + :type usable: str or ~quantum.models.UsableStatus + :param provisioning_state: The Workspace's current status. Possible values + include: 'Succeeded', 'ProviderLaunching', 'ProviderUpdating', + 'ProviderDeleting', 'ProviderProvisioning', 'Deleted', 'Failed' + :type provisioning_state: str or ~quantum.models.ProvisioningStatus + """ + + _attribute_map = { + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'usable': {'key': 'usable', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, *, providers=None, usable=None, provisioning_state=None, **kwargs) -> None: + super(WorkspaceResourceProperties, self).__init__(**kwargs) + self.providers = providers + self.usable = usable + self.provisioning_state = provisioning_state diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/__init__.py new file mode 100644 index 00000000000..67b413f9988 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 + +__all__ = [ + 'WorkspacesOperations', + 'OfferingsOperations', +] diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/offerings_operations.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/offerings_operations.py new file mode 100644 index 00000000000..f75574fe278 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/offerings_operations.py @@ -0,0 +1,103 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class OfferingsOperations(object): + """OfferingsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-11-04-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-04-preview" + + self.config = config + + def list( + self, location_name, custom_headers=None, raw=False, **operation_config): + """Returns the list of all providers available for the given location. + + :param location_name: Location. + :type location_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ProviderDescription + :rtype: + ~quantum.models.ProviderDescriptionPaged[~quantum.models.ProviderDescription] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ProviderDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ProviderDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/microsoft.quantum/locations/{locationName}/offerings'} diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/workspaces_operations.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/workspaces_operations.py new file mode 100644 index 00000000000..b738cd5b9b2 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/operations/workspaces_operations.py @@ -0,0 +1,426 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class WorkspacesOperations(object): + """WorkspacesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-11-04-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-11-04-preview" + + self.config = config + + def get( + self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QuantumWorkspace or ClientRawResponse if raw=true + :rtype: ~quantum.models.QuantumWorkspace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.quantum/workspaces/{workspaceName}'} + + + def _create_and_update_initial( + self, resource_group_name, workspace_name, quantum_workspace, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_and_update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(quantum_workspace, 'QuantumWorkspace') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('QuantumWorkspace', response) + if response.status_code == 201: + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_and_update( + self, resource_group_name, workspace_name, quantum_workspace, custom_headers=None, raw=False, polling=True, **operation_config): + """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: ~quantum.models.QuantumWorkspace + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns QuantumWorkspace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~quantum.models.QuantumWorkspace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~quantum.models.QuantumWorkspace]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_and_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + quantum_workspace=quantum_workspace, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_and_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.quantum/workspaces/{workspaceName}'} + + def update( + self, resource_group_name, workspace_name, quantum_workspace, custom_headers=None, raw=False, **operation_config): + """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: Quantum workspace details. + :type quantum_workspace: ~quantum.models.QuantumWorkspace + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QuantumWorkspace or ClientRawResponse if raw=true + :rtype: ~quantum.models.QuantumWorkspace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(quantum_workspace, 'QuantumWorkspace') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.quantum/workspaces/{workspaceName}'} + + + def _delete_initial( + self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, workspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns QuantumWorkspace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~quantum.models.QuantumWorkspace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~quantum.models.QuantumWorkspace]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('QuantumWorkspace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.quantum/workspaces/{workspaceName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets the list of Workspaces within a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of QuantumWorkspace + :rtype: + ~quantum.models.QuantumWorkspacePaged[~quantum.models.QuantumWorkspace] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.QuantumWorkspacePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.QuantumWorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.quantum/workspaces'} diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/quantum_management_client.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/quantum_management_client.py new file mode 100644 index 00000000000..6e2b08937ac --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/quantum_management_client.py @@ -0,0 +1,86 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.workspaces_operations import WorkspacesOperations +from .operations.offerings_operations import OfferingsOperations +from . import models + + +class QuantumManagementClientConfiguration(AzureConfiguration): + """Configuration for QuantumManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(QuantumManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('quantummanagementclient/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class QuantumManagementClient(SDKClient): + """QuantumManagementClient + + :ivar config: Configuration for client. + :vartype config: QuantumManagementClientConfiguration + + :ivar workspaces: Workspaces operations + :vartype workspaces: quantum.operations.WorkspacesOperations + :ivar offerings: Offerings operations + :vartype offerings: quantum.operations.OfferingsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = QuantumManagementClientConfiguration(credentials, subscription_id, base_url) + super(QuantumManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-11-04-preview' + 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) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/version.py b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/version.py new file mode 100644 index 00000000000..f85b9c12434 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/version.py @@ -0,0 +1,13 @@ +# 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 = "2019-11-04-preview" + diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/__init__.py new file mode 100644 index 00000000000..97d75e8849d --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/__init__.py @@ -0,0 +1,18 @@ +# 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 .quantum_client import QuantumClient +from .version import VERSION + +__all__ = ['QuantumClient'] + +__version__ = VERSION + diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/__init__.py new file mode 100644 index 00000000000..9e0f9694ffe --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/__init__.py @@ -0,0 +1,32 @@ +# 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 .rest_error_py3 import RestError, RestErrorException + from .job_details_py3 import JobDetails + from .target_status_py3 import TargetStatus + from .provider_status_py3 import ProviderStatus +except (SyntaxError, ImportError): + from .rest_error import RestError, RestErrorException + from .job_details import JobDetails + from .target_status import TargetStatus + from .provider_status import ProviderStatus +from .job_details_paged import JobDetailsPaged +from .provider_status_paged import ProviderStatusPaged + +__all__ = [ + 'RestError', 'RestErrorException', + 'JobDetails', + 'TargetStatus', + 'ProviderStatus', + 'JobDetailsPaged', + 'ProviderStatusPaged', +] diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details.py new file mode 100644 index 00000000000..0a528927a8c --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details.py @@ -0,0 +1,120 @@ +# 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 msrest.serialization import Model + + +class JobDetails(Model): + """Job details. + + 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. + + :param id: The job id. + :type id: str + :param name: The job name. Is not required for the name to be unique and + it's only used for display purposes. + :type name: str + :param container_uri: Required. The blob container SAS uri, the container + is used to host job data. + :type container_uri: str + :param input_data_uri: The input blob SAS uri, if specified, it will + override the default input blob in the container. + :type input_data_uri: str + :param input_data_format: Required. The format of the input data. + :type input_data_format: str + :param input_params: The input parameters for the job. JSON object used by + the target solver. It is expected that the size of this object is small + and only used to specify parameters for the execution target, not the + input data. + :type input_params: object + :param provider_id: Required. The unique identifier for the provider. + :type provider_id: str + :param target: Required. The target identifier to run the job. + :type target: str + :param metadata: The job metadata. Metadata provides client the ability to + store client-specific information + :type metadata: dict[str, str] + :param output_data_uri: The output blob SAS uri. When a job finishes + successfully, results will be uploaded to this blob. + :type output_data_uri: str + :param output_data_format: The format of the output data. + :type output_data_format: str + :ivar status: The job status. Possible values include: 'Waiting', + 'Executing', 'Succeeded', 'Failed', 'Cancelled' + :vartype status: str or ~quantum.models.enum + :ivar creation_time: The creation time of the job. + :vartype creation_time: str + :ivar begin_execution_time: The time when the job began execution. + :vartype begin_execution_time: str + :ivar end_execution_time: The time when the job finished execution. + :vartype end_execution_time: str + :ivar cancellation_time: The time when a job was successfully cancelled. + :vartype cancellation_time: str + :ivar error_data: The error data for the job. This is expected only when + Status 'Failed'. + :vartype error_data: ~quantum.models.RestError + """ + + _validation = { + 'container_uri': {'required': True}, + 'input_data_format': {'required': True}, + 'provider_id': {'required': True}, + 'target': {'required': True}, + 'status': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'begin_execution_time': {'readonly': True}, + 'end_execution_time': {'readonly': True}, + 'cancellation_time': {'readonly': True}, + 'error_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'container_uri': {'key': 'containerUri', 'type': 'str'}, + 'input_data_uri': {'key': 'inputDataUri', 'type': 'str'}, + 'input_data_format': {'key': 'inputDataFormat', 'type': 'str'}, + 'input_params': {'key': 'inputParams', 'type': 'object'}, + 'provider_id': {'key': 'providerId', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'output_data_uri': {'key': 'outputDataUri', 'type': 'str'}, + 'output_data_format': {'key': 'outputDataFormat', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'creation_time': {'key': 'creationTime', 'type': 'str'}, + 'begin_execution_time': {'key': 'beginExecutionTime', 'type': 'str'}, + 'end_execution_time': {'key': 'endExecutionTime', 'type': 'str'}, + 'cancellation_time': {'key': 'cancellationTime', 'type': 'str'}, + 'error_data': {'key': 'errorData', 'type': 'RestError'}, + } + + def __init__(self, **kwargs): + super(JobDetails, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.container_uri = kwargs.get('container_uri', None) + self.input_data_uri = kwargs.get('input_data_uri', None) + self.input_data_format = kwargs.get('input_data_format', None) + self.input_params = kwargs.get('input_params', None) + self.provider_id = kwargs.get('provider_id', None) + self.target = kwargs.get('target', None) + self.metadata = kwargs.get('metadata', None) + self.output_data_uri = kwargs.get('output_data_uri', None) + self.output_data_format = kwargs.get('output_data_format', None) + self.status = None + self.creation_time = None + self.begin_execution_time = None + self.end_execution_time = None + self.cancellation_time = None + self.error_data = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_paged.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_paged.py new file mode 100644 index 00000000000..171821cde82 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class JobDetailsPaged(Paged): + """ + A paging container for iterating over a list of :class:`JobDetails ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[JobDetails]'} + } + + def __init__(self, *args, **kwargs): + + super(JobDetailsPaged, self).__init__(*args, **kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_py3.py new file mode 100644 index 00000000000..148f30de2fa --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/job_details_py3.py @@ -0,0 +1,120 @@ +# 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 msrest.serialization import Model + + +class JobDetails(Model): + """Job details. + + 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. + + :param id: The job id. + :type id: str + :param name: The job name. Is not required for the name to be unique and + it's only used for display purposes. + :type name: str + :param container_uri: Required. The blob container SAS uri, the container + is used to host job data. + :type container_uri: str + :param input_data_uri: The input blob SAS uri, if specified, it will + override the default input blob in the container. + :type input_data_uri: str + :param input_data_format: Required. The format of the input data. + :type input_data_format: str + :param input_params: The input parameters for the job. JSON object used by + the target solver. It is expected that the size of this object is small + and only used to specify parameters for the execution target, not the + input data. + :type input_params: object + :param provider_id: Required. The unique identifier for the provider. + :type provider_id: str + :param target: Required. The target identifier to run the job. + :type target: str + :param metadata: The job metadata. Metadata provides client the ability to + store client-specific information + :type metadata: dict[str, str] + :param output_data_uri: The output blob SAS uri. When a job finishes + successfully, results will be uploaded to this blob. + :type output_data_uri: str + :param output_data_format: The format of the output data. + :type output_data_format: str + :ivar status: The job status. Possible values include: 'Waiting', + 'Executing', 'Succeeded', 'Failed', 'Cancelled' + :vartype status: str or ~quantum.models.enum + :ivar creation_time: The creation time of the job. + :vartype creation_time: str + :ivar begin_execution_time: The time when the job began execution. + :vartype begin_execution_time: str + :ivar end_execution_time: The time when the job finished execution. + :vartype end_execution_time: str + :ivar cancellation_time: The time when a job was successfully cancelled. + :vartype cancellation_time: str + :ivar error_data: The error data for the job. This is expected only when + Status 'Failed'. + :vartype error_data: ~quantum.models.RestError + """ + + _validation = { + 'container_uri': {'required': True}, + 'input_data_format': {'required': True}, + 'provider_id': {'required': True}, + 'target': {'required': True}, + 'status': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'begin_execution_time': {'readonly': True}, + 'end_execution_time': {'readonly': True}, + 'cancellation_time': {'readonly': True}, + 'error_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'container_uri': {'key': 'containerUri', 'type': 'str'}, + 'input_data_uri': {'key': 'inputDataUri', 'type': 'str'}, + 'input_data_format': {'key': 'inputDataFormat', 'type': 'str'}, + 'input_params': {'key': 'inputParams', 'type': 'object'}, + 'provider_id': {'key': 'providerId', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'output_data_uri': {'key': 'outputDataUri', 'type': 'str'}, + 'output_data_format': {'key': 'outputDataFormat', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'creation_time': {'key': 'creationTime', 'type': 'str'}, + 'begin_execution_time': {'key': 'beginExecutionTime', 'type': 'str'}, + 'end_execution_time': {'key': 'endExecutionTime', 'type': 'str'}, + 'cancellation_time': {'key': 'cancellationTime', 'type': 'str'}, + 'error_data': {'key': 'errorData', 'type': 'RestError'}, + } + + def __init__(self, *, container_uri: str, input_data_format: str, provider_id: str, target: str, id: str=None, name: str=None, input_data_uri: str=None, input_params=None, metadata=None, output_data_uri: str=None, output_data_format: str=None, **kwargs) -> None: + super(JobDetails, self).__init__(**kwargs) + self.id = id + self.name = name + self.container_uri = container_uri + self.input_data_uri = input_data_uri + self.input_data_format = input_data_format + self.input_params = input_params + self.provider_id = provider_id + self.target = target + self.metadata = metadata + self.output_data_uri = output_data_uri + self.output_data_format = output_data_format + self.status = None + self.creation_time = None + self.begin_execution_time = None + self.end_execution_time = None + self.cancellation_time = None + self.error_data = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status.py new file mode 100644 index 00000000000..299c4423524 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class ProviderStatus(Model): + """Providers status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Provider id. + :vartype id: str + :ivar current_availability: Provider availability. Possible values + include: 'Available', 'Degraded', 'Unavailable' + :vartype current_availability: str or ~quantum.models.enum + :ivar targets: + :vartype targets: list[~quantum.models.TargetStatus] + """ + + _validation = { + 'id': {'readonly': True}, + 'current_availability': {'readonly': True}, + 'targets': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_availability': {'key': 'currentAvailability', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[TargetStatus]'}, + } + + def __init__(self, **kwargs): + super(ProviderStatus, self).__init__(**kwargs) + self.id = None + self.current_availability = None + self.targets = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_paged.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_paged.py new file mode 100644 index 00000000000..9e498393005 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class ProviderStatusPaged(Paged): + """ + A paging container for iterating over a list of :class:`ProviderStatus ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ProviderStatus]'} + } + + def __init__(self, *args, **kwargs): + + super(ProviderStatusPaged, self).__init__(*args, **kwargs) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_py3.py new file mode 100644 index 00000000000..754a9b6bdf0 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/provider_status_py3.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class ProviderStatus(Model): + """Providers status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Provider id. + :vartype id: str + :ivar current_availability: Provider availability. Possible values + include: 'Available', 'Degraded', 'Unavailable' + :vartype current_availability: str or ~quantum.models.enum + :ivar targets: + :vartype targets: list[~quantum.models.TargetStatus] + """ + + _validation = { + 'id': {'readonly': True}, + 'current_availability': {'readonly': True}, + 'targets': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_availability': {'key': 'currentAvailability', 'type': 'str'}, + 'targets': {'key': 'targets', 'type': '[TargetStatus]'}, + } + + def __init__(self, **kwargs) -> None: + super(ProviderStatus, self).__init__(**kwargs) + self.id = None + self.current_availability = None + self.targets = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error.py new file mode 100644 index 00000000000..87c30c5656c --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error.py @@ -0,0 +1,47 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class RestError(Model): + """An Error response. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for displaying in a user interface. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RestError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class RestErrorException(HttpOperationError): + """Server responsed with exception of type: 'RestError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(RestErrorException, self).__init__(deserialize, response, 'RestError', *args) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error_py3.py new file mode 100644 index 00000000000..d30bdbb1007 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/rest_error_py3.py @@ -0,0 +1,47 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class RestError(Model): + """An Error response. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for displaying in a user interface. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(RestError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class RestErrorException(HttpOperationError): + """Server responsed with exception of type: 'RestError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(RestErrorException, self).__init__(deserialize, response, 'RestError', *args) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status.py new file mode 100644 index 00000000000..3f124d19f13 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TargetStatus(Model): + """Target status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Target id. + :vartype id: str + :ivar current_availability: Target availability. Possible values include: + 'Available', 'Degraded', 'Unavailable' + :vartype current_availability: str or ~quantum.models.enum + :ivar average_queue_time: Average queue time in seconds. + :vartype average_queue_time: long + :ivar status_page: A page with detailed status of the provider. + :vartype status_page: str + """ + + _validation = { + 'id': {'readonly': True}, + 'current_availability': {'readonly': True}, + 'average_queue_time': {'readonly': True}, + 'status_page': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_availability': {'key': 'currentAvailability', 'type': 'str'}, + 'average_queue_time': {'key': 'averageQueueTime', 'type': 'long'}, + 'status_page': {'key': 'statusPage', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TargetStatus, self).__init__(**kwargs) + self.id = None + self.current_availability = None + self.average_queue_time = None + self.status_page = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status_py3.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status_py3.py new file mode 100644 index 00000000000..44920ca8f6b --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/target_status_py3.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TargetStatus(Model): + """Target status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Target id. + :vartype id: str + :ivar current_availability: Target availability. Possible values include: + 'Available', 'Degraded', 'Unavailable' + :vartype current_availability: str or ~quantum.models.enum + :ivar average_queue_time: Average queue time in seconds. + :vartype average_queue_time: long + :ivar status_page: A page with detailed status of the provider. + :vartype status_page: str + """ + + _validation = { + 'id': {'readonly': True}, + 'current_availability': {'readonly': True}, + 'average_queue_time': {'readonly': True}, + 'status_page': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_availability': {'key': 'currentAvailability', 'type': 'str'}, + 'average_queue_time': {'key': 'averageQueueTime', 'type': 'long'}, + 'status_page': {'key': 'statusPage', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(TargetStatus, self).__init__(**kwargs) + self.id = None + self.current_availability = None + self.average_queue_time = None + self.status_page = None diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/__init__.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/__init__.py new file mode 100644 index 00000000000..1805354c3ee --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 .jobs_operations import JobsOperations +from .providers_operations import ProvidersOperations + +__all__ = [ + 'JobsOperations', + 'ProvidersOperations', +] diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/jobs_operations.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/jobs_operations.py new file mode 100644 index 00000000000..5c7dbf92b1c --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/jobs_operations.py @@ -0,0 +1,285 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class JobsOperations(object): + """JobsOperations operations. + + :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, custom_headers=None, raw=False, **operation_config): + """List jobs. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of JobDetails + :rtype: ~quantum.models.JobDetailsPaged[~quantum.models.JobDetails] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str'), + 'workspaceName': self._serialize.url("self.config.workspace_name", self.config.workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.JobDetailsPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.JobDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs'} + + def get( + self, job_id, custom_headers=None, raw=False, **operation_config): + """Get job by id. + + :param job_id: Id of the job. + :type job_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobDetails or ClientRawResponse if raw=true + :rtype: ~quantum.models.JobDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`RestErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str'), + 'workspaceName': self._serialize.url("self.config.workspace_name", self.config.workspace_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.RestErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JobDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}'} + + def put( + self, job_id, job_definition, custom_headers=None, raw=False, **operation_config): + """Create a job. + + :param job_id: Id of the job. + :type job_id: str + :param job_definition: + :type job_definition: ~quantum.models.JobDetails + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobDetails or ClientRawResponse if raw=true + :rtype: ~quantum.models.JobDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`RestErrorException` + """ + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str'), + 'workspaceName': self._serialize.url("self.config.workspace_name", self.config.workspace_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(job_definition, 'JobDetails') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.RestErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JobDetails', response) + if response.status_code == 201: + deserialized = self._deserialize('JobDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + put.metadata = {'url': '/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}'} + + def delete( + self, job_id, custom_headers=None, raw=False, **operation_config): + """Delete a job. + + :param job_id: Id of the job. + :type job_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobDetails or ClientRawResponse if raw=true + :rtype: ~quantum.models.JobDetails or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`RestErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str'), + 'workspaceName': self._serialize.url("self.config.workspace_name", self.config.workspace_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.RestErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JobDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}'} diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/providers_operations.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/providers_operations.py new file mode 100644 index 00000000000..8d91ae768a8 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/operations/providers_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ProvidersOperations(object): + """ProvidersOperations operations. + + :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_status( + self, custom_headers=None, raw=False, **operation_config): + """Get provider status. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ProviderStatus + :rtype: + ~quantum.models.ProviderStatusPaged[~quantum.models.ProviderStatus] + :raises: + :class:`RestErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.get_status.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str'), + 'workspaceName': self._serialize.url("self.config.workspace_name", self.config.workspace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.RestErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ProviderStatusPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ProviderStatusPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + get_status.metadata = {'url': '/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/providerStatus'} diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/quantum_client.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/quantum_client.py new file mode 100644 index 00000000000..1d324d7e459 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/quantum_client.py @@ -0,0 +1,102 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.jobs_operations import JobsOperations +from .operations.providers_operations import ProvidersOperations +from . import models + + +class QuantumClientConfiguration(AzureConfiguration): + """Configuration for QuantumClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param workspace_name: Name of the workspace. + :type workspace_name: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, resource_group_name, workspace_name, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if resource_group_name is None: + raise ValueError("Parameter 'resource_group_name' must not be None.") + if workspace_name is None: + raise ValueError("Parameter 'workspace_name' must not be None.") + if not base_url: + base_url = 'https://app-jobscheduler-prod.azurewebsites.net' + + super(QuantumClientConfiguration, self).__init__(base_url) + + self.add_user_agent('quantumclient/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + self.resource_group_name = resource_group_name + self.workspace_name = workspace_name + + +class QuantumClient(SDKClient): + """Azure Quantum REST API client + + :ivar config: Configuration for client. + :vartype config: QuantumClientConfiguration + + :ivar jobs: Jobs operations + :vartype jobs: quantum.operations.JobsOperations + :ivar providers: Providers operations + :vartype providers: quantum.operations.ProvidersOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param resource_group_name: Name of an Azure resource group. + :type resource_group_name: str + :param workspace_name: Name of the workspace. + :type workspace_name: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, resource_group_name, workspace_name, base_url=None): + + self.config = QuantumClientConfiguration(credentials, subscription_id, resource_group_name, workspace_name, base_url) + super(QuantumClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-11-04-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.jobs = JobsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/src/quantum/azext_quantum/vendored_sdks/azure_quantum/version.py b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/version.py new file mode 100644 index 00000000000..f85b9c12434 --- /dev/null +++ b/src/quantum/azext_quantum/vendored_sdks/azure_quantum/version.py @@ -0,0 +1,13 @@ +# 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 = "2019-11-04-preview" + diff --git a/src/quantum/setup.cfg b/src/quantum/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/src/quantum/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/quantum/setup.py b/src/quantum/setup.py new file mode 100644 index 00000000000..1306708acd2 --- /dev/null +++ b/src/quantum/setup.py @@ -0,0 +1,58 @@ +#!/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. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.11.2906.2' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [ + 'azure-cli-core' +] + +with open('README.rst', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='quantum', + version=VERSION, + description='Microsoft Azure Command-Line Tools Quantum Extension', + author='Microsoft Corporation, Quantum Team', + author_email='que-contacts@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_quantum': ['azext_metadata.json']}, +)