Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR machinelearningservices] Adding ComputeInstance to preview swagger #209

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Generated from a549e1823957a0c2def96950290ecac98dcd5b37
Adding POBO changes
SDK Automation committed Sep 1, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit eee1af0bb24dedf86eafa40b39992ea097bb5473
8 changes: 8 additions & 0 deletions src/machinelearningservices/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/machinelearningservices/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'machinelearningservices' Extension
==========================================

This package is for the 'machinelearningservices' extension.
i.e. 'az machinelearningservices'
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_machinelearningservices.generated._help import helps # pylint: disable=unused-import


class AzureMachineLearningWorkspacesCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_machinelearningservices.generated._client_factory import cf_machinelearningservices
machinelearningservices_custom = CliCommandType(
operations_tmpl='azext_machinelearningservices.custom#{}',
client_factory=cf_machinelearningservices)
parent = super(AzureMachineLearningWorkspacesCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=machinelearningservices_custom)

def load_command_table(self, args):
from azext_machinelearningservices.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_machinelearningservices.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_machinelearningservices.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_machinelearningservices.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = AzureMachineLearningWorkspacesCommandsLoader
Original file line number Diff line number Diff line change
@@ -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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
Original file line number Diff line number Diff line change
@@ -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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------


def cf_machinelearningservices(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.machinelearningservices import AzureMachineLearningWorkspaces
return get_mgmt_service_client(cli_ctx, AzureMachineLearningWorkspaces)


def cf_workspace(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).workspace


def cf_workspace_feature(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).workspace_feature


def cf_notebook(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).notebook


def cf_usage(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).usage


def cf_virtual_machine_size(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).virtual_machine_size


def cf_quota(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).quota


def cf_workspace_connection(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).workspace_connection


def cf_machine_learning_compute(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).machine_learning_compute


def cf_private_endpoint_connection(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).private_endpoint_connection


def cf_private_link_resource(cli_ctx, *_):
return cf_machinelearningservices(cli_ctx).private_link_resource

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------
# pylint: disable=protected-access

import argparse
from knack.util import CLIError
from collections import defaultdict


class AddSku(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.sku = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'name':
d['name'] = v[0]
elif kl == 'tier':
d['tier'] = v[0]
return d


class AddSharedPrivateLinkResources(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(AddSharedPrivateLinkResources, self).__call__(parser, namespace, action, option_string)

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'name':
d['name'] = v[0]
elif kl == 'private-link-resource-id':
d['private_link_resource_id'] = v[0]
elif kl == 'group-id':
d['group_id'] = v[0]
elif kl == 'request-message':
d['request_message'] = v[0]
elif kl == 'status':
d['status'] = v[0]
return d


class AddEncryptionKeyVaultProperties(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.encryption_key_vault_properties = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'key-vault-arm-id':
d['key_vault_arm_id'] = v[0]
elif kl == 'key-identifier':
d['key_identifier'] = v[0]
elif kl == 'identity-client-id':
d['identity_client_id'] = v[0]
return d


class AddValue(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(AddValue, self).__call__(parser, namespace, action, option_string)

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
d['unit'] = "Count"
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'id':
d['id'] = v[0]
elif kl == 'type':
d['type'] = v[0]
elif kl == 'limit':
d['limit'] = v[0]
return d


class AddSshSettings(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.ssh_settings = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
d['ssh_public_access'] = "Disabled"
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'ssh-public-access':
d['ssh_public_access'] = v[0]
elif kl == 'admin-public-key':
d['admin_public_key'] = v[0]
return d


class AddAdministratorAccount(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.administrator_account = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'username':
d['username'] = v[0]
elif kl == 'password':
d['password'] = v[0]
elif kl == 'public-key-data':
d['public_key_data'] = v[0]
elif kl == 'private-key-data':
d['private_key_data'] = v[0]
return d


class AddScaleSettings(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.scale_settings = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
d['min_node_count'] = 0
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'max-node-count':
d['max_node_count'] = v[0]
elif kl == 'min-node-count':
d['min_node_count'] = v[0]
elif kl == 'node-idle-time-before-scale-down':
d['node_idle_time_before_scale_down'] = v[0]
return d


class AddPrivateLinkServiceConnectionState(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.private_link_service_connection_state = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'status':
d['status'] = v[0]
elif kl == 'description':
d['description'] = v[0]
elif kl == 'actions-required':
d['actions_required'] = v[0]
return d
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core.commands import CliCommandType


def load_command_table(self, _):

from azext_machinelearningservices.generated._client_factory import cf_workspace
machinelearningservices_workspace = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._workspace_oper'
'ations#WorkspaceOperations.{}',
client_factory=cf_workspace)
with self.command_group('machinelearningservices workspace', machinelearningservices_workspace,
client_factory=cf_workspace, is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_workspace_list')
g.custom_show_command('show', 'machinelearningservices_workspace_show')
g.custom_command('create', 'machinelearningservices_workspace_create', supports_no_wait=True)
g.custom_command('update', 'machinelearningservices_workspace_update')
g.custom_command('delete', 'machinelearningservices_workspace_delete', supports_no_wait=True)
g.custom_command('list-key', 'machinelearningservices_workspace_list_key')
g.custom_command('resync-key', 'machinelearningservices_workspace_resync_key')
g.custom_wait_command('wait', 'machinelearningservices_workspace_show')

from azext_machinelearningservices.generated._client_factory import cf_workspace_feature
machinelearningservices_workspace_feature = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._workspace_feat'
'ure_operations#WorkspaceFeatureOperations.{}',
client_factory=cf_workspace_feature)
with self.command_group('machinelearningservices workspace-feature', machinelearningservices_workspace_feature,
client_factory=cf_workspace_feature, is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_workspace_feature_list')

from azext_machinelearningservices.generated._client_factory import cf_notebook
machinelearningservices_notebook = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._notebook_opera'
'tions#NotebookOperations.{}',
client_factory=cf_notebook)
with self.command_group('machinelearningservices notebook', machinelearningservices_notebook,
client_factory=cf_notebook, is_experimental=True) as g:
g.custom_command('prepare', 'machinelearningservices_notebook_prepare')

from azext_machinelearningservices.generated._client_factory import cf_usage
machinelearningservices_usage = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._usage_operatio'
'ns#UsageOperations.{}',
client_factory=cf_usage)
with self.command_group('machinelearningservices usage', machinelearningservices_usage, client_factory=cf_usage,
is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_usage_list')

from azext_machinelearningservices.generated._client_factory import cf_virtual_machine_size
machinelearningservices_virtual_machine_size = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._virtual_machin'
'e_size_operations#VirtualMachineSizeOperations.{}',
client_factory=cf_virtual_machine_size)
with self.command_group('machinelearningservices virtual-machine-size',
machinelearningservices_virtual_machine_size, client_factory=cf_virtual_machine_size,
is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_virtual_machine_size_list')

from azext_machinelearningservices.generated._client_factory import cf_quota
machinelearningservices_quota = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._quota_operatio'
'ns#QuotaOperations.{}',
client_factory=cf_quota)
with self.command_group('machinelearningservices quota', machinelearningservices_quota, client_factory=cf_quota,
is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_quota_list')
g.custom_command('update', 'machinelearningservices_quota_update')

from azext_machinelearningservices.generated._client_factory import cf_workspace_connection
machinelearningservices_workspace_connection = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._workspace_conn'
'ection_operations#WorkspaceConnectionOperations.{}',
client_factory=cf_workspace_connection)
with self.command_group('machinelearningservices workspace-connection',
machinelearningservices_workspace_connection, client_factory=cf_workspace_connection,
is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_workspace_connection_list')
g.custom_show_command('show', 'machinelearningservices_workspace_connection_show')
g.custom_command('create', 'machinelearningservices_workspace_connection_create')
g.custom_command('delete', 'machinelearningservices_workspace_connection_delete')

from azext_machinelearningservices.generated._client_factory import cf_machine_learning_compute
machinelearningservices_machine_learning_compute = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._machine_learni'
'ng_compute_operations#MachineLearningComputeOperations.{}',
client_factory=cf_machine_learning_compute)
with self.command_group('machinelearningservices machine-learning-compute',
machinelearningservices_machine_learning_compute,
client_factory=cf_machine_learning_compute, is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_machine_learning_compute_list')
g.custom_show_command('show', 'machinelearningservices_machine_learning_compute_show')
g.custom_command('aks create', 'machinelearningservices_machine_learning_compute_aks_create',
supports_no_wait=True)
g.custom_command('aml-compute create', 'machinelearningservices_machine_learning_compute_aml_compute_create',
supports_no_wait=True)
g.custom_command('compute-instance create', 'machinelearningservices_machine_learning_compute_compute_instance_'
'create', supports_no_wait=True)
g.custom_command('data-factory create', 'machinelearningservices_machine_learning_compute_data_factory_create',
supports_no_wait=True)
g.custom_command('data-lake-analytics create', 'machinelearningservices_machine_learning_compute_data_lake_anal'
'ytics_create', supports_no_wait=True)
g.custom_command('databricks create', 'machinelearningservices_machine_learning_compute_databricks_create',
supports_no_wait=True)
g.custom_command('hd-insight create', 'machinelearningservices_machine_learning_compute_hd_insight_create',
supports_no_wait=True)
g.custom_command('virtual-machine create', 'machinelearningservices_machine_learning_compute_virtual_machine_cr'
'eate', supports_no_wait=True)
g.custom_command('update', 'machinelearningservices_machine_learning_compute_update', supports_no_wait=True)
g.custom_command('delete', 'machinelearningservices_machine_learning_compute_delete', supports_no_wait=True)
g.custom_command('list-key', 'machinelearningservices_machine_learning_compute_list_key')
g.custom_command('list-node', 'machinelearningservices_machine_learning_compute_list_node')
g.custom_command('restart', 'machinelearningservices_machine_learning_compute_restart')
g.custom_command('start', 'machinelearningservices_machine_learning_compute_start')
g.custom_command('stop', 'machinelearningservices_machine_learning_compute_stop')
g.custom_wait_command('wait', 'machinelearningservices_machine_learning_compute_show')

from azext_machinelearningservices.generated._client_factory import cf_machinelearningservices
machinelearningservices_ = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._model_operatio'
'ns#ModelOperations.{}',
client_factory=cf_machinelearningservices)
with self.command_group('machinelearningservices ', machinelearningservices_,
client_factory=cf_machinelearningservices, is_experimental=True) as g:
g.custom_command('list-sku', 'machinelearningservices__list_sku')

from azext_machinelearningservices.generated._client_factory import cf_private_endpoint_connection
machinelearningservices_private_endpoint_connection = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._private_endpoi'
'nt_connection_operations#PrivateEndpointConnectionOperations.{}',
client_factory=cf_private_endpoint_connection)
with self.command_group('machinelearningservices private-endpoint-connection',
machinelearningservices_private_endpoint_connection,
client_factory=cf_private_endpoint_connection, is_experimental=True) as g:
g.custom_show_command('show', 'machinelearningservices_private_endpoint_connection_show')
g.custom_command('delete', 'machinelearningservices_private_endpoint_connection_delete')
g.custom_command('put', 'machinelearningservices_private_endpoint_connection_put')

from azext_machinelearningservices.generated._client_factory import cf_private_link_resource
machinelearningservices_private_link_resource = CliCommandType(
operations_tmpl='azext_machinelearningservices.vendored_sdks.machinelearningservices.operations._private_link_r'
'esource_operations#PrivateLinkResourceOperations.{}',
client_factory=cf_private_link_resource)
with self.command_group('machinelearningservices private-link-resource',
machinelearningservices_private_link_resource, client_factory=cf_private_link_resource,
is_experimental=True) as g:
g.custom_command('list', 'machinelearningservices_private_link_resource_list')

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import inspect
import os
import sys
import traceback
from azure.core.exceptions import AzureError
from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError


__path__ = __import__('pkgutil').extend_path(__path__, __name__)
exceptions = []


def try_manual(func):
def import_manual_function(origin_func):
from importlib import import_module
decorated_path = inspect.getfile(origin_func)
module_path = __path__[0]
if not decorated_path.startswith(module_path):
raise Exception("Decorator can only be used in submodules!")
manual_path = os.path.join(
decorated_path[module_path.rfind(os.path.sep) + 1:])
manual_file_path, manual_file_name = os.path.split(manual_path)
module_name, _ = os.path.splitext(manual_file_name)
manual_module = "..manual." + \
".".join(manual_file_path.split(os.path.sep) + [module_name, ])
return getattr(import_module(manual_module, package=__name__), origin_func.__name__)

def get_func_to_call():
func_to_call = func
try:
func_to_call = import_manual_function(func)
print("Found manual override for {}(...)".format(func.__name__))
except (ImportError, AttributeError):
pass
return func_to_call

def wrapper(*args, **kwargs):
func_to_call = get_func_to_call()
print("running {}()...".format(func.__name__))
try:
return func_to_call(*args, **kwargs)
except (AssertionError, AzureError, CliTestError, CliExecutionError, JMESPathCheckAssertionError) as e:
print("--------------------------------------")
print("step exception: ", e)
print("--------------------------------------", file=sys.stderr)
print("step exception in {}: {}".format(func.__name__, e), file=sys.stderr)
traceback.print_exc()
exceptions.append((func.__name__, sys.exc_info()))

if inspect.isclass(func):
return get_func_to_call()
return wrapper


def raise_if():
if exceptions:
if len(exceptions) <= 1:
raise exceptions[0][1][1]
message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1]))
message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]])
raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2])
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# --------------------------------------------------------------------------
# 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 os
from datetime import datetime
from azure_devtools.scenario_tests import SingleValueReplacer
from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer
from azure.cli.testsdk.exceptions import CliTestError
from azure.cli.testsdk.reverse_dependency import get_dummy_cli


