id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
4,275
from promptflow._sdk._configuration import Configuration PRIVACY_STATEMENT = """ Welcome to prompt flow! --------------------- Use `pf -h` to see available commands or go to https://aka.ms/pf-cli. Telemetry --------- The prompt flow CLI collects usage data in order to improve your experience. The data is anonymous and does not include commandline argument values. The data is collected by Microsoft. You can change your telemetry settings with `pf config`. """ def show_privacy_statement(): config = Configuration.get_instance() ran_before = config.get_config("first_run") if not ran_before: print(PRIVACY_STATEMENT) config.set_config("first_run", True)
null
4,276
from promptflow._sdk._configuration import Configuration WELCOME_MESSAGE = r""" ____ _ __ _ | _ \ _ __ ___ _ __ ___ _ __ | |_ / _| | _____ __ | |_) | '__/ _ \| '_ ` _ \| '_ \| __| | |_| |/ _ \ \ /\ / / | __/| | | (_) | | | | | | |_) | |_ | _| | (_) \ V V / |_| |_| \___/|_| |_| |_| .__/ \__| |_| |_|\___/ \_/\_/ |_| Welcome to the cool prompt flow CLI! Use `pf --version` to display the current version. Here are the base commands: """ def show_welcome_message(): print(WELCOME_MESSAGE)
null
4,277
import json import time from promptflow._cli._pf._experiment import add_experiment_parser, dispatch_experiment_commands from promptflow._cli._utils import _get_cli_activity_name, cli_exception_and_telemetry_handler from promptflow._sdk._configuration import Configuration from promptflow._sdk._telemetry.activity import update_activity_name import argparse import logging import sys from promptflow._cli._pf._config import add_config_parser, dispatch_config_commands from promptflow._cli._pf._connection import add_connection_parser, dispatch_connection_commands from promptflow._cli._pf._flow import add_flow_parser, dispatch_flow_commands from promptflow._cli._pf._run import add_run_parser, dispatch_run_commands from promptflow._cli._pf._tool import add_tool_parser, dispatch_tool_commands from promptflow._cli._pf.help import show_privacy_statement, show_welcome_message from promptflow._cli._pf._upgrade import add_upgrade_parser, upgrade_version from promptflow._cli._user_agent import USER_AGENT from promptflow._sdk._utils import ( # noqa: E402 get_promptflow_sdk_version, print_pf_version, setup_user_agent_to_operation_context, ) from promptflow._utils.logger_utils import get_cli_sdk_logger def run_command(args): # Log the init finish time init_finish_time = time.perf_counter() try: # --verbose, enable info logging if hasattr(args, "verbose") and args.verbose: for handler in logger.handlers: handler.setLevel(logging.INFO) # --debug, enable debug logging if hasattr(args, "debug") and args.debug: for handler in logger.handlers: handler.setLevel(logging.DEBUG) if args.version: print_pf_version() elif args.action == "flow": dispatch_flow_commands(args) elif args.action == "connection": dispatch_connection_commands(args) elif args.action == "run": dispatch_run_commands(args) elif args.action == "config": dispatch_config_commands(args) elif args.action == "tool": dispatch_tool_commands(args) elif args.action == "upgrade": upgrade_version(args) elif args.action == "experiment": dispatch_experiment_commands(args) except KeyboardInterrupt as ex: logger.debug("Keyboard interrupt is captured.") raise ex except SystemExit as ex: # some code directly call sys.exit, this is to make sure command metadata is logged exit_code = ex.code if ex.code is not None else 1 logger.debug(f"Code directly call sys.exit with code {exit_code}") raise ex except Exception as ex: logger.debug(f"Command {args} execute failed. {str(ex)}") raise ex finally: # Log the invoke finish time invoke_finish_time = time.perf_counter() logger.info( "Command ran in %.3f seconds (init: %.3f, invoke: %.3f)", invoke_finish_time - start_time, init_finish_time - start_time, invoke_finish_time - init_finish_time, ) def get_parser_args(argv): parser = argparse.ArgumentParser( prog="pf", formatter_class=argparse.RawDescriptionHelpFormatter, description="pf: manage prompt flow assets. Learn more: https://microsoft.github.io/promptflow.", ) parser.add_argument( "-v", "--version", dest="version", action="store_true", help="show current CLI version and exit" ) subparsers = parser.add_subparsers() add_upgrade_parser(subparsers) add_flow_parser(subparsers) add_connection_parser(subparsers) add_run_parser(subparsers) add_config_parser(subparsers) add_tool_parser(subparsers) if Configuration.get_instance().is_internal_features_enabled(): add_experiment_parser(subparsers) return parser.prog, parser.parse_args(argv) The provided code snippet includes necessary dependencies for implementing the `entry` function. Write a Python function `def entry(argv)` to solve the following problem: Control plane CLI tools for promptflow. Here is the function: def entry(argv): """ Control plane CLI tools for promptflow. """ prog, args = get_parser_args(argv) if hasattr(args, "user_agent"): setup_user_agent_to_operation_context(args.user_agent) activity_name = _get_cli_activity_name(cli=prog, args=args) activity_name = update_activity_name(activity_name, args=args) cli_exception_and_telemetry_handler(run_command, activity_name)(args)
Control plane CLI tools for promptflow.
4,278
import os from promptflow._cli._params import add_param_yes, base_params from promptflow._cli._utils import activate_action, get_cli_sdk_logger from promptflow._utils.utils import prompt_y_n from promptflow.exceptions import UserErrorException The provided code snippet includes necessary dependencies for implementing the `add_upgrade_parser` function. Write a Python function `def add_upgrade_parser(subparsers)` to solve the following problem: Add upgrade parser to the pf subparsers. Here is the function: def add_upgrade_parser(subparsers): """Add upgrade parser to the pf subparsers.""" epilog = """ Examples: # Upgrade prompt flow without prompt and run non-interactively: pf upgrade --yes """ # noqa: E501 add_params = [ add_param_yes, ] + base_params activate_action( name="upgrade", description="Upgrade prompt flow CLI.", epilog=epilog, add_params=add_params, subparsers=subparsers, help_message="pf upgrade", action_param_name="action", )
Add upgrade parser to the pf subparsers.
4,279
import os from promptflow._cli._params import add_param_yes, base_params from promptflow._cli._utils import activate_action, get_cli_sdk_logger from promptflow._utils.utils import prompt_y_n from promptflow.exceptions import UserErrorException logger = get_cli_sdk_logger() UPGRADE_MSG = "Not able to upgrade automatically" def _upgrade_on_windows(yes): """Download MSI to a temp folder and install it with msiexec.exe. Directly installing from URL may be blocked by policy: https://github.com/Azure/azure-cli/issues/19171 This also gives the user a chance to manually install the MSI in case of msiexec.exe failure. """ import subprocess import sys import tempfile msi_url = "https://aka.ms/installpromptflowwindowsx64" logger.warning("Updating prompt flow CLI with MSI from %s", msi_url) # Save MSI to ~\AppData\Local\Temp\promptflow-msi, clean up the folder first msi_dir = os.path.join(tempfile.gettempdir(), "promptflow-msi") try: import shutil shutil.rmtree(msi_dir) except FileNotFoundError: # The folder has already been deleted. No further retry is needed. # errno: 2, winerror: 3, strerror: 'The system cannot find the path specified' pass except OSError as err: logger.warning("Failed to delete '%s': %s. You may try to delete it manually.", msi_dir, err) os.makedirs(msi_dir, exist_ok=True) msi_path = _download_from_url(msi_url, msi_dir) if yes: subprocess.Popen(["msiexec.exe", "/i", msi_path, "/qn"]) else: subprocess.call(["msiexec.exe", "/i", msi_path]) logger.warning("Installation started. Please complete the upgrade in the opened window.") sys.exit(0) def upgrade_version(args): import platform import subprocess import sys from packaging.version import parse from promptflow._constants import _ENV_PF_INSTALLER, CLI_PACKAGE_NAME from promptflow._utils.version_hint_utils import get_latest_version from promptflow._version import VERSION as local_version installer = os.getenv(_ENV_PF_INSTALLER) or "" installer = installer.upper() print(f"installer: {installer}") latest_version = get_latest_version(CLI_PACKAGE_NAME, installer=installer) if not latest_version: logger.warning("Failed to get the latest prompt flow version.") return elif parse(latest_version) <= parse(local_version): logger.warning("You already have the latest prompt flow version: %s", local_version) return yes = args.yes exit_code = 0 latest_version_msg = ( "Upgrading prompt flow CLI version to {}.".format(latest_version) if yes else "Latest version available is {}.".format(latest_version) ) logger.warning("Your current prompt flow CLI version is %s. %s", local_version, latest_version_msg) if not yes: logger.warning("Please check the release notes first") if not sys.stdin.isatty(): logger.debug("No tty available.") raise UserErrorException("No tty available. Please run command with --yes.") confirmation = prompt_y_n("Do you want to continue?", default="y") if not confirmation: logger.debug("Upgrade stopped by user") return if installer == "MSI": _upgrade_on_windows(yes) elif installer == "PIP": pip_args = [ sys.executable, "-m", "pip", "install", "--upgrade", "promptflow[azure,executable,azureml-serving,executor-service]", "-vv", "--disable-pip-version-check", "--no-cache-dir", ] logger.debug("Update prompt flow with '%s'", " ".join(pip_args)) exit_code = subprocess.call(pip_args, shell=platform.system() == "Windows") elif installer == "SCRIPT": command = "curl https://promptflowartifact.blob.core.windows.net/linux-install-scripts/install | bash" logger.warning(f"{UPGRADE_MSG}, you can try to run {command} in your terminal directly to upgrade package.") return else: logger.warning(UPGRADE_MSG) return if exit_code: err_msg = "CLI upgrade failed." logger.warning(err_msg) sys.exit(exit_code) import importlib import json importlib.reload(subprocess) importlib.reload(json) version_result = subprocess.check_output(["pf", "version"], shell=platform.system() == "Windows") version_json = json.loads(version_result) new_version = version_json["promptflow"] if new_version == local_version: err_msg = f"CLI upgrade to version {latest_version} failed or aborted." logger.warning(err_msg) sys.exit(1) logger.warning("Upgrade finished.")
null
4,280
import jwt from promptflow.exceptions import ValidationException def is_arm_id(obj) -> bool: return isinstance(obj, str) and obj.startswith("azureml://")
null
4,281
import jwt from promptflow.exceptions import ValidationException def get_token(credential, resource) -> str: from azure.ai.ml._azure_environments import _resource_to_scopes azure_ml_scopes = _resource_to_scopes(resource) token = credential.get_token(*azure_ml_scopes).token # validate token has aml audience decoded_token = jwt.decode( token, options={"verify_signature": False, "verify_aud": False}, ) if decoded_token.get("aud") != resource: msg = """AAD token with aml scope could not be fetched using the credentials being used. Please validate if token with {0} scope can be fetched using credentials provided to PFClient. Token with {0} scope can be fetched using credentials.get_token({0}) """ raise ValidationException( message=msg.format(*azure_ml_scopes), ) return token def get_aml_token(credential) -> str: from azure.ai.ml._azure_environments import _get_aml_resource_id_from_metadata resource = _get_aml_resource_id_from_metadata() return get_token(credential, resource)
null
4,282
import jwt from promptflow.exceptions import ValidationException def get_arm_token(credential) -> str: from azure.ai.ml._azure_environments import _get_base_url_from_metadata resource = _get_base_url_from_metadata() return get_token(credential, resource) def get_authorization(credential=None) -> str: token = get_arm_token(credential=credential) return "Bearer " + token
null
4,283
import jwt from promptflow.exceptions import ValidationException def get_arm_token(credential) -> str: from azure.ai.ml._azure_environments import _get_base_url_from_metadata resource = _get_base_url_from_metadata() return get_token(credential, resource) def get_user_alias_from_credential(credential): token = get_arm_token(credential=credential) decode_json = jwt.decode(token, options={"verify_signature": False, "verify_aud": False}) try: email = decode_json.get("upn", decode_json.get("email", None)) return email.split("@")[0] except Exception: # use oid when failed to get upn, e.g. service principal return decode_json["oid"]
null
4,284
import asyncio import contextvars import functools import json from pathlib import Path from typing import Optional, Union import httpx from azure.core.exceptions import HttpResponseError from azure.storage.blob.aio import BlobServiceClient from promptflow._sdk._constants import DEFAULT_ENCODING, DownloadedRun from promptflow._sdk._errors import DownloadInternalError, RunNotFoundError, RunOperationError from promptflow._sdk.entities import Run from promptflow._utils.logger_utils import get_cli_sdk_logger from promptflow.exceptions import UserErrorException async def to_thread(func, /, *args, **kwargs): # this is copied from asyncio.to_thread() in Python 3.9 # as it is not available in Python 3.8, which is the minimum supported version of promptflow loop = asyncio.get_running_loop() ctx = contextvars.copy_context() func_call = functools.partial(ctx.run, func, *args, **kwargs) return await loop.run_in_executor(None, func_call)
null
4,285
from typing import Any, Dict, Union import requests from azure.ai.ml._scope_dependent_operations import ( OperationConfig, OperationsContainer, OperationScope, _ScopeDependentOperations, ) from azure.core.exceptions import ClientAuthenticationError from promptflow._constants import ConnectionAuthMode from promptflow._sdk.entities._connection import CustomConnection, _Connection from promptflow._utils.retry_utils import http_retry_wrapper from promptflow.azure._models._models import WorkspaceConnectionPropertiesV2BasicResource from promptflow.azure._restclient.flow_service_caller import FlowServiceCaller from promptflow.azure._utils.general import get_arm_token from promptflow.exceptions import ErrorTarget, SystemErrorException, UserErrorException def get_case_insensitive_key(d, key, default=None): for k, v in d.items(): if k.lower() == key.lower(): return v return default
null
4,286
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient The provided code snippet includes necessary dependencies for implementing the `list_logs_in_datastore` function. Write a Python function `def list_logs_in_datastore(ds_info: Dict[str, str], prefix: str, legacy_log_folder_name: str) -> Dict[str, str]` to solve the following problem: Returns a dictionary of file name to blob or data lake uri with SAS token, matching the structure of RunDetails.logFiles. legacy_log_folder_name: the name of the folder in the datastore that contains the logs /azureml-logs/*.txt is the legacy log structure for commandJob and sweepJob /logs/azureml/*.txt is the legacy log structure for pipeline parent Job Here is the function: def list_logs_in_datastore(ds_info: Dict[str, str], prefix: str, legacy_log_folder_name: str) -> Dict[str, str]: """Returns a dictionary of file name to blob or data lake uri with SAS token, matching the structure of RunDetails.logFiles. legacy_log_folder_name: the name of the folder in the datastore that contains the logs /azureml-logs/*.txt is the legacy log structure for commandJob and sweepJob /logs/azureml/*.txt is the legacy log structure for pipeline parent Job """ if ds_info["storage_type"] not in [ DatastoreType.AZURE_BLOB, DatastoreType.AZURE_DATA_LAKE_GEN2, ]: raise Exception("Only Blob and Azure DataLake Storage Gen2 datastores are supported.") storage_client = get_storage_client( credential=ds_info["credential"], container_name=ds_info["container_name"], storage_account=ds_info["storage_account"], storage_type=ds_info["storage_type"], ) items = storage_client.list(starts_with=prefix + "/user_logs/") # Append legacy log files if present items.extend(storage_client.list(starts_with=prefix + legacy_log_folder_name)) log_dict = {} for item_name in items: sub_name = item_name.split(prefix + "/")[1] if isinstance(storage_client, BlobStorageClient): token = generate_blob_sas( account_name=ds_info["storage_account"], container_name=ds_info["container_name"], blob_name=item_name, account_key=ds_info["credential"], permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(minutes=30), ) elif isinstance(storage_client, Gen2StorageClient): token = generate_file_sas( # pylint: disable=no-value-for-parameter account_name=ds_info["storage_account"], file_system_name=ds_info["container_name"], file_name=item_name, credential=ds_info["credential"], permission=FileSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(minutes=30), ) log_dict[sub_name] = "{}/{}/{}?{}".format(ds_info["account_url"], ds_info["container_name"], item_name, token) return log_dict
Returns a dictionary of file name to blob or data lake uri with SAS token, matching the structure of RunDetails.logFiles. legacy_log_folder_name: the name of the folder in the datastore that contains the logs /azureml-logs/*.txt is the legacy log structure for commandJob and sweepJob /logs/azureml/*.txt is the legacy log structure for pipeline parent Job
4,287
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def get_datastore_info(operations: DatastoreOperations, name: str) -> Dict[str, str]: """Get datastore account, type, and auth information.""" datastore_info = {} if name: datastore = operations.get(name, include_secrets=True) else: datastore = operations.get_default(include_secrets=True) storage_endpoint = _get_storage_endpoint_from_metadata() credentials = datastore.credentials datastore_info["storage_type"] = datastore.type datastore_info["storage_account"] = datastore.account_name datastore_info["account_url"] = STORAGE_ACCOUNT_URLS[datastore.type].format( datastore.account_name, storage_endpoint ) if isinstance(credentials, AccountKeyConfiguration): datastore_info["credential"] = credentials.account_key else: try: datastore_info["credential"] = credentials.sas_token except Exception as e: # pylint: disable=broad-except if not hasattr(credentials, "sas_token"): datastore_info["credential"] = operations._credential else: raise e if datastore.type == DatastoreType.AZURE_BLOB: datastore_info["container_name"] = str(datastore.container_name) elif datastore.type == DatastoreType.AZURE_DATA_LAKE_GEN2: datastore_info["container_name"] = str(datastore.filesystem) elif datastore.type == DatastoreType.AZURE_FILE: datastore_info["container_name"] = str(datastore.file_share_name) else: raise Exception( f"Datastore type {datastore.type} is not supported for uploads. " f"Supported types are {DatastoreType.AZURE_BLOB} and {DatastoreType.AZURE_DATA_LAKE_GEN2}." ) return datastore_info def _get_default_datastore_info(datastore_operation): return get_datastore_info(datastore_operation, None)
null
4,288
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def _get_datastore_name(*, datastore_name: Optional[str] = WORKSPACE_BLOB_STORE) -> str: datastore_name = WORKSPACE_BLOB_STORE if not datastore_name else datastore_name try: datastore_name = get_resource_name_from_arm_id(datastore_name) except (ValueError, AttributeError, ValidationException): module_logger.debug("datastore_name %s is not a full arm id. Proceed with a shortened name.\n", datastore_name) datastore_name = remove_aml_prefix(datastore_name) if is_ARM_id_for_resource(datastore_name): datastore_name = get_resource_name_from_arm_id(datastore_name) return datastore_name def get_datastore_info(operations: DatastoreOperations, name: str) -> Dict[str, str]: """Get datastore account, type, and auth information.""" datastore_info = {} if name: datastore = operations.get(name, include_secrets=True) else: datastore = operations.get_default(include_secrets=True) storage_endpoint = _get_storage_endpoint_from_metadata() credentials = datastore.credentials datastore_info["storage_type"] = datastore.type datastore_info["storage_account"] = datastore.account_name datastore_info["account_url"] = STORAGE_ACCOUNT_URLS[datastore.type].format( datastore.account_name, storage_endpoint ) if isinstance(credentials, AccountKeyConfiguration): datastore_info["credential"] = credentials.account_key else: try: datastore_info["credential"] = credentials.sas_token except Exception as e: # pylint: disable=broad-except if not hasattr(credentials, "sas_token"): datastore_info["credential"] = operations._credential else: raise e if datastore.type == DatastoreType.AZURE_BLOB: datastore_info["container_name"] = str(datastore.container_name) elif datastore.type == DatastoreType.AZURE_DATA_LAKE_GEN2: datastore_info["container_name"] = str(datastore.filesystem) elif datastore.type == DatastoreType.AZURE_FILE: datastore_info["container_name"] = str(datastore.file_share_name) else: raise Exception( f"Datastore type {datastore.type} is not supported for uploads. " f"Supported types are {DatastoreType.AZURE_BLOB} and {DatastoreType.AZURE_DATA_LAKE_GEN2}." ) return datastore_info def download_artifact( starts_with: Union[str, os.PathLike], destination: str, datastore_operation: DatastoreOperations, datastore_name: Optional[str], datastore_info: Optional[Dict] = None, ) -> str: """Download datastore path to local file or directory. :param Union[str, os.PathLike] starts_with: Prefix of blobs to download :param str destination: Path that files will be written to :param DatastoreOperations datastore_operation: Datastore operations :param Optional[str] datastore_name: name of datastore :param Dict datastore_info: the return value of invoking get_datastore_info :return str: Path that files were written to """ starts_with = starts_with.as_posix() if isinstance(starts_with, Path) else starts_with datastore_name = _get_datastore_name(datastore_name=datastore_name) if datastore_info is None: datastore_info = get_datastore_info(datastore_operation, datastore_name) storage_client = get_storage_client(**datastore_info) storage_client.download(starts_with=starts_with, destination=destination) return destination The provided code snippet includes necessary dependencies for implementing the `download_artifact_from_storage_url` function. Write a Python function `def download_artifact_from_storage_url( blob_url: str, destination: str, datastore_operation: DatastoreOperations, datastore_name: Optional[str], ) -> str` to solve the following problem: Download datastore blob URL to local file or directory. Here is the function: def download_artifact_from_storage_url( blob_url: str, destination: str, datastore_operation: DatastoreOperations, datastore_name: Optional[str], ) -> str: """Download datastore blob URL to local file or directory.""" datastore_name = _get_datastore_name(datastore_name=datastore_name) datastore_info = get_datastore_info(datastore_operation, datastore_name) starts_with = get_artifact_path_from_storage_url( blob_url=str(blob_url), container_name=datastore_info.get("container_name") ) return download_artifact( starts_with=starts_with, destination=destination, datastore_operation=datastore_operation, datastore_name=datastore_name, datastore_info=datastore_info, )
Download datastore blob URL to local file or directory.
4,289
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def download_artifact( starts_with: Union[str, os.PathLike], destination: str, datastore_operation: DatastoreOperations, datastore_name: Optional[str], datastore_info: Optional[Dict] = None, ) -> str: """Download datastore path to local file or directory. :param Union[str, os.PathLike] starts_with: Prefix of blobs to download :param str destination: Path that files will be written to :param DatastoreOperations datastore_operation: Datastore operations :param Optional[str] datastore_name: name of datastore :param Dict datastore_info: the return value of invoking get_datastore_info :return str: Path that files were written to """ starts_with = starts_with.as_posix() if isinstance(starts_with, Path) else starts_with datastore_name = _get_datastore_name(datastore_name=datastore_name) if datastore_info is None: datastore_info = get_datastore_info(datastore_operation, datastore_name) storage_client = get_storage_client(**datastore_info) storage_client.download(starts_with=starts_with, destination=destination) return destination The provided code snippet includes necessary dependencies for implementing the `download_artifact_from_aml_uri` function. Write a Python function `def download_artifact_from_aml_uri(uri: str, destination: str, datastore_operation: DatastoreOperations)` to solve the following problem: Downloads artifact pointed to by URI of the form `azureml://...` to destination. :param str uri: AzureML uri of artifact to download :param str destination: Path to download artifact to :param DatastoreOperations datastore_operation: datastore operations :return str: Path that files were downloaded to Here is the function: def download_artifact_from_aml_uri(uri: str, destination: str, datastore_operation: DatastoreOperations): """Downloads artifact pointed to by URI of the form `azureml://...` to destination. :param str uri: AzureML uri of artifact to download :param str destination: Path to download artifact to :param DatastoreOperations datastore_operation: datastore operations :return str: Path that files were downloaded to """ parsed_uri = AzureMLDatastorePathUri(uri) return download_artifact( starts_with=parsed_uri.path, destination=destination, datastore_operation=datastore_operation, datastore_name=parsed_uri.datastore, )
Downloads artifact pointed to by URI of the form `azureml://...` to destination. :param str uri: AzureML uri of artifact to download :param str destination: Path to download artifact to :param DatastoreOperations datastore_operation: datastore operations :return str: Path that files were downloaded to
4,290
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def get_datastore_info(operations: DatastoreOperations, name: str) -> Dict[str, str]: """Get datastore account, type, and auth information.""" datastore_info = {} if name: datastore = operations.get(name, include_secrets=True) else: datastore = operations.get_default(include_secrets=True) storage_endpoint = _get_storage_endpoint_from_metadata() credentials = datastore.credentials datastore_info["storage_type"] = datastore.type datastore_info["storage_account"] = datastore.account_name datastore_info["account_url"] = STORAGE_ACCOUNT_URLS[datastore.type].format( datastore.account_name, storage_endpoint ) if isinstance(credentials, AccountKeyConfiguration): datastore_info["credential"] = credentials.account_key else: try: datastore_info["credential"] = credentials.sas_token except Exception as e: # pylint: disable=broad-except if not hasattr(credentials, "sas_token"): datastore_info["credential"] = operations._credential else: raise e if datastore.type == DatastoreType.AZURE_BLOB: datastore_info["container_name"] = str(datastore.container_name) elif datastore.type == DatastoreType.AZURE_DATA_LAKE_GEN2: datastore_info["container_name"] = str(datastore.filesystem) elif datastore.type == DatastoreType.AZURE_FILE: datastore_info["container_name"] = str(datastore.file_share_name) else: raise Exception( f"Datastore type {datastore.type} is not supported for uploads. " f"Supported types are {DatastoreType.AZURE_BLOB} and {DatastoreType.AZURE_DATA_LAKE_GEN2}." ) return datastore_info The provided code snippet includes necessary dependencies for implementing the `aml_datastore_path_exists` function. Write a Python function `def aml_datastore_path_exists( uri: str, datastore_operation: DatastoreOperations, datastore_info: Optional[dict] = None )` to solve the following problem: Checks whether `uri` of the form "azureml://" points to either a directory or a file. :param str uri: azure ml datastore uri :param DatastoreOperations datastore_operation: Datastore operation :param dict datastore_info: return value of get_datastore_info Here is the function: def aml_datastore_path_exists( uri: str, datastore_operation: DatastoreOperations, datastore_info: Optional[dict] = None ): """Checks whether `uri` of the form "azureml://" points to either a directory or a file. :param str uri: azure ml datastore uri :param DatastoreOperations datastore_operation: Datastore operation :param dict datastore_info: return value of get_datastore_info """ parsed_uri = AzureMLDatastorePathUri(uri) datastore_info = datastore_info or get_datastore_info(datastore_operation, parsed_uri.datastore) return get_storage_client(**datastore_info).exists(parsed_uri.path)
Checks whether `uri` of the form "azureml://" points to either a directory or a file. :param str uri: azure ml datastore uri :param DatastoreOperations datastore_operation: Datastore operation :param dict datastore_info: return value of get_datastore_info
4,291
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def _upload_to_datastore( operation_scope: OperationScope, datastore_operation: DatastoreOperations, path: Union[str, Path, os.PathLike], artifact_type: str, datastore_name: Optional[str] = None, show_progress: bool = True, asset_name: Optional[str] = None, asset_version: Optional[str] = None, asset_hash: Optional[str] = None, ignore_file: Optional[IgnoreFile] = None, sas_uri: Optional[str] = None, # contains registry sas url ) -> ArtifactStorageInfo: _validate_path(path, _type=artifact_type) if not ignore_file: ignore_file = get_ignore_file(path) if not asset_hash: asset_hash = get_object_hash(path, ignore_file) artifact = upload_artifact( str(path), datastore_operation, operation_scope, datastore_name, show_progress=show_progress, asset_hash=asset_hash, asset_name=asset_name, asset_version=asset_version, ignore_file=ignore_file, sas_uri=sas_uri, ) return artifact def _upload_and_generate_remote_uri( operation_scope: OperationScope, datastore_operation: DatastoreOperations, path: Union[str, Path, os.PathLike], artifact_type: str = ErrorTarget.ARTIFACT, datastore_name: str = WORKSPACE_BLOB_STORE, show_progress: bool = True, ) -> str: # Asset name is required for uploading to a datastore asset_name = str(uuid.uuid4()) artifact_info = _upload_to_datastore( operation_scope=operation_scope, datastore_operation=datastore_operation, path=path, datastore_name=datastore_name, asset_name=asset_name, artifact_type=artifact_type, show_progress=show_progress, ) path = artifact_info.relative_path datastore = AMLNamedArmId(artifact_info.datastore_arm_id).asset_name return SHORT_URI_FORMAT.format(datastore, path)
null
4,292
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def _update_blob_metadata(name, version, indicator_file, storage_client) -> None: container_client = storage_client.container_client if indicator_file.startswith(storage_client.container): indicator_file = indicator_file.split(storage_client.container)[1] blob = container_client.get_blob_client(blob=indicator_file) blob.set_blob_metadata(_build_metadata_dict(name=name, version=version)) def _update_gen2_metadata(name, version, indicator_file, storage_client) -> None: artifact_directory_client = storage_client.file_system_client.get_directory_client(indicator_file) artifact_directory_client.set_metadata(_build_metadata_dict(name=name, version=version)) def _update_metadata(name, version, indicator_file, datastore_info) -> None: storage_client = get_storage_client(**datastore_info) if isinstance(storage_client, BlobStorageClient): _update_blob_metadata(name, version, indicator_file, storage_client) elif isinstance(storage_client, Gen2StorageClient): _update_gen2_metadata(name, version, indicator_file, storage_client)
null
4,293
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def _upload_to_datastore( operation_scope: OperationScope, datastore_operation: DatastoreOperations, path: Union[str, Path, os.PathLike], artifact_type: str, datastore_name: Optional[str] = None, show_progress: bool = True, asset_name: Optional[str] = None, asset_version: Optional[str] = None, asset_hash: Optional[str] = None, ignore_file: Optional[IgnoreFile] = None, sas_uri: Optional[str] = None, # contains registry sas url ) -> ArtifactStorageInfo: _validate_path(path, _type=artifact_type) if not ignore_file: ignore_file = get_ignore_file(path) if not asset_hash: asset_hash = get_object_hash(path, ignore_file) artifact = upload_artifact( str(path), datastore_operation, operation_scope, datastore_name, show_progress=show_progress, asset_hash=asset_hash, asset_name=asset_name, asset_version=asset_version, ignore_file=ignore_file, sas_uri=sas_uri, ) return artifact T = TypeVar("T", bound=Artifact) The provided code snippet includes necessary dependencies for implementing the `_check_and_upload_path` function. Write a Python function `def _check_and_upload_path( artifact: T, asset_operations: Union["DataOperations", "ModelOperations", "CodeOperations", "FeatureSetOperations"], artifact_type: str, datastore_name: Optional[str] = None, sas_uri: Optional[str] = None, show_progress: bool = True, )` to solve the following problem: Checks whether `artifact` is a path or a uri and uploads it to the datastore if necessary. param T artifact: artifact to check and upload param Union["DataOperations", "ModelOperations", "CodeOperations"] asset_operations: the asset operations to use for uploading param str datastore_name: the name of the datastore to upload to param str sas_uri: the sas uri to use for uploading Here is the function: def _check_and_upload_path( artifact: T, asset_operations: Union["DataOperations", "ModelOperations", "CodeOperations", "FeatureSetOperations"], artifact_type: str, datastore_name: Optional[str] = None, sas_uri: Optional[str] = None, show_progress: bool = True, ): """Checks whether `artifact` is a path or a uri and uploads it to the datastore if necessary. param T artifact: artifact to check and upload param Union["DataOperations", "ModelOperations", "CodeOperations"] asset_operations: the asset operations to use for uploading param str datastore_name: the name of the datastore to upload to param str sas_uri: the sas uri to use for uploading """ from azure.ai.ml._utils.utils import is_mlflow_uri, is_url datastore_name = artifact.datastore if ( hasattr(artifact, "local_path") and artifact.local_path is not None or ( hasattr(artifact, "path") and artifact.path is not None and not (is_url(artifact.path) or is_mlflow_uri(artifact.path)) ) ): path = ( Path(artifact.path) if hasattr(artifact, "path") and artifact.path is not None else Path(artifact.local_path) ) if not path.is_absolute(): path = Path(artifact.base_path, path).resolve() uploaded_artifact = _upload_to_datastore( asset_operations._operation_scope, asset_operations._datastore_operation, path, datastore_name=datastore_name, asset_name=artifact.name, asset_version=str(artifact.version), asset_hash=artifact._upload_hash if hasattr(artifact, "_upload_hash") else None, sas_uri=sas_uri, artifact_type=artifact_type, show_progress=show_progress, ignore_file=getattr(artifact, "_ignore_file", None), ) return uploaded_artifact
Checks whether `artifact` is a path or a uri and uploads it to the datastore if necessary. param T artifact: artifact to check and upload param Union["DataOperations", "ModelOperations", "CodeOperations"] asset_operations: the asset operations to use for uploading param str datastore_name: the name of the datastore to upload to param str sas_uri: the sas uri to use for uploading
4,294
import os import uuid from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Optional, TypeVar, Union from azure.ai.ml._artifacts._blob_storage_helper import BlobStorageClient from azure.ai.ml._artifacts._gen2_storage_helper import Gen2StorageClient from azure.ai.ml._azure_environments import _get_storage_endpoint_from_metadata from azure.ai.ml._restclient.v2022_10_01.models import DatastoreType from azure.ai.ml._scope_dependent_operations import OperationScope from azure.ai.ml._utils._arm_id_utils import ( AMLNamedArmId, get_resource_name_from_arm_id, is_ARM_id_for_resource, remove_aml_prefix, ) from azure.ai.ml._utils._asset_utils import ( IgnoreFile, _build_metadata_dict, _validate_path, get_ignore_file, get_object_hash, ) from azure.ai.ml._utils._storage_utils import ( AzureMLDatastorePathUri, get_artifact_path_from_storage_url, get_storage_client, ) from azure.ai.ml.constants._common import SHORT_URI_FORMAT, STORAGE_ACCOUNT_URLS from azure.ai.ml.entities import Environment from azure.ai.ml.entities._assets._artifacts.artifact import Artifact, ArtifactStorageInfo from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore._constants import WORKSPACE_BLOB_STORE from azure.ai.ml.exceptions import ErrorTarget, ValidationException from azure.ai.ml.operations._datastore_operations import DatastoreOperations from azure.storage.blob import BlobSasPermissions, generate_blob_sas from azure.storage.filedatalake import FileSasPermissions, generate_file_sas from ..._utils.logger_utils import LoggerFactory from ._fileshare_storeage_helper import FlowFileStorageClient def _upload_to_datastore( operation_scope: OperationScope, datastore_operation: DatastoreOperations, path: Union[str, Path, os.PathLike], artifact_type: str, datastore_name: Optional[str] = None, show_progress: bool = True, asset_name: Optional[str] = None, asset_version: Optional[str] = None, asset_hash: Optional[str] = None, ignore_file: Optional[IgnoreFile] = None, sas_uri: Optional[str] = None, # contains registry sas url ) -> ArtifactStorageInfo: _validate_path(path, _type=artifact_type) if not ignore_file: ignore_file = get_ignore_file(path) if not asset_hash: asset_hash = get_object_hash(path, ignore_file) artifact = upload_artifact( str(path), datastore_operation, operation_scope, datastore_name, show_progress=show_progress, asset_hash=asset_hash, asset_name=asset_name, asset_version=asset_version, ignore_file=ignore_file, sas_uri=sas_uri, ) return artifact def _check_and_upload_env_build_context( environment: Environment, operations: "EnvironmentOperations", sas_uri=None, show_progress: bool = True, ) -> Environment: if environment.path: uploaded_artifact = _upload_to_datastore( operations._operation_scope, operations._datastore_operation, environment.path, asset_name=environment.name, asset_version=str(environment.version), asset_hash=environment._upload_hash, sas_uri=sas_uri, artifact_type=ErrorTarget.ENVIRONMENT, datastore_name=environment.datastore, show_progress=show_progress, ) # TODO: Depending on decision trailing "/" needs to stay or not. EMS requires it to be present environment.build.path = uploaded_artifact.full_storage_path + "/" return environment
null
4,295
import json import os import sys import time import uuid from functools import wraps, cached_property import pydash from azure.core.exceptions import HttpResponseError, ResourceExistsError from azure.core.pipeline.policies import RetryPolicy from promptflow._sdk._telemetry import request_id_context from promptflow._sdk._telemetry import TelemetryMixin from promptflow._utils.logger_utils import LoggerFactory from promptflow.azure._constants._flow import AUTOMATIC_RUNTIME, SESSION_CREATION_TIMEOUT_ENV_VAR from promptflow.azure._restclient.flow import AzureMachineLearningDesignerServiceClient from promptflow.azure._utils.general import get_authorization, get_arm_token, get_aml_token from promptflow.exceptions import UserErrorException, PromptflowException, SystemErrorException class FlowRequestException(SystemErrorException): """FlowRequestException.""" def __init__(self, message, **kwargs): super().__init__(message, **kwargs) class RequestTelemetryMixin(TelemetryMixin): def __init__(self): super().__init__() self._refresh_request_id_for_telemetry() self._from_cli = False def _get_telemetry_values(self, *args, **kwargs): return {"request_id": self._request_id, "from_cli": self._from_cli} def _set_from_cli_for_telemetry(self): self._from_cli = True def _refresh_request_id_for_telemetry(self): # refresh request id from current request id context self._request_id = request_id_context.get() or str(uuid.uuid4()) The provided code snippet includes necessary dependencies for implementing the `_request_wrapper` function. Write a Python function `def _request_wrapper()` to solve the following problem: Wrapper for request. Will refresh request id and pretty print exception. Here is the function: def _request_wrapper(): """Wrapper for request. Will refresh request id and pretty print exception.""" def exception_wrapper(func): @wraps(func) def wrapper(self, *args, **kwargs): if not isinstance(self, RequestTelemetryMixin): raise PromptflowException(f"Wrapped function is not RequestTelemetryMixin, got {type(self)}") # refresh request before each request self._refresh_request_id_for_telemetry() try: return func(self, *args, **kwargs) except HttpResponseError as e: raise FlowRequestException( f"Calling {func.__name__} failed with request id: {self._request_id} \n" f"Status code: {e.status_code} \n" f"Reason: {e.reason} \n" f"Error message: {e.message} \n" ) return wrapper return exception_wrapper
Wrapper for request. Will refresh request id and pretty print exception.
4,296
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def build_get_runtime_latest_config_request( **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/runtimes/latestConfig') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,297
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,298
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_update_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=url, headers=header_parameters, **kwargs )
null
4,299
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,300
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_delete_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest connection_scope = kwargs.pop('connection_scope', None) # type: Optional[Union[str, "_models.ConnectionScope"]] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if connection_scope is not None: query_parameters['connectionScope'] = _SERIALIZER.query("connection_scope", connection_scope, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,301
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_connections_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,302
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_connection_specs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connection/specs') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,303
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_index_entity_by_id_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/v1.0/flows/getIndexEntities') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,304
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_updated_entity_ids_for_workspace_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/v1.0/flows/rebuildIndex') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,305
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error, ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_flow_session_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str session_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] waitfor_completion = kwargs.pop('waitfor_completion', False) # type: Optional[bool] accept = "text/plain, application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessionsAdmin/{sessionId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "sessionId": _SERIALIZER.url("session_id", session_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if waitfor_completion is not None: query_parameters['waitforCompletion'] = _SERIALIZER.query("waitfor_completion", waitfor_completion, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,306
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_runtime_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] async_call = kwargs.pop('async_call', False) # type: Optional[bool] msi_token = kwargs.pop('msi_token', False) # type: Optional[bool] skip_port_check = kwargs.pop('skip_port_check', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if async_call is not None: query_parameters['asyncCall'] = _SERIALIZER.query("async_call", async_call, 'bool') if msi_token is not None: query_parameters['msiToken'] = _SERIALIZER.query("msi_token", msi_token, 'bool') if skip_port_check is not None: query_parameters['skipPortCheck'] = _SERIALIZER.query("skip_port_check", skip_port_check, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,307
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_update_runtime_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] async_call = kwargs.pop('async_call', False) # type: Optional[bool] msi_token = kwargs.pop('msi_token', False) # type: Optional[bool] skip_port_check = kwargs.pop('skip_port_check', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if async_call is not None: query_parameters['asyncCall'] = _SERIALIZER.query("async_call", async_call, 'bool') if msi_token is not None: query_parameters['msiToken'] = _SERIALIZER.query("msi_token", msi_token, 'bool') if skip_port_check is not None: query_parameters['skipPortCheck'] = _SERIALIZER.query("skip_port_check", skip_port_check, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,308
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_runtime_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,309
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_delete_runtime_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest async_call = kwargs.pop('async_call', False) # type: Optional[bool] msi_token = kwargs.pop('msi_token', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if async_call is not None: query_parameters['asyncCall'] = _SERIALIZER.query("async_call", async_call, 'bool') if msi_token is not None: query_parameters['msiToken'] = _SERIALIZER.query("msi_token", msi_token, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,310
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_check_ci_availability_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest compute_instance_name = kwargs.pop('compute_instance_name') # type: str custom_app_name = kwargs.pop('custom_app_name') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/checkCiAvailability') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['computeInstanceName'] = _SERIALIZER.query("compute_instance_name", compute_instance_name, 'str') query_parameters['customAppName'] = _SERIALIZER.query("custom_app_name", custom_app_name, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,311
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_check_mir_availability_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest endpoint_name = kwargs.pop('endpoint_name') # type: str deployment_name = kwargs.pop('deployment_name') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/checkMirAvailability') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['endpointName'] = _SERIALIZER.query("endpoint_name", endpoint_name, 'str') query_parameters['deploymentName'] = _SERIALIZER.query("deployment_name", deployment_name, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,312
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_check_runtime_upgrade_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}/needUpgrade') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,313
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_runtime_capability_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str runtime_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/{runtimeName}/capability') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "runtimeName": _SERIALIZER.url("runtime_name", runtime_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,314
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_runtime_latest_config_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes/latestConfig') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,315
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_runtimes_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRuntimes') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,316
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_submit_bulk_run_async_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest error_handling_mode = kwargs.pop('error_handling_mode', None) # type: Optional[Union[str, "_models.ErrorHandlingMode"]] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/submit') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if error_handling_mode is not None: query_parameters['errorHandlingMode'] = _SERIALIZER.query("error_handling_mode", error_handling_mode, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,317
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_send_policy_validation_async_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/policy') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,318
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_check_policy_validation_async_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/policy') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,319
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_log_result_for_bulk_run_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/LogResult') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,320
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_storage_info_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/storageInfo') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,321
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_log_flow_run_event_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str runtime_version, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/flowRuns/{flowRunId}/runtime/{runtimeVersion}/logEvent') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), "runtimeVersion": _SERIALIZER.url("runtime_version", runtime_version, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,322
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_log_flow_run_event_v2_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest runtime_version = kwargs.pop('runtime_version', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/flowRuns/{flowRunId}/logEvent') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if runtime_version is not None: query_parameters['runtimeVersion'] = _SERIALIZER.query("runtime_version", runtime_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,323
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_log_flow_run_terminated_event_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest last_checked_time = kwargs.pop('last_checked_time', None) # type: Optional[datetime.datetime] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/flowRuns/{flowRunId}/logTerminatedEvent') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if last_checked_time is not None: query_parameters['lastCheckedTime'] = _SERIALIZER.query("last_checked_time", last_checked_time, 'iso-8601') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,324
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_update_service_logs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/serviceLogs') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,325
import datetime import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_batch_update_service_logs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/bulkRuns/{bulkRunId}/serviceLogs/batch') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkRunId": _SERIALIZER.url("bulk_run_id", bulk_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,326
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_init_trace_session_async_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest overwrite = kwargs.pop('overwrite', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/TraceSessions/initialize') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if overwrite is not None: query_parameters['overwrite'] = _SERIALIZER.query("overwrite", overwrite, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,327
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_cleanup_trace_session_async_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/TraceSessions/cleanup') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,328
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_poll_trace_session_status_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str operation_id, # type: str operation_type, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/TraceSessions/operation/{operationType}/{operationId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), "operationType": _SERIALIZER.url("operation_type", operation_type, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,329
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_attach_cosmos_account_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] overwrite = kwargs.pop('overwrite', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/TraceSessions/attachDb') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if overwrite is not None: query_parameters['overwrite'] = _SERIALIZER.query("overwrite", overwrite, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,330
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_cosmos_resource_token_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str container_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest acquire_write = kwargs.pop('acquire_write', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/TraceSessions/container/{containerName}/resourceToken') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if acquire_write is not None: query_parameters['acquireWrite'] = _SERIALIZER.query("acquire_write", acquire_write, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,331
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] experiment_id = kwargs.pop('experiment_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if experiment_id is not None: query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,332
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_flows_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id', None) # type: Optional[str] owned_only = kwargs.pop('owned_only', None) # type: Optional[bool] flow_type = kwargs.pop('flow_type', None) # type: Optional[Union[str, "_models.FlowType"]] list_view_type = kwargs.pop('list_view_type', None) # type: Optional[Union[str, "_models.ListViewType"]] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if experiment_id is not None: query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') if owned_only is not None: query_parameters['ownedOnly'] = _SERIALIZER.query("owned_only", owned_only, 'bool') if flow_type is not None: query_parameters['flowType'] = _SERIALIZER.query("flow_type", flow_type, 'str') if list_view_type is not None: query_parameters['listViewType'] = _SERIALIZER.query("list_view_type", list_view_type, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,333
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_update_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,334
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_patch_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,335
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,336
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_submit_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] experiment_id = kwargs.pop('experiment_id') # type: str endpoint_name = kwargs.pop('endpoint_name', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/submit') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') if endpoint_name is not None: query_parameters['endpointName'] = _SERIALIZER.query("endpoint_name", endpoint_name, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,337
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_run_status_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/{flowRunId}/status') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if experiment_id is not None: query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,338
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_flow_run_info_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/runs/{flowRunId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,339
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_flow_child_runs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest index = kwargs.pop('index', None) # type: Optional[int] start_index = kwargs.pop('start_index', None) # type: Optional[int] end_index = kwargs.pop('end_index', None) # type: Optional[int] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/runs/{flowRunId}/childRuns') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if index is not None: query_parameters['index'] = _SERIALIZER.query("index", index, 'int') if start_index is not None: query_parameters['startIndex'] = _SERIALIZER.query("start_index", start_index, 'int') if end_index is not None: query_parameters['endIndex'] = _SERIALIZER.query("end_index", end_index, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,340
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_get_flow_node_runs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str node_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest index = kwargs.pop('index', None) # type: Optional[int] start_index = kwargs.pop('start_index', None) # type: Optional[int] end_index = kwargs.pop('end_index', None) # type: Optional[int] aggregation = kwargs.pop('aggregation', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/runs/{flowRunId}/nodeRuns/{nodeName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if index is not None: query_parameters['index'] = _SERIALIZER.query("index", index, 'int') if start_index is not None: query_parameters['startIndex'] = _SERIALIZER.query("start_index", start_index, 'int') if end_index is not None: query_parameters['endIndex'] = _SERIALIZER.query("end_index", end_index, 'int') if aggregation is not None: query_parameters['aggregation'] = _SERIALIZER.query("aggregation", aggregation, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,341
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_node_run_base_path_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str node_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/runs/{flowRunId}/nodeRuns/{nodeName}/basePath') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,342
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_bulk_tests_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/bulkTests') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if experiment_id is not None: query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,343
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_bulk_test_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str bulk_test_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/bulkTests/{bulkTestId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "bulkTestId": _SERIALIZER.url("bulk_test_id", bulk_test_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,344
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_deploy_reserved_environment_variable_names_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/DeployReservedEnvironmentVariableNames') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,345
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_deploy_flow_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] async_call = kwargs.pop('async_call', False) # type: Optional[bool] msi_token = kwargs.pop('msi_token', False) # type: Optional[bool] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/deploy') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if async_call is not None: query_parameters['asyncCall'] = _SERIALIZER.query("async_call", async_call, 'bool') if msi_token is not None: query_parameters['msiToken'] = _SERIALIZER.query("msi_token", msi_token, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,346
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_run_log_content_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/runs/{flowRunId}/logContent') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,347
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_cancel_flow_run_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "text/plain, application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/runs/{flowRunId}/cancel') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,348
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_cancel_flow_test_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str flow_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "text/plain, application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/flowTests/{flowRunId}/cancel') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), "flowRunId": _SERIALIZER.url("flow_run_id", flow_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,349
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_cancel_bulk_test_run_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str bulk_test_run_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "text/plain, application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/bulkTests/{bulkTestRunId}/cancel') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "bulkTestRunId": _SERIALIZER.url("bulk_test_run_id", bulk_test_run_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,350
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_snapshot_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/FlowSnapshot') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,351
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_connection_override_settings_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] runtime_name = kwargs.pop('runtime_name', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/connectionOverride') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if runtime_name is not None: query_parameters['runtimeName'] = _SERIALIZER.query("runtime_name", runtime_name, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,352
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_inputs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/flowInputs') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,353
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_load_as_component_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/LoadAsComponent') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,354
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_tools_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/flowTools') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,355
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_setup_flow_session_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/sessions') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,356
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_delete_flow_session_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/sessions') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,357
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_session_status_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/sessions/status') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,358
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): def build_list_flow_session_pip_packages_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str flow_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest experiment_id = kwargs.pop('experiment_id') # type: str accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Flows/{flowId}/sessions/pipPackages') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "flowId": _SERIALIZER.url("flow_id", flow_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['experimentId'] = _SERIALIZER.query("experiment_id", experiment_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,359
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,360
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_update_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=url, headers=header_parameters, **kwargs )
null
4,361
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,362
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_delete_connection_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=url, headers=header_parameters, **kwargs )
null
4,363
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_connection_with_secrets_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}/listsecrets') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,364
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_connections_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,365
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_connection_specs_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/specs') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,366
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_list_azure_open_ai_deployments_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Connections/{connectionName}/AzureOpenAIDeployments') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,367
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_tool_setting_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/setting') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null
4,368
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_tool_meta_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] tool_name = kwargs.pop('tool_name') # type: str tool_type = kwargs.pop('tool_type') # type: str endpoint_name = kwargs.pop('endpoint_name', None) # type: Optional[str] flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] flow_id = kwargs.pop('flow_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/meta') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['toolName'] = _SERIALIZER.query("tool_name", tool_name, 'str') query_parameters['toolType'] = _SERIALIZER.query("tool_type", tool_type, 'str') if endpoint_name is not None: query_parameters['endpointName'] = _SERIALIZER.query("endpoint_name", endpoint_name, 'str') if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') if flow_id is not None: query_parameters['flowId'] = _SERIALIZER.query("flow_id", flow_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,369
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_tool_meta_v2_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] flow_id = kwargs.pop('flow_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/meta-v2') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') if flow_id is not None: query_parameters['flowId'] = _SERIALIZER.query("flow_id", flow_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,370
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_package_tools_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] flow_id = kwargs.pop('flow_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/packageTools') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') if flow_id is not None: query_parameters['flowId'] = _SERIALIZER.query("flow_id", flow_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,371
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_dynamic_list_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] flow_id = kwargs.pop('flow_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/dynamicList') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') if flow_id is not None: query_parameters['flowId'] = _SERIALIZER.query("flow_id", flow_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,372
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_retrieve_tool_func_result_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] flow_runtime_name = kwargs.pop('flow_runtime_name', None) # type: Optional[str] flow_id = kwargs.pop('flow_id', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/Tools/RetrieveToolFuncResult') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if flow_runtime_name is not None: query_parameters['flowRuntimeName'] = _SERIALIZER.query("flow_runtime_name", flow_runtime_name, 'str') if flow_id is not None: query_parameters['flowId'] = _SERIALIZER.query("flow_id", flow_id, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs )
null
4,373
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_create_flow_session_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str session_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/{sessionId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "sessionId": _SERIALIZER.url("session_id", session_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=url, headers=header_parameters, **kwargs )
null
4,374
import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def _format_url_section(template, **kwargs): components = template.split("/") while components: try: return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") components = [ c for c in formatted_components if "{}".format(key.args[0]) not in c ] template = "/".join(components) def build_get_flow_session_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str session_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/{sessionId}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), "sessionId": _SERIALIZER.url("session_id", session_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, headers=header_parameters, **kwargs )
null