KEY_RESOURCE_GROUP = 'rg'
KEY_VIRTUAL_NETWORK = 'vnet'
KEY_VNET_SUBNET = 'subnet'
KEY_VNET_NIC = 'nic'


class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer):
def __init__(self, name_prefix='clitest.vn',
parameter_name='virtual_network',
resource_group_name=None,
resource_group_key=KEY_RESOURCE_GROUP,
dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME',
random_name_length=24, key=KEY_VIRTUAL_NETWORK):
if ' ' in name_prefix:
raise CliTestError(
'Error: Space character in name prefix \'%s\'' % name_prefix)
super(VirtualNetworkPreparer, self).__init__(
name_prefix, random_name_length)
self.cli_ctx = get_dummy_cli()
self.parameter_name = parameter_name
self.key = key
self.resource_group_name = resource_group_name
self.resource_group_key = resource_group_key
self.dev_setting_name = os.environ.get(dev_setting_name, None)

def create_resource(self, name, **_):
if self.dev_setting_name:
return {self.parameter_name: self.dev_setting_name, }

if not self.resource_group_name:
self.resource_group_name = self.test_class_instance.kwargs.get(
self.resource_group_key)
if not self.resource_group_name:
raise CliTestError("Error: No resource group configured!")

tags = {'product': 'azurecli', 'cause': 'automation',
'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')}
if 'ENV_JOB_NAME' in os.environ:
tags['job'] = os.environ['ENV_JOB_NAME']
tags = ' '.join(['{}={}'.format(key, value)
for key, value in tags.items()])
template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags
self.live_only_execute(self.cli_ctx, template.format(
self.resource_group_name, name))

self.test_class_instance.kwargs[self.key] = name
return {self.parameter_name: name}

def remove_resource(self, name, **_):
# delete vnet if test is being recorded and if the vnet is not a dev rg
if not self.dev_setting_name:
self.live_only_execute(
self.cli_ctx,
'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name))


class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer):
def __init__(self, name_prefix='clitest.vn',
parameter_name='subnet',
resource_group_key=KEY_RESOURCE_GROUP,
vnet_key=KEY_VIRTUAL_NETWORK,
address_prefixes="11.0.0.0/24",
dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME',
key=KEY_VNET_SUBNET):
if ' ' in name_prefix:
raise CliTestError(
'Error: Space character in name prefix \'%s\'' % name_prefix)
super(VnetSubnetPreparer, self).__init__(name_prefix, 15)
self.cli_ctx = get_dummy_cli()
self.parameter_name = parameter_name
self.key = key
self.resource_group = [resource_group_key, None]
self.vnet = [vnet_key, None]
self.address_prefixes = address_prefixes
self.dev_setting_name = os.environ.get(dev_setting_name, None)

def create_resource(self, name, **_):
if self.dev_setting_name:
return {self.parameter_name: self.dev_setting_name, }

if not self.resource_group[1]:
self.resource_group[1] = self.test_class_instance.kwargs.get(
self.resource_group[0])
if not self.resource_group[1]:
raise CliTestError("Error: No resource group configured!")
if not self.vnet[1]:
self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0])
if not self.vnet[1]:
raise CliTestError("Error: No vnet configured!")

self.test_class_instance.kwargs[self.key] = 'default'
return {self.parameter_name: name}

def remove_resource(self, name, **_):
pass


class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer):
def __init__(self, name_prefix='clitest.nic',
parameter_name='subnet',
resource_group_key=KEY_RESOURCE_GROUP,
vnet_key=KEY_VIRTUAL_NETWORK,
dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME',
key=KEY_VNET_NIC):
if ' ' in name_prefix:
raise CliTestError(
'Error: Space character in name prefix \'%s\'' % name_prefix)
super(VnetNicPreparer, self).__init__(name_prefix, 15)
self.cli_ctx = get_dummy_cli()
self.parameter_name = parameter_name
self.key = key
self.resource_group = [resource_group_key, None]
self.vnet = [vnet_key, None]
self.dev_setting_name = os.environ.get(dev_setting_name, None)

def create_resource(self, name, **_):
if self.dev_setting_name:
return {self.parameter_name: self.dev_setting_name, }

if not self.resource_group[1]:
self.resource_group[1] = self.test_class_instance.kwargs.get(
self.resource_group[0])
if not self.resource_group[1]:
raise CliTestError("Error: No resource group configured!")
if not self.vnet[1]:
self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0])
if not self.vnet[1]:
raise CliTestError("Error: No vnet configured!")

template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default '
self.live_only_execute(self.cli_ctx, template.format(
self.resource_group[1], name, self.vnet[1]))

self.test_class_instance.kwargs[self.key] = name
return {self.parameter_name: name}

def remove_resource(self, name, **_):
if not self.dev_setting_name:
self.live_only_execute(
self.cli_ctx,
'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1]))

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_machine_learning_workspaces import AzureMachineLearningWorkspaces
__all__ = ['AzureMachineLearningWorkspaces']

try:
from ._patch import patch_sdk
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -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 typing import TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import AzureMachineLearningWorkspacesConfiguration
from .operations import OperationOperations
from .operations import WorkspaceOperations
from .operations import WorkspaceFeatureOperations
from .operations import NotebookOperations
from .operations import UsageOperations
from .operations import VirtualMachineSizeOperations
from .operations import QuotaOperations
from .operations import WorkspaceConnectionOperations
from .operations import MachineLearningComputeOperations
from .operations import AzureMachineLearningWorkspacesOperationsMixin
from .operations import PrivateEndpointConnectionOperations
from .operations import PrivateLinkResourceOperations
from . import models


class AzureMachineLearningWorkspaces(AzureMachineLearningWorkspacesOperationsMixin):
"""These APIs allow end users to operate on Azure Machine Learning Workspace resources.
:ivar operation: OperationOperations operations
:vartype operation: azure_machine_learning_workspaces.operations.OperationOperations
:ivar workspace: WorkspaceOperations operations
:vartype workspace: azure_machine_learning_workspaces.operations.WorkspaceOperations
:ivar workspace_feature: WorkspaceFeatureOperations operations
:vartype workspace_feature: azure_machine_learning_workspaces.operations.WorkspaceFeatureOperations
:ivar notebook: NotebookOperations operations
:vartype notebook: azure_machine_learning_workspaces.operations.NotebookOperations
:ivar usage: UsageOperations operations
:vartype usage: azure_machine_learning_workspaces.operations.UsageOperations
:ivar virtual_machine_size: VirtualMachineSizeOperations operations
:vartype virtual_machine_size: azure_machine_learning_workspaces.operations.VirtualMachineSizeOperations
:ivar quota: QuotaOperations operations
:vartype quota: azure_machine_learning_workspaces.operations.QuotaOperations
:ivar workspace_connection: WorkspaceConnectionOperations operations
:vartype workspace_connection: azure_machine_learning_workspaces.operations.WorkspaceConnectionOperations
:ivar machine_learning_compute: MachineLearningComputeOperations operations
:vartype machine_learning_compute: azure_machine_learning_workspaces.operations.MachineLearningComputeOperations
:ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations
:vartype private_endpoint_connection: azure_machine_learning_workspaces.operations.PrivateEndpointConnectionOperations
:ivar private_link_resource: PrivateLinkResourceOperations operations
:vartype private_link_resource: azure_machine_learning_workspaces.operations.PrivateLinkResourceOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure subscription identifier.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = AzureMachineLearningWorkspacesConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.operation = OperationOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace = WorkspaceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace_feature = WorkspaceFeatureOperations(
self._client, self._config, self._serialize, self._deserialize)
self.notebook = NotebookOperations(
self._client, self._config, self._serialize, self._deserialize)
self.usage = UsageOperations(
self._client, self._config, self._serialize, self._deserialize)
self.virtual_machine_size = VirtualMachineSizeOperations(
self._client, self._config, self._serialize, self._deserialize)
self.quota = QuotaOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace_connection = WorkspaceConnectionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.machine_learning_compute = MachineLearningComputeOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connection = PrivateEndpointConnectionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_link_resource = PrivateLinkResourceOperations(
self._client, self._config, self._serialize, self._deserialize)

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> AzureMachineLearningWorkspaces
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class AzureMachineLearningWorkspacesConfiguration(Configuration):
"""Configuration for AzureMachineLearningWorkspaces.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure subscription identifier.
:type subscription_id: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-06-01"
self.credential_scopes = ['https://management.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'azuremachinelearningworkspaces/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_machine_learning_workspaces_async import AzureMachineLearningWorkspaces
__all__ = ['AzureMachineLearningWorkspaces']
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, Optional, TYPE_CHECKING

from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration_async import AzureMachineLearningWorkspacesConfiguration
from .operations_async import OperationOperations
from .operations_async import WorkspaceOperations
from .operations_async import WorkspaceFeatureOperations
from .operations_async import NotebookOperations
from .operations_async import UsageOperations
from .operations_async import VirtualMachineSizeOperations
from .operations_async import QuotaOperations
from .operations_async import WorkspaceConnectionOperations
from .operations_async import MachineLearningComputeOperations
from .operations_async import AzureMachineLearningWorkspacesOperationsMixin
from .operations_async import PrivateEndpointConnectionOperations
from .operations_async import PrivateLinkResourceOperations
from .. import models


class AzureMachineLearningWorkspaces(AzureMachineLearningWorkspacesOperationsMixin):
"""These APIs allow end users to operate on Azure Machine Learning Workspace resources.
:ivar operation: OperationOperations operations
:vartype operation: azure_machine_learning_workspaces.aio.operations_async.OperationOperations
:ivar workspace: WorkspaceOperations operations
:vartype workspace: azure_machine_learning_workspaces.aio.operations_async.WorkspaceOperations
:ivar workspace_feature: WorkspaceFeatureOperations operations
:vartype workspace_feature: azure_machine_learning_workspaces.aio.operations_async.WorkspaceFeatureOperations
:ivar notebook: NotebookOperations operations
:vartype notebook: azure_machine_learning_workspaces.aio.operations_async.NotebookOperations
:ivar usage: UsageOperations operations
:vartype usage: azure_machine_learning_workspaces.aio.operations_async.UsageOperations
:ivar virtual_machine_size: VirtualMachineSizeOperations operations
:vartype virtual_machine_size: azure_machine_learning_workspaces.aio.operations_async.VirtualMachineSizeOperations
:ivar quota: QuotaOperations operations
:vartype quota: azure_machine_learning_workspaces.aio.operations_async.QuotaOperations
:ivar workspace_connection: WorkspaceConnectionOperations operations
:vartype workspace_connection: azure_machine_learning_workspaces.aio.operations_async.WorkspaceConnectionOperations
:ivar machine_learning_compute: MachineLearningComputeOperations operations
:vartype machine_learning_compute: azure_machine_learning_workspaces.aio.operations_async.MachineLearningComputeOperations
:ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations
:vartype private_endpoint_connection: azure_machine_learning_workspaces.aio.operations_async.PrivateEndpointConnectionOperations
:ivar private_link_resource: PrivateLinkResourceOperations operations
:vartype private_link_resource: azure_machine_learning_workspaces.aio.operations_async.PrivateLinkResourceOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Azure subscription identifier.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: Optional[str] = None,
**kwargs: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = AzureMachineLearningWorkspacesConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.operation = OperationOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace = WorkspaceOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace_feature = WorkspaceFeatureOperations(
self._client, self._config, self._serialize, self._deserialize)
self.notebook = NotebookOperations(
self._client, self._config, self._serialize, self._deserialize)
self.usage = UsageOperations(
self._client, self._config, self._serialize, self._deserialize)
self.virtual_machine_size = VirtualMachineSizeOperations(
self._client, self._config, self._serialize, self._deserialize)
self.quota = QuotaOperations(
self._client, self._config, self._serialize, self._deserialize)
self.workspace_connection = WorkspaceConnectionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.machine_learning_compute = MachineLearningComputeOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connection = PrivateEndpointConnectionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.private_link_resource = PrivateLinkResourceOperations(
self._client, self._config, self._serialize, self._deserialize)

async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "AzureMachineLearningWorkspaces":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class AzureMachineLearningWorkspacesConfiguration(Configuration):
"""Configuration for AzureMachineLearningWorkspaces.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Azure subscription identifier.
:type subscription_id: str
"""

def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-06-01"
self.credential_scopes = ['https://management.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'azuremachinelearningworkspaces/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 ._operation_operations_async import OperationOperations
from ._workspace_operations_async import WorkspaceOperations
from ._workspace_feature_operations_async import WorkspaceFeatureOperations
from ._notebook_operations_async import NotebookOperations
from ._usage_operations_async import UsageOperations
from ._virtual_machine_size_operations_async import VirtualMachineSizeOperations
from ._quota_operations_async import QuotaOperations
from ._workspace_connection_operations_async import WorkspaceConnectionOperations
from ._machine_learning_compute_operations_async import MachineLearningComputeOperations
from ._azure_machine_learning_workspaces_operations_async import AzureMachineLearningWorkspacesOperationsMixin
from ._private_endpoint_connection_operations_async import PrivateEndpointConnectionOperations
from ._private_link_resource_operations_async import PrivateLinkResourceOperations

__all__ = [
'OperationOperations',
'WorkspaceOperations',
'WorkspaceFeatureOperations',
'NotebookOperations',
'UsageOperations',
'VirtualMachineSizeOperations',
'QuotaOperations',
'WorkspaceConnectionOperations',
'MachineLearningComputeOperations',
'AzureMachineLearningWorkspacesOperationsMixin',
'PrivateEndpointConnectionOperations',
'PrivateLinkResourceOperations',
]
Original file line number Diff line number Diff line change
@@ -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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class AzureMachineLearningWorkspacesOperationsMixin:

def list_sku(
self,
**kwargs
) -> AsyncIterable["models.SkuListResult"]:
"""Lists all skus with associated features.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SkuListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_machine_learning_workspaces.models.SkuListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.SkuListResult"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_sku.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

async def extract_data(pipeline_response):
deserialized = self._deserialize('SkuListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)

async def get_next(next_link=None):
request = prepare_request(next_link)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
error = self._deserialize(models.MachineLearningServiceError, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(
get_next, extract_data
)
list_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces/skus'} # type: ignore

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class NotebookOperations:
"""NotebookOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure_machine_learning_workspaces.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

async def _prepare_initial(
self,
resource_group_name: str,
workspace_name: str,
**kwargs
) -> "models.NotebookResourceInfo":
cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookResourceInfo"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

# Construct URL
url = self._prepare_initial.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.post(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.MachineLearningServiceError, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('NotebookResourceInfo', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
_prepare_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook'} # type: ignore

async def prepare(
self,
resource_group_name: str,
workspace_name: str,
**kwargs
) -> "models.NotebookResourceInfo":
"""prepare.
:param resource_group_name: Name of the resource group in which workspace is located.
:type resource_group_name: str
:param workspace_name: Name of Azure Machine Learning workspace.
:type workspace_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: NotebookResourceInfo, or the result of cls(response)
:rtype: ~azure_machine_learning_workspaces.models.NotebookResourceInfo
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["models.NotebookResourceInfo"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
raw_result = await self._prepare_initial(
resource_group_name=resource_group_name,
workspace_name=workspace_name,
cls=lambda x,y,z: x,
**kwargs
)

kwargs.pop('error_map', None)
kwargs.pop('content_type', None)

def get_long_running_output(pipeline_response):
deserialized = self._deserialize('NotebookResourceInfo', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return deserialized

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
prepare.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook'} # type: ignore
Original file line number Diff line number Diff line change
@@ -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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class OperationOperations:
"""OperationOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure_machine_learning_workspaces.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

def list(
self,
**kwargs
) -> AsyncIterable["models.OperationListResult"]:
"""Lists all of the available Azure Machine Learning Workspaces REST API operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_machine_learning_workspaces.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

async def extract_data(pipeline_response):
deserialized = self._deserialize('OperationListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)

async def get_next(next_link=None):
request = prepare_request(next_link)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
error = self._deserialize(models.MachineLearningServiceError, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.MachineLearningServices/operations'} # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class PrivateEndpointConnectionOperations:
"""PrivateEndpointConnectionOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure_machine_learning_workspaces.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

async def get(
self,
resource_group_name: str,
workspace_name: str,
private_endpoint_connection_name: str,
**kwargs
) -> "models.PrivateEndpointConnection":
"""Gets the specified private endpoint connection associated with the workspace.
:param resource_group_name: Name of the resource group in which workspace is located.
:type resource_group_name: str
:param workspace_name: Name of Azure Machine Learning workspace.
:type workspace_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the workspace.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection, or the result of cls(response)
:rtype: ~azure_machine_learning_workspaces.models.PrivateEndpointConnection
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

# Construct URL
url = self.get.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'),
'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore

async def put(
self,
resource_group_name: str,
workspace_name: str,
private_endpoint_connection_name: str,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
sku: Optional["models.Sku"] = None,
type: Optional[Union[str, "models.ResourceIdentityType"]] = None,
user_assigned_identities: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None,
private_endpoint: Optional["models.PrivateEndpoint"] = None,
private_link_service_connection_state: Optional["models.PrivateLinkServiceConnectionState"] = None,
**kwargs
) -> "models.PrivateEndpointConnection":
"""Update the state of specified private endpoint connection associated with the workspace.
:param resource_group_name: Name of the resource group in which workspace is located.
:type resource_group_name: str
:param workspace_name: Name of Azure Machine Learning workspace.
:type workspace_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the workspace.
:type private_endpoint_connection_name: str
:param location: Specifies the location of the resource.
:type location: str
:param tags: Contains resource tags defined as key/value pairs.
:type tags: dict[str, str]
:param sku: The sku of the workspace.
:type sku: ~azure_machine_learning_workspaces.models.Sku
:param type: The identity type.
:type type: str or ~azure_machine_learning_workspaces.models.ResourceIdentityType
:param user_assigned_identities: The list of user identities associated with resource. The user
identity dictionary key references will be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:type user_assigned_identities: dict[str, ~azure_machine_learning_workspaces.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties]
:param private_endpoint: The resource of private end point.
:type private_endpoint: ~azure_machine_learning_workspaces.models.PrivateEndpoint
:param private_link_service_connection_state: A collection of information about the state of
the connection between service consumer and provider.
:type private_link_service_connection_state: ~azure_machine_learning_workspaces.models.PrivateLinkServiceConnectionState
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection, or the result of cls(response)
:rtype: ~azure_machine_learning_workspaces.models.PrivateEndpointConnection
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_properties = models.PrivateEndpointConnection(location=location, tags=tags, sku=sku, type_identity_type=type, user_assigned_identities=user_assigned_identities, private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state)
api_version = "2020-06-01"
content_type = kwargs.pop("content_type", "application/json")

# Construct URL
url = self.put.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'),
'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = 'application/json'

# Construct and send request
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_properties, 'PrivateEndpointConnection')
body_content_kwargs['content'] = body_content
request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore

async def delete(
self,
resource_group_name: str,
workspace_name: str,
private_endpoint_connection_name: str,
**kwargs
) -> None:
"""Deletes the specified private endpoint connection associated with the workspace.
:param resource_group_name: Name of the resource group in which workspace is located.
:type resource_group_name: str
:param workspace_name: Name of Azure Machine Learning workspace.
:type workspace_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the workspace.
:type private_endpoint_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

# Construct URL
url = self.delete.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'),
'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]

# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
return cls(pipeline_response, None, {})

delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings

from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class PrivateLinkResourceOperations:
"""PrivateLinkResourceOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure_machine_learning_workspaces.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

async def list_by_workspace(
self,
resource_group_name: str,
workspace_name: str,
**kwargs
) -> "models.PrivateLinkResourceListResult":
"""Gets the private link resources that need to be created for a workspace.
:param resource_group_name: Name of the resource group in which workspace is located.
:type resource_group_name: str
:param workspace_name: Name of Azure Machine Learning workspace.
:type workspace_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResourceListResult, or the result of cls(response)
:rtype: ~azure_machine_learning_workspaces.models.PrivateLinkResourceListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

# Construct URL
url = self.list_by_workspace.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources'} # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar
import warnings

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class QuotaOperations:
"""QuotaOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure_machine_learning_workspaces.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

async def update(
self,
location: str,
value: Optional[List["models.QuotaBaseProperties"]] = None,
**kwargs
) -> "models.UpdateWorkspaceQuotasResult":
"""Update quota for each VM family in workspace.
:param location: The location for update quota is queried.
:type location: str
:param value: The list for update quota.
:type value: list[~azure_machine_learning_workspaces.models.QuotaBaseProperties]
:keyword callable cls: A custom type or function that will be passed the direct response
:return: UpdateWorkspaceQuotasResult, or the result of cls(response)
:rtype: ~azure_machine_learning_workspaces.models.UpdateWorkspaceQuotasResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.UpdateWorkspaceQuotasResult"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))

_parameters = models.QuotaUpdateParameters(value=value)
api_version = "2020-06-01"
content_type = kwargs.pop("content_type", "application/json")

# Construct URL
url = self.update.metadata['url'] # type: ignore
path_format_arguments = {
'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = 'application/json'

# Construct and send request
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_parameters, 'QuotaUpdateParameters')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.MachineLearningServiceError, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('UpdateWorkspaceQuotasResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas'} # type: ignore

def list(
self,
location: str,
**kwargs
) -> AsyncIterable["models.ListWorkspaceQuotas"]:
"""Gets the currently assigned Workspace Quotas based on VMFamily.
:param location: The location for which resource usage is queried.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ListWorkspaceQuotas or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_machine_learning_workspaces.models.ListWorkspaceQuotas]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.ListWorkspaceQuotas"]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-06-01"

def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')

else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = 'application/json'

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

async def extract_data(pipeline_response):
deserialized = self._deserialize('ListWorkspaceQuotas', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)

async def get_next(next_link=None):
request = prepare_request(next_link)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/Quotas'} # type: ignore
Loading