diff --git a/.flake8 b/.flake8 index 5d2b0466e0e..00339313420 100644 --- a/.flake8 +++ b/.flake8 @@ -2,13 +2,20 @@ max-line-length = 120 max-complexity = 10 ignore = - E501, # line too long, it is covered by pylint - E722, # bare except, bad practice, to be removed in the future - F401, # imported but unused, too many violations, to be removed in the future - F811, # redefinition of unused, to be removed in the future - C901 # code flow is too complex, too many violations, to be removed in the future - W503 # line break before binary operator effect on readability is subjective - W504 # line break after binary operator effect on readability is subjective + # line too long, it is covered by pylint + E501, + # bare except, bad practice, to be removed in the future + E722, + # imported but unused, too many violations, to be removed in the future + F401, + # redefinition of unused, to be removed in the future + F811, + # code flow is too complex, too many violations, to be removed in the future + C901, + # line break before binary operator effect on readability is subjective + W503, + # line break after binary operator effect on readability is subjective + W504 exclude = */vendored_sdks docs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 127b9c6d11f..1b7042872d5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -292,6 +292,8 @@ /src/alb/ @jaishals +/src/azext_aosm/ @jddarby + /src/managedccfs/ @msftsettiy /src/acrquery/ @CarolineNB diff --git a/.github/workflows/BuildAOSMWheel.yml b/.github/workflows/BuildAOSMWheel.yml new file mode 100644 index 00000000000..36ad8f82bbb --- /dev/null +++ b/.github/workflows/BuildAOSMWheel.yml @@ -0,0 +1,31 @@ +on: + push: + branches: + - add-aosm-extension + +jobs: + build_aosm: + runs-on: ubuntu-latest + container: mcr.microsoft.com/azure-cli/tools:latest + permissions: write-all + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Build AOSM Wheel + run: | + # Pretend we have a valid git repo to satisfy azdev. + mkdir .git + azdev setup -r . + azdev extension build aosm + - name: Upload AOSM Wheel + uses: actions/upload-artifact@v3 + with: + name: aosm-extension + path: dist/*.whl + - name: Update Release + uses: pyTooling/Actions/releaser@r0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + files: | + dist/*.whl + tag: aosm-extension diff --git a/.github/workflows/CheckStyleAndLinting.yml b/.github/workflows/CheckStyleAndLinting.yml new file mode 100644 index 00000000000..82e39b86e0b --- /dev/null +++ b/.github/workflows/CheckStyleAndLinting.yml @@ -0,0 +1,18 @@ +name: Style and Lint Check + +on: + pull_request: + types: [opened] + +jobs: + build_aosm: + runs-on: ubuntu-latest + container: mcr.microsoft.com/azure-cli/tools:latest + permissions: write-all + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Check Style + run: azdev style aosm + - name: Check Linting + run: azdev linter aosm \ No newline at end of file diff --git a/src/aosm/HISTORY.rst b/src/aosm/HISTORY.rst new file mode 100644 index 00000000000..f32748c01fb --- /dev/null +++ b/src/aosm/HISTORY.rst @@ -0,0 +1,40 @@ +.. :changelog: + +Release History +=============== + +upcoming +++++++++++ +* Added a `--clean` flag to the NSD `delete` command. This flag will delete the NSDG on top of the other resources deleted by the `delete` command. +* Added integration tests for `publish` and `delete` commands. +* Added a `--force` flag to the aosm `build` and `delete` commands. This command will force the `build` or `delete` commands to proceed without waiting on user input to confirm. +* `az aosm nfd build` options `--order-params` and `--interactive` to help users choose which NF parameters to expose as deployParameters. Feature added that allows CNF value mappings file to be generated if none is supplied. +* NFDV version exposed as a CGV on an SNS. +* `az aosm nfd publish` option added for `--definition-type cnf` to publish the CNF bicep templates, upload helm charts from disk to the ACR and copy the images from a source ACR to the target ACR. +* Managed Identity added to VNF NF templates - requires subscription to be registered for the feature flag. +* Various fixes to NFD build of deployParameters schema and interactive mode create of deployParameters mappings file. +* Fix CNF NFD publish so that it doesn't render the ACR unuseable for future Artifact publishing. +* Allow CNF NFD image copy from a source ACR using a namespace. +* Fix - Add new CGSchema parameters not from the NFD to the `required` section of the schema. +* Add the ability to skip bicep publish or artifact upload during publish commands. +* Fix Manifest name for NSDs so it isn't the same as that for NFDs +* Add validation of source_registry_id format for CNF configuration +* Workaround Oras client bug (#90) on Windows for Artifact upload to ACR +* Take Oras 0.1.18 so above Workaround could be removed +* Take Oras 0.1.19 to fix NSD Artifact upload on Windows +* Support deploying multiple instances of the same NF in an SNS +* Fix CNF publish on Windows by using Linux style paths in rendered NFD bicep templates (bicep always requires Linux style paths). +* Add progress information for VHD upload +* Change optional argument from `manifest_parameters_json_file` to `manifest_params_file` to appease linter. + +0.2.0 +++++++ +Breaking change to commands - now use `nfd` instead of `definition`. Publish option removed from build. +* `az aosm nfd generate-config` for vnf and cnf. This is for NFDVs +* `az aosm nfd build|publish|delete --definition-type vnf|cnf` for vnf and `build` only for cnf. This is for NFDVs + +0.1.0 +++++++ +* Initial release - alpha quality + * `az aosm definition generate-config` for vnf and cnf. This is for NFDVs + * `az aosm definition build|publish|delete` for vnf and `build` only for cnf. This is for NFDVs diff --git a/src/aosm/README.md b/src/aosm/README.md new file mode 100644 index 00000000000..1b262315fb8 --- /dev/null +++ b/src/aosm/README.md @@ -0,0 +1,205 @@ +# Microsoft Azure CLI 'aosm' Extension + +This package is for the 'aosm' extension to support Azure Operator Service Manager +functions. +i.e. `az aosm` + +## Background + +The `az aosm` extension is intended to provide support for working with AOSM +resources and definitions. Currently it only implements commands which aid the +process of publishing Network Function Definitions and Network Service Designs to +use with Azure Operator Service Manager or Network Function Manager. + +## Installation + +Eventually the extension will be published through the usual process and it will be +installed as usual, via `az extension add --name aosm` + +Until then, the latest development version can be found here: +https://github.com/jddarby/azure-cli-extensions/releases/download/aosm-extension/aosm-0.2.0-py2.py3-none-any.whl + +To install, download this wheel and run: +`az extension add --source path/to/aosm-0.2.0-py2.py3-none-any.whl` + +For CNFs you will also need helm installed. See [CNFs](#cnfs) below for details. + +## Updating + +We are currently not bumping versions, so if you would like the most up to date version of the CLI. You should run: +'az extension remove --name aosm' + +And then re-add with the new wheel, as detailed in Installation above. + +# nfd and nsd commands + +These commands help with the publishing of Network Function Definition and Network +Service Design resources. + +## Overview of function +A generic workflow of using the tool would be: +- Find the pre-requisite items you require for your use-case +- Run a `generate-config` command to output an example JSON config file for subsequent commands +- Fill in the config file +- Run a `build` command to output one or more bicep templates for your Network Function Definition or Network Service Design +- Review the output of the build command, edit the output as necessary for your requirements +- Run a `publish` command to: + * Create all pre-requisite resources such as Resource Group, Publisher, Artifact Stores, Groups + * Deploy those bicep templates + * Upload artifacts to the artifact stores + +### Pre-requisites + +#### VNFs + +For VNFs, you will need a single ARM template which would create the Azure resources +for your VNF, for example a Virtual Machine, disks and NICs. You'll also need a VHD +image that would be used for the VNF Virtual Machine. + +#### CNFs + +For CNFs you must have these packages installed on the machine you are running the CLI from: +- `helm` package installed . Instructions on how to do this can be found [here](https://helm.sh/docs/intro/install/). + +For CNFs, you must provide: +* helm packages with an associated schema. These files must be on your disk and will be referenced in the `input.json` config file. +* a reference to an existing Azure Container Registry which contains the images for your CNF. Currently, only one ACR is supported per CNF. The images to be copied from this ACR are populated automatically based on the helm package schema. +* optionally, you can provide a file (on disk) path_to_mappings which is a copy of values.yaml with your chosen values replaced by deployment parameters, thus exposing them as parameters to the CNF. You can get this file auto-generated by leaving the value as a blank string, either having every value as a deployment parameter, or using `--interactive` to interactively choose. +When filling in the input.json file, you must list helm packages in the order they are to be deployed. For example, if A must be deployed before B, your input.json should look something like this: + + "helm_packages": [ + { + "name": "A", + "path_to_chart": "Path to package A", + "path_to_mappings": "Path to package A mappings", + "depends_on": [ + "Names of the Helm packages this package depends on" + ] + }, + { + "name": "B", + "path_to_chart": "Path to package B", + "path_to_mappings": "Path to package B mappings", + "depends_on": [ + "Names of the Helm packages this package depends on" + ] + }, + +#### NSDs +For NSDs, you will need to have a Resource Group with a deployed Publisher, Artifact Store, Network Function Definition and Network Function Definition Version. You can use the `az aosm nfd` commands to create all of these resources. + + +### Command examples + +#### Before you start +`az login` to login to the Azure CLI. +`az account set --subscription ` to choose the subscription you will work on. + +#### NFDs + +Get help on command arguments + +`az aosm -h` +`az aosm nfd -h` +`az aosm nfd build -h` +etc... + +All these commands take a `--definition-type` argument of `vnf` or `cnf` + +Create an example config file for building a definition + +`az aosm nfd generate-config` + +This will output a file called `input.json` which must be filled in. +Once the config file has been filled in the following commands can be run. + +Build an nfd definition locally + +`az aosm nfd build --config-file input.json` + +More options on building an nfd definition locally: + +Choose which of the VNF ARM template parameters you want to expose as NFD deploymentParameters, with the option of interactively choosing each one. + +`az aosm nfd build --config-file input.json --definition_type vnf --order_params` +`az aosm nfd build --config-file input.json --definition_type vnf --order_params --interactive` + +Choose which of the CNF Helm values parameters you want to expose as NFD deploymentParameters. + +`az aosm nfd build --config-file input.json --definition_type cnf [--interactive]` + +Publish a pre-built definition + +`az aosm nfd publish --config-file input.json` + +Delete a published definition + +`az aosm nfd delete --config-file input.json` + +Delete a published definition and the publisher, artifact stores and NFD group + +`az aosm nfd delete --config-file input.json --clean` + +#### NSDs + +Get help on command arguments + +`az aosm -h` +`az aosm nsd -h` +`az aosm nsd build -h` +etc... + +Create an example config file for building a definition + +`az aosm nsd generate-config` + +This will output a file called `input.json` which must be filled in. +Once the config file has been filled in the following commands can be run. + +Build an nsd locally + +`az aosm nsd build --config-file input.json` + +Publish a pre-built design + +`az aosm nsd publish --config-file input.json` + +Delete a published design + +`az aosm nsd delete --config-file input.json` + +Delete a published design and the publisher, artifact stores and NSD group + +`az aosm nsd delete --config-file input.json --clean` + +## Bug Reporting + +Especially as this extension is still in development, you may encounter bugs or +usability issues as you try to use it in its current form. It would be much +appreciated if you could report these so that we're aware of them! + +The (Microsoft internal) process for bug reporting during development is here: +https://eng.ms/docs/strategic-missions-and-technologies/strategic-missions-and-technologies-organization/azure-for-operators/aiops/aiops-orchestration/aosm-product-docs/processes/bug_process + +CLI issues should be tagged and triaged as UX bugs. + +## Logging + +The CLI uses the standard Azure CLI logging mechanism. To enable logging to the console, you can use the following flags depending on the desired level of logging: +- `--verbose` - This flag changes the logging level to Info and above. +- `--debug` - This flag changes the logging level to Debug and above. +- `--only-show-errors` - This flag changes the logging level to Error only, suppressing Warning. + +It is also possible to enable logging to file by running the following command: +``` +az config set logging.enable_log_file=true +``` +This will create a log file in the `~/.azure/logs` directory. + +**Note:** The above command will enable logging for all Azure CLI commands until the logging is disabled again by the user. Not disabling file logging could slow down the performance of the CLI. To disable file logging, run the following command: +``` +az config set logging.enable_log_file=false +``` + +## Development +Information about setting up and maintaining a development environment for this extension can be found [here](./development.md). diff --git a/src/aosm/azext_aosm/__init__.py b/src/aosm/azext_aosm/__init__.py new file mode 100644 index 00000000000..c15badcb435 --- /dev/null +++ b/src/aosm/azext_aosm/__init__.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +from azext_aosm._help import helps # pylint: disable=unused-import + + +class AosmCommandsLoader(AzCommandsLoader): + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + + aosm_custom = CliCommandType(operations_tmpl="azext_aosm.custom#{}") + super().__init__(cli_ctx=cli_ctx, custom_command_type=aosm_custom) + + def load_command_table(self, args): + from azext_aosm.commands import load_command_table + + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_aosm._params import load_arguments + + load_arguments(self, command) + + +COMMAND_LOADER_CLS = AosmCommandsLoader diff --git a/src/aosm/azext_aosm/_client_factory.py b/src/aosm/azext_aosm/_client_factory.py new file mode 100644 index 00000000000..61fe56814a4 --- /dev/null +++ b/src/aosm/azext_aosm/_client_factory.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.profiles import ResourceType +from azure.mgmt.containerregistry import ContainerRegistryManagementClient + +from .vendored_sdks import HybridNetworkManagementClient + + +def cf_aosm(cli_ctx, *_) -> HybridNetworkManagementClient: + return get_mgmt_service_client(cli_ctx, HybridNetworkManagementClient) + + +def cf_resources(cli_ctx, subscription_id=None): + return get_mgmt_service_client( + cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, subscription_id=subscription_id + ) + + +def cf_acr_registries(cli_ctx, *_) -> ContainerRegistryManagementClient: + """ + Returns the client for managing container registries. + + :param cli_ctx: CLI context + :return: ContainerRegistryManagementClient object + """ + return get_mgmt_service_client( + cli_ctx, ResourceType.MGMT_CONTAINERREGISTRY + ).registries diff --git a/src/aosm/azext_aosm/_configuration.py b/src/aosm/azext_aosm/_configuration.py new file mode 100644 index 00000000000..b8d14d68f77 --- /dev/null +++ b/src/aosm/azext_aosm/_configuration.py @@ -0,0 +1,536 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Configuration class for input config file parsing,""" +import abc +import logging +import json +import os +import re +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any, Dict, List, Optional, Union + +from azure.cli.core.azclierror import InvalidArgumentValueError, ValidationError +from azext_aosm.util.constants import ( + CNF, + NF_DEFINITION_OUTPUT_BICEP_PREFIX, + NF_DEFINITION_JSON_FILENAME, + NSD, + NSD_OUTPUT_BICEP_PREFIX, + VNF, + SOURCE_ACR_REGEX, +) + +logger = logging.getLogger(__name__) + +DESCRIPTION_MAP: Dict[str, str] = { + "publisher_resource_group_name": ( + "Resource group for the Publisher resource. " + "Will be created if it does not exist." + ), + "publisher_name": ( + "Name of the Publisher resource you want your definition published to. " + "Will be created if it does not exist." + ), + "publisher_resource_group_name_nsd": "Resource group for the Publisher resource.", + "nf_name": "Name of NF definition", + "version": "Version of the NF definition in A.B.C format.", + "acr_artifact_store_name": ( + "Name of the ACR Artifact Store resource. Will be created if it does not exist." + ), + "location": "Azure location to use when creating resources.", + "blob_artifact_store_name": ( + "Name of the storage account Artifact Store resource. Will be created if it " + "does not exist." + ), + "artifact_name": "Name of the artifact", + "file_path": ( + "Optional. File path of the artifact you wish to upload from your local disk. " + "Delete if not required. Relative paths are relative to the configuration file." + "On Windows escape any backslash with another backslash." + ), + "blob_sas_url": ( + "Optional. SAS URL of the blob artifact you wish to copy to your Artifact" + " Store. Delete if not required." + ), + "artifact_version": ( + "Version of the artifact. For VHDs this must be in format A-B-C. " + "For ARM templates this must be in format A.B.C" + ), + "nsdv_description": "Description of the NSDV", + "nsdg_name": ( + "Network Service Design Group Name. This is the collection of Network Service" + " Design Versions. Will be created if it does not exist." + ), + "nsd_version": ( + "Version of the NSD to be created. This should be in the format A.B.C" + ), + "helm_package_name": "Name of the Helm package", + "path_to_chart": ( + "File path of Helm Chart on local disk. Accepts .tgz, .tar or .tar.gz." + " Use Linux slash (/) file separator even if running on Windows." + ), + "path_to_mappings": ( + "File path of value mappings on local disk where chosen values are replaced " + "with deploymentParameter placeholders. Accepts .yaml or .yml. If left as a " + "blank string, a value mappings file will be generated with every value " + "mapped to a deployment parameter. Use a blank string and --interactive on " + "the build command to interactively choose which values to map." + ), + "helm_depends_on": ( + "Names of the Helm packages this package depends on. " + "Leave as an empty array if no dependencies" + ), + "image_name_parameter": ( + "The parameter name in the VM ARM template which specifies the name of the " + "image to use for the VM." + ), + "source_registry_id": ( + "Resource ID of the source acr registry from which to pull the image." + ), + "source_registry_namespace": ( + "Optional. Namespace of the repository of the source acr registry from which " + "to pull. For example if your repository is samples/prod/nginx then set this to" + " samples/prod . Leave blank if the image is in the root namespace." + "See https://learn.microsoft.com/en-us/azure/container-registry/" + "container-registry-best-practices#repository-namespaces for further details." + ), +} + + +@dataclass +class ArtifactConfig: + # artifact.py checks for the presence of the default descriptions, change + # there if you change the descriptions. + artifact_name: str = DESCRIPTION_MAP["artifact_name"] + file_path: Optional[str] = DESCRIPTION_MAP["file_path"] + blob_sas_url: Optional[str] = DESCRIPTION_MAP["blob_sas_url"] + version: Optional[str] = DESCRIPTION_MAP["artifact_version"] + + +@dataclass +class Configuration(abc.ABC): + config_file: Optional[str] = None + publisher_name: str = DESCRIPTION_MAP["publisher_name"] + publisher_resource_group_name: str = DESCRIPTION_MAP[ + "publisher_resource_group_name" + ] + acr_artifact_store_name: str = DESCRIPTION_MAP["acr_artifact_store_name"] + location: str = DESCRIPTION_MAP["location"] + + def path_from_cli_dir(self, path: str) -> str: + """ + Convert path from config file to path from current directory. + + We assume that the path supplied in the config file is relative to the + configuration file. That isn't the same as the path relative to where ever the + CLI is being run from. This function fixes that up. + + :param path: The path relative to the config file. + """ + assert self.config_file + + # If no path has been supplied we shouldn't try to update it. + if path == "": + return "" + + # If it is an absolute path then we don't need to monkey around with it. + if os.path.isabs(path): + return path + + config_file_dir = Path(self.config_file).parent + + updated_path = str(config_file_dir / path) + + logger.debug("Updated path: %s", updated_path) + + return updated_path + + @property + def output_directory_for_build(self) -> Path: + """Base class method to ensure subclasses implement this function.""" + raise NotImplementedError("Subclass must define property") + + @property + def acr_manifest_names(self) -> List[str]: + """The list of ACR manifest names.""" + raise NotImplementedError("Subclass must define property") + + +@dataclass +class NFConfiguration(Configuration): + """Network Function configuration.""" + + publisher_name: str = DESCRIPTION_MAP["publisher_name"] + publisher_resource_group_name: str = DESCRIPTION_MAP[ + "publisher_resource_group_name" + ] + nf_name: str = DESCRIPTION_MAP["nf_name"] + version: str = DESCRIPTION_MAP["version"] + acr_artifact_store_name: str = DESCRIPTION_MAP["acr_artifact_store_name"] + location: str = DESCRIPTION_MAP["location"] + + @property + def nfdg_name(self) -> str: + """Return the NFD Group name from the NFD name.""" + return f"{self.nf_name}-nfdg" + + @property + def acr_manifest_names(self) -> List[str]: + """ + Return the ACR manifest name from the NFD name. + + This is returned in a list for consistency with the NSConfiguration, where there + can be multiple ACR manifests. + """ + sanitized_nf_name = self.nf_name.lower().replace("_", "-") + return [f"{sanitized_nf_name}-acr-manifest-{self.version.replace('.', '-')}"] + + +@dataclass +class VNFConfiguration(NFConfiguration): + blob_artifact_store_name: str = DESCRIPTION_MAP["blob_artifact_store_name"] + image_name_parameter: str = DESCRIPTION_MAP["image_name_parameter"] + arm_template: Any = ArtifactConfig() + vhd: Any = ArtifactConfig() + + def __post_init__(self): + """ + Cope with deserializing subclasses from dicts to ArtifactConfig. + + Used when creating VNFConfiguration object from a loaded json config file. + """ + if isinstance(self.arm_template, dict): + self.arm_template["file_path"] = self.path_from_cli_dir( + self.arm_template["file_path"] + ) + self.arm_template = ArtifactConfig(**self.arm_template) + + if isinstance(self.vhd, dict): + if self.vhd.get("file_path"): + self.vhd["file_path"] = self.path_from_cli_dir(self.vhd["file_path"]) + self.vhd = ArtifactConfig(**self.vhd) + self.validate() + + def validate(self) -> None: + """ + Validate the configuration passed in. + + :raises ValidationError for any invalid config + """ + + if self.vhd.version == DESCRIPTION_MAP["version"]: + # Config has not been filled in. Don't validate. + return + + if "." in self.vhd.version or "-" not in self.vhd.version: + raise ValidationError( + "Config validation error. VHD artifact version should be in format" + " A-B-C" + ) + if "." not in self.arm_template.version or "-" in self.arm_template.version: + raise ValidationError( + "Config validation error. ARM template artifact version should be in" + " format A.B.C" + ) + filepath_set = ( + self.vhd.file_path and self.vhd.file_path != DESCRIPTION_MAP["file_path"] + ) + sas_set = ( + self.vhd.blob_sas_url + and self.vhd.blob_sas_url != DESCRIPTION_MAP["blob_sas_url"] + ) + # If these are the same, either neither is set or both are, both of which are errors + if filepath_set == sas_set: + raise ValidationError( + "Config validation error. VHD config must have either a local filepath" + " or a blob SAS URL" + ) + + if filepath_set: + # Explicitly set the blob SAS URL to None to avoid other code having to + # check if the value is the default description + self.vhd.blob_sas_url = None + elif sas_set: + self.vhd.file_path = None + + @property + def sa_manifest_name(self) -> str: + """Return the Storage account manifest name from the NFD name.""" + sanitized_nf_name = self.nf_name.lower().replace("_", "-") + return f"{sanitized_nf_name}-sa-manifest-{self.version.replace('.', '-')}" + + @property + def output_directory_for_build(self) -> Path: + """Return the local folder for generating the bicep template to.""" + arm_template_name = Path(self.arm_template.file_path).stem + return Path(f"{NF_DEFINITION_OUTPUT_BICEP_PREFIX}{arm_template_name}") + + +@dataclass +class HelmPackageConfig: + name: str = DESCRIPTION_MAP["helm_package_name"] + path_to_chart: str = DESCRIPTION_MAP["path_to_chart"] + path_to_mappings: str = DESCRIPTION_MAP["path_to_mappings"] + depends_on: List[str] = field( + default_factory=lambda: [DESCRIPTION_MAP["helm_depends_on"]] + ) + + +@dataclass +class CNFConfiguration(NFConfiguration): + source_registry_id: str = DESCRIPTION_MAP["source_registry_id"] + source_registry_namespace: str = DESCRIPTION_MAP["source_registry_namespace"] + helm_packages: List[Any] = field(default_factory=lambda: [HelmPackageConfig()]) + + def __post_init__(self): + """ + Cope with deserializing subclasses from dicts to HelmPackageConfig. + + Used when creating CNFConfiguration object from a loaded json config file. + """ + for package_index, package in enumerate(self.helm_packages): + if isinstance(package, dict): + package["path_to_chart"] = self.path_from_cli_dir( + package["path_to_chart"] + ) + package["path_to_mappings"] = self.path_from_cli_dir( + package["path_to_mappings"] + ) + self.helm_packages[package_index] = HelmPackageConfig(**dict(package)) + + @property + def output_directory_for_build(self) -> Path: + """Return the directory the build command will writes its output to.""" + return Path(f"{NF_DEFINITION_OUTPUT_BICEP_PREFIX}{self.nf_name}") + + def validate(self): + """ + Validate the CNF config. + + :raises ValidationError: If source registry ID doesn't match the regex + """ + if self.source_registry_id == DESCRIPTION_MAP["source_registry_id"]: + # Config has not been filled in. Don't validate. + return + + source_registry_match = re.search(SOURCE_ACR_REGEX, self.source_registry_id) + if not source_registry_match or len(source_registry_match.groups()) < 2: + raise ValidationError( + "CNF config has an invalid source registry ID. Please run `az aosm " + "nfd generate-config` to see the valid formats." + ) + + +NFD_NAME = "The name of the existing Network Function Definition Group to deploy using this NSD" +NFD_VERSION = ( + "The version of the existing Network Function Definition to base this NSD on. " + "This NSD will be able to deploy any NFDV with deployment parameters compatible " + "with this version." +) +NFD_LOCATION = "The region that the NFDV is published to." +PUBLISHER_RESOURCE_GROUP = "The resource group that the publisher is hosted in." +PUBLISHER_NAME = "The name of the publisher that this NFDV is published under." +NFD_TYPE = "Type of Network Function. Valid values are 'cnf' or 'vnf'" +MULTIPLE_INSTANCES = ( + "Set to true or false. Whether the NSD should allow arbitrary numbers of this " + "type of NF. If set to false only a single instance will be allowed. Only " + "supported on VNFs, must be set to false on CNFs." +) + + +@dataclass +class NFDRETConfiguration: + """The configuration required for an NFDV that you want to include in an NSDV.""" + + publisher: str = PUBLISHER_NAME + publisher_resource_group: str = PUBLISHER_RESOURCE_GROUP + name: str = NFD_NAME + version: str = NFD_VERSION + publisher_offering_location: str = NFD_LOCATION + type: str = NFD_TYPE + multiple_instances: Union[str, bool] = MULTIPLE_INSTANCES + + def validate(self) -> None: + """ + Validate the configuration passed in. + + :raises ValidationError for any invalid config + """ + if self.name == NFD_NAME: + raise ValidationError("Network function definition name must be set") + + if self.publisher == PUBLISHER_NAME: + raise ValidationError(f"Publisher name must be set for {self.name}") + + if self.publisher_resource_group == PUBLISHER_RESOURCE_GROUP: + raise ValidationError( + f"Publisher resource group name must be set for {self.name}" + ) + + if self.version == NFD_VERSION: + raise ValidationError( + f"Network function definition version must be set for {self.name}" + ) + + if self.publisher_offering_location == NFD_LOCATION: + raise ValidationError( + f"Network function definition offering location must be set, for {self.name}" + ) + + if self.type not in [CNF, VNF]: + raise ValueError( + f"Network Function Type must be cnf or vnf for {self.name}" + ) + + if not isinstance(self.multiple_instances, bool): + raise ValueError( + f"multiple_instances must be a boolean for for {self.name}" + ) + + # There is currently a NFM bug that means that multiple copies of the same NF + # cannot be deployed to the same custom location: + # https://portal.microsofticm.com/imp/v3/incidents/details/405078667/home + if self.type == CNF and self.multiple_instances: + raise ValueError("Multiple instances is not supported on CNFs.") + + @property + def build_output_folder_name(self) -> Path: + """Return the local folder for generating the bicep template to.""" + current_working_directory = os.getcwd() + return Path(current_working_directory, NSD_OUTPUT_BICEP_PREFIX) + + @property + def arm_template(self) -> ArtifactConfig: + """Return the parameters of the ARM template for this RET to be uploaded as part of + the NSDV.""" + artifact = ArtifactConfig() + artifact.artifact_name = f"{self.name.lower()}_nf_artifact" + + # We want the ARM template version to match the NSD version, but we don't have + # that information here. + artifact.version = None + artifact.file_path = os.path.join( + self.build_output_folder_name, NF_DEFINITION_JSON_FILENAME + ) + return artifact + + @property + def nf_bicep_filename(self) -> str: + """Return the name of the bicep template for deploying the NFs.""" + return f"{self.name}_nf.bicep" + + @property + def resource_element_name(self) -> str: + """Return the name of the resource element.""" + artifact_name = self.arm_template.artifact_name + return f"{artifact_name}_resource_element" + + def acr_manifest_name(self, nsd_version: str) -> str: + """Return the ACR manifest name from the NFD name.""" + return ( + f"{self.name.lower().replace('_', '-')}" + f"-nf-acr-manifest-{nsd_version.replace('.', '-')}" + ) + + +@dataclass +class NSConfiguration(Configuration): + network_functions: List[NFDRETConfiguration] = field( + default_factory=lambda: [ + NFDRETConfiguration(), + ] + ) + nsdg_name: str = DESCRIPTION_MAP["nsdg_name"] + nsd_version: str = DESCRIPTION_MAP["nsd_version"] + nsdv_description: str = DESCRIPTION_MAP["nsdv_description"] + + def __post_init__(self): + """Covert things to the correct format.""" + if self.network_functions and isinstance(self.network_functions[0], dict): + nf_ret_list = [ + NFDRETConfiguration(**config) for config in self.network_functions + ] + self.network_functions = nf_ret_list + + def validate(self): + # validate that all of the configuration parameters are set + + if self.location in (DESCRIPTION_MAP["location"], ""): + raise ValueError("Location must be set") + if self.publisher_name in (DESCRIPTION_MAP["publisher_name"], ""): + raise ValueError("Publisher name must be set") + if self.publisher_resource_group_name in ( + DESCRIPTION_MAP["publisher_resource_group_name_nsd"], + "", + ): + raise ValueError("Publisher resource group name must be set") + if self.acr_artifact_store_name in ( + DESCRIPTION_MAP["acr_artifact_store_name"], + "", + ): + raise ValueError("ACR Artifact Store name must be set") + if self.network_functions in ([], None): + raise ValueError(("At least one network function must be included.")) + + for configuration in self.network_functions: + configuration.validate() + if self.nsdg_name in (DESCRIPTION_MAP["nsdg_name"], ""): + raise ValueError("NSD name must be set") + if self.nsd_version in (DESCRIPTION_MAP["nsd_version"], ""): + raise ValueError("NSD Version must be set") + + @property + def output_directory_for_build(self) -> Path: + """Return the local folder for generating the bicep template to.""" + current_working_directory = os.getcwd() + return Path(current_working_directory, NSD_OUTPUT_BICEP_PREFIX) + + @property + def nfvi_site_name(self) -> str: + """Return the name of the NFVI used for the NSDV.""" + return f"{self.nsdg_name}_NFVI" + + @property + def cg_schema_name(self) -> str: + """Return the name of the Configuration Schema used for the NSDV.""" + return f"{self.nsdg_name.replace('-', '_')}_ConfigGroupSchema" + + @property + def acr_manifest_names(self) -> List[str]: + """The list of ACR manifest names for all the NF ARM templates.""" + return [nf.acr_manifest_name(self.nsd_version) for nf in self.network_functions] + + +def get_configuration( + configuration_type: str, config_file: Optional[str] = None +) -> Configuration: + """ + Return the correct configuration object based on the type. + + :param configuration_type: The type of configuration to return + :param config_file: The path to the config file + :return: The configuration object + """ + if config_file: + with open(config_file, "r", encoding="utf-8") as f: + config_as_dict = json.loads(f.read()) + else: + config_as_dict = {} + + config: Configuration + + if configuration_type == VNF: + config = VNFConfiguration(config_file=config_file, **config_as_dict) + elif configuration_type == CNF: + config = CNFConfiguration(config_file=config_file, **config_as_dict) + elif configuration_type == NSD: + config = NSConfiguration(config_file=config_file, **config_as_dict) + else: + raise InvalidArgumentValueError( + "Definition type not recognized, options are: vnf, cnf or nsd" + ) + + return config diff --git a/src/aosm/azext_aosm/_help.py b/src/aosm/azext_aosm/_help.py new file mode 100644 index 00000000000..64bc5e32940 --- /dev/null +++ b/src/aosm/azext_aosm/_help.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +from knack.help_files import helps + +helps[ + "aosm" +] = """ + type: group + short-summary: Commands to interact with Azure Operator Service Manager (AOSM). +""" + +helps[ + "aosm nfd" +] = """ + type: group + short-summary: Manage AOSM publisher Network Function Definitions. +""" + +helps[ + "aosm nfd generate-config" +] = """ + type: command + short-summary: Generate configuration file for building an AOSM publisher Network Function Definition. +""" + +helps[ + "aosm nfd build" +] = """ + type: command + short-summary: Build an AOSM Network Function Definition. +""" + +helps[ + "aosm nfd publish" +] = """ + type: command + short-summary: Publish a pre-built AOSM Network Function definition. +""" + + +helps[ + "aosm nfd delete" +] = """ + type: command + short-summary: Delete AOSM Network Function Definition. +""" + +helps[ + "aosm nsd" +] = """ + type: group + short-summary: Manage AOSM publisher Network Service Designs. +""" + +helps[ + "aosm nsd generate-config" +] = """ + type: command + short-summary: Generate configuration file for building an AOSM publisher Network Service Design. +""" + +helps[ + "aosm nsd build" +] = """ + type: command + short-summary: Build an AOSM Network Service Design. +""" + +helps[ + "aosm nsd publish" +] = """ + type: command + short-summary: Publish a pre-built AOSM Network Service Design. +""" + + +helps[ + "aosm nfd delete" +] = """ + type: command + short-summary: Delete AOSM Network Function Definition. +""" diff --git a/src/aosm/azext_aosm/_params.py b/src/aosm/azext_aosm/_params.py new file mode 100644 index 00000000000..bfa934438f1 --- /dev/null +++ b/src/aosm/azext_aosm/_params.py @@ -0,0 +1,138 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from argcomplete.completers import FilesCompleter +from azure.cli.core import AzCommandsLoader + +from .util.constants import CNF, VNF, BICEP_PUBLISH, ARTIFACT_UPLOAD, IMAGE_UPLOAD + + +def load_arguments(self: AzCommandsLoader, _): + from azure.cli.core.commands.parameters import ( + file_type, + get_enum_type, + get_three_state_flag, + ) + + definition_type = get_enum_type([VNF, CNF]) + nf_skip_steps = get_enum_type([BICEP_PUBLISH, ARTIFACT_UPLOAD, IMAGE_UPLOAD]) + ns_skip_steps = get_enum_type([BICEP_PUBLISH, ARTIFACT_UPLOAD]) + + # Set the argument context so these options are only available when this specific command + # is called. + + with self.argument_context("aosm nfd") as c: + c.argument( + "definition_type", arg_type=definition_type, help="Type of AOSM definition." + ) + c.argument( + "config_file", + options_list=["--config-file", "-f"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help="The path to the configuration file.", + ) + c.argument( + "clean", + arg_type=get_three_state_flag(), + help="Also delete artifact stores, NFD Group and Publisher. Use with care.", + ) + c.argument( + "definition_file", + options_list=["--definition-file", "-b"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help=( + "Optional path to a bicep file to publish. Use to override publish of" + " the built definition with an alternative file." + ), + ) + c.argument( + "design_file", + options_list=["--design-file", "-b"], + type=file_type, + completer=FilesCompleter(allowednames="*.bicep"), + help=( + "Optional path to a bicep file to publish. Use to override publish of" + " the built design with an alternative file." + ), + ) + c.argument( + "order_params", + arg_type=get_three_state_flag(), + help=( + "VNF definition_type only - ignored for CNF. Order deploymentParameters" + " schema and configMappings to have the parameters without default" + " values at the top and those with default values at the bottom. Can" + " make it easier to remove those with defaults which you do not want to" + " expose as NFD parameters." + ), + ) + c.argument( + "interactive", + options_list=["--interactive", "-i"], + arg_type=get_three_state_flag(), + help=( + "Prompt user to choose every parameter to expose as an NFD parameter." + " Those without defaults are automatically included." + ), + ) + c.argument( + "parameters_json_file", + options_list=["--parameters-file", "-p"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help=( + "Optional path to a parameters file for the bicep definition file. Use" + " to override publish of the built definition and config with" + " alternative parameters." + ), + ) + c.argument( + "manifest_file", + options_list=["--manifest-file", "-m"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help=( + "Optional path to a bicep file to publish manifests. Use to override" + " publish of the built definition with an alternative file." + ), + ) + c.argument( + "manifest_params_file", + options_list=["--manifest-params-file"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help=( + "Optional path to a parameters file for the manifest definition file." + " Use to override publish of the built definition and config with" + " alternative parameters." + ), + ) + c.argument( + "skip", + arg_type=nf_skip_steps, + help=( + "Optional skip steps. 'bicep-publish' will skip deploying the bicep " + "template; 'artifact-upload' will skip uploading any artifacts; " + "'image-upload' will skip uploading the VHD image (for VNFs) or the " + "container images (for CNFs)." + ), + ) + + with self.argument_context("aosm nsd") as c: + c.argument( + "config_file", + options_list=["--config-file", "-f"], + type=file_type, + completer=FilesCompleter(allowednames="*.json"), + help="The path to the configuration file.", + ) + c.argument("skip", arg_type=ns_skip_steps, help="Optional skip steps") + c.argument( + "clean", + arg_type=get_three_state_flag(), + help="Also delete NSD Group. Use with care.", + ) diff --git a/src/aosm/azext_aosm/_validators.py b/src/aosm/azext_aosm/_validators.py new file mode 100644 index 00000000000..1a9f0e39617 --- /dev/null +++ b/src/aosm/azext_aosm/_validators.py @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + # Example of a storage account name or ID validator. + # See: + # https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md#supporting-name-or-id-parameters + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace="Microsoft.Storage", + type="storageAccounts", + name=namespace.storage_account, + ) diff --git a/src/aosm/azext_aosm/azext_metadata.json b/src/aosm/azext_aosm/azext_metadata.json new file mode 100644 index 00000000000..be5de02d927 --- /dev/null +++ b/src/aosm/azext_aosm/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.45.0" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/commands.py b/src/aosm/azext_aosm/commands.py new file mode 100644 index 00000000000..abc33f8444b --- /dev/null +++ b/src/aosm/azext_aosm/commands.py @@ -0,0 +1,26 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +from azext_aosm._client_factory import cf_aosm + + +def load_command_table(self: AzCommandsLoader, _): + with self.command_group("aosm nfd", client_factory=cf_aosm) as g: + # Add each command and bind it to a function in custom.py + g.custom_command("generate-config", "generate_definition_config") + g.custom_command("build", "build_definition") + g.custom_command("delete", "delete_published_definition") + g.custom_command("publish", "publish_definition") + with self.command_group("aosm nsd", client_factory=cf_aosm) as g: + # Add each command and bind it to a function in custom.py + g.custom_command("generate-config", "generate_design_config") + g.custom_command("build", "build_design") + g.custom_command("delete", "delete_published_design") + g.custom_command("publish", "publish_design") + + with self.command_group("aosm", is_preview=True): + pass diff --git a/src/aosm/azext_aosm/custom.py b/src/aosm/azext_aosm/custom.py new file mode 100644 index 00000000000..46774f55091 --- /dev/null +++ b/src/aosm/azext_aosm/custom.py @@ -0,0 +1,416 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import json +import os +import shutil +from dataclasses import asdict +from pathlib import Path +from typing import Optional + +from azure.cli.core.azclierror import ( + CLIInternalError, + InvalidArgumentValueError, + UnclassifiedUserFault, +) +from knack.log import get_logger + +from azext_aosm._client_factory import cf_acr_registries, cf_resources +from azext_aosm._configuration import ( + CNFConfiguration, + Configuration, + NFConfiguration, + NSConfiguration, + VNFConfiguration, + get_configuration, +) +from azext_aosm.delete.delete import ResourceDeleter +from azext_aosm.deploy.deploy_with_arm import DeployerViaArm +from azext_aosm.generate_nfd.cnf_nfd_generator import CnfNfdGenerator +from azext_aosm.generate_nfd.nfd_generator_base import NFDGenerator +from azext_aosm.generate_nfd.vnf_nfd_generator import VnfNfdGenerator +from azext_aosm.generate_nsd.nsd_generator import NSDGenerator +from azext_aosm.util.constants import CNF, DeployableResourceTypes, NSD, SkipSteps, VNF +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.vendored_sdks import HybridNetworkManagementClient + +logger = get_logger(__name__) + + +def build_definition( + definition_type: str, + config_file: str, + order_params: bool = False, + interactive: bool = False, + force: bool = False, +): + """ + Build a definition. + + :param cmd: + :type cmd: _type_ + :param config_file: path to the file + :param definition_type: VNF, CNF + :param force: force the build even if the design has already been built + """ + + # Read the config from the given file + config = _get_config_from_file( + config_file=config_file, configuration_type=definition_type + ) + assert isinstance(config, NFConfiguration) + + # Generate the NFD and the artifact manifest. + _generate_nfd( + definition_type=definition_type, + config=config, + order_params=order_params, + interactive=interactive, + force=force, + ) + + +def generate_definition_config(definition_type: str, output_file: str = "input.json"): + """ + Generate an example config file for building a definition. + + :param definition_type: CNF, VNF + :param output_file: path to output config file, defaults to "input.json" + :type output_file: str, optional + """ + _generate_config(configuration_type=definition_type, output_file=output_file) + + +def _get_config_from_file(config_file: str, configuration_type: str) -> Configuration: + """ + Read input config file JSON and turn it into a Configuration object. + + :param config_file: path to the file + :param definition_type: VNF, CNF or NSD + :rtype: Configuration + """ + + if not os.path.exists(config_file): + raise InvalidArgumentValueError( + f"Config file {config_file} not found. Please specify a valid config file" + " path." + ) + + config = get_configuration(configuration_type, config_file) + return config + + +def _generate_nfd( + definition_type: str, + config: NFConfiguration, + order_params: bool, + interactive: bool, + force: bool = False, +): + """Generate a Network Function Definition for the given type and config.""" + nfd_generator: NFDGenerator + if definition_type == VNF: + assert isinstance(config, VNFConfiguration) + nfd_generator = VnfNfdGenerator(config, order_params, interactive) + elif definition_type == CNF: + assert isinstance(config, CNFConfiguration) + nfd_generator = CnfNfdGenerator(config, interactive) + else: + raise CLIInternalError( + "Generate NFD called for unrecognised definition_type. Only VNF and CNF" + " have been implemented." + ) + if nfd_generator.nfd_bicep_path: + if not force: + carry_on = input( + f"The {nfd_generator.nfd_bicep_path.parent} directory already exists -" + " delete it and continue? (y/n)" + ) + if carry_on != "y": + raise UnclassifiedUserFault("User aborted!") + + shutil.rmtree(nfd_generator.nfd_bicep_path.parent) + nfd_generator.generate_nfd() + + +def publish_definition( + cmd, + client: HybridNetworkManagementClient, + definition_type, + config_file, + definition_file: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_file: Optional[str] = None, + manifest_params_file: Optional[str] = None, + skip: Optional[SkipSteps] = None, +): + """ + Publish a generated definition. + + :param cmd: + :param client: + :type client: HybridNetworkManagementClient + :param definition_type: VNF or CNF + :param config_file: Path to the config file for the NFDV + :param definition_file: Optional path to a bicep template to deploy, in case the + user wants to edit the built NFDV template. + If omitted, the default built NFDV template will be used. + :param parameters_json_file: Optional path to a parameters file for the bicep file, + in case the user wants to edit the built NFDV template. If omitted, + parameters from config will be turned into parameters for the bicep file + :param manifest_file: Optional path to an override bicep template to deploy + manifests + :param manifest_params_file: Optional path to an override bicep parameters + file for manifest parameters + :param skip: options to skip, either publish bicep or upload artifacts + """ + print("Publishing definition.") + api_clients = ApiClients( + aosm_client=client, + resource_client=cf_resources(cmd.cli_ctx), + container_registry_client=cf_acr_registries(cmd.cli_ctx), + ) + + if definition_type not in (VNF, CNF): + raise ValueError( + "Definition type must be either 'vnf' or 'cnf'. Definition type" + f" '{definition_type}' is not valid for network function definitions." + ) + + config = _get_config_from_file( + config_file=config_file, configuration_type=definition_type + ) + + deployer = DeployerViaArm( + api_clients, + resource_type=definition_type, + config=config, + bicep_path=definition_file, + parameters_json_file=parameters_json_file, + manifest_bicep_path=manifest_file, + manifest_params_file=manifest_params_file, + skip=skip, + cli_ctx=cmd.cli_ctx, + ) + deployer.deploy_nfd_from_bicep() + + +def delete_published_definition( + cmd, + client: HybridNetworkManagementClient, + definition_type, + config_file, + clean=False, + force=False, +): + """ + Delete a published definition. + + :param definition_type: CNF or VNF + :param config_file: Path to the config file + :param clean: if True, will delete the NFDG, artifact stores and publisher too. + Defaults to False. Only works if no resources have those as a parent. Use + with care. + :param force: if True, will not prompt for confirmation before deleting the resources. + """ + config = _get_config_from_file( + config_file=config_file, configuration_type=definition_type + ) + + api_clients = ApiClients( + aosm_client=client, resource_client=cf_resources(cmd.cli_ctx) + ) + + delly = ResourceDeleter(api_clients, config, cmd.cli_ctx) + if definition_type == VNF: + delly.delete_nfd(clean=clean, force=force) + elif definition_type == CNF: + delly.delete_nfd(clean=clean, force=force) + else: + raise ValueError( + "Definition type must be either 'vnf' or 'cnf'. Definition type" + f" {definition_type} is not recognised." + ) + + +def generate_design_config(output_file: str = "input.json"): + """ + Generate an example config file for building a NSD. + + :param output_file: path to output config file, defaults to "input.json" + :type output_file: str, optional + """ + _generate_config(NSD, output_file) + + +def _generate_config(configuration_type: str, output_file: str = "input.json"): + """ + Generic generate config function for NFDs and NSDs. + + :param configuration_type: CNF, VNF or NSD + :param output_file: path to output config file, defaults to "input.json" + :type output_file: str, optional + """ + # Config file is a special parameter on the configuration objects. It is the path + # to the configuration file, rather than an input parameter. It therefore shouldn't + # be included here. + config = asdict(get_configuration(configuration_type)) + config.pop("config_file") + + config_as_dict = json.dumps(config, indent=4) + + if Path(output_file).exists(): + carry_on = input( + f"The file {output_file} already exists - do you want to overwrite it?" + " (y/n)" + ) + if carry_on != "y": + raise UnclassifiedUserFault("User aborted!") + + with open(output_file, "w", encoding="utf-8") as f: + f.write(config_as_dict) + if configuration_type in (CNF, VNF): + prtName = "definition" + else: + prtName = "design" + print(f"Empty {prtName} configuration has been written to {output_file}") + logger.info( + "Empty %s configuration has been written to %s", prtName, output_file + ) + + +def build_design( + cmd, client: HybridNetworkManagementClient, config_file: str, force: bool = False +): + """ + Build a Network Service Design. + + :param cmd: + :type cmd: _type_ + :param client: + :type client: HybridNetworkManagementClient + :param config_file: path to the file + :param force: force the build, even if the design has already been built + """ + + api_clients = ApiClients( + aosm_client=client, resource_client=cf_resources(cmd.cli_ctx) + ) + + # Read the config from the given file + config = _get_config_from_file(config_file=config_file, configuration_type=NSD) + assert isinstance(config, NSConfiguration) + config.validate() + + # Generate the NSD and the artifact manifest. + # This function should not be taking deploy parameters + _generate_nsd( + config=config, + api_clients=api_clients, + force=force, + ) + + +def delete_published_design( + cmd, + client: HybridNetworkManagementClient, + config_file, + clean=False, + force=False, +): + """ + Delete a published NSD. + + :param config_file: Path to the config file + :param clean: if True, will delete the NSDG, artifact stores and publisher too. + Defaults to False. Only works if no resources have those as a parent. + Use with care. + :param clean: if True, will delete the NSDG on top of the other resources. + :param force: if True, will not prompt for confirmation before deleting the resources. + """ + config = _get_config_from_file(config_file=config_file, configuration_type=NSD) + + api_clients = ApiClients( + aosm_client=client, resource_client=cf_resources(cmd.cli_ctx) + ) + + destroyer = ResourceDeleter(api_clients, config, cmd.cli_ctx) + destroyer.delete_nsd(clean=clean, force=force) + + +def publish_design( + cmd, + client: HybridNetworkManagementClient, + config_file, + design_file: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_file: Optional[str] = None, + manifest_params_file: Optional[str] = None, + skip: Optional[SkipSteps] = None, +): + """ + Publish a generated design. + + :param cmd: + :param client: + :type client: HybridNetworkManagementClient + :param config_file: Path to the config file for the NSDV + :param design_file: Optional path to an override bicep template to deploy the NSDV. + :param parameters_json_file: Optional path to a parameters file for the bicep file, + in case the user wants to edit the built NSDV template. If + omitted, parameters from config will be turned into parameters + for the bicep file + :param manifest_file: Optional path to an override bicep template to deploy + manifests + :param manifest_params_file: Optional path to an override bicep parameters + file for manifest parameters + :param skip: options to skip, either publish bicep or upload artifacts + """ + + print("Publishing design.") + api_clients = ApiClients( + aosm_client=client, resource_client=cf_resources(cmd.cli_ctx) + ) + + config = _get_config_from_file(config_file=config_file, configuration_type=NSD) + assert isinstance(config, NSConfiguration) + config.validate() + + deployer = DeployerViaArm( + api_clients, + resource_type=DeployableResourceTypes.NSD, + config=config, + bicep_path=design_file, + parameters_json_file=parameters_json_file, + manifest_bicep_path=manifest_file, + manifest_params_file=manifest_params_file, + skip=skip, + cli_ctx=cmd.cli_ctx, + ) + + deployer.deploy_nsd_from_bicep() + + +def _generate_nsd( + config: NSConfiguration, api_clients: ApiClients, force: bool = False +): + """Generate a Network Service Design for the given config.""" + if config: + nsd_generator = NSDGenerator(config=config, api_clients=api_clients) + else: + raise CLIInternalError("Generate NSD called without a config file") + + if os.path.exists(config.output_directory_for_build): + if not force: + carry_on = input( + f"The folder {config.output_directory_for_build} already exists - delete it" + " and continue? (y/n)" + ) + if carry_on != "y": + raise UnclassifiedUserFault("User aborted! ") + + shutil.rmtree(config.output_directory_for_build) + + nsd_generator.generate_nsd() diff --git a/src/aosm/azext_aosm/delete/__init__.py b/src/aosm/azext_aosm/delete/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/delete/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/delete/delete.py b/src/aosm/azext_aosm/delete/delete.py new file mode 100644 index 00000000000..c6b1999b41a --- /dev/null +++ b/src/aosm/azext_aosm/delete/delete.py @@ -0,0 +1,330 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains class for deploying generated definitions using the Python SDK.""" +from typing import Optional +from knack.log import get_logger + +from azure.cli.core.commands import LongRunningOperation +from azext_aosm._configuration import ( + Configuration, + NFConfiguration, + NSConfiguration, + VNFConfiguration, +) +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.util.utils import input_ack + +logger = get_logger(__name__) + + +class ResourceDeleter: + def __init__( + self, + api_clients: ApiClients, + config: Configuration, + cli_ctx: Optional[object] = None, + ) -> None: + """ + Initializes a new instance of the Deployer class. + + :param aosm_client: The client to use for managing AOSM resources. + :type aosm_client: HybridNetworkManagementClient + :param resource_client: The client to use for managing Azure resources. + :type resource_client: ResourceManagementClient + """ + logger.debug("Create ARM/Bicep Deployer") + self.api_clients = api_clients + self.config = config + self.cli_ctx = cli_ctx + + def delete_nfd(self, clean: bool = False, force: bool = False) -> None: + """ + Delete the NFDV and manifests. If they don't exist it still reports them as deleted. + + :param clean: Delete the NFDG, artifact stores and publisher too. Defaults to False. + Use with care. + """ + assert isinstance(self.config, NFConfiguration) + + if not force: + if clean: + print( + "Are you sure you want to delete all resources associated with NFD" + f" {self.config.nf_name} including the artifact stores and publisher" + f" {self.config.publisher_name}?" + ) + logger.warning( + "This command will fail if other NFD versions exist in the NFD group." + ) + logger.warning( + "Only do this if you are SURE you are not sharing the publisher and" + " artifact stores with other NFDs" + ) + print("There is no undo. Type the publisher name to confirm.") + if not input_ack(self.config.publisher_name.lower(), "Confirm delete:"): + print("Not proceeding with delete") + return + else: + print( + "Are you sure you want to delete the NFD Version" + f" {self.config.version} and associated manifests from group" + f" {self.config.nfdg_name} and publisher {self.config.publisher_name}?" + ) + print("There is no undo. Type 'delete' to confirm") + if not input_ack("delete", "Confirm delete:"): + print("Not proceeding with delete") + return + + self.delete_nfdv() + + if isinstance(self.config, VNFConfiguration): + self.delete_artifact_manifest("sa") + self.delete_artifact_manifest("acr") + + if clean: + logger.info("Delete called for all resources.") + self.delete_nfdg() + self.delete_artifact_store("acr") + if isinstance(self.config, VNFConfiguration): + self.delete_artifact_store("sa") + self.delete_publisher() + + def delete_nsd(self, clean: bool = False, force: bool = False) -> None: + """ + Delete the NSDV and manifests. + + If they don't exist it still reports them as deleted. + """ + assert isinstance(self.config, NSConfiguration) + + if not force: + print( + "Are you sure you want to delete the NSD Version" + f" {self.config.nsd_version}, the associated manifests" + f" {self.config.acr_manifest_names} and configuration group schema" + f" {self.config.cg_schema_name}?" + ) + if clean: + print( + f"Because of the --clean flag, the NSDG {self.config.nsdg_name} will also be deleted." + ) + print("There is no undo. Type 'delete' to confirm") + if not input_ack("delete", "Confirm delete:"): + print("Not proceeding with delete") + return + + self.delete_nsdv() + self.delete_artifact_manifest("acr") + self.delete_config_group_schema() + if clean: + self.delete_nsdg() + + def delete_nfdv(self): + assert isinstance(self.config, NFConfiguration) + message = ( + f"Delete NFDV {self.config.version} from group {self.config.nfdg_name} and" + f" publisher {self.config.publisher_name}" + ) + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.network_function_definition_versions.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + network_function_definition_group_name=self.config.nfdg_name, + network_function_definition_version_name=self.config.version, + ) + LongRunningOperation(self.cli_ctx, "Deleting NFDV...")(poller) + print("Deleted NFDV.") + except Exception: + logger.error( + "Failed to delete NFDV %s from group %s", + self.config.version, + self.config.nfdg_name, + ) + raise + + def delete_nsdv(self): + assert isinstance(self.config, NSConfiguration) + message = ( + f"Delete NSDV {self.config.nsd_version} from group" + f" {self.config.nsdg_name} and publisher {self.config.publisher_name}" + ) + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.network_service_design_versions.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + network_service_design_group_name=self.config.nsdg_name, + network_service_design_version_name=self.config.nsd_version, + ) + LongRunningOperation(self.cli_ctx, "Deleting NSDV...")(poller) + print("Deleted NSDV.") + except Exception: + logger.error( + "Failed to delete NSDV %s from group %s", + self.config.nsd_version, + self.config.nsdg_name, + ) + raise + + def delete_artifact_manifest(self, store_type: str) -> None: + """ + _summary_ + + :param store_type: "sa" or "acr" + :raises CLIInternalError: If called with any other store type :raises + Exception if delete throws an exception + """ + if store_type == "sa": + assert isinstance(self.config, VNFConfiguration) + store_name = self.config.blob_artifact_store_name + manifest_names = [self.config.sa_manifest_name] + elif store_type == "acr": + store_name = self.config.acr_artifact_store_name + manifest_names = self.config.acr_manifest_names + else: + from azure.cli.core.azclierror import CLIInternalError + + raise CLIInternalError( + "Delete artifact manifest called for invalid store type. Valid types" + " are sa and acr." + ) + + for manifest_name in manifest_names: + message = f"Delete Artifact manifest {manifest_name} from artifact store {store_name}" + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.artifact_manifests.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + artifact_store_name=store_name, + artifact_manifest_name=manifest_name, + ) + LongRunningOperation(self.cli_ctx, "Deleting Artifact manifest...")( + poller + ) # noqa: E501 + print("Deleted Artifact Manifest") + except Exception: + logger.error( + "Failed to delete Artifact manifest %s from artifact store %s", + manifest_name, + store_name, + ) + raise + + def delete_nsdg(self) -> None: + """Delete the NSDG.""" + assert isinstance(self.config, NSConfiguration) + message = f"Delete NSD Group {self.config.nsdg_name}" + logger.debug(message) + print(message) + try: + poller = ( + self.api_clients.aosm_client.network_service_design_groups.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + network_service_design_group_name=self.config.nsdg_name, + ) + ) + LongRunningOperation(self.cli_ctx, "Deleting NSD Group...")(poller) + print("Deleted NSD Group") + except Exception: + logger.error("Failed to delete NFDG.") + raise + + def delete_nfdg(self) -> None: + """Delete the NFDG.""" + assert isinstance(self.config, NFConfiguration) + message = f"Delete NFD Group {self.config.nfdg_name}" + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.network_function_definition_groups.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + network_function_definition_group_name=self.config.nfdg_name, + ) + LongRunningOperation(self.cli_ctx, "Deleting NFD Group...")(poller) + print("Deleted NFD Group") + except Exception: + logger.error("Failed to delete NFDG.") + raise + + def delete_artifact_store(self, store_type: str) -> None: + """Delete an artifact store + :param store_type: "sa" or "acr" + :raises CLIInternalError: If called with any other store type + :raises Exception if delete throws an exception.""" + if store_type == "sa": + assert isinstance(self.config, VNFConfiguration) + store_name = self.config.blob_artifact_store_name + elif store_type == "acr": + store_name = self.config.acr_artifact_store_name + else: + from azure.cli.core.azclierror import CLIInternalError + + raise CLIInternalError( + "Delete artifact store called for invalid store type. Valid types are" + " sa and acr." + ) + message = f"Delete Artifact store {store_name}" + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.artifact_stores.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + artifact_store_name=store_name, + ) + LongRunningOperation(self.cli_ctx, "Deleting Artifact store...")(poller) + print("Deleted Artifact Store") + except Exception: + logger.error("Failed to delete Artifact store %s", store_name) + raise + + def delete_publisher(self) -> None: + """ + Delete the publisher. + + Warning - dangerous + """ + message = f"Delete Publisher {self.config.publisher_name}" + logger.debug(message) + print(message) + try: + poller = self.api_clients.aosm_client.publishers.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + ) + LongRunningOperation(self.cli_ctx, "Deleting Publisher...")(poller) + print("Deleted Publisher") + except Exception: + logger.error("Failed to delete publisher") + raise + + def delete_config_group_schema(self) -> None: + """Delete the Configuration Group Schema.""" + assert isinstance(self.config, NSConfiguration) + message = f"Delete Configuration Group Schema {self.config.cg_schema_name}" + logger.debug(message) + print(message) + try: + poller = ( + self.api_clients.aosm_client.configuration_group_schemas.begin_delete( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + configuration_group_schema_name=self.config.cg_schema_name, + ) + ) + LongRunningOperation( + self.cli_ctx, "Deleting Configuration Group Schema..." + )(poller) + print("Deleted Configuration Group Schema") + except Exception: + logger.error("Failed to delete the Configuration Group Schema") + raise diff --git a/src/aosm/azext_aosm/deploy/__init__.py b/src/aosm/azext_aosm/deploy/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/deploy/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/deploy/artifact.py b/src/aosm/azext_aosm/deploy/artifact.py new file mode 100644 index 00000000000..784287f5bea --- /dev/null +++ b/src/aosm/azext_aosm/deploy/artifact.py @@ -0,0 +1,264 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Highly Confidential Material + +# pylint: disable=unidiomatic-typecheck +"""A module to handle interacting with artifacts.""" +import math +import subprocess +import shutil +from dataclasses import dataclass +from typing import List, Optional, Union + +from azure.cli.core.commands import LongRunningOperation +from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.models import ImportImageParameters, ImportSource +from azure.storage.blob import BlobClient, BlobType +from knack.log import get_logger +from knack.util import CLIError +from oras.client import OrasClient + +from azext_aosm._configuration import ArtifactConfig, HelmPackageConfig + +logger = get_logger(__name__) + + +@dataclass +class Artifact: + """Artifact class.""" + + artifact_name: str + artifact_type: str + artifact_version: str + artifact_client: Union[BlobClient, OrasClient] + + def upload(self, artifact_config: Union[ArtifactConfig, HelmPackageConfig]) -> None: + """ + Upload artifact. + + :param artifact_config: configuration for the artifact being uploaded + """ + if isinstance(self.artifact_client, OrasClient): + if isinstance(artifact_config, HelmPackageConfig): + self._upload_helm_to_acr(artifact_config) + elif isinstance(artifact_config, ArtifactConfig): + self._upload_arm_to_acr(artifact_config) + else: + raise ValueError(f"Unsupported artifact type: {type(artifact_config)}.") + else: + assert isinstance(artifact_config, ArtifactConfig) + self._upload_to_storage_account(artifact_config) + + def _upload_arm_to_acr(self, artifact_config: ArtifactConfig) -> None: + """ + Upload ARM artifact to ACR. + + :param artifact_config: configuration for the artifact being uploaded + """ + assert isinstance(self.artifact_client, OrasClient) + + if artifact_config.file_path: + if not self.artifact_client.remote.hostname: + raise ValueError( + "Cannot upload ARM template as OrasClient has no remote hostname." + " Please check your ACR config." + ) + target = ( + f"{self.artifact_client.remote.hostname.replace('https://', '')}" + f"/{self.artifact_name}:{self.artifact_version}" + ) + logger.debug("Uploading %s to %s", artifact_config.file_path, target) + self.artifact_client.push(files=[artifact_config.file_path], target=target) + else: + raise NotImplementedError( + "Copying artifacts is not implemented for ACR artifacts stores." + ) + + def _upload_helm_to_acr(self, artifact_config: HelmPackageConfig) -> None: + """ + Upload artifact to ACR. + + :param artifact_config: configuration for the artifact being uploaded + """ + assert isinstance(self.artifact_client, OrasClient) + chart_path = artifact_config.path_to_chart + if not self.artifact_client.remote.hostname: + raise ValueError( + "Cannot upload artifact. Oras client has no remote hostname." + ) + registry = self.artifact_client.remote.hostname.replace("https://", "") + target_registry = f"oci://{registry}" + registry_name = registry.replace(".azurecr.io", "") + + # Note that this uses the user running the CLI's AZ login credentials, not the + # manifest credentials retrieved from the ACR. This isn't ideal, but using the + # manifest credentials caused problems so we are doing this for now. + # This logs in to the registry by retrieving an access token, which allows use + # of this command in environments without docker. + logger.debug("Logging into %s", registry_name) + acr_login_with_token_cmd = [ + str(shutil.which("az")), + "acr", + "login", + "--name", + registry_name, + "--expose-token", + "--output", + "tsv", + "--query", + "accessToken", + ] + acr_token = subprocess.check_output( + acr_login_with_token_cmd, encoding="utf-8" + ).strip() + + try: + logger.debug("Uploading %s to %s", chart_path, target_registry) + helm_login_cmd = [ + str(shutil.which("helm")), + "registry", + "login", + registry, + "--username", + "00000000-0000-0000-0000-000000000000", + "--password", + acr_token, + ] + subprocess.run(helm_login_cmd, check=True) + + # helm push "$chart_path" "$target_registry" + push_command = [ + str(shutil.which("helm")), + "push", + chart_path, + target_registry, + ] + subprocess.run(push_command, check=True) + finally: + helm_logout_cmd = [ + str(shutil.which("helm")), + "registry", + "logout", + registry, + ] + subprocess.run(helm_logout_cmd, check=True) + + def _convert_to_readable_size(self, size_in_bytes: Optional[int]) -> str: + """Converts a size in bytes to a human readable size.""" + if size_in_bytes is None: + return "Unknown bytes" + size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") + index = int(math.floor(math.log(size_in_bytes, 1024))) + power = math.pow(1024, index) + readable_size = round(size_in_bytes / power, 2) + return f"{readable_size} {size_name[index]}" + + def _vhd_upload_progress_callback( + self, current_bytes: int, total_bytes: Optional[int] + ) -> None: + """Callback function for VHD upload progress.""" + current_readable = self._convert_to_readable_size(current_bytes) + total_readable = self._convert_to_readable_size(total_bytes) + message = f"Uploaded {current_readable} of {total_readable} bytes" + logger.info(message) + print(message) + + def _upload_to_storage_account(self, artifact_config: ArtifactConfig) -> None: + """ + Upload artifact to storage account. + + :param artifact_config: configuration for the artifact being uploaded + """ + assert isinstance(self.artifact_client, BlobClient) + assert isinstance(artifact_config, ArtifactConfig) + + # If the file path is given, upload the artifact, else, copy it from an existing blob. + if artifact_config.file_path: + logger.info("Upload to blob store") + with open(artifact_config.file_path, "rb") as artifact: + self.artifact_client.upload_blob( + data=artifact, + overwrite=True, + blob_type=BlobType.PAGEBLOB, + progress_hook=self._vhd_upload_progress_callback, + ) + logger.info( + "Successfully uploaded %s to %s", + artifact_config.file_path, + self.artifact_client.account_name, + ) + else: + # Config Validation will raise error if not true + assert artifact_config.blob_sas_url + logger.info("Copy from SAS URL to blob store") + source_blob = BlobClient.from_blob_url(artifact_config.blob_sas_url) + + if source_blob.exists(): + logger.debug(source_blob.url) + self.artifact_client.start_copy_from_url(source_blob.url) + logger.info( + "Successfully copied %s from %s to %s", + source_blob.blob_name, + source_blob.account_name, + self.artifact_client.account_name, + ) + else: + raise RuntimeError( + f"{source_blob.blob_name} does not exist in" + f" {source_blob.account_name}." + ) + + @staticmethod + def copy_image( + cli_ctx, + container_registry_client: ContainerRegistryManagementClient, + source_registry_id: str, + source_image: str, + target_registry_resource_group_name: str, + target_registry_name: str, + target_tags: List[str], + mode: str = "NoForce", + ): + """ + Copy image from one ACR to another. + + :param cli_ctx: CLI context + :param container_registry_client: container registry client + :param source_registry_id: source registry ID + :param source_image: source image + :param target_registry_resource_group_name: target registry resource group name + :param target_registry_name: target registry name + :param target_tags: the list of tags to be applied to the imported image + should be of form: namepace/name:tag or name:tag + :param mode: mode for import + """ + + source = ImportSource(resource_id=source_registry_id, source_image=source_image) + + import_parameters = ImportImageParameters( + source=source, + target_tags=target_tags, + untagged_target_repositories=[], + mode=mode, + ) + try: + result_poller = container_registry_client.begin_import_image( + resource_group_name=target_registry_resource_group_name, + registry_name=target_registry_name, + parameters=import_parameters, + ) + + LongRunningOperation(cli_ctx, "Importing image...")(result_poller) + + logger.info( + "Successfully imported %s to %s", source_image, target_registry_name + ) + except CLIError as error: + logger.error( + ( + "Failed to import %s to %s. Check if this image exists in the" + " source registry or is already present in the target registry." + ), + source_image, + target_registry_name, + ) + logger.debug(error, exc_info=True) diff --git a/src/aosm/azext_aosm/deploy/artifact_manifest.py b/src/aosm/azext_aosm/deploy/artifact_manifest.py new file mode 100644 index 00000000000..20cecf5c056 --- /dev/null +++ b/src/aosm/azext_aosm/deploy/artifact_manifest.py @@ -0,0 +1,168 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Highly Confidential Material +"""A module to handle interacting with artifact manifests.""" + +from functools import cached_property, lru_cache +from typing import Any, List, Union + +from azure.cli.core.azclierror import AzCLIError +from azure.storage.blob import BlobClient +from knack.log import get_logger +from oras.client import OrasClient + +from azext_aosm._configuration import Configuration +from azext_aosm.deploy.artifact import Artifact +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.vendored_sdks.models import ( + ArtifactManifest, + ArtifactType, + CredentialType, + ManifestArtifactFormat, +) + +logger = get_logger(__name__) + + +class ArtifactManifestOperator: + """ArtifactManifest class.""" + + # pylint: disable=too-few-public-methods + def __init__( + self, + config: Configuration, + api_clients: ApiClients, + store_name: str, + manifest_name: str, + ) -> None: + """Init.""" + self.manifest_name = manifest_name + self.api_clients = api_clients + self.config = config + self.store_name = store_name + self.artifacts = self._get_artifact_list() + + @cached_property + def _manifest_credentials(self) -> Any: + """Gets the details for uploading the artifacts in the manifest.""" + + return self.api_clients.aosm_client.artifact_manifests.list_credential( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + artifact_store_name=self.store_name, + artifact_manifest_name=self.manifest_name, + ).as_dict() + + @lru_cache(maxsize=32) # noqa: B019 + def _oras_client(self, acr_url: str) -> OrasClient: + """ + Returns an OrasClient object for uploading to the artifact store ACR. + + :param arc_url: URL of the ACR backing the artifact manifest + """ + client = OrasClient(hostname=acr_url) + client.login( + username=self._manifest_credentials["username"], + password=self._manifest_credentials["acr_token"], + ) + + return client + + def _get_artifact_list(self) -> List[Artifact]: + """Get the list of Artifacts in the Artifact Manifest.""" + artifacts = [] + + manifest: ArtifactManifest = ( + self.api_clients.aosm_client.artifact_manifests.get( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + artifact_store_name=self.store_name, + artifact_manifest_name=self.manifest_name, + ) + ) + + # Instatiate an Artifact object for each artifact in the manifest. + if manifest.artifacts: + for artifact in manifest.artifacts: + if not ( + artifact.artifact_name + and artifact.artifact_type + and artifact.artifact_version + ): + raise AzCLIError( + "Cannot upload artifact. Artifact returned from " + "manifest query is missing required information." + f"{artifact}" + ) + + artifacts.append( + Artifact( + artifact_name=artifact.artifact_name, + artifact_type=artifact.artifact_type, + artifact_version=artifact.artifact_version, + artifact_client=self._get_artifact_client(artifact), + ) + ) + + return artifacts + + def _get_artifact_client( + self, artifact: ManifestArtifactFormat + ) -> Union[BlobClient, OrasClient]: + """ + Get the artifact client required for uploading the artifact. + + :param artifact - a ManifestArtifactFormat with the artifact info. + """ + # Appease mypy - an error will be raised before this if these are blank + assert artifact.artifact_name + assert artifact.artifact_type + assert artifact.artifact_version + if ( + self._manifest_credentials["credential_type"] + == CredentialType.AZURE_STORAGE_ACCOUNT_TOKEN + ): + # Check we have the required artifact types for this credential. Indicates + # a coding error if we hit this but worth checking. + if not ( + artifact.artifact_type + in (ArtifactType.IMAGE_FILE, ArtifactType.VHD_IMAGE_FILE) + ): + raise AzCLIError( + f"Cannot upload artifact {artifact.artifact_name}." + " Artifact manifest credentials of type " + f"{CredentialType.AZURE_STORAGE_ACCOUNT_TOKEN} are not expected " + f"for Artifacts of type {artifact.artifact_type}" + ) + + container_basename = artifact.artifact_name.replace("-", "") + container_name = f"{container_basename}-{artifact.artifact_version}" + + # For AOSM to work VHD blobs must have the suffix .vhd + if artifact.artifact_name.endswith("-vhd"): + blob_name = f"{artifact.artifact_name[:-4].replace('-', '')}-{artifact.artifact_version}.vhd" + else: + blob_name = container_name + + logger.debug("container name: %s, blob name: %s", container_name, blob_name) + + blob_url = self._get_blob_url(container_name, blob_name) + return BlobClient.from_blob_url(blob_url) + return self._oras_client(self._manifest_credentials["acr_server_url"]) + + def _get_blob_url(self, container_name: str, blob_name: str) -> str: + """ + Get the URL for the blob to be uploaded to the storage account artifact store. + + :param container_name: name of the container + :param blob_name: the name that the blob will get uploaded with + """ + for container_credential in self._manifest_credentials["container_credentials"]: + if container_credential["container_name"] == container_name: + sas_uri = str(container_credential["container_sas_uri"]) + sas_uri_prefix, sas_uri_token = sas_uri.split("?", maxsplit=1) + + blob_url = f"{sas_uri_prefix}/{blob_name}?{sas_uri_token}" + logger.debug("Blob URL: %s", blob_url) + + return blob_url + raise KeyError(f"Manifest does not include a credential for {container_name}.") diff --git a/src/aosm/azext_aosm/deploy/deploy_with_arm.py b/src/aosm/azext_aosm/deploy/deploy_with_arm.py new file mode 100644 index 00000000000..f346561b103 --- /dev/null +++ b/src/aosm/azext_aosm/deploy/deploy_with_arm.py @@ -0,0 +1,693 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains class for deploying generated definitions using ARM.""" +import json +import os +import shutil +import subprocess # noqa +import tempfile +import time +from typing import Any, Dict, Optional + +from azure.cli.core.commands import LongRunningOperation +from azure.mgmt.resource.resources.models import DeploymentExtended +from knack.log import get_logger + +from azext_aosm._configuration import ( + CNFConfiguration, + Configuration, + NFConfiguration, + NSConfiguration, + VNFConfiguration, +) +from azext_aosm.deploy.artifact import Artifact +from azext_aosm.deploy.artifact_manifest import ArtifactManifestOperator +from azext_aosm.deploy.pre_deploy import PreDeployerViaSDK +from azext_aosm.util.constants import ( + ARTIFACT_UPLOAD, + BICEP_PUBLISH, + CNF, + CNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + CNF_MANIFEST_BICEP_TEMPLATE_FILENAME, + DeployableResourceTypes, + IMAGE_UPLOAD, + NSD, + NSD_ARTIFACT_MANIFEST_BICEP_FILENAME, + NSD_BICEP_FILENAME, + SkipSteps, + VNF, + VNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + VNF_MANIFEST_BICEP_TEMPLATE_FILENAME, +) +from azext_aosm.util.management_clients import ApiClients + +logger = get_logger(__name__) + + +class DeployerViaArm: # pylint: disable=too-many-instance-attributes + """ + A class to deploy Artifact Manifests, NFDs and NSDs from bicep templates using ARM. + + Uses the SDK to pre-deploy less complex resources and then ARM to deploy the bicep + templates. + """ + + def __init__( + self, + api_clients: ApiClients, + resource_type: DeployableResourceTypes, + config: Configuration, + bicep_path: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_bicep_path: Optional[str] = None, + manifest_params_file: Optional[str] = None, + skip: Optional[SkipSteps] = None, + cli_ctx: Optional[object] = None, + ): + """ + :param api_clients: ApiClients object for AOSM and ResourceManagement + :param config: The configuration for this NF + :param bicep_path: The path to the bicep template of the nfdv + :param parameters_json_file: path to an override file of set parameters for the nfdv + :param manifest_bicep_path: The path to the bicep template of the manifest + :param manifest_params_file: path to an override file of set parameters for + the manifest + :param skip: options to skip, either publish bicep or upload artifacts + :param cli_ctx: The CLI context. Used with CNFs and all LongRunningOperations + """ + self.api_clients = api_clients + self.resource_type = resource_type + self.config = config + self.bicep_path = bicep_path + self.parameters_json_file = parameters_json_file + self.manifest_bicep_path = manifest_bicep_path + self.manifest_params_file = manifest_params_file + self.skip = skip + self.cli_ctx = cli_ctx + self.pre_deployer = PreDeployerViaSDK( + self.api_clients, self.config, self.cli_ctx + ) + + def deploy_nfd_from_bicep(self) -> None: + """ + Deploy the bicep template defining the NFD. + + Also ensure that all required predeploy resources are deployed. + """ + assert isinstance(self.config, NFConfiguration) + if self.skip == BICEP_PUBLISH: + print("Skipping bicep publish") + else: + if not self.bicep_path: + # User has not passed in a bicep template, so we are deploying the default + # one produced from building the NFDV using this CLI + if self.resource_type == VNF: + file_name = VNF_DEFINITION_BICEP_TEMPLATE_FILENAME + if self.resource_type == CNF: + file_name = CNF_DEFINITION_BICEP_TEMPLATE_FILENAME + bicep_path = os.path.join( + self.config.output_directory_for_build, file_name + ) + + # Create or check required resources + deploy_manifest_template = not self.nfd_predeploy() + if deploy_manifest_template: + self.deploy_manifest_template() + else: + print( + f"Artifact manifests exist for NFD {self.config.nf_name} " + f"version {self.config.version}" + ) + message = ( + f"Deploy bicep template for NFD {self.config.nf_name} version" + f" {self.config.version} into" + f" {self.config.publisher_resource_group_name} under publisher" + f" {self.config.publisher_name}" + ) + print(message) + logger.info(message) + logger.debug( + "Parameters used for NF definition bicep deployment: %s", + self.parameters, + ) + + self.deploy_bicep_template(bicep_path, self.parameters) + print(f"Deployed NFD {self.config.nf_name} version {self.config.version}.") + + if self.skip == ARTIFACT_UPLOAD: + print("Skipping artifact upload") + print("Done") + return + + if self.resource_type == VNF: + self._vnfd_artifact_upload() + if self.resource_type == CNF: + self._cnfd_artifact_upload() + + print("Done") + + def _vnfd_artifact_upload(self) -> None: + """Uploads the VHD and ARM template artifacts.""" + assert isinstance(self.config, VNFConfiguration) + storage_account_manifest = ArtifactManifestOperator( + self.config, + self.api_clients, + self.config.blob_artifact_store_name, + self.config.sa_manifest_name, + ) + acr_manifest = ArtifactManifestOperator( + self.config, + self.api_clients, + self.config.acr_artifact_store_name, + self.config.acr_manifest_names[0], + ) + + vhd_artifact = storage_account_manifest.artifacts[0] + arm_template_artifact = acr_manifest.artifacts[0] + + if self.skip == IMAGE_UPLOAD: + print("Skipping VHD artifact upload") + else: + print("Uploading VHD artifact") + vhd_artifact.upload(self.config.vhd) + + print("Uploading ARM template artifact") + arm_template_artifact.upload(self.config.arm_template) + + def _cnfd_artifact_upload(self) -> None: + """Uploads the Helm chart and any additional images.""" + assert isinstance(self.config, CNFConfiguration) + acr_properties = self.api_clients.aosm_client.artifact_stores.get( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + artifact_store_name=self.config.acr_artifact_store_name, + ) + if not acr_properties.storage_resource_id: + raise ValueError( + f"Artifact store {self.config.acr_artifact_store_name} " + "has no storage resource id linked" + ) + + target_registry_name = acr_properties.storage_resource_id.split("/")[-1] + target_registry_resource_group_name = acr_properties.storage_resource_id.split( + "/" + )[-5] + # Check whether the source registry has a namespace in the repository path + source_registry_namespace: str = "" + if self.config.source_registry_namespace: + source_registry_namespace = f"{self.config.source_registry_namespace}/" + + acr_manifest = ArtifactManifestOperator( + self.config, + self.api_clients, + self.config.acr_artifact_store_name, + self.config.acr_manifest_names[0], + ) + + artifact_dictionary = {} + + for artifact in acr_manifest.artifacts: + artifact_dictionary[artifact.artifact_name] = artifact + + for helm_package in self.config.helm_packages: + helm_package_name = helm_package.name + + if helm_package_name not in artifact_dictionary: + raise ValueError( + f"Artifact {helm_package_name} not found in the artifact manifest" + ) + + manifest_artifact = artifact_dictionary[helm_package_name] + + print(f"Uploading Helm package: {helm_package_name}") + + manifest_artifact.upload(helm_package) + + print(f"Finished uploading Helm package: {helm_package_name}") + + artifact_dictionary.pop(helm_package_name) + + # All the remaining artifacts are not in the helm_packages list. We assume that + # they are images that need to be copied from another ACR. + if self.skip == IMAGE_UPLOAD: + print("Skipping upload of images") + return + + for artifact in artifact_dictionary.values(): + assert isinstance(artifact, Artifact) + + print(f"Copying artifact: {artifact.artifact_name}") + artifact.copy_image( + cli_ctx=self.cli_ctx, + container_registry_client=self.api_clients.container_registry_client, + source_registry_id=self.config.source_registry_id, + source_image=( + f"{source_registry_namespace}{artifact.artifact_name}" + f":{artifact.artifact_version}" + ), + target_registry_resource_group_name=target_registry_resource_group_name, + target_registry_name=target_registry_name, + target_tags=[f"{artifact.artifact_name}:{artifact.artifact_version}"], + ) + + def nfd_predeploy(self) -> bool: + """ + All the predeploy steps for a NFD. Create publisher, artifact stores and NFDG. + + Return True if artifact manifest already exists, False otherwise + """ + logger.debug("Ensure all required resources exist") + self.pre_deployer.ensure_config_resource_group_exists() + self.pre_deployer.ensure_config_publisher_exists() + self.pre_deployer.ensure_acr_artifact_store_exists() + if self.resource_type == VNF: + self.pre_deployer.ensure_sa_artifact_store_exists() + if self.resource_type == CNF: + self.pre_deployer.ensure_config_source_registry_exists() + + self.pre_deployer.ensure_config_nfdg_exists() + return self.pre_deployer.do_config_artifact_manifests_exist() + + @property + def parameters(self) -> Dict[str, Any]: + if self.parameters_json_file: + message = f"Use parameters from file {self.parameters_json_file}" + logger.info(message) + print(message) + with open(self.parameters_json_file, "r", encoding="utf-8") as f: + parameters_json = json.loads(f.read()) + parameters = parameters_json["parameters"] + else: + # User has not passed in parameters file, so we use the parameters + # required from config for the default bicep template produced from + # building the NFDV using this CLI + logger.debug("Create parameters for default template.") + parameters = self.construct_parameters() + + return parameters + + def construct_parameters(self) -> Dict[str, Any]: + """ + Create the parmeters dictionary for vnfdefinitions.bicep. + + VNF specific. + """ + if self.resource_type == VNF: + assert isinstance(self.config, VNFConfiguration) + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "saArtifactStoreName": {"value": self.config.blob_artifact_store_name}, + "nfName": {"value": self.config.nf_name}, + "nfDefinitionGroup": {"value": self.config.nfdg_name}, + "nfDefinitionVersion": {"value": self.config.version}, + "vhdVersion": {"value": self.config.vhd.version}, + "armTemplateVersion": {"value": self.config.arm_template.version}, + } + if self.resource_type == CNF: + assert isinstance(self.config, CNFConfiguration) + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "nfDefinitionGroup": {"value": self.config.nfdg_name}, + "nfDefinitionVersion": {"value": self.config.version}, + } + if self.resource_type == NSD: + assert isinstance(self.config, NSConfiguration) + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "nsDesignGroup": {"value": self.config.nsdg_name}, + "nsDesignVersion": {"value": self.config.nsd_version}, + "nfviSiteName": {"value": self.config.nfvi_site_name}, + } + raise TypeError( + "Unexpected config type. Expected [VNFConfiguration|CNFConfiguration|NSConfiguration]," + f" received {type(self.config)}" + ) + + def construct_manifest_parameters(self) -> Dict[str, Any]: + """Create the parmeters dictionary for VNF, CNF or NSD.""" + if self.resource_type == VNF: + assert isinstance(self.config, VNFConfiguration) + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "saArtifactStoreName": {"value": self.config.blob_artifact_store_name}, + "acrManifestName": {"value": self.config.acr_manifest_names[0]}, + "saManifestName": {"value": self.config.sa_manifest_name}, + "nfName": {"value": self.config.nf_name}, + "vhdVersion": {"value": self.config.vhd.version}, + "armTemplateVersion": {"value": self.config.arm_template.version}, + } + if self.resource_type == CNF: + assert isinstance(self.config, CNFConfiguration) + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "acrManifestName": {"value": self.config.acr_manifest_names[0]}, + } + if self.resource_type == NSD: + assert isinstance(self.config, NSConfiguration) + + arm_template_names = [ + nf.arm_template.artifact_name for nf in self.config.network_functions + ] + + # Set the artifact version to be the same as the NSD version, so that they + # don't get over written when a new NSD is published. + return { + "location": {"value": self.config.location}, + "publisherName": {"value": self.config.publisher_name}, + "acrArtifactStoreName": {"value": self.config.acr_artifact_store_name}, + "acrManifestNames": {"value": self.config.acr_manifest_names}, + "armTemplateNames": {"value": arm_template_names}, + "armTemplateVersion": {"value": self.config.nsd_version}, + } + raise ValueError("Unknown configuration type") + + def deploy_nsd_from_bicep(self) -> None: + """ + Deploy the bicep template defining the VNFD. + + Also ensure that all required predeploy resources are deployed. + """ + assert isinstance(self.config, NSConfiguration) + if not self.skip == BICEP_PUBLISH: + if not self.bicep_path: + # User has not passed in a bicep template, so we are deploying the default + # one produced from building the NSDV using this CLI + bicep_path = os.path.join( + self.config.output_directory_for_build, + NSD_BICEP_FILENAME, + ) + + logger.debug(self.parameters) + + # Create or check required resources + deploy_manifest_template = not self.nsd_predeploy() + + if deploy_manifest_template: + self.deploy_manifest_template() + else: + logger.debug( + "Artifact manifests %s already exist", + self.config.acr_manifest_names, + ) + print("Artifact manifests already exist") + + message = ( + f"Deploy bicep template for NSDV {self.config.nsd_version} " + f"into {self.config.publisher_resource_group_name} under publisher " + f"{self.config.publisher_name}" + ) + print(message) + logger.info(message) + self.deploy_bicep_template(bicep_path, self.parameters) + print( + f"Deployed NSD {self.config.nsdg_name} " + f"version {self.config.nsd_version}." + ) + if self.skip == ARTIFACT_UPLOAD: + print("Skipping artifact upload") + print("Done") + return + + for manifest, nf in zip( + self.config.acr_manifest_names, self.config.network_functions + ): + acr_manifest = ArtifactManifestOperator( + self.config, + self.api_clients, + self.config.acr_artifact_store_name, + manifest, + ) + + # Convert the NF bicep to ARM + arm_template_artifact_json = self.convert_bicep_to_arm( + os.path.join( + self.config.output_directory_for_build, nf.nf_bicep_filename + ) + ) + + arm_template_artifact = acr_manifest.artifacts[0] + + # appease mypy + assert nf.arm_template.file_path, "Config missing ARM template file path" + with open(nf.arm_template.file_path, "w", encoding="utf-8") as file: + file.write(json.dumps(arm_template_artifact_json, indent=4)) + + print(f"Uploading ARM template artifact: {nf.arm_template.file_path}") + arm_template_artifact.upload(nf.arm_template) + print("Done") + + def deploy_manifest_template(self) -> None: + """Deploy the bicep template defining the manifest.""" + print("Deploy bicep template for Artifact manifests") + logger.debug("Deploy manifest bicep") + + if not self.manifest_bicep_path: + file_name: str = "" + if self.resource_type == NSD: + file_name = NSD_ARTIFACT_MANIFEST_BICEP_FILENAME + if self.resource_type == VNF: + file_name = VNF_MANIFEST_BICEP_TEMPLATE_FILENAME + if self.resource_type == CNF: + file_name = CNF_MANIFEST_BICEP_TEMPLATE_FILENAME + + manifest_bicep_path = os.path.join( + str(self.config.output_directory_for_build), + file_name, + ) + if not self.manifest_params_file: + manifest_params = self.construct_manifest_parameters() + else: + logger.info("Use provided manifest parameters") + with open(self.manifest_params_file, "r", encoding="utf-8") as f: + manifest_json = json.loads(f.read()) + manifest_params = manifest_json["parameters"] + self.deploy_bicep_template(manifest_bicep_path, manifest_params) + + def nsd_predeploy(self) -> bool: + """ + All the predeploy steps for a NSD. Check if the RG, publisher, ACR, NSDG and + artifact manifest exist. + + Return True if artifact manifest already exists, False otherwise + """ + logger.debug("Ensure all required resources exist") + self.pre_deployer.ensure_config_resource_group_exists() + self.pre_deployer.ensure_config_publisher_exists() + self.pre_deployer.ensure_acr_artifact_store_exists() + self.pre_deployer.ensure_config_nsdg_exists() + return self.pre_deployer.do_config_artifact_manifests_exist() + + def deploy_bicep_template( + self, bicep_template_path: str, parameters: Dict[Any, Any] + ) -> Any: + """ + Deploy a bicep template. + + :param bicep_template_path: Path to the bicep template + :param parameters: Parameters for the bicep template + :return Any output that the template produces + """ + logger.info("Deploy %s", bicep_template_path) + logger.debug("Parameters: %s", parameters) + arm_template_json = self.convert_bicep_to_arm(bicep_template_path) + + return self.validate_and_deploy_arm_template( + arm_template_json, parameters, self.config.publisher_resource_group_name + ) + + def resource_exists(self, resource_name: str) -> bool: + """ + Determine if a resource with the given name exists. + + :param resource_name: The name of the resource to check. + """ + logger.debug("Check if %s exists", resource_name) + resources = self.api_clients.resource_client.resources.list_by_resource_group( + resource_group_name=self.config.publisher_resource_group_name + ) + + resource_exists = False + + for resource in resources: + if resource.name == resource_name: + resource_exists = True + break + + return resource_exists + + def validate_and_deploy_arm_template( + self, template: Any, parameters: Dict[Any, Any], resource_group: str + ) -> Any: + """ + Validate and deploy an individual ARM template. + + This ARM template will be created in the resource group passed in. + + :param template: The JSON contents of the template to deploy + :param parameters: The JSON contents of the parameters file + :param resource_group: The name of the resource group that has been deployed + :raise RuntimeError if validation or deploy fails + :return: Output dictionary from the bicep template. + """ + # Get current time from the time module and remove all digits after the decimal + # point + current_time = str(time.time()).split(".", maxsplit=1)[0] + + # Add a timestamp to the deployment name to ensure it is unique + deployment_name = f"AOSM_CLI_deployment_{current_time}" + + # Validation is automatically re-attempted in live runs, but not in test + # playback, causing them to fail. This explicitly re-attempts validation to + # ensure the tests pass + validation_res = None + for validation_attempt in range(2): + try: + validation = self.api_clients.resource_client.deployments.begin_validate( + resource_group_name=resource_group, + deployment_name=deployment_name, + parameters={ + "properties": { + "mode": "Incremental", + "template": template, + "parameters": parameters, + } + }, + ) + validation_res = LongRunningOperation( + self.cli_ctx, "Validating ARM template..." + )(validation) + break + except Exception: # pylint: disable=broad-except + if validation_attempt == 1: + raise + + if not validation_res: + # Don't expect to hit this but it appeases mypy + raise RuntimeError(f"Validation of template {template} failed.") + + logger.debug("Validation Result %s", validation_res) + if validation_res.error: + # Validation failed so don't even try to deploy + logger.error( + ( + "Template for resource group %s has failed validation. The message" + " was: %s. See logs for additional details." + ), + resource_group, + validation_res.error.message, + ) + logger.debug( + ( + "Template for resource group %s failed validation." + " Full error details: %s" + ), + resource_group, + validation_res.error, + ) + raise RuntimeError("Azure template validation failed.") + + # Validation succeeded so proceed with deployment + logger.debug("Successfully validated resources for %s", resource_group) + + poller = self.api_clients.resource_client.deployments.begin_create_or_update( + resource_group_name=resource_group, + deployment_name=deployment_name, + parameters={ + "properties": { + "mode": "Incremental", + "template": template, + "parameters": parameters, + } + }, + ) + logger.debug(poller) + + # Wait for the deployment to complete and get the outputs + deployment: DeploymentExtended = LongRunningOperation( + self.cli_ctx, "Deploying ARM template" + )(poller) + logger.debug("Finished deploying") + + if deployment.properties is not None: + depl_props = deployment.properties + else: + raise RuntimeError("The deployment has no properties.\nAborting") + logger.debug("Deployed: %s %s %s", deployment.name, deployment.id, depl_props) + + if depl_props.provisioning_state != "Succeeded": + logger.debug("Failed to provision: %s", depl_props) + raise RuntimeError( + "Deploy of template to resource group" + f" {resource_group} proceeded but the provisioning" + f" state returned is {depl_props.provisioning_state}." + "\nAborting" + ) + logger.debug( + "Provisioning state of deployment %s : %s", + resource_group, + depl_props.provisioning_state, + ) + + return depl_props.outputs + + @staticmethod + def convert_bicep_to_arm(bicep_template_path: str) -> Any: + """ + Convert a bicep template into an ARM template. + + :param bicep_template_path: The path to the bicep template to be converted + + :return: Output dictionary from the bicep template. + """ + logger.debug("Converting %s to ARM template", bicep_template_path) + + with tempfile.TemporaryDirectory() as tmpdir: + bicep_filename = os.path.basename(bicep_template_path) + arm_template_name = bicep_filename.replace(".bicep", ".json") + + try: + bicep_output = subprocess.run( # noqa + [ + str(shutil.which("az")), + "bicep", + "build", + "--file", + bicep_template_path, + "--outfile", + os.path.join(tmpdir, arm_template_name), + ], + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + logger.debug("az bicep output: %s", str(bicep_output)) + except subprocess.CalledProcessError as err: + logger.error( + ( + "ARM template compilation failed! See logs for full " + "output. The failing command was %s" + ), + err.cmd, + ) + logger.debug("bicep build stdout: %s", err.stdout) + logger.debug("bicep build stderr: %s", err.stderr) + raise + + with open( + os.path.join(tmpdir, arm_template_name), "r", encoding="utf-8" + ) as template_file: + arm_json = json.loads(template_file.read()) + + return arm_json diff --git a/src/aosm/azext_aosm/deploy/pre_deploy.py b/src/aosm/azext_aosm/deploy/pre_deploy.py new file mode 100644 index 00000000000..26deff1cf9e --- /dev/null +++ b/src/aosm/azext_aosm/deploy/pre_deploy.py @@ -0,0 +1,479 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains class for deploying resources required by NFDs/NSDs via the SDK.""" + +import re +from typing import Optional + +from azure.cli.core.azclierror import AzCLIError +from azure.cli.core.commands import LongRunningOperation +from azure.core import exceptions as azure_exceptions +from azure.mgmt.resource.resources.models import ResourceGroup +from knack.log import get_logger + +from azext_aosm._configuration import ( + Configuration, + VNFConfiguration, + CNFConfiguration, +) +from azext_aosm.util.constants import SOURCE_ACR_REGEX +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.vendored_sdks.models import ( + ArtifactStore, + ArtifactStoreType, + NetworkFunctionDefinitionGroup, + NetworkServiceDesignGroup, + ProvisioningState, + Publisher, +) + +logger = get_logger(__name__) + + +class PreDeployerViaSDK: + """ + A class for checking or publishing resources required by NFDs/NSDs. + + Uses the SDK to deploy rather than ARM, as the objects it deploys are not complex. + """ + + def __init__( + self, + api_clients: ApiClients, + config: Configuration, + cli_ctx: Optional[object] = None, + ) -> None: + """ + Initializes a new instance of the Deployer class. + + :param api_clients: ApiClients object for AOSM and ResourceManagement + :param config: The configuration for this NF + :param cli_ctx: The CLI context. Used with all LongRunningOperation calls. + """ + + self.api_clients = api_clients + self.config = config + self.cli_ctx = cli_ctx + + def ensure_resource_group_exists(self, resource_group_name: str) -> None: + """ + Checks whether a particular resource group exists on the subscription. + Copied from virtutils. + + :param resource_group_name: The name of the resource group Raises a + NotFoundError exception if the resource group does not exist. Raises a + PermissionsError exception if we don't have permissions to check + resource group existence. + """ + if not self.api_clients.resource_client.resource_groups.check_existence( + resource_group_name + ): + logger.info("RG %s not found. Create it.", resource_group_name) + print(f"Creating resource group {resource_group_name}.") + rg_params: ResourceGroup = ResourceGroup(location=self.config.location) + poller = self.api_clients.resource_client.resource_groups.create_or_update( + resource_group_name, rg_params + ) + LongRunningOperation(self.cli_ctx, "Creating resource group...")(poller) + else: + print(f"Resource group {resource_group_name} exists.") + self.api_clients.resource_client.resource_groups.get(resource_group_name) + + def ensure_config_resource_group_exists(self) -> None: + """ + Ensures that the resource group exists. + + Finds the parameters from self.config + """ + self.ensure_resource_group_exists(self.config.publisher_resource_group_name) + + def ensure_publisher_exists( + self, resource_group_name: str, publisher_name: str, location: str + ) -> None: + """ + Ensures that the publisher exists in the resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param location: The location of the publisher. + :type location: str + """ + + try: + publisher = self.api_clients.aosm_client.publishers.get( + resource_group_name, publisher_name + ) + print( + f"Publisher {publisher.name} exists in resource group" + f" {resource_group_name}" + ) + except azure_exceptions.ResourceNotFoundError: + # Create the publisher + logger.info("Creating publisher %s if it does not exist", publisher_name) + print( + f"Creating publisher {publisher_name} in resource group" + f" {resource_group_name}" + ) + poller = self.api_clients.aosm_client.publishers.begin_create_or_update( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + parameters=Publisher(location=location, scope="Private"), + ) + LongRunningOperation(self.cli_ctx, "Creating publisher...")(poller) + + def ensure_config_publisher_exists(self) -> None: + """ + Ensures that the publisher exists in the resource group. + + Finds the parameters from self.config + """ + self.ensure_publisher_exists( + resource_group_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + location=self.config.location, + ) + + def ensure_config_source_registry_exists(self) -> None: + """ + Ensures that the source registry exists. + + Finds the parameters from self.config + """ + assert isinstance(self.config, CNFConfiguration) + logger.info( + "Check if the source registry %s exists", + self.config.source_registry_id, + ) + + # Match the source registry format + source_registry_match = re.search( + SOURCE_ACR_REGEX, self.config.source_registry_id + ) + # Config validation has already checked and raised an error if the regex doesn't + # match + if source_registry_match and len(source_registry_match.groups()) > 1: + source_registry_resource_group_name = source_registry_match.group( + "resource_group" + ) + source_registry_name = source_registry_match.group("registry_name") + + # This will raise an error if the registry does not exist + assert self.api_clients.container_registry_client + self.api_clients.container_registry_client.get( + resource_group_name=source_registry_resource_group_name, + registry_name=source_registry_name, + ) + + def ensure_artifact_store_exists( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_store_type: ArtifactStoreType, + location: str, + ) -> None: + """ + Ensures that the artifact store exists in the resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_store_type: The type of the artifact store. + :type artifact_store_type: ArtifactStoreType + :param location: The location of the artifact store. + :type location: str + """ + logger.info( + "Creating artifact store %s if it does not exist", + artifact_store_name, + ) + try: + self.api_clients.aosm_client.artifact_stores.get( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + ) + print( + f"Artifact store {artifact_store_name} exists in resource group" + f" {resource_group_name}" + ) + except azure_exceptions.ResourceNotFoundError as ex: + print( + f"Create Artifact Store {artifact_store_name} of type" + f" {artifact_store_type}" + ) + poller = ( + self.api_clients.aosm_client.artifact_stores.begin_create_or_update( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + parameters=ArtifactStore( + location=location, + store_type=artifact_store_type, + ), + ) + ) + # LongRunningOperation waits for provisioning state Succeeded before + # carrying on + arty: ArtifactStore = LongRunningOperation( + self.cli_ctx, "Creating Artifact Store..." + )(poller) + + if arty.provisioning_state != ProvisioningState.SUCCEEDED: + logger.debug("Failed to provision artifact store: %s", arty.name) + raise RuntimeError( + "Creation of artifact store proceeded, but the provisioning" + f" state returned is {arty.provisioning_state}. " + "\nAborting" + ) from ex + logger.debug( + "Provisioning state of %s: %s", + artifact_store_name, + arty.provisioning_state, + ) + + def ensure_acr_artifact_store_exists(self) -> None: + """ + Ensures that the ACR Artifact store exists. + + Finds the parameters from self.config + """ + self.ensure_artifact_store_exists( + self.config.publisher_resource_group_name, + self.config.publisher_name, + self.config.acr_artifact_store_name, + ArtifactStoreType.AZURE_CONTAINER_REGISTRY, # type: ignore + self.config.location, + ) + + def ensure_sa_artifact_store_exists(self) -> None: + """ + Ensures that the Storage Account Artifact store for VNF exists. + + Finds the parameters from self.config + """ + if not isinstance(self.config, VNFConfiguration): + # This is a coding error but worth checking. + raise AzCLIError( + "Cannot check that the storage account artifact store exists as " + "the configuration file doesn't map to VNFConfiguration" + ) + + self.ensure_artifact_store_exists( + self.config.publisher_resource_group_name, + self.config.publisher_name, + self.config.blob_artifact_store_name, + ArtifactStoreType.AZURE_STORAGE_ACCOUNT, # type: ignore + self.config.location, + ) + + def ensure_nfdg_exists( + self, + resource_group_name: str, + publisher_name: str, + nfdg_name: str, + location: str, + ): + """ + Ensures that the network function definition group exists in the resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param nfdg_name: The name of the network function definition group. + :type nfdg_name: str + :param location: The location of the network function definition group. + :type location: str + """ + + logger.info( + "Creating network function definition group %s if it does not exist", + nfdg_name, + ) + + try: + self.api_clients.aosm_client.network_function_definition_groups.get( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=nfdg_name, + ) + print( + f"Network function definition group {nfdg_name} exists in resource" + f" group {resource_group_name}" + ) + except azure_exceptions.ResourceNotFoundError as ex: + print(f"Create Network Function Definition Group {nfdg_name}") + poller = self.api_clients.aosm_client.network_function_definition_groups.begin_create_or_update( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=nfdg_name, + parameters=NetworkFunctionDefinitionGroup(location=location), + ) + + # Asking for result waits for provisioning state Succeeded before carrying + # on + nfdg: NetworkFunctionDefinitionGroup = LongRunningOperation( + self.cli_ctx, "Creating Network Function Definition Group..." + )(poller) + + if nfdg.provisioning_state != ProvisioningState.SUCCEEDED: + logger.debug( + "Failed to provision Network Function Definition Group: %s", + nfdg.name, + ) + raise RuntimeError( + "Creation of Network Function Definition Group proceeded, but the" + f" provisioning state returned is {nfdg.provisioning_state}." + " \nAborting" + ) from ex + logger.debug( + "Provisioning state of %s: %s", nfdg_name, nfdg.provisioning_state + ) + + def ensure_config_nfdg_exists( + self, + ): + """ + Ensures that the Network Function Definition Group exists. + + Finds the parameters from self.config + """ + self.ensure_nfdg_exists( + self.config.publisher_resource_group_name, + self.config.publisher_name, + self.config.nfdg_name, + self.config.location, + ) + + def ensure_config_nsdg_exists( + self, + ): + """ + Ensures that the Network Function Definition Group exists. + + Finds the parameters from self.config + """ + self.ensure_nsdg_exists( + self.config.publisher_resource_group_name, + self.config.publisher_name, + self.config.nsdg_name, + self.config.location, + ) + + def does_artifact_manifest_exist( + self, rg_name: str, publisher_name: str, store_name: str, manifest_name: str + ) -> bool: + try: + self.api_clients.aosm_client.artifact_manifests.get( + resource_group_name=rg_name, + publisher_name=publisher_name, + artifact_store_name=store_name, + artifact_manifest_name=manifest_name, + ) + logger.debug("Artifact manifest %s exists", manifest_name) + return True + except azure_exceptions.ResourceNotFoundError: + logger.debug("Artifact manifest %s does not exist", manifest_name) + return False + + def do_config_artifact_manifests_exist( + self, + ) -> bool: + """Returns True if all required manifests exist, False otherwise.""" + all_acr_mannys_exist = True + any_acr_mannys_exist: bool = not self.config.acr_manifest_names + + for manifest in self.config.acr_manifest_names: + acr_manny_exists: bool = self.does_artifact_manifest_exist( + rg_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + store_name=self.config.acr_artifact_store_name, + manifest_name=manifest, + ) + all_acr_mannys_exist &= acr_manny_exists + any_acr_mannys_exist |= acr_manny_exists + + if isinstance(self.config, VNFConfiguration): + sa_manny_exists: bool = self.does_artifact_manifest_exist( + rg_name=self.config.publisher_resource_group_name, + publisher_name=self.config.publisher_name, + store_name=self.config.blob_artifact_store_name, + manifest_name=self.config.sa_manifest_name, + ) + if all_acr_mannys_exist and sa_manny_exists: + return True + if any_acr_mannys_exist or sa_manny_exists: + raise AzCLIError( + "Only a subset of artifact manifest exists. Cannot proceed. Please delete" + " the NFDV or NSDV as appropriate using the `az aosm nfd delete` or " + "`az aosm nsd delete` command." + ) + return False + + return acr_manny_exists + + def ensure_nsdg_exists( + self, + resource_group_name: str, + publisher_name: str, + nsdg_name: str, + location: str, + ): + """ + Ensures that the network service design group exists in the resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param nsdg_name: The name of the network service design group. + :type nsdg_name: str + :param location: The location of the network service design group. + :type location: str + """ + print( + "Creating Network Service Design Group %s if it does not exist", + nsdg_name, + ) + logger.info( + "Creating Network Service Design Group %s if it does not exist", + nsdg_name, + ) + poller = self.api_clients.aosm_client.network_service_design_groups.begin_create_or_update( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=nsdg_name, + parameters=NetworkServiceDesignGroup(location=location), + ) + LongRunningOperation(self.cli_ctx, "Creating Network Service Design group...")( + poller + ) + + def resource_exists_by_name(self, rg_name: str, resource_name: str) -> bool: + """ + Determine if a resource with the given name exists. No checking is done as + to the type. + + :param resource_name: The name of the resource to check. + """ + logger.debug("Check if %s exists", resource_name) + resources = self.api_clients.resource_client.resources.list_by_resource_group( + resource_group_name=rg_name + ) + + resource_exists = False + + for resource in resources: + if resource.name == resource_name: + resource_exists = True + break + + return resource_exists diff --git a/src/aosm/azext_aosm/generate_nfd/__init__.py b/src/aosm/azext_aosm/generate_nfd/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py new file mode 100644 index 00000000000..2c7df29848c --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -0,0 +1,784 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains a class for generating CNF NFDs and associated resources.""" +import json +import re +import shutil +import tarfile +import tempfile +from dataclasses import dataclass +from pathlib import Path +from typing import Any, Dict, Iterator, List, Optional, Tuple + +import yaml +from azure.cli.core.azclierror import FileOperationError, InvalidTemplateError +from jinja2 import StrictUndefined, Template +from knack.log import get_logger + +from azext_aosm._configuration import CNFConfiguration, HelmPackageConfig +from azext_aosm.generate_nfd.nfd_generator_base import NFDGenerator +from azext_aosm.util.constants import ( + CNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + CNF_DEFINITION_JINJA2_SOURCE_TEMPLATE_FILENAME, + CNF_MANIFEST_BICEP_TEMPLATE_FILENAME, + CNF_MANIFEST_JINJA2_SOURCE_TEMPLATE_FILENAME, + CNF_VALUES_SCHEMA_FILENAME, + CONFIG_MAPPINGS_DIR_NAME, + DEPLOYMENT_PARAMETER_MAPPING_REGEX, + DEPLOYMENT_PARAMETERS_FILENAME, + GENERATED_VALUES_MAPPINGS_DIR_NAME, + IMAGE_NAME_AND_VERSION_REGEX, + IMAGE_PATH_REGEX, + IMAGE_PULL_SECRETS_START_STRING, + IMAGE_START_STRING, + SCHEMA_PREFIX, + SCHEMAS_DIR_NAME, +) +from azext_aosm.util.utils import input_ack + +logger = get_logger(__name__) + + +@dataclass +class Artifact: + """Information about an artifact.""" + + name: str + version: str + + +@dataclass +class NFApplicationConfiguration: + name: str + chartName: str + chartVersion: str + dependsOnProfile: List[str] + registryValuesPaths: List[str] + imagePullSecretsValuesPaths: List[str] + valueMappingsFile: str + + +@dataclass +class ImageInfo: + parameter: List[str] + name: str + version: str + + +class CnfNfdGenerator(NFDGenerator): # pylint: disable=too-many-instance-attributes + """ + CNF NFD Generator. + + This takes a config file, and outputs: + - A bicep file for the NFDV + - Parameters files that are used by the NFDV bicep file, these are the + deployParameters and the mapping profiles of those deploy parameters + - A bicep file for the Artifact manifests + """ + + def __init__(self, config: CNFConfiguration, interactive: bool = False): + """ + Create a new CNF NFD Generator. + + Interactive parameter is only used if the user wants to generate the values + mapping file from the values.yaml in the helm package, and also requires the + mapping file in config to be blank. + """ + self.config = config + self.nfd_jinja2_template_path = ( + Path(__file__).parent + / "templates" + / CNF_DEFINITION_JINJA2_SOURCE_TEMPLATE_FILENAME + ) + self.manifest_jinja2_template_path = ( + Path(__file__).parent + / "templates" + / CNF_MANIFEST_JINJA2_SOURCE_TEMPLATE_FILENAME + ) + self.output_directory: Path = self.config.output_directory_for_build + self._cnfd_bicep_path = ( + self.output_directory / CNF_DEFINITION_BICEP_TEMPLATE_FILENAME + ) + self._tmp_dir: Optional[Path] = None + + self.artifacts: List[Artifact] = [] + self.nf_application_configurations: List[NFApplicationConfiguration] = [] + self.deployment_parameter_schema: Dict[str, Any] = SCHEMA_PREFIX + self.interactive = interactive + + def generate_nfd(self) -> None: + """Generate a CNF NFD which comprises a group, an Artifact Manifest and an NFDV.""" + + # Create temporary directory. + with tempfile.TemporaryDirectory() as tmpdirname: + self._tmp_dir = Path(tmpdirname) + try: + for helm_package in self.config.helm_packages: + # Unpack the chart into the tmp directory + self._extract_chart(Path(helm_package.path_to_chart)) + + # TODO: Validate charts + + # Create a chart mapping schema if none has been passed in. + if not helm_package.path_to_mappings: + self._generate_chart_value_mappings(helm_package) + + # Get schema for each chart + # (extract mappings and relevant parts of the schema) + # + Add that schema to the big schema. + self.deployment_parameter_schema["properties"].update( + self._get_chart_mapping_schema(helm_package) + ) + + # Get all image line matches for files in the chart. + # Do this here so we don't have to do it multiple times. + image_line_matches = self._find_image_parameter_from_chart( + helm_package + ) + + # Creates a flattened list of image registry paths to prevent set error + image_registry_paths: List[str] = [] + for image_info in image_line_matches: + image_registry_paths += image_info.parameter + + # Generate the NF application configuration for the chart + # passed to jinja2 renderer to render bicep template + self.nf_application_configurations.append( + self._generate_nf_application_config( + helm_package, + image_registry_paths, + self._find_image_pull_secrets_parameter_from_chart( + helm_package + ), + ) + ) + # Workout the list of artifacts for the chart and + # update the list for the NFD with any unique artifacts. + chart_artifacts = self._get_artifact_list( + helm_package, image_line_matches + ) + self.artifacts += [ + a for a in chart_artifacts if a not in self.artifacts + ] + self._write_nfd_bicep_file() + self._write_schema_to_file() + self._write_manifest_bicep_file() + self._copy_to_output_directory() + print( + f"Generated NFD bicep template created in {self.output_directory}" + ) + print( + "Please review these templates. When you are happy with them run " + "`az aosm nfd publish` with the same arguments." + ) + except InvalidTemplateError as e: + raise e + + @property + def nfd_bicep_path(self) -> Optional[Path]: + """Returns the path to the bicep file for the NFD if it has been created.""" + if self._cnfd_bicep_path.exists(): + return self._cnfd_bicep_path + return None + + def _extract_chart(self, path: Path) -> None: + """ + Extract the chart into the tmp directory. + + :param path: The path to helm package + """ + assert self._tmp_dir + + logger.debug("Extracting helm package %s", path) + + file_extension = path.suffix + if file_extension in (".gz", ".tgz"): + with tarfile.open(path, "r:gz") as tar: + tar.extractall(path=self._tmp_dir) + + elif file_extension == ".tar": + with tarfile.open(path, "r:") as tar: + tar.extractall(path=self._tmp_dir) + + else: + raise InvalidTemplateError( + f"ERROR: The helm package '{path}' is not a .tgz, .tar or .tar.gz file." + " Please fix this and run the command again." + ) + + def _generate_chart_value_mappings(self, helm_package: HelmPackageConfig) -> None: + """ + Optional function to create a chart value mappings file with every value being a deployParameter. + + Expected use when a helm chart is very simple and user wants every value to be a + deployment parameter. + """ + assert self._tmp_dir + logger.debug( + "Creating chart value mappings file for %s", helm_package.path_to_chart + ) + print(f"Creating chart value mappings file for {helm_package.path_to_chart}.") + + # Get all the values files in the chart + top_level_values_yaml = self._read_top_level_values_yaml(helm_package) + + mapping_to_write = self._replace_values_with_deploy_params( + top_level_values_yaml, None + ) + + # Write the mapping to a file + mapping_directory: Path = self._tmp_dir / GENERATED_VALUES_MAPPINGS_DIR_NAME + mapping_directory.mkdir(exist_ok=True) + mapping_filepath = ( + mapping_directory / f"{helm_package.name}-generated-mapping.yaml" + ) + with open(mapping_filepath, "w", encoding="UTF-8") as mapping_file: + yaml.dump(mapping_to_write, mapping_file) + + # Update the config that points to the mapping file + helm_package.path_to_mappings = str(mapping_filepath) + + def _read_top_level_values_yaml( + self, helm_package: HelmPackageConfig + ) -> Dict[str, Any]: + """ + Return a dictionary of the values.yaml|yml read from the root of the helm package. + + :param helm_package: The helm package to look in + :type helm_package: HelmPackageConfig + :raises FileOperationError: if no values.yaml|yml found + :return: A dictionary of the yaml read from the file + :rtype: Dict[str, Any] + """ + assert self._tmp_dir + for file in Path(self._tmp_dir / helm_package.name).iterdir(): + if file.name in ("values.yaml", "values.yml"): + with file.open(encoding="UTF-8") as values_file: + values_yaml = yaml.safe_load(values_file) + return values_yaml + + raise FileOperationError( + "Cannot find top level values.yaml/.yml file in Helm package." + ) + + def _write_manifest_bicep_file(self) -> None: + """Write the bicep file for the Artifact Manifest to the temp directory.""" + assert self._tmp_dir + + with open(self.manifest_jinja2_template_path, "r", encoding="UTF-8") as f: + template: Template = Template( + f.read(), + undefined=StrictUndefined, + ) + + bicep_contents: str = template.render( + artifacts=self.artifacts, + ) + + path = self._tmp_dir / CNF_MANIFEST_BICEP_TEMPLATE_FILENAME + with open(path, "w", encoding="utf-8") as f: + f.write(bicep_contents) + + logger.info("Created artifact manifest bicep template: %s", path) + + def _write_nfd_bicep_file(self) -> None: + """Write the bicep file for the NFD to the temp directory.""" + assert self._tmp_dir + with open(self.nfd_jinja2_template_path, "r", encoding="UTF-8") as f: + template: Template = Template( + f.read(), + undefined=StrictUndefined, + ) + + bicep_contents: str = template.render( + nf_application_configurations=self.nf_application_configurations, + ) + + path = self._tmp_dir / CNF_DEFINITION_BICEP_TEMPLATE_FILENAME + with open(path, "w", encoding="utf-8") as f: + f.write(bicep_contents) + + logger.info("Created NFD bicep template: %s", path) + + def _write_schema_to_file(self) -> None: + """Write the schema to file deploymentParameters.json to the temp directory.""" + logger.debug("Create deploymentParameters.json") + assert self._tmp_dir + + full_schema = self._tmp_dir / DEPLOYMENT_PARAMETERS_FILENAME + with open(full_schema, "w", encoding="UTF-8") as f: + json.dump(self.deployment_parameter_schema, f, indent=4) + + logger.debug("%s created", full_schema) + + def _copy_to_output_directory(self) -> None: + """ + Copy files from the temp directory to the output directory. + + Files are the config mappings, schema and bicep templates (artifact manifest and + NFDV). + """ + assert self._tmp_dir + + logger.info("Create NFD bicep %s", self.output_directory) + + Path(self.output_directory / SCHEMAS_DIR_NAME).mkdir( + parents=True, exist_ok=True + ) + + # Copy the nfd and the manifest bicep files to the output directory + shutil.copy( + self._tmp_dir / CNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + self.output_directory, + ) + shutil.copy( + self._tmp_dir / CNF_MANIFEST_BICEP_TEMPLATE_FILENAME, self.output_directory + ) + + # Copy any generated values mappings YAML files to the corresponding directory in + # the output directory so that the user can edit them and re-run the build if + # required + if Path(self._tmp_dir / GENERATED_VALUES_MAPPINGS_DIR_NAME).exists(): + shutil.copytree( + self._tmp_dir / GENERATED_VALUES_MAPPINGS_DIR_NAME, + self.output_directory / GENERATED_VALUES_MAPPINGS_DIR_NAME, + ) + + # Copy the JSON config mappings and deploymentParameters schema that are used + # for the NFD to the output directory + shutil.copytree( + self._tmp_dir / CONFIG_MAPPINGS_DIR_NAME, + self.output_directory / CONFIG_MAPPINGS_DIR_NAME, + dirs_exist_ok=True, + ) + shutil.copy( + self._tmp_dir / DEPLOYMENT_PARAMETERS_FILENAME, + self.output_directory / SCHEMAS_DIR_NAME / DEPLOYMENT_PARAMETERS_FILENAME, + ) + + logger.info("Copied files to %s", self.output_directory) + + def _generate_nf_application_config( + self, + helm_package: HelmPackageConfig, + image_registry_path: List[str], + image_pull_secret_line_matches: List[str], + ) -> NFApplicationConfiguration: + """Generate NF application config.""" + (name, version) = self._get_chart_name_and_version(helm_package) + + registry_values_paths = set(image_registry_path) + image_pull_secrets_values_paths = set(image_pull_secret_line_matches) + + return NFApplicationConfiguration( + name=helm_package.name, + chartName=name, + chartVersion=version, + dependsOnProfile=helm_package.depends_on, + registryValuesPaths=list(registry_values_paths), + imagePullSecretsValuesPaths=list(image_pull_secrets_values_paths), + valueMappingsFile=self._jsonify_value_mappings(helm_package), + ) + + @staticmethod + def _find_yaml_files(directory: Path) -> Iterator[Path]: + """ + Find all yaml files recursively in given directory. + + :param directory: The directory to search. + """ + yield from directory.glob("**/*.yaml") + yield from directory.glob("**/*.yml") + + def _find_image_parameter_from_chart( + self, helm_package_config: HelmPackageConfig + ) -> List[ImageInfo]: + """ + Find pattern matches in Helm chart for the names of the image parameters. + + :param helm_package: The helm package config. + + Returns list of tuples containing the list of image + paths and the name and version of the image. e.g. (Values.foo.bar.repoPath, foo, + 1.2.3) + """ + assert self._tmp_dir + chart_dir = self._tmp_dir / helm_package_config.name + matches = [] + path = [] + + for file in self._find_yaml_files(chart_dir): + with open(file, "r", encoding="UTF-8") as f: + logger.debug("Searching for %s in %s", IMAGE_START_STRING, file) + for line in f: + if IMAGE_START_STRING in line: + logger.debug("Found %s in %s", IMAGE_START_STRING, line) + path = re.findall(IMAGE_PATH_REGEX, line) + + # If "image:", search for chart name and version + name_and_version = re.search(IMAGE_NAME_AND_VERSION_REGEX, line) + logger.debug( + "Regex match for name and version is %s", + name_and_version, + ) + + if name_and_version and len(name_and_version.groups()) == 2: + logger.debug( + "Found image name and version %s %s", + name_and_version.group("name"), + name_and_version.group("version"), + ) + matches.append( + ImageInfo( + path, + name_and_version.group("name"), + name_and_version.group("version"), + ) + ) + else: + logger.debug("No image name and version found") + return matches + + def _find_image_pull_secrets_parameter_from_chart( + self, helm_package_config: HelmPackageConfig + ) -> List[str]: + """ + Find pattern matches in Helm chart for the ImagePullSecrets parameter. + + :param helm_package: The helm package config. + + Returns list of lists containing image pull + secrets paths, e.g. Values.foo.bar.imagePullSecret + """ + assert self._tmp_dir + chart_dir = self._tmp_dir / helm_package_config.name + matches = [] + path = [] + + for file in self._find_yaml_files(chart_dir): + with open(file, "r", encoding="UTF-8") as f: + logger.debug( + "Searching for %s in %s", IMAGE_PULL_SECRETS_START_STRING, file + ) + for line in f: + if IMAGE_PULL_SECRETS_START_STRING in line: + logger.debug( + "Found %s in %s", IMAGE_PULL_SECRETS_START_STRING, line + ) + path = re.findall(IMAGE_PATH_REGEX, line) + matches += path + return matches + + def _get_artifact_list( + self, + helm_package: HelmPackageConfig, + image_line_matches: List[ImageInfo], + ) -> List[Artifact]: + """ + Get the list of artifacts for the chart. + + :param helm_package: The helm package config. + :param image_line_matches: The list of image line matches. + """ + artifact_list = [] + (name, version) = self._get_chart_name_and_version(helm_package) + helm_artifact = Artifact(name, version) + + artifact_list.append(helm_artifact) + for image_info in image_line_matches: + artifact_list.append(Artifact(image_info.name, image_info.version)) + + return artifact_list + + def _get_chart_mapping_schema( + self, helm_package: HelmPackageConfig + ) -> Dict[Any, Any]: + """ + Get the schema for the non default values (those with {deploymentParameter...}). + Based on the user provided values schema. + + param helm_package: The helm package config. + """ + assert self._tmp_dir + logger.debug("Get chart mapping schema for %s", helm_package.name) + + mappings_path = helm_package.path_to_mappings + values_schema = self._tmp_dir / helm_package.name / CNF_VALUES_SCHEMA_FILENAME + if not Path(mappings_path).exists(): + raise InvalidTemplateError( + f"ERROR: The helm package '{helm_package.name}' does not have a valid values" + " mappings file. The file at '{helm_package.path_to_mappings}' does not exist." + "\nPlease fix this and run the command again." + ) + if not values_schema.exists(): + raise InvalidTemplateError( + f"ERROR: The helm package '{helm_package.name}' is missing {CNF_VALUES_SCHEMA_FILENAME}." + "\nPlease fix this and run the command again." + ) + + with open(mappings_path, "r", encoding="utf-8") as stream: + values_data = yaml.load(stream, Loader=yaml.SafeLoader) + + with open(values_schema, "r", encoding="utf-8") as f: + schema_data = json.load(f) + + try: + deploy_params_dict = self.traverse_dict( + values_data, DEPLOYMENT_PARAMETER_MAPPING_REGEX + ) + logger.debug("Deploy params dict is %s", deploy_params_dict) + new_schema = self.search_schema(deploy_params_dict, schema_data) + except KeyError as e: + raise InvalidTemplateError( + "ERROR: There is a problem with your schema or values for the helm" + f" package '{helm_package.name}'." + "\nPlease fix this and run the command again." + ) from e + + logger.debug("Generated chart mapping schema for %s", helm_package.name) + return new_schema + + @staticmethod + def traverse_dict( + dict_to_search: Dict[Any, Any], target_regex: str + ) -> Dict[str, List[str]]: + """ + Traverse the dictionary provided and return a dictionary of all the values that match the target regex, + with the key being the deploy parameter and the value being the path (as a list) to the value. + e.g. {"foo": ["global", "foo", "bar"]} + + :param d: The dictionary to traverse. + :param target: The regex to search for. + """ + + # pylint: disable=too-many-nested-blocks + @dataclass + class DictNode: + # The dictionary under this node + sub_dict: Dict[Any, Any] + + # The path to this node under the main dictionary + position_path: List[str] + + # Initialize the stack with the dictionary and an empty path + stack: List[DictNode] = [DictNode(dict_to_search, [])] + result = {} # Initialize empty dictionary to store the results + while stack: # While there are still items in the stack + # Pop the last item from the stack and unpack it into node (the dictionary) and path + node = stack.pop() + + # For each key-value pair in the popped item + for key, value in node.sub_dict.items(): + # If the value is a dictionary + if isinstance(value, dict): + # Add the dictionary to the stack with the path + stack.append(DictNode(value, node.position_path + [key])) + + # If the value is a string + matches target regex + elif isinstance(value, str): + # Take the match i.e, foo from {deployParameter.foo} + match = re.search(target_regex, value) + + # Add it to the result dictionary with its path as the value + if match: + result[match.group(1)] = node.position_path + [key] + + elif isinstance(value, list): + logger.debug("Found a list %s", value) + for item in value: + logger.debug("Found an item %s", item) + + if isinstance(item, str): + match = re.search(target_regex, item) + + if match: + result[match.group(1)] = node.position_path + [key] + + elif isinstance(item, dict): + stack.append(DictNode(item, node.position_path + [key])) + + elif isinstance(item, list): + # We should fix this but for now just log a warning and + # carry on + logger.warning( + "Values mapping file contains a list of lists " + "at path %s, which this tool cannot parse. " + "Please check the output configMappings and schemas " + "files and check that they are as required.", + node.position_path + [key], + ) + return result + + @staticmethod + def search_schema( + deployParams_paths: Dict[str, List[str]], full_schema + ) -> Dict[str, Dict[str, str]]: + """ + Search through the provided schema for the types of the deployment parameters. + This assumes that the type of the key will be the type of the deployment parameter. + e.g. if foo: {deployParameter.bar} and foo is type string, then bar is type string. + + Returns a dictionary of the deployment parameters in the format: + {"foo": {"type": "string"}, "bar": {"type": "string"}} + + param deployParams_paths: a dictionary of all the deploy parameters to search for, + with the key being the deploy parameter and the value being the + path to the value. + e.g. {"foo": ["global", "foo", "bar"]} + param full_schema: The schema to search through. + """ + new_schema = {} + no_schema_list = [] + for deploy_param, path_list in deployParams_paths.items(): + logger.debug( + "Searching for %s in schema at path %s", deploy_param, path_list + ) + node = full_schema + for path in path_list: + if "properties" in node.keys(): + logger.debug( + "Searching properties for %s in schema at path %s", + deploy_param, + path, + ) + node = node["properties"][path] + else: + logger.debug("No schema node found for %s", deploy_param) + no_schema_list.append(deploy_param) + new_schema.update({deploy_param: {"type": "string"}}) + if deploy_param not in new_schema: + new_schema.update({deploy_param: {"type": node.get("type", None)}}) + if no_schema_list: + logger.warning( + "No schema found for deployment parameter(s): %s", no_schema_list + ) + logger.warning( + "We default these parameters to type string. " + "Please edit schemas/%s in the output before publishing " + "if this is wrong", + DEPLOYMENT_PARAMETERS_FILENAME, + ) + return new_schema + + def _replace_values_with_deploy_params( + self, + values_yaml_dict, + param_prefix: Optional[str] = None, + ) -> Dict[Any, Any]: + """ + Given the yaml dictionary read from values.yaml, replace all the values with {deploymentParameter.keyname}. + + Thus creating a values mapping file if the user has not provided one in config. + """ + logger.debug("Replacing values with deploy parameters") + final_values_mapping_dict: Dict[Any, Any] = {} + for k, v in values_yaml_dict.items(): + # if value is a string and contains deployParameters. + logger.debug("Processing key %s", k) + param_name = k if param_prefix is None else f"{param_prefix}_{k}" + if isinstance(v, (str, int, bool)): + # Replace the parameter with {deploymentParameter.keyname} + if self.interactive: + # Interactive mode. Prompt user to include or exclude parameters + # This requires the enter key after the y/n input which isn't ideal + if not input_ack("y", f"Expose parameter {param_name}? y/n "): + logger.debug("Excluding parameter %s", param_name) + final_values_mapping_dict.update({k: v}) + continue + replacement_value = f"{{deployParameters.{param_name}}}" + + # add the schema for k (from the big schema) to the (smaller) schema + final_values_mapping_dict.update({k: replacement_value}) + elif isinstance(v, dict): + final_values_mapping_dict[k] = self._replace_values_with_deploy_params( + v, param_name + ) + elif isinstance(v, list): + final_values_mapping_dict[k] = [] + for index, item in enumerate(v): + param_name = ( + f"{param_prefix}_{k}_{index}" + if param_prefix + else f"{k})_{index}" + ) + if isinstance(item, dict): + final_values_mapping_dict[k].append( + self._replace_values_with_deploy_params(item, param_name) + ) + elif isinstance(v, (str, int, bool)) or not v: + replacement_value = f"{{deployParameters.{param_name}}}" + final_values_mapping_dict[k].append(replacement_value) + else: + raise ValueError( + f"Found an unexpected type {type(v)} of key {k} in " + "values.yaml, cannot generate values mapping file." + ) + elif not v: + # V is blank so we don't know what type it is. Assuming it is an + # empty string (but do this after checking for dict and list) + # Replace the parameter with {deploymentParameter.keyname} + if self.interactive: + # Interactive mode. Prompt user to include or exclude parameters + # This requires the enter key after the y/n input which isn't ideal + if not input_ack("y", f"Expose parameter {param_name}? y/n "): + logger.debug("Excluding parameter %s", param_name) + final_values_mapping_dict.update({k: v}) + continue + replacement_value = f"{{deployParameters.{param_name}}}" + + # add the schema for k (from the big schema) to the (smaller) schema + final_values_mapping_dict.update({k: replacement_value}) + else: + raise ValueError( + f"Found an unexpected type {type(v)} of key {k} in values.yaml, " + "cannot generate values mapping file." + ) + + return final_values_mapping_dict + + def _get_chart_name_and_version( + self, helm_package: HelmPackageConfig + ) -> Tuple[str, str]: + """Get the name and version of the chart.""" + assert self._tmp_dir + chart_path = self._tmp_dir / helm_package.name / "Chart.yaml" + + if not chart_path.exists(): + raise InvalidTemplateError( + f"There is no Chart.yaml file in the helm package '{helm_package.name}'. " + "\nPlease fix this and run the command again." + ) + + with open(chart_path, "r", encoding="utf-8") as f: + data = yaml.load(f, Loader=yaml.FullLoader) + if "name" in data and "version" in data: + chart_name = data["name"] + chart_version = data["version"] + else: + raise FileOperationError( + "A name or version is missing from Chart.yaml in the helm package" + f" '{helm_package.name}'." + "\nPlease fix this and run the command again." + ) + + return (chart_name, chart_version) + + def _jsonify_value_mappings(self, helm_package: HelmPackageConfig) -> str: + """Yaml->JSON values mapping file, then return the filename.""" + assert self._tmp_dir + mappings_yaml_file = helm_package.path_to_mappings + mappings_dir = self._tmp_dir / CONFIG_MAPPINGS_DIR_NAME + mappings_output_file = mappings_dir / f"{helm_package.name}-mappings.json" + + mappings_dir.mkdir(exist_ok=True) + + with open(mappings_yaml_file, "r", encoding="utf-8") as f: + data = yaml.load(f, Loader=yaml.FullLoader) + + with open(mappings_output_file, "w", encoding="utf-8") as file: + json.dump(data, file, indent=4) + + logger.debug("Generated parameter mappings for %s", helm_package.name) + return f"{helm_package.name}-mappings.json" diff --git a/src/aosm/azext_aosm/generate_nfd/nfd_generator_base.py b/src/aosm/azext_aosm/generate_nfd/nfd_generator_base.py new file mode 100644 index 00000000000..e155950c03d --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/nfd_generator_base.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains a base class for generating NFDs.""" +from abc import ABC, abstractmethod +from pathlib import Path +from typing import Optional + +from knack.log import get_logger + +logger = get_logger(__name__) + + +class NFDGenerator(ABC): + """A class for generating an NFD from a config file.""" + + @abstractmethod + def generate_nfd(self) -> None: + ... + + @property + @abstractmethod + def nfd_bicep_path(self) -> Optional[Path]: + ... diff --git a/src/aosm/azext_aosm/generate_nfd/templates/cnfartifactmanifest.bicep.j2 b/src/aosm/azext_aosm/generate_nfd/templates/cnfartifactmanifest.bicep.j2 new file mode 100644 index 00000000000..c9c475cf010 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/templates/cnfartifactmanifest.bicep.j2 @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an Artifact Manifest for a CNF +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestName string + +// Created by the az aosm definition publish command before the template is deployed +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// Created by the az aosm definition publish command before the template is deployed +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +resource acrArtifactManifest 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = { + parent: acrArtifactStore + name: acrManifestName + location: location + properties: { + artifacts: [ + {%- for artifact in artifacts %} + { + artifactName: '{{ artifact.name }}' + artifactType: 'OCIArtifact' + artifactVersion: '{{ artifact.version }}' + } + {%- endfor %} + ] + } +} diff --git a/src/aosm/azext_aosm/generate_nfd/templates/cnfdefinition.bicep.j2 b/src/aosm/azext_aosm/generate_nfd/templates/cnfdefinition.bicep.j2 new file mode 100644 index 00000000000..8396447065a --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/templates/cnfdefinition.bicep.j2 @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an NF definition for a CNF +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Network Function Definition Group') +param nfDefinitionGroup string +@description('The version of the NFDV you want to deploy, in format A.B.C') +param nfDefinitionVersion string + +// Created by the az aosm definition publish command before the template is deployed +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// Created by the az aosm definition publish command before the template is deployed +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created by the az aosm definition publish command before the template is deployed +resource nfdg 'Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups@2023-04-01-preview' existing = { + parent: publisher + name: nfDefinitionGroup +} + +resource nfdv 'Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions@2023-04-01-preview' = { + parent: nfdg + name: nfDefinitionVersion + location: location + properties: { + // versionState should be changed to 'Active' once it is finalized. + versionState: 'Preview' + {#- Note that all paths in bicep must be specified using the forward slash #} + {#- (/) character even if running on Windows. #} + {#- See https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/modules#local-file #} + deployParameters: string(loadJsonContent('schemas/deploymentParameters.json')) + networkFunctionType: 'ContainerizedNetworkFunction' + networkFunctionTemplate: { + nfviType: 'AzureArcKubernetes' + networkFunctionApplications: [ + {%- for configuration in nf_application_configurations %} + { + artifactType: 'HelmPackage' + name: '{{ configuration.name }}' + dependsOnProfile: { + installDependsOn: {{ configuration.dependsOnProfile }} + } + artifactProfile: { + artifactStore: { + id: acrArtifactStore.id + } + helmArtifactProfile: { + helmPackageName: '{{ configuration.chartName }}' + helmPackageVersionRange: '{{ configuration.chartVersion }}' + registryValuesPaths: {{ configuration.registryValuesPaths }} + imagePullSecretsValuesPaths: {{ configuration.imagePullSecretsValuesPaths }} + } + } + deployParametersMappingRuleProfile: { + applicationEnablement: 'Enabled' + helmMappingRuleProfile: { + releaseNamespace: '{{ configuration.chartName }}' + releaseName: '{{ configuration.chartName }}' + helmPackageVersion: '{{ configuration.chartVersion }}' + values: string(loadJsonContent('configMappings/{{ configuration.valueMappingsFile }}')) + } + } + } + {%- endfor %} + ] + } + } +} diff --git a/src/aosm/azext_aosm/generate_nfd/templates/vnfartifactmanifests.bicep b/src/aosm/azext_aosm/generate_nfd/templates/vnfartifactmanifests.bicep new file mode 100644 index 00000000000..bc884941987 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/templates/vnfartifactmanifests.bicep @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an NF definition for a VNF +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Storage Account-backed Artifact Store, deployed under the publisher.') +param saArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestName string +@description('Name of the manifest to deploy for the Storage Account-backed Artifact Store') +param saManifestName string +@description('Name of Network Function. Used predominantly as a prefix for other variable names') +param nfName string +@description('The version that you want to name the NFM VHD artifact, in format A-B-C. e.g. 6-13-0') +param vhdVersion string +@description('The name under which to store the ARM template') +param armTemplateVersion string + +// Created by the az aosm definition publish command before the template is deployed +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// Created by the az aosm definition publish command before the template is deployed +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created by the az aosm definition publish command before the template is deployed +resource saArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: saArtifactStoreName +} + +resource saArtifactManifest 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = { + parent: saArtifactStore + name: saManifestName + location: location + properties: { + artifacts: [ + { + artifactName: '${nfName}-vhd' + artifactType: 'VhdImageFile' + artifactVersion: vhdVersion + } + ] + } +} + +resource acrArtifactManifest 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = { + parent: acrArtifactStore + name: acrManifestName + location: location + properties: { + artifacts: [ + { + artifactName: '${nfName}-arm-template' + artifactType: 'ArmTemplate' + artifactVersion: armTemplateVersion + } + ] + } +} diff --git a/src/aosm/azext_aosm/generate_nfd/templates/vnfdefinition.bicep b/src/aosm/azext_aosm/generate_nfd/templates/vnfdefinition.bicep new file mode 100644 index 00000000000..f6466ab6a06 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/templates/vnfdefinition.bicep @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an NF definition for a VNF +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Storage Account-backed Artifact Store, deployed under the publisher.') +param saArtifactStoreName string +@description('Name of Network Function. Used predominantly as a prefix for other variable names') +param nfName string +@description('Name of an existing Network Function Definition Group') +param nfDefinitionGroup string +@description('The version of the NFDV you want to deploy, in format A.B.C') +param nfDefinitionVersion string +@description('The version that you want to name the NFM VHD artifact, in format A-B-C. e.g. 6-13-0') +param vhdVersion string +@description('The version that you want to name the NFM template artifact, in format A.B.C. e.g. 6.13.0. If testing for development, you can use any numbers you like.') +param armTemplateVersion string + +// Created by the az aosm definition publish command before the template is deployed +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// Created by the az aosm definition publish command before the template is deployed +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created by the az aosm definition publish command before the template is deployed +resource saArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: saArtifactStoreName +} + +// Created by the az aosm definition publish command before the template is deployed +resource nfdg 'Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups@2023-04-01-preview' existing = { + parent: publisher + name: nfDefinitionGroup +} + +resource nfdv 'Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions@2023-04-01-preview' = { + parent: nfdg + name: nfDefinitionVersion + location: location + properties: { + // versionState should be changed to 'Active' once it is finalized. + versionState: 'Preview' + deployParameters: string(loadJsonContent('schemas/deploymentParameters.json')) + networkFunctionType: 'VirtualNetworkFunction' + networkFunctionTemplate: { + nfviType: 'AzureCore' + networkFunctionApplications: [ + { + artifactType: 'VhdImageFile' + name: '${nfName}Image' + dependsOnProfile: null + artifactProfile: { + vhdArtifactProfile: { + vhdName: '${nfName}-vhd' + vhdVersion: vhdVersion + } + artifactStore: { + id: saArtifactStore.id + } + } + // mapping deploy param vals to vals required by this network function application object + deployParametersMappingRuleProfile: { + vhdImageMappingRuleProfile: { + userConfiguration: string(loadJsonContent('configMappings/vhdParameters.json')) + } + // ?? + applicationEnablement: 'Unknown' + } + } + { + artifactType: 'ArmTemplate' + name: nfName + dependsOnProfile: null + artifactProfile: { + templateArtifactProfile: { + templateName: '${nfName}-arm-template' + templateVersion: armTemplateVersion + } + artifactStore: { + id: acrArtifactStore.id + } + } + deployParametersMappingRuleProfile: { + templateMappingRuleProfile: { + templateParameters: string(loadJsonContent('configMappings/templateParameters.json')) + } + applicationEnablement: 'Unknown' + } + } + ] + } + } +} diff --git a/src/aosm/azext_aosm/generate_nfd/vnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/vnf_nfd_generator.py new file mode 100644 index 00000000000..f3bc4e7bd56 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/vnf_nfd_generator.py @@ -0,0 +1,324 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains a class for generating VNF NFDs and associated resources.""" + +import json +import shutil +import tempfile +from functools import cached_property +from pathlib import Path +from typing import Any, Dict, Optional + +from knack.log import get_logger + +from azext_aosm._configuration import VNFConfiguration +from azext_aosm.generate_nfd.nfd_generator_base import NFDGenerator +from azext_aosm.util.constants import ( + CONFIG_MAPPINGS_DIR_NAME, + DEPLOYMENT_PARAMETERS_FILENAME, + OPTIONAL_DEPLOYMENT_PARAMETERS_FILENAME, + OPTIONAL_DEPLOYMENT_PARAMETERS_HEADING, + SCHEMA_PREFIX, + SCHEMAS_DIR_NAME, + TEMPLATE_PARAMETERS_FILENAME, + VHD_PARAMETERS_FILENAME, + VNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + VNF_MANIFEST_BICEP_TEMPLATE_FILENAME, +) +from azext_aosm.util.utils import input_ack + +logger = get_logger(__name__) + +# Different types are used in ARM templates and NFDs. The list accepted by NFDs is +# documented in the AOSM meta-schema. This will be published in the future but for now +# can be found in +# https://microsoft.sharepoint.com/:w:/t/NSODevTeam/Ec7ovdKroSRIv5tumQnWIE0BE-B2LykRcll2Qb9JwfVFMQ +ARM_TO_JSON_PARAM_TYPES: Dict[str, str] = { + "int": "integer", + "securestring": "string", + "bool": "boolean", +} + + +class VnfNfdGenerator(NFDGenerator): + # pylint: disable=too-many-instance-attributes + """ + VNF NFD Generator. + + This takes a source ARM template and a config file, and outputs: + - A bicep file for the NFDV + - Parameters files that are used by the NFDV bicep file, these are the + deployParameters and the mapping profiles of those deploy parameters + - A bicep file for the Artifact manifests + + @param order_params: whether to order the deployment and template output parameters + with those without a default first, then those with a default. + Those without a default will definitely be required to be + exposed, those with a default may not be. + @param interactive: whether to prompt the user to confirm the parameters to be + exposed. + """ + + def __init__(self, config: VNFConfiguration, order_params: bool, interactive: bool): + self.config = config + + self.arm_template_path = Path(self.config.arm_template.file_path) + self.output_directory: Path = self.config.output_directory_for_build + + self._vnfd_bicep_path = Path( + self.output_directory, VNF_DEFINITION_BICEP_TEMPLATE_FILENAME + ) + self._manifest_bicep_path = Path( + self.output_directory, VNF_MANIFEST_BICEP_TEMPLATE_FILENAME + ) + self.order_params = order_params + self.interactive = interactive + self._tmp_dir: Optional[Path] = None + self.image_name = f"{self.config.nf_name}Image" + + def generate_nfd(self) -> None: + """ + Generate a VNF NFD which comprises an group, an Artifact Manifest and a NFDV. + + Create a bicep template for an NFD from the ARM template for the VNF. + """ + # Create temporary directory. + with tempfile.TemporaryDirectory() as tmpdirname: + self._tmp_dir = Path(tmpdirname) + + self._create_parameter_files() + self._copy_to_output_directory() + print(f"Generated NFD bicep templates created in {self.output_directory}") + print( + "Please review these templates. When you are happy with them run " + "`az aosm nfd publish` with the same arguments." + ) + + @property + def nfd_bicep_path(self) -> Optional[Path]: + """Returns the path to the bicep file for the NFD if it has been created.""" + if self._vnfd_bicep_path.exists(): + return self._vnfd_bicep_path + return None + + @property + def manifest_bicep_path(self) -> Optional[Path]: + """Returns the path to the bicep file for the NFD if it has been created.""" + if self._manifest_bicep_path.exists(): + return self._manifest_bicep_path + return None + + @cached_property + def vm_parameters(self) -> Dict[str, Any]: + """The parameters from the VM ARM template.""" + with open(self.arm_template_path, "r", encoding="utf-8") as _file: + data = json.load(_file) + if "parameters" in data: + parameters: Dict[str, Any] = data["parameters"] + else: + print( + "No parameters found in the template provided. " + "Your NFD will have no deployParameters" + ) + parameters = {} + + return parameters + + @property + def vm_parameters_ordered(self) -> Dict[str, Any]: + """The parameters from the VM ARM template, ordered as those without defaults then those with.""" + vm_parameters_no_default: Dict[str, Any] = {} + vm_parameters_with_default: Dict[str, Any] = {} + has_default_field: bool = False + has_default: bool = False + + for key in self.vm_parameters: + # Order parameters into those with and without defaults + has_default_field = "defaultValue" in self.vm_parameters[key] + has_default = ( + has_default_field and not self.vm_parameters[key]["defaultValue"] == "" + ) + + if has_default: + vm_parameters_with_default[key] = self.vm_parameters[key] + else: + vm_parameters_no_default[key] = self.vm_parameters[key] + + return {**vm_parameters_no_default, **vm_parameters_with_default} + + def _create_parameter_files(self) -> None: + """Create the deployment, template and VHD parameter files.""" + assert self._tmp_dir + tmp_schemas_directory: Path = self._tmp_dir / SCHEMAS_DIR_NAME + tmp_schemas_directory.mkdir() + self.write_deployment_parameters(tmp_schemas_directory) + + tmp_mappings_directory: Path = self._tmp_dir / CONFIG_MAPPINGS_DIR_NAME + tmp_mappings_directory.mkdir() + self.write_template_parameters(tmp_mappings_directory) + self.write_vhd_parameters(tmp_mappings_directory) + + def write_deployment_parameters(self, directory: Path) -> None: + """ + Write out the NFD deploymentParameters.json file to `directory` + + :param directory: The directory to put this file in. + """ + logger.debug("Create deploymentParameters.json") + + nfd_parameters = {} + nfd_parameters_with_default = {} + vm_parameters_to_exclude = [] + + vm_parameters = ( + self.vm_parameters_ordered if self.order_params else self.vm_parameters + ) + + for key in vm_parameters: + if key == self.config.image_name_parameter: + # There is only one correct answer for the image name, so don't ask the + # user, instead it is hardcoded in config mappings. + continue + + # Order parameters into those without and then with defaults + has_default_field = "defaultValue" in self.vm_parameters[key] + has_default = ( + has_default_field and not self.vm_parameters[key]["defaultValue"] == "" + ) + + if self.interactive and has_default: + # Interactive mode. Prompt user to include or exclude parameters + # This requires the enter key after the y/n input which isn't ideal + if not input_ack("y", f"Expose parameter {key}? y/n "): + logger.debug("Excluding parameter %s", key) + vm_parameters_to_exclude.append(key) + continue + + # Map ARM parameter types to JSON parameter types accepted by AOSM + arm_type = self.vm_parameters[key]["type"] + json_type = ARM_TO_JSON_PARAM_TYPES.get(arm_type.lower(), arm_type) + + if has_default: + nfd_parameters_with_default[key] = {"type": json_type} + + nfd_parameters[key] = {"type": json_type} + + # Now we are out of the vm_parameters loop, we can remove the excluded + # parameters so they don't get included in templateParameters.json + # Remove from both ordered and unordered dicts + for key in vm_parameters_to_exclude: + self.vm_parameters.pop(key, None) + + deployment_parameters_path = directory / DEPLOYMENT_PARAMETERS_FILENAME + + # Heading for the deployParameters schema + deploy_parameters_full: Dict[str, Any] = SCHEMA_PREFIX + deploy_parameters_full["properties"].update(nfd_parameters) + + with open(deployment_parameters_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(deploy_parameters_full, indent=4)) + + logger.debug("%s created", deployment_parameters_path) + if self.order_params: + print( + "Deployment parameters for the generated NFDV are ordered by those " + "without defaults first to make it easier to choose which to expose." + ) + + # Extra output file to help the user know which parameters are optional + if not self.interactive: + if nfd_parameters_with_default: + optional_deployment_parameters_path = ( + directory / OPTIONAL_DEPLOYMENT_PARAMETERS_FILENAME + ) + with open( + optional_deployment_parameters_path, "w", encoding="utf-8" + ) as _file: + _file.write(OPTIONAL_DEPLOYMENT_PARAMETERS_HEADING) + _file.write(json.dumps(nfd_parameters_with_default, indent=4)) + print( + "Optional ARM parameters detected. Created " + f"{OPTIONAL_DEPLOYMENT_PARAMETERS_FILENAME} to help you choose which " + "to expose." + ) + + def write_template_parameters(self, directory: Path) -> None: + """ + Write out the NFD templateParameters.json file to `directory`. + + :param directory: The directory to put this file in. + """ + logger.debug("Create %s", TEMPLATE_PARAMETERS_FILENAME) + vm_parameters = ( + self.vm_parameters_ordered if self.order_params else self.vm_parameters + ) + + template_parameters = {} + + for key in vm_parameters: + if key == self.config.image_name_parameter: + template_parameters[key] = self.image_name + continue + + template_parameters[key] = f"{{deployParameters.{key}}}" + + template_parameters_path = directory / TEMPLATE_PARAMETERS_FILENAME + + with open(template_parameters_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(template_parameters, indent=4)) + + logger.debug("%s created", template_parameters_path) + + def write_vhd_parameters(self, directory: Path) -> None: + """ + Write out the NFD vhdParameters.json file to `directory`. + + :param directory: The directory to put this file in. + """ + azureDeployLocation: str + if self.vm_parameters.get("location"): + # Location can be passed in as deploy parameter + azureDeployLocation = "{deployParameters.location}" + else: + # Couldn't find a location parameter in the source template, so hard code to + # the location we are deploying the publisher to. + azureDeployLocation = self.config.location + + vhd_parameters = { + "imageName": self.image_name, + "azureDeployLocation": azureDeployLocation, + } + + vhd_parameters_path = directory / VHD_PARAMETERS_FILENAME + with open(vhd_parameters_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(vhd_parameters, indent=4)) + + logger.debug("%s created", vhd_parameters_path) + + def _copy_to_output_directory(self) -> None: + """Copy the static bicep templates and generated config mappings and schema into the build output directory.""" + logger.info("Create NFD bicep %s", self.output_directory) + assert self._tmp_dir + Path(self.output_directory).mkdir(exist_ok=True) + + static_bicep_templates_dir = Path(__file__).parent / "templates" + + static_vnfd_bicep_path = ( + static_bicep_templates_dir / VNF_DEFINITION_BICEP_TEMPLATE_FILENAME + ) + shutil.copy(static_vnfd_bicep_path, self.output_directory) + + static_manifest_bicep_path = ( + static_bicep_templates_dir / VNF_MANIFEST_BICEP_TEMPLATE_FILENAME + ) + shutil.copy(static_manifest_bicep_path, self.output_directory) + # Copy everything in the temp directory to the output directory + shutil.copytree( + self._tmp_dir, + self.output_directory, + dirs_exist_ok=True, + ) + + logger.info("Copied files to %s", self.output_directory) diff --git a/src/aosm/azext_aosm/generate_nsd/__init__.py b/src/aosm/azext_aosm/generate_nsd/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/generate_nsd/nf_ret.py b/src/aosm/azext_aosm/generate_nsd/nf_ret.py new file mode 100644 index 00000000000..ab335b1123f --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/nf_ret.py @@ -0,0 +1,179 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Handles the creation of a resource element template for a network function.""" + +import json + +from typing import Dict, Any, List, Union +from knack.log import get_logger + +from azext_aosm._configuration import NFDRETConfiguration +from azext_aosm.util.constants import CNF, VNF +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.vendored_sdks.models import NetworkFunctionDefinitionVersion, NFVIType + + +logger = get_logger(__name__) + + +class NFRETGenerator: + """Represents a single network function resource element template withing an NSD.""" + + def __init__( + self, api_clients: ApiClients, config: NFDRETConfiguration, cg_schema_name: str + ) -> None: + self.config = config + self.cg_schema_name = cg_schema_name + nfdv = self._get_nfdv(config, api_clients) + print( + f"Finding the deploy parameters for {self.config.name}:{self.config.version}" + ) + + if not nfdv.deploy_parameters: + raise NotImplementedError( + f"NFDV {self.config.name} has no deploy parameters, cannot generate NSD." + ) + self.deploy_parameters: Dict[str, Any] = json.loads(nfdv.deploy_parameters) + + self.nfd_group_name = self.config.name.replace("-", "_") + self.nfdv_parameter_name = f"{self.nfd_group_name}_nfd_version" + self.config_mapping_filename = f"{self.config.name}_config_mapping.json" + + @staticmethod + def _get_nfdv( + config: NFDRETConfiguration, api_clients + ) -> NetworkFunctionDefinitionVersion: + """Get the existing NFDV resource object.""" + print( + "Reading existing NFDV resource object " + f"{config.version} from group {config.name}" + ) + nfdv_object = api_clients.aosm_client.network_function_definition_versions.get( + resource_group_name=config.publisher_resource_group, + publisher_name=config.publisher, + network_function_definition_group_name=config.name, + network_function_definition_version_name=config.version, + ) + return nfdv_object + + @property + def config_mappings(self) -> Dict[str, Any]: + """ + Return the contents of the config mapping file for this RET. + + Output will look something like: + { + "deploymentParameters": [ + "{configurationparameters('foo_ConfigGroupSchema').bar.deploymentParameters}" + ], + "nginx_nfdg_nfd_version": "{configurationparameters('foo_ConfigGroupSchema').bar.bar_nfd_version}", + "managedIdentity": "{configurationparameters('foo_ConfigGroupSchema').managedIdentity}", + "customLocationId": "{configurationparameters('foo_ConfigGroupSchema').bar.customLocationId}" + } + """ + nf = self.config.name + + logger.debug("Create %s", self.config_mapping_filename) + + deployment_parameters: Union[ + str, List[str] + ] = f"{{configurationparameters('{self.cg_schema_name}').{nf}.deploymentParameters}}" + + if not self.config.multiple_instances: + assert isinstance(deployment_parameters, str) + deployment_parameters = [deployment_parameters] + + version_parameter = ( + f"{{configurationparameters('{self.cg_schema_name}')." + f"{nf}.{self.nfdv_parameter_name}}}" + ) + + config_mappings = { + "deploymentParameters": deployment_parameters, + self.nfdv_parameter_name: version_parameter, + "managedIdentity": f"{{configurationparameters('{self.cg_schema_name}').managedIdentity}}", + } + + if self.config.type == CNF: + config_mappings[ + "customLocationId" + ] = f"{{configurationparameters('{self.cg_schema_name}').{nf}.customLocationId}}" + + return config_mappings + + @property + def nf_bicep_substitutions(self) -> Dict[str, Any]: + """Returns the jinja2 parameters for the NF bicep template template.""" + return { + "network_function_name": self.config.name, + "publisher_name": self.config.publisher, + "network_function_definition_group_name": (self.config.name), + "network_function_definition_version_parameter": (self.nfdv_parameter_name), + "network_function_definition_offering_location": ( + self.config.publisher_offering_location + ), + # Ideally we would use the network_function_type from reading the actual + # NF, as we do for deployParameters, but the SDK currently doesn't + # support this and needs to be rebuilt to do so. + "nfvi_type": ( + NFVIType.AZURE_CORE.value # type: ignore[attr-defined] # pylint: disable=no-member + if self.config.type == VNF + else NFVIType.AZURE_ARC_KUBERNETES.value # type: ignore[attr-defined] # pylint: disable=no-member + ), + "CNF": self.config.type == CNF, + } + + @property + def config_schema_snippet(self) -> Dict[str, Any]: + """Return the CGS snippet for this NF.""" + nfdv_version_description_string = ( + f"The version of the {self.config.name} " + "NFD to use. This version must be compatible with (have the same " + "parameters exposed as) " + f"{self.config.name}." + ) + + if self.config.multiple_instances: + deploy_parameters = { + "type": "array", + "items": { + "type": "object", + "properties": self.deploy_parameters["properties"], + }, + } + else: + deploy_parameters = { + "type": "object", + "properties": self.deploy_parameters["properties"], + } + + nf_schema: Dict[str, Any] = { + "type": "object", + "properties": { + "deploymentParameters": deploy_parameters, + self.nfdv_parameter_name: { + "type": "string", + "description": nfdv_version_description_string, + }, + }, + "required": ["deploymentParameters", self.nfdv_parameter_name], + } + + if self.config.type == CNF: + custom_location_description_string = ( + "The custom location ID of the ARC-Enabled AKS Cluster to deploy the CNF " + "to. Should be of the form " + "'/subscriptions/{subscriptionId}/resourcegroups" + "/{resourceGroupName}/providers/microsoft.extendedlocation/" + "customlocations/{customLocationName}'" + ) + + nf_schema["properties"]["customLocationId"] = { + "type": "string", + "description": custom_location_description_string, + } + nf_schema["required"].append("customLocationId") + + return nf_schema diff --git a/src/aosm/azext_aosm/generate_nsd/nsd_generator.py b/src/aosm/azext_aosm/generate_nsd/nsd_generator.py new file mode 100644 index 00000000000..e1e80740b0f --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/nsd_generator.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT +# License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------- +"""Contains a class for generating NSDs and associated resources.""" +import json +import os +import shutil +import tempfile +from functools import cached_property +from typing import Any, Dict + +from jinja2 import Template +from knack.log import get_logger + +from azext_aosm._configuration import NSConfiguration +from azext_aosm.generate_nsd.nf_ret import NFRETGenerator +from azext_aosm.util.constants import ( + CONFIG_MAPPINGS_DIR_NAME, + NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE, + NSD_ARTIFACT_MANIFEST_BICEP_FILENAME, + NSD_ARTIFACT_MANIFEST_SOURCE_TEMPLATE_FILENAME, + NSD_BICEP_FILENAME, + NSD_DEFINITION_JINJA2_SOURCE_TEMPLATE, + SCHEMAS_DIR_NAME, + TEMPLATES_DIR_NAME, +) +from azext_aosm.util.management_clients import ApiClients + +logger = get_logger(__name__) + +# Different types are used in Bicep templates and NFDs. The list accepted by NFDs is +# documented in the AOSM meta-schema. This will be published in the future but for now +# can be found in +# https://microsoft.sharepoint.com/:w:/t/NSODevTeam/Ec7ovdKroSRIv5tumQnWIE0BE-B2LykRcll2Qb9JwfVFMQ +NFV_TO_BICEP_PARAM_TYPES: Dict[str, str] = { + "integer": "int", + "boolean": "bool", +} + + +class NSDGenerator: # pylint: disable=too-few-public-methods + """ + NSD Generator. + + This takes a config file and a set of NFDV deploy_parameters and outputs: + - A bicep file for the NSDV + - Parameters files that are used by the NSDV bicep file, these are the + schemas and the mapping profiles of those schemas parameters + - A bicep file for the Artifact manifest + - A bicep and JSON file defining the Network Function that will + be deployed by the NSDV + """ + + def __init__(self, api_clients: ApiClients, config: NSConfiguration): + self.config = config + self.nsd_bicep_template_name = NSD_DEFINITION_JINJA2_SOURCE_TEMPLATE + self.nsd_bicep_output_name = NSD_BICEP_FILENAME + self.nf_ret_generators = [ + NFRETGenerator(api_clients, nf_config, self.config.cg_schema_name) + for nf_config in self.config.network_functions + ] + + def generate_nsd(self) -> None: + """Generate a NSD templates which includes an Artifact Manifest, NFDV and NF templates.""" + logger.info("Generate NSD bicep templates") + + # Create temporary folder. + with tempfile.TemporaryDirectory() as tmpdirname: + self._write_config_group_schema_json(tmpdirname) + self._write_config_mapping_files(tmpdirname) + self._write_nsd_manifest(tmpdirname) + self._write_nf_bicep_files(tmpdirname) + self._write_nsd_bicep(tmpdirname) + + self._copy_to_output_folder(tmpdirname) + print( + "Generated NSD bicep templates created in" + f" {self.config.output_directory_for_build}" + ) + print( + "Please review these templates. When you are happy with them run " + "`az aosm nsd publish` with the same arguments." + ) + + @cached_property + def _config_group_schema_dict(self) -> Dict[str, Any]: + """ + :return: The Config Group Schema as a dictionary. + + See src/aosm/azext_aosm/tests/latest/nsd_output/*/schemas for examples of the + output from this function. + """ + managed_identity_description_string = ( + "The managed identity to use to deploy NFs within this SNS. This should " + "be of the form '/subscriptions/{subscriptionId}/resourceGroups/" + "{resourceGroupName}/providers/Microsoft.ManagedIdentity/" + "userAssignedIdentities/{identityName}. " + "If you wish to use a system assigned identity, set this to a blank string." + ) + + properties = { + nf.config.name: nf.config_schema_snippet for nf in self.nf_ret_generators + } + + properties.update( + { + "managedIdentity": { + "type": "string", + "description": managed_identity_description_string, + } + } + ) + + required = [nf.config.name for nf in self.nf_ret_generators] + required.append("managedIdentity") + + cgs_dict: Dict[str, Any] = { + "$schema": "https://json-schema.org/draft-07/schema#", + "title": self.config.cg_schema_name, + "type": "object", + "properties": properties, + "required": required, + } + + return cgs_dict + + def _write_config_group_schema_json(self, output_directory) -> None: + """Create a file containing the json schema for the CGS.""" + temp_schemas_folder_path = os.path.join(output_directory, SCHEMAS_DIR_NAME) + os.mkdir(temp_schemas_folder_path) + + logger.debug("Create %s.json", self.config.cg_schema_name) + + schema_path = os.path.join( + temp_schemas_folder_path, f"{self.config.cg_schema_name}.json" + ) + + with open(schema_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(self._config_group_schema_dict, indent=4)) + + logger.debug("%s created", schema_path) + + def _write_config_mapping_files(self, output_directory) -> None: + """Write out a config mapping file for each NF.""" + temp_mappings_folder_path = os.path.join( + output_directory, CONFIG_MAPPINGS_DIR_NAME + ) + + os.mkdir(temp_mappings_folder_path) + + for nf in self.nf_ret_generators: + config_mappings_path = os.path.join( + temp_mappings_folder_path, nf.config_mapping_filename + ) + + with open(config_mappings_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(nf.config_mappings, indent=4)) + + logger.debug("%s created", config_mappings_path) + + def _write_nf_bicep_files(self, output_directory) -> None: + """ + Write bicep files for deploying NFs. + + In the publish step these bicep files will be uploaded to the publisher storage + account as artifacts. + """ + for nf in self.nf_ret_generators: + substitutions = {"location": self.config.location} + substitutions.update(nf.nf_bicep_substitutions) + + self._generate_bicep( + NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE, + os.path.join(output_directory, nf.config.nf_bicep_filename), + substitutions, + ) + + def _write_nsd_bicep(self, output_directory) -> None: + """Write out the NSD bicep file.""" + ret_names = [nf.config.resource_element_name for nf in self.nf_ret_generators] + arm_template_names = [ + nf.config.arm_template.artifact_name for nf in self.nf_ret_generators + ] + config_mapping_files = [ + nf.config_mapping_filename for nf in self.nf_ret_generators + ] + + # We want the armTemplateVersion to be the same as the NSD Version. That means + # that if we create a new NSDV then the existing artifacts won't be overwritten. + params = { + "nfvi_site_name": self.config.nfvi_site_name, + "armTemplateNames": arm_template_names, + "armTemplateVersion": self.config.nsd_version, + "cg_schema_name": self.config.cg_schema_name, + "nsdv_description": self.config.nsdv_description, + "ResourceElementName": ret_names, + "configMappingFiles": config_mapping_files, + "nf_count": len(self.nf_ret_generators), + } + + self._generate_bicep( + self.nsd_bicep_template_name, + os.path.join(output_directory, self.nsd_bicep_output_name), + params, + ) + + def _write_nsd_manifest(self, output_directory) -> None: + """Write out the NSD manifest bicep file.""" + logger.debug("Create NSD manifest") + + self._generate_bicep( + NSD_ARTIFACT_MANIFEST_SOURCE_TEMPLATE_FILENAME, + os.path.join(output_directory, NSD_ARTIFACT_MANIFEST_BICEP_FILENAME), + {}, + ) + + @staticmethod + def _generate_bicep( + template_name: str, output_file_name: str, params: Dict[Any, Any] + ) -> None: + """ + Render the bicep templates with the correct parameters and copy them into the build output folder. + + :param template_name: The name of the template to render + :param output_file_name: The name of the output file + :param params: The parameters to render the template with + """ + + code_dir = os.path.dirname(__file__) + + bicep_template_path = os.path.join(code_dir, TEMPLATES_DIR_NAME, template_name) + + with open(bicep_template_path, "r", encoding="utf-8") as file: + bicep_contents = file.read() + + bicep_template = Template(bicep_contents) + + # Render all the relevant parameters in the bicep template + rendered_template = bicep_template.render(**params) + + with open(output_file_name, "w", encoding="utf-8") as file: + file.write(rendered_template) + + def _copy_to_output_folder(self, temp_dir) -> None: + """Copy the bicep templates, config mappings and schema into the build output folder.""" + + logger.info("Create NSD bicep %s", self.config.output_directory_for_build) + os.mkdir(self.config.output_directory_for_build) + + shutil.copytree( + temp_dir, + self.config.output_directory_for_build, + dirs_exist_ok=True, + ) + + logger.info("Copied files to %s", self.config.output_directory_for_build) diff --git a/src/aosm/azext_aosm/generate_nsd/templates/artifact_manifest_template.bicep b/src/aosm/azext_aosm/generate_nsd/templates/artifact_manifest_template.bicep new file mode 100644 index 00000000000..7abba315154 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/templates/artifact_manifest_template.bicep @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an Artifact Manifest for a NSD +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestNames array +@description('The name under which to store the ARM template') +param armTemplateNames array +@description('The version that you want to name the NFM template artifact, in format A.B.C. e.g. 6.13.0. If testing for development, you can use any numbers you like.') +param armTemplateVersion string + +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +resource acrArtifactManifests 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = [for (values, i) in armTemplateNames: { + parent: acrArtifactStore + name: acrManifestNames[i] + location: location + properties: { + artifacts: [ + { + artifactName: armTemplateNames[i] + artifactType: 'ArmTemplate' + artifactVersion: armTemplateVersion + } + ] + } +}] diff --git a/src/aosm/azext_aosm/generate_nsd/templates/nf_template.bicep.j2 b/src/aosm/azext_aosm/generate_nsd/templates/nf_template.bicep.j2 new file mode 100644 index 00000000000..43d3ea8b429 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/templates/nf_template.bicep.j2 @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// The template that the NSD invokes to create the Network Function from a published NFDV. + +@description('Publisher where the NFD is published') +param publisherName string = '{{publisher_name}}' + +@description('NFD Group name for the Network Function') +param networkFunctionDefinitionGroupName string = '{{network_function_definition_group_name}}' + +@description('NFD version') +param {{network_function_definition_version_parameter}} string + +@description('Offering location for the Network Function') +param networkFunctionDefinitionOfferingLocation string = '{{network_function_definition_offering_location}}' + +@description('The managed identity that should be used to create the NF.') +param managedIdentity string + +{%- if CNF %} +@description('The custom location of the ARC-enabled AKS cluster to create the NF.') +param customLocationId string +{%- endif %} + +param location string = '{{location}}' + +param nfviType string = '{{nfvi_type}}' + +param resourceGroupId string = resourceGroup().id + +param deploymentParameters array + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = [for (values, i) in deploymentParameters: { + name: '{{network_function_name}}${i}' + location: location + identity: identityObject + properties: { + publisherName: publisherName + publisherScope: 'Private' + networkFunctionDefinitionGroupName: networkFunctionDefinitionGroupName + networkFunctionDefinitionVersion: {{network_function_definition_version_parameter}} + networkFunctionDefinitionOfferingLocation: networkFunctionDefinitionOfferingLocation + nfviType: nfviType +{%- if CNF %} + nfviId: customLocationId +{%- else %} + nfviId: resourceGroupId +{%- endif %} + allowSoftwareUpdate: true + deploymentValues: string(values) + } +}] diff --git a/src/aosm/azext_aosm/generate_nsd/templates/nsd_template.bicep.j2 b/src/aosm/azext_aosm/generate_nsd/templates/nsd_template.bicep.j2 new file mode 100644 index 00000000000..f707069674c --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/templates/nsd_template.bicep.j2 @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// Bicep template to create an Artifact Manifest, Config Group Schema and NSDV. +// +// Requires an existing NFDV from which the values will be populated. + +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Network Service Design Group') +param nsDesignGroup string +@description('The version of the NSDV you want to create, in format A.B.C') +param nsDesignVersion string +@description('Name of the nfvi site') +param nfviSiteName string = '{{nfvi_site_name}}' + +// The publisher resource is the top level AOSM resource under which all other designer resources +// are created. +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// The artifact store is the resource in which all the artifacts required to deploy the NF are stored. +// The artifact store is created by the az aosm CLI before this template is deployed. +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created up-front, the NSD Group is the parent resource under which all NSD versions will be created. +resource nsdGroup 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups@2023-04-01-preview' existing = { + parent: publisher + name: nsDesignGroup +} + +// The configuration group schema defines the configuration required to deploy the NSD. The NSD references this object in the +// `configurationgroupsSchemaReferences` and references the values in the schema in the `parameterValues`. +// The operator will create a config group values object that will satisfy this schema. +resource cgSchema 'Microsoft.Hybridnetwork/publishers/configurationGroupSchemas@2023-04-01-preview' = { + parent: publisher + name: '{{cg_schema_name}}' + location: location + properties: { + schemaDefinition: string(loadJsonContent('schemas/{{cg_schema_name}}.json')) + } +} + +// The NSD version +resource nsdVersion 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions@2023-04-01-preview' = { + parent: nsdGroup + name: nsDesignVersion + location: location + properties: { + description: '{{nsdv_description}}' + // The version state can be Preview, Active or Deprecated. + // Once in an Active state, the NSDV becomes immutable. + versionState: 'Preview' + // The `configurationgroupsSchemaReferences` field contains references to the schemas required to + // be filled out to configure this NSD. + configurationGroupSchemaReferences: { + {{cg_schema_name}}: { + id: cgSchema.id + } + } + // This details the NFVIs that should be available in the Site object created by the operator. + nfvisFromSite: { + nfvi1: { + name: nfviSiteName + type: 'AzureCore' + } + } + // This field lists the templates that will be deployed by AOSM and the config mappings + // to the values in the CG schemas. + resourceElementTemplates: [ +{%- for index in range(nf_count) %} + { + name: '{{ResourceElementName[index]}}' + // The type of resource element can be ArmResourceDefinition, ConfigurationDefinition or NetworkFunctionDefinition. + type: 'NetworkFunctionDefinition' + // The configuration object may be different for different types of resource element. + configuration: { + // This field points AOSM at the artifact in the artifact store. + artifactProfile: { + artifactStoreReference: { + id: acrArtifactStore.id + } + artifactName: '{{armTemplateNames[index]}}' + artifactVersion: '{{armTemplateVersion}}' + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + parameterValues: string(loadJsonContent('configMappings/{{configMappingFiles[index]}}')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } +{%- endfor %} + ] + } +} diff --git a/src/aosm/azext_aosm/tests/__init__.py b/src/aosm/azext_aosm/tests/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/tests/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/tests/latest/__init__.py b/src/aosm/azext_aosm/tests/latest/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/tests/latest/metaschema.json b/src/aosm/azext_aosm/tests/latest/metaschema.json new file mode 100644 index 00000000000..81f2b211f0c --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/metaschema.json @@ -0,0 +1,264 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "version": "2023-04-01-preview", + "$ref": "#/definitions/schemaObjectRoot", + "definitions": { + "schemaArray": { + "type": "object", + "properties": { + "type": { + "const": "array" + }, + "items": { + "$ref": "#/definitions/schemaAnyOf" + }, + "minItems": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxItems": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaArrayMultiType": { + "type": "object", + "properties": { + "type": { + "const": "array" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/schemaAnyOf" + } + }, + "minItems": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "maxItems": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "additionalItems": { + "const": false + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "type", + "additionalItems" + ], + "additionalProperties": false + }, + "schemaObjectRoot": { + "type": "object", + "properties": { + "format": { + "type": "string" + }, + "type": { + "const": "object" + }, + "$schema": { + "type": "string", + "format": "uri", + "not": { + "const": "https://json-schema.org/draft/2020-12/schema" + } + }, + "$id": { + "type": "string", + "format": "uri-reference" + }, + "version": { + "type": "string" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "array" + }, + "additionalProperties": { + "type": "boolean" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "maxProperties": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "minProperties": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schemaAnyOf" + } + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaObject": { + "type": "object", + "properties": { + "format": { + "type": "string" + }, + "type": { + "const": "object" + }, + "version": { + "type": "string" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "array" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "additionalProperties": { + "type": "boolean" + }, + "maxProperties": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "minProperties": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schemaAnyOf" + } + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaAnyOf": { + "anyOf": [ + { + "$ref": "#/definitions/schemaObject" + }, + { + "$ref": "#/definitions/schemaArray" + }, + { + "$ref": "#/definitions/schemaArrayMultiType" + }, + { + "$ref": "#/definitions/schemaPrimitive" + } + ] + }, + "schemaPrimitive": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "integer", + "string", + "boolean", + "null" + ] + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "default": { + "not": {} + } + }, + "required": [ + "type" + ], + "additionalProperties": true + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { + "$ref": "#/definitions/nonNegativeInteger" + }, + { + "default": 0 + } + ] + } + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/metaschema_modified.json b/src/aosm/azext_aosm/tests/latest/metaschema_modified.json new file mode 100644 index 00000000000..f0dfef8b530 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/metaschema_modified.json @@ -0,0 +1,260 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "version": "2023-04-01-preview", + "$ref": "#/definitions/schemaObjectRoot", + "definitions": { + "schemaArray": { + "type": "object", + "properties": { + "type": { + "const": "array" + }, + "items": { + "$ref": "#/definitions/schemaAnyOf" + }, + "minItems": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxItems": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaArrayMultiType": { + "type": "object", + "properties": { + "type": { + "const": "array" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/schemaAnyOf" + } + }, + "minItems": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "maxItems": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "additionalItems": { + "const": false + }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "type", + "additionalItems" + ], + "additionalProperties": false + }, + "schemaObjectRoot": { + "type": "object", + "properties": { + "format": { + "type": "string" + }, + "type": { + "const": "object" + }, + "$schema": { + "type": "string", + "format": "uri", + "not": { + "const": "https://json-schema.org/draft/2020-12/schema" + } + }, + "version": { + "type": "string" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "array" + }, + "additionalProperties": { + "type": "boolean" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "maxProperties": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "minProperties": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schemaAnyOf" + } + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaObject": { + "type": "object", + "properties": { + "format": { + "type": "string" + }, + "type": { + "const": "object" + }, + "version": { + "type": "string" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "array" + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "additionalProperties": { + "type": "boolean" + }, + "maxProperties": { + "$ref": "#/definitions/nonNegativeInteger" + }, + "minProperties": { + "$ref": "#/definitions/nonNegativeIntegerDefault0" + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schemaAnyOf" + } + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "schemaAnyOf": { + "anyOf": [ + { + "$ref": "#/definitions/schemaObject" + }, + { + "$ref": "#/definitions/schemaArray" + }, + { + "$ref": "#/definitions/schemaArrayMultiType" + }, + { + "$ref": "#/definitions/schemaPrimitive" + } + ] + }, + "schemaPrimitive": { + "type": "object", + "properties": { + "type": { + "enum": [ + "number", + "integer", + "string", + "boolean", + "null" + ] + }, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "default": { + "not": {} + } + }, + "required": [ + "type" + ], + "additionalProperties": true + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { + "$ref": "#/definitions/nonNegativeInteger" + }, + { + "default": 0 + } + ] + } + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf-0.1.0.tgz b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf-0.1.0.tgz new file mode 100644 index 00000000000..679c20fddcf Binary files /dev/null and b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf-0.1.0.tgz differ diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/.helmignore b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/.helmignore new file mode 100644 index 00000000000..0e8a0eb36f4 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/Chart.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/Chart.yaml new file mode 100644 index 00000000000..275ab10e2e2 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nf-agent-cnf +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/NOTES.txt b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/NOTES.txt new file mode 100644 index 00000000000..238eb9aa2f6 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nf-agent-cnf.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nf-agent-cnf.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nf-agent-cnf.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nf-agent-cnf.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/_helpers.tpl b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/_helpers.tpl new file mode 100644 index 00000000000..1a8d7653757 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nf-agent-cnf.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nf-agent-cnf.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nf-agent-cnf.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nf-agent-cnf.labels" -}} +helm.sh/chart: {{ include "nf-agent-cnf.chart" . }} +{{ include "nf-agent-cnf.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nf-agent-cnf.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nf-agent-cnf.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nf-agent-cnf.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nf-agent-cnf.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/deployment.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/deployment.yaml new file mode 100644 index 00000000000..90bae35f548 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/deployment.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nf-agent-cnf.fullname" . }} + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nf-agent-cnf.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nf-agent-cnf.selectorLabels" . | nindent 8 }} + #aadpodidbinding: {{ .Values.nfagent.podIdentity }} - not using podidentity any more + spec: + # Copied imagePullSecrets from how afosas-aosm repo does it + imagePullSecrets: {{ mustToPrettyJson (ternary (list ) .Values.imagePullSecrets (kindIs "invalid" .Values.imagePullSecrets)) }} + serviceAccountName: {{ include "nf-agent-cnf.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + # Edited the image to point to the nf-agent image in the Artifact Store ACR + image: "{{ .Values.image.repository }}/pez-nfagent:879624" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + # Commented out otherwise kubernetes keeps restarting the pod thinking the probes have failed + # livenessProbe: + # httpGet: + # path: / + # port: http + # readinessProbe: + # httpGet: + # path: / + # port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + # Gets the NF Agent config from the configMap - see nf-agent-config-map.yaml + volumeMounts: + - name: nfagent-config-volume + mountPath: /etc/nf-agent/config.yaml + subPath: config.yaml + volumes: + - name: nfagent-config-volume + configMap: + name: nfagent-config + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/hpa.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/hpa.yaml new file mode 100644 index 00000000000..ae24cfc1704 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nf-agent-cnf.fullname" . }} + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nf-agent-cnf.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/ingress.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/ingress.yaml new file mode 100644 index 00000000000..9fc4d315aed --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nf-agent-cnf.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/nf-agent-config-map.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/nf-agent-config-map.yaml new file mode 100644 index 00000000000..8c2f5e6f823 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/nf-agent-config-map.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nfagent-config +data: + config.yaml: | + # Example NF Agent config file. + # Config is read from /etc/nf-agent/config.yaml. + log_level: debug + service_bus: + # Using a namespace and Managed Identity (specified by client ID) for auth. + namespace: {{ .Values.nfagent.namespace }} + # Helm uses sprig for templating, so we can use sprig functions to find just the UID from the full Managed Identity ID path. + identity: {{ (splitList "/" .Values.nfagent.identity) | last }} + # Alternatively can use a connstring instead of namespace + managed identity: + # connstring: "Endpoint=sb://contoso.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=TopSecretSASTokenGoesHere=" + subscriptions: + - topic: {{ .Values.nfagent.topic }} + subscription: {{ .Values.nfagent.topic }}-subscription + # Handler-specific config + handler_config: + simpl: + # The endpoint is constructed from the namespace and service name of the receiving thing. + # We couldn't get AOSM to install the service to listen on anything but port 80 + # Doh - that was because we changed values.yaml in the chart but didn't change values.mappings.yaml in the NFDV + # Changing values.mappings.yaml should make this work on port 5222 as expected. + endpoint: http://nfconfigchart.nfconfigchart.svc.cluster.local:80 # DevSkim: ignore DS162092 diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/service.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/service.yaml new file mode 100644 index 00000000000..ed537a4e61c --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nf-agent-cnf.fullname" . }} + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nf-agent-cnf.selectorLabels" . | nindent 4 }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/serviceaccount.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/serviceaccount.yaml new file mode 100644 index 00000000000..e19c3c09fbc --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nf-agent-cnf.serviceAccountName" . }} + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/tests/test-connection.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/tests/test-connection.yaml new file mode 100644 index 00000000000..309ea5078a2 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "nf-agent-cnf.fullname" . }}-test-connection" + labels: + {{- include "nf-agent-cnf.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "nf-agent-cnf.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.mappings.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.mappings.yaml new file mode 100644 index 00000000000..eef4e074f8b --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.mappings.yaml @@ -0,0 +1,89 @@ +# Default values for nf-agent-cnf. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: sunnyclipubsunnynfagentacre00abc1832.azurecr.io + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "879624" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +nfagent: + namespace: "{deployParameters.nfAgentServiceBusNamespace}" + identity: "{deployParameters.nfAgentUserAssignedIdentityResourceId}" + topic: "{deployParameters.nfagent_topic}" # ??? This wasn't made available to simpl + # name of pod identity - not using this any more + # podIdentity: mypeapod diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.schema.json b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.schema.json new file mode 100644 index 00000000000..5207b19a8df --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.schema.json @@ -0,0 +1,193 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "additionalProperties": true, + "properties": { + "affinity": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "autoscaling": { + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "maxReplicas": { + "type": "integer" + }, + "minReplicas": { + "type": "integer" + }, + "targetCPUUtilizationPercentage": { + "type": "integer" + } + }, + "type": "object" + }, + "fullnameOverride": { + "type": "string" + }, + "image": { + "additionalProperties": false, + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "imagePullSecrets": { + "items": { + "anyOf": [] + }, + "type": "array" + }, + "ingress": { + "additionalProperties": false, + "properties": { + "annotations": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "className": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "hosts": { + "items": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "host": { + "type": "string" + }, + "paths": { + "items": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "path": { + "type": "string" + }, + "pathType": { + "type": "string" + } + }, + "type": "object" + } + ] + }, + "type": "array" + } + }, + "type": "object" + } + ] + }, + "type": "array" + }, + "tls": { + "items": { + "anyOf": [] + }, + "type": "array" + } + }, + "type": "object" + }, + "nameOverride": { + "type": "string" + }, + "nfagent": { + "additionalProperties": false, + "properties": { + "identity": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "topic": { + "type": "string" + } + }, + "type": "object" + }, + "nodeSelector": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "podAnnotations": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "podSecurityContext": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "replicaCount": { + "type": "integer" + }, + "resources": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "securityContext": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "service": { + "additionalProperties": false, + "properties": { + "port": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "serviceAccount": { + "additionalProperties": false, + "properties": { + "annotations": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "create": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "tolerations": { + "items": { + "anyOf": [] + }, + "type": "array" + } + }, + "type": "object" +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.yaml new file mode 100644 index 00000000000..3d9aeb6c9cb --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nf-agent-cnf/values.yaml @@ -0,0 +1,92 @@ +# Default values for nf-agent-cnf. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + # NFDV defines that AOSM overwrites image.repository with the Articfact Store ACR + repository: sunnyclipubsunnynfagentacr2dd56aed266.azurecr.io + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "879624" + +# NFDV defines that AOSM overwrites imagePullSecrets with whatever is needed for the Artifact Store ACR +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + # I forgot to change values.mappings.yaml in NFDV to match the service port in the Helm chart when testing this + port: 8123 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +nfagent: + namespace: sb-uowvjfivpyuow + identity: 041db2eb-36e0-42cd-ac13-03ae8e997cd1 + topic: simpl + # name of pod identity - not using this any more + # podIdentity: mypeapod diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart-0.1.0.tgz b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart-0.1.0.tgz new file mode 100644 index 00000000000..db24d31925a Binary files /dev/null and b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart-0.1.0.tgz differ diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/.helmignore b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/.helmignore new file mode 100644 index 00000000000..50af0317254 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/Chart.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/Chart.yaml new file mode 100644 index 00000000000..750a5cbded9 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +appVersion: "1.0" +description: Sunny & Chaos demo Helm chart for NF Agent Config receiver +name: nfconfigchart +version: 0.1.0 + diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/configmap/default.conf b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/configmap/default.conf new file mode 100644 index 00000000000..5feb2a704f0 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/configmap/default.conf @@ -0,0 +1,38 @@ +log_format client '$remote_addr - $remote_user $request_time $upstream_response_time ' + '[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; +server { + listen 80; + listen [::]:80; + server_name localhost; + + access_log /var/log/nginx/host.access.log client; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + error_page 405 =200 $uri; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + location = /posty { + #access_log logs/uaa_access.log client; + # add the proper port or IP address if Nginx is not on 127.0.0.1:80 + proxy_pass http://127.0.0.1/post_thing; + } + + location = /post_thing { + # turn off logging here to avoid double logging + access_log off; + empty_gif; + } + +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/nfconfigchartvalues.mappings.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/nfconfigchartvalues.mappings.yaml new file mode 100644 index 00000000000..64bd4c5294b --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/nfconfigchartvalues.mappings.yaml @@ -0,0 +1,69 @@ +# Default values for nfconfigchart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + tag: stable + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: '{deployParameters.serviceAccount_create}' + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + # I forgot to change values.mappings.yaml in NFDV to match the service port in the Helm chart when testing this + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/NOTES.txt b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/NOTES.txt new file mode 100644 index 00000000000..1a4961b6284 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nfconfigchart.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nfconfigchart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nfconfigchart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nfconfigchart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/_helpers.tpl b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/_helpers.tpl new file mode 100644 index 00000000000..80aed0f9c4a --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/_helpers.tpl @@ -0,0 +1,56 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "nfconfigchart.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nfconfigchart.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nfconfigchart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "nfconfigchart.labels" -}} +app.kubernetes.io/name: {{ include "nfconfigchart.name" . }} +helm.sh/chart: {{ include "nfconfigchart.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nfconfigchart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "nfconfigchart.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/deployment.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/deployment.yaml new file mode 100644 index 00000000000..1d3f00666c3 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nfconfigchart.fullname" . }} + labels: +{{ include "nfconfigchart.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nfconfigchart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "nfconfigchart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + # Copied from sas + imagePullSecrets: {{ mustToPrettyJson (ternary (list ) .Values.imagePullSecrets (kindIs "invalid" .Values.imagePullSecrets)) }} + serviceAccountName: {{ template "nfconfigchart.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + # Want this to evaluate to acr-name.azurecr.io/nginx:stable (or specific version) + # docker tag nginx:stable acr-name.azurecr.io/nginx:stable + # docker push acr-name.azurecr.io/nginx:stable + # Image hard coded to that put in the Artifact Store ACR for this CNF POC + image: "{{ .Values.image.repository }}/nginx:stable" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + # Gets the nginx config from the configMap - see nginx_config_map.yaml + volumeMounts: + - name: nginx-config-volume + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + volumes: + - name: nginx-config-volume + configMap: + name: nginx-config + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/ingress.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/ingress.yaml new file mode 100644 index 00000000000..cafa8c3c913 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nfconfigchart.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: +{{ include "nfconfigchart.labels" . | indent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/nginx_config_map.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/nginx_config_map.yaml new file mode 100644 index 00000000000..3174b9eef3c --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/nginx_config_map.yaml @@ -0,0 +1,56 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-config +# This writes the nginx config file to the ConfigMap and deployment.yaml mounts it as a volume +# to the right place. +data: + default.conf: | + log_format client '$remote_addr - $remote_user $request_time $upstream_response_time ' + '[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + server { + listen 80; + listen 5222; + listen [::]:80; + server_name localhost; + + access_log /var/log/nginx/host.access.log client; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + error_page 405 =200 $uri; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + location = /nf-config/v1/config { + #access_log logs/uaa_access.log client; + # add the proper port or IP address if Nginx is not on 127.0.0.1:80 + # This results in a Bad Gateway. We could pass it back to the nf-agent + # but haven't worked out how to put a body in it here. + proxy_pass http://127.0.0.1:8123/nf-status/v1/report; + error_page 405 =200 $uri; + } + + location = /post_thing { + # turn off logging here to avoid double logging + access_log off; + error_page 405 =200 $uri; + } + + location = /nf-config/v1/delete { + #access_log logs/uaa_access.log client; + # add the proper port or IP address if Nginx is not on 127.0.0.1:80 + proxy_pass http://127.0.0.1:8123/nf-status/v1/report; + error_page 405 =200 $uri; + } + } diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/service.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/service.yaml new file mode 100644 index 00000000000..a9f1a14e49c --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nfconfigchart.fullname" . }} + labels: +{{ include "nfconfigchart.labels" . | indent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "nfconfigchart.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/serviceaccount.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/serviceaccount.yaml new file mode 100644 index 00000000000..cab132a5c75 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "nfconfigchart.serviceAccountName" . }} + labels: +{{ include "nfconfigchart.labels" . | indent 4 }} +{{- end -}} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/tests/test-connection.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/tests/test-connection.yaml new file mode 100644 index 00000000000..db6b909125f --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "nfconfigchart.fullname" . }}-test-connection" + labels: +{{ include "nfconfigchart.labels" . | indent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "nfconfigchart.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.schema.json b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.schema.json new file mode 100644 index 00000000000..4972d65822b --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.schema.json @@ -0,0 +1,134 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "additionalProperties": true, + "properties": { + "affinity": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "fullnameOverride": { + "type": "string" + }, + "image": { + "additionalProperties": false, + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "imagePullSecrets": { + "items": { + "anyOf": [] + }, + "type": "array" + }, + "ingress": { + "additionalProperties": false, + "properties": { + "annotations": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "hosts": { + "items": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "host": { + "type": "string" + }, + "paths": { + "items": { + "anyOf": [] + }, + "type": "array" + } + }, + "type": "object" + } + ] + }, + "type": "array" + }, + "tls": { + "items": { + "anyOf": [] + }, + "type": "array" + } + }, + "type": "object" + }, + "nameOverride": { + "type": "string" + }, + "nodeSelector": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "podSecurityContext": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "replicaCount": { + "type": "integer" + }, + "resources": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "securityContext": { + "additionalProperties": false, + "properties": {}, + "type": "object" + }, + "service": { + "additionalProperties": false, + "properties": { + "port": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "serviceAccount": { + "additionalProperties": false, + "properties": { + "create": { + "type": "boolean" + }, + "name": { + "type": "null" + } + }, + "type": "object" + }, + "tolerations": { + "items": { + "anyOf": [] + }, + "type": "array" + } + }, + "type": "object" +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.yaml new file mode 100644 index 00000000000..de470d42f3c --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/helm-charts/nfconfigchart/values.yaml @@ -0,0 +1,70 @@ +# Default values for nfconfigchart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + # Repository gets overwritten by AOSM to the Artifact Store ACR, however we've hard-coded the image name and tag in deployment.yaml + repository: sunnyclipubsunnynfagentacr2dd56aed266.azurecr.io + tag: stable + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + # I forgot to change values.mappings.yaml in NFDV to match the service port in the Helm chart when testing this + port: 5222 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nf-agent-cnf.json b/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nf-agent-cnf.json new file mode 100644 index 00000000000..e260384ff23 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nf-agent-cnf.json @@ -0,0 +1,17 @@ +{ + "publisher_name": "sunnyclipub", + "publisher_resource_group_name": "sunny-uksouth", + "nf_name": "nf-agent-cnf", + "version": "0.1.0", + "acr_artifact_store_name": "sunny-nfagent-acr-2", + "location": "uksouth", + "source_registry_id": "--this was copied here and renamed from https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/4a0479c0-b795-4d0f-96fd-c7edd2a2928f/resourceGroups/pez-nfagent-pipelines/providers/Microsoft.ContainerRegistry/registries/peznfagenttemp/overview new one was /subscriptions/c7bd9d96-70dd-4f61-af56-6e0abd8d80b5/resourceGroups/sunny-nfagent-acr-HostedResources-4CDE264A/providers/Microsoft.ContainerRegistry/registries/SunnyclipubSunnyNfagentAcre00abc1832", + "helm_packages": [ + { + "name": "nf-agent-cnf", + "path_to_chart": "helm-charts/nf-agent-cnf-0.1.0.tgz", + "path_to_mappings": "", + "depends_on": [] + } + ] +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nfconfigchart.json b/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nfconfigchart.json new file mode 100644 index 00000000000..f1869fe5cb1 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/input-nfconfigchart.json @@ -0,0 +1,18 @@ +{ + "publisher_name": "sunnyclipub", + "publisher_resource_group_name": "sunny-uksouth", + "nf_name": "nginx-basic-test", + "version": "0.1.0", + "acr_artifact_store_name": "sunny-nfagent-acr-2", + "location": "uksouth", + "source_registry_id": "this was nonsense just put something in to stop CLI complaining. The image was manually uploaded. /subscriptions/c7bd9d96-70dd-4f61-af56-6e0abd8d80b5/resourceGroups/SIMPLVM-team-CI/providers/Microsoft.ContainerRegistry/registries/a4oSIMPL", + "helm_packages": [ + { + "name": "nfconfigchart", + "path_to_chart": "helm-charts/nfconfigchart-0.1.0.tgz", + "path_to_mappings": "helm-charts/nfconfigchart/nfconfigchartvalues.mappings.yaml", + "depends_on": [ + ] + } + ] +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_chart.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_chart.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_config_file.json b/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_config_file.json new file mode 100644 index 00000000000..6f2372284bc --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_config_file.json @@ -0,0 +1,16 @@ +{ + "publisher_name": "test_cnf_publisher", + "publisher_resource_group_name": "test_cnf_publisher_rg", + "nf_name": "test_cnf_nf", + "version": "1.0.0", + "acr_artifact_store_name": "test_cnf_acr", + "location": "uksouth", + "helm_packages": [ + { + "name": "invalid-package", + "path_to_chart": "src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_chart.yaml", + "path_to_mappings":"src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_mappings.yaml", + "depends_on": [] + } + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_mappings.yaml b/src/aosm/azext_aosm/tests/latest/mock_cnf/invalid_mappings.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/aosm/azext_aosm/tests/latest/mock_cnf/valid_chart.tgz b/src/aosm/azext_aosm/tests/latest/mock_cnf/valid_chart.tgz new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/aosm/azext_aosm/tests/latest/mock_nsd/input.json b/src/aosm/azext_aosm/tests/latest/mock_nsd/input.json new file mode 100644 index 00000000000..81d0247e8ea --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_nsd/input.json @@ -0,0 +1,20 @@ +{ + "location": "eastus", + "publisher_name": "jamie-mobile-publisher", + "publisher_resource_group_name": "Jamie-publisher", + "acr_artifact_store_name": "ubuntu-acr", + "network_functions": [ + { + "name": "ubuntu-vm-nfdg", + "version": "1.0.0", + "publisher_offering_location": "eastus", + "type": "vnf", + "multiple_instances": false, + "publisher": "jamie-mobile-publisher", + "publisher_resource_group": "Jamie-publisher" + } + ], + "nsdg_name": "ubuntu", + "nsd_version": "1.0.0", + "nsdv_description": "Plain ubuntu VM" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multi_nf_nsd.json b/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multi_nf_nsd.json new file mode 100644 index 00000000000..6286059d0fe --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multi_nf_nsd.json @@ -0,0 +1,29 @@ +{ + "publisher_name": "jamie-publisher", + "publisher_resource_group_name": "Jamie-multi-NF", + "acr_artifact_store_name": "acr", + "location": "eastus", + "network_functions": [ + { + "publisher": "reference-publisher", + "publisher_resource_group": "Reference-publisher", + "name": "nginx-nfdg", + "version": "1.0.0", + "publisher_offering_location": "eastus", + "type": "cnf", + "multiple_instances": false + }, + { + "publisher": "reference-publisher", + "publisher_resource_group": "Reference-publisher", + "name": "ubuntu-nfdg", + "version": "1.0.0", + "publisher_offering_location": "eastus", + "type": "vnf", + "multiple_instances": false + } + ], + "nsdg_name": "multinf", + "nsd_version": "1.0.1", + "nsdv_description": "Test deploying multiple NFs" +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multiple_instances.json b/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multiple_instances.json new file mode 100644 index 00000000000..40289d8f8df --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_nsd/input_multiple_instances.json @@ -0,0 +1,20 @@ +{ + "location": "eastus", + "publisher_name": "jamie-mobile-publisher", + "publisher_resource_group_name": "Jamie-publisher", + "acr_artifact_store_name": "ubuntu-acr", + "network_functions": [ + { + "name": "ubuntu-vm-nfdg", + "version": "1.0.0", + "publisher_offering_location": "eastus", + "type": "vnf", + "multiple_instances": true, + "publisher": "jamie-mobile-publisher", + "publisher_resource_group": "Jamie-publisher" + } + ], + "nsdg_name": "ubuntu", + "nsd_version": "1.0.0", + "nsdv_description": "Plain ubuntu VM" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_fp.json b/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_fp.json new file mode 100644 index 00000000000..b3a3b991a1d --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_fp.json @@ -0,0 +1,18 @@ +{ + "publisher_name": "jamie-mobile-publisher", + "publisher_resource_group_name": "Jamie-publisher", + "nf_name": "ubuntu-vm", + "version": "1.0.0", + "acr_artifact_store_name": "ubuntu-acr", + "location": "eastus", + "blob_artifact_store_name": "ubuntu-blob-store", + "image_name_parameter": "imageName", + "arm_template": { + "file_path": "ubuntu-template.json", + "version": "1.0.0" + }, + "vhd": { + "file_path": "livecd.ubuntu-cpc.azure.vhd", + "version": "1-0-0" + } +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_sas.json b/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_sas.json new file mode 100644 index 00000000000..2a959add126 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_sas.json @@ -0,0 +1,18 @@ +{ + "publisher_name": "jamie-mobile-publisher", + "publisher_resource_group_name": "Jamie-publisher", + "nf_name": "ubuntu-vm", + "version": "1.0.0", + "acr_artifact_store_name": "ubuntu-acr", + "location": "eastus", + "blob_artifact_store_name": "ubuntu-blob-store", + "image_name_parameter": "imageName", + "arm_template": { + "file_path": "ubuntu-template.json", + "version": "1.0.0" + }, + "vhd": { + "blob_sas_url": "https://a/dummy/sas-url", + "version": "1-0-0" + } +} diff --git a/src/aosm/azext_aosm/tests/latest/mock_vnf/ubuntu-template.json b/src/aosm/azext_aosm/tests/latest/mock_vnf/ubuntu-template.json new file mode 100644 index 00000000000..378927a3fe5 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_vnf/ubuntu-template.json @@ -0,0 +1,118 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.15.31.15270", + "templateHash": "1656082395923655778" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "subnetName": { + "type": "string" + }, + "ubuntuVmName": { + "type": "string", + "defaultValue": "ubuntu-vm" + }, + "virtualNetworkId": { + "type": "string" + }, + "sshPublicKeyAdmin": { + "type": "string" + }, + "imageName": { + "type": "string" + } + }, + "variables": { + "imageResourceGroup": "[resourceGroup().name]", + "subscriptionId": "[subscription().subscriptionId]", + "vmSizeSku": "Standard_D2s_v3" + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2021-05-01", + "name": "[format('{0}_nic', parameters('ubuntuVmName'))]", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[format('{0}/subnets/{1}', parameters('virtualNetworkId'), parameters('subnetName'))]" + }, + "primary": true, + "privateIPAddressVersion": "IPv4" + } + } + ] + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2021-07-01", + "name": "[parameters('ubuntuVmName')]", + "location": "[parameters('location')]", + "properties": { + "hardwareProfile": { + "vmSize": "[variables('vmSizeSku')]" + }, + "storageProfile": { + "imageReference": { + "id": "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('subscriptionId'), variables('imageResourceGroup')), 'Microsoft.Compute/images', parameters('imageName'))]" + }, + "osDisk": { + "osType": "Linux", + "name": "[format('{0}_disk', parameters('ubuntuVmName'))]", + "createOption": "FromImage", + "caching": "ReadWrite", + "writeAcceleratorEnabled": false, + "managedDisk": "[json('{\"storageAccountType\": \"Premium_LRS\"}')]", + "deleteOption": "Delete", + "diskSizeGB": 30 + } + }, + "osProfile": { + "computerName": "[parameters('ubuntuVmName')]", + "adminUsername": "azureuser", + "linuxConfiguration": { + "disablePasswordAuthentication": true, + "ssh": { + "publicKeys": [ + { + "path": "/home/azureuser/.ssh/authorized_keys", + "keyData": "[parameters('sshPublicKeyAdmin')]" + } + ] + }, + "provisionVMAgent": true, + "patchSettings": { + "patchMode": "ImageDefault", + "assessmentMode": "ImageDefault" + } + }, + "secrets": [], + "allowExtensionOperations": true + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}_nic', parameters('ubuntuVmName')))]" + } + ] + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', format('{0}_nic', parameters('ubuntuVmName')))]" + ] + } + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/artifact_manifest.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/artifact_manifest.bicep new file mode 100644 index 00000000000..3192c4ce035 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/artifact_manifest.bicep @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an Artifact Manifest for a NSD +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestNames array +@description('The name under which to store the ARM template') +param armTemplateNames array +@description('The version that you want to name the NFM template artifact, in format A.B.C. e.g. 6.13.0. If testing for development, you can use any numbers you like.') +param armTemplateVersion string + +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +resource acrArtifactManifests 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = [for (values, i) in armTemplateNames: { + parent: acrArtifactStore + name: acrManifestNames[i] + location: location + properties: { + artifacts: [ + { + artifactName: armTemplateNames[i] + artifactType: 'ArmTemplate' + artifactVersion: armTemplateVersion + } + ] + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/configMappings/ubuntu-vm-nfdg_config_mapping.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/configMappings/ubuntu-vm-nfdg_config_mapping.json new file mode 100644 index 00000000000..2361fbd1490 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/configMappings/ubuntu-vm-nfdg_config_mapping.json @@ -0,0 +1,7 @@ +{ + "deploymentParameters": [ + "{configurationparameters('ubuntu_ConfigGroupSchema').ubuntu-vm-nfdg.deploymentParameters}" + ], + "ubuntu_vm_nfdg_nfd_version": "{configurationparameters('ubuntu_ConfigGroupSchema').ubuntu-vm-nfdg.ubuntu_vm_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters('ubuntu_ConfigGroupSchema').managedIdentity}" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/nsd_definition.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/nsd_definition.bicep new file mode 100644 index 00000000000..8969b671381 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/nsd_definition.bicep @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// Bicep template to create an Artifact Manifest, Config Group Schema and NSDV. +// +// Requires an existing NFDV from which the values will be populated. + +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Network Service Design Group') +param nsDesignGroup string +@description('The version of the NSDV you want to create, in format A.B.C') +param nsDesignVersion string +@description('Name of the nfvi site') +param nfviSiteName string = 'ubuntu_NFVI' + +// The publisher resource is the top level AOSM resource under which all other designer resources +// are created. +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// The artifact store is the resource in which all the artifacts required to deploy the NF are stored. +// The artifact store is created by the az aosm CLI before this template is deployed. +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created up-front, the NSD Group is the parent resource under which all NSD versions will be created. +resource nsdGroup 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups@2023-04-01-preview' existing = { + parent: publisher + name: nsDesignGroup +} + +// The configuration group schema defines the configuration required to deploy the NSD. The NSD references this object in the +// `configurationgroupsSchemaReferences` and references the values in the schema in the `parameterValues`. +// The operator will create a config group values object that will satisfy this schema. +resource cgSchema 'Microsoft.Hybridnetwork/publishers/configurationGroupSchemas@2023-04-01-preview' = { + parent: publisher + name: 'ubuntu_ConfigGroupSchema' + location: location + properties: { + schemaDefinition: string(loadJsonContent('schemas/ubuntu_ConfigGroupSchema.json')) + } +} + +// The NSD version +resource nsdVersion 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions@2023-04-01-preview' = { + parent: nsdGroup + name: nsDesignVersion + location: location + properties: { + description: 'Plain ubuntu VM' + // The version state can be Preview, Active or Deprecated. + // Once in an Active state, the NSDV becomes immutable. + versionState: 'Preview' + // The `configurationgroupsSchemaReferences` field contains references to the schemas required to + // be filled out to configure this NSD. + configurationGroupSchemaReferences: { + ubuntu_ConfigGroupSchema: { + id: cgSchema.id + } + } + // This details the NFVIs that should be available in the Site object created by the operator. + nfvisFromSite: { + nfvi1: { + name: nfviSiteName + type: 'AzureCore' + } + } + // This field lists the templates that will be deployed by AOSM and the config mappings + // to the values in the CG schemas. + resourceElementTemplates: [ + { + name: 'ubuntu-vm-nfdg_nf_artifact_resource_element' + // The type of resource element can be ArmResourceDefinition, ConfigurationDefinition or NetworkFunctionDefinition. + type: 'NetworkFunctionDefinition' + // The configuration object may be different for different types of resource element. + configuration: { + // This field points AOSM at the artifact in the artifact store. + artifactProfile: { + artifactStoreReference: { + id: acrArtifactStore.id + } + artifactName: 'ubuntu-vm-nfdg_nf_artifact' + artifactVersion: '1.0.0' + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + parameterValues: string(loadJsonContent('configMappings/ubuntu-vm-nfdg_config_mapping.json')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } + ] + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/schemas/ubuntu_ConfigGroupSchema.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/schemas/ubuntu_ConfigGroupSchema.json new file mode 100644 index 00000000000..287fa0a6106 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/schemas/ubuntu_ConfigGroupSchema.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "ubuntu_ConfigGroupSchema", + "type": "object", + "properties": { + "ubuntu-vm-nfdg": { + "type": "object", + "properties": { + "deploymentParameters": { + "type": "object", + "properties": { + "location": { + "type": "string" + }, + "subnetName": { + "type": "string" + }, + "virtualNetworkId": { + "type": "string" + }, + "sshPublicKeyAdmin": { + "type": "string" + } + } + }, + "ubuntu_vm_nfdg_nfd_version": { + "type": "string", + "description": "The version of the ubuntu-vm-nfdg NFD to use. This version must be compatible with (have the same parameters exposed as) ubuntu-vm-nfdg." + } + }, + "required": [ + "deploymentParameters", + "ubuntu_vm_nfdg_nfd_version" + ] + }, + "managedIdentity": { + "type": "string", + "description": "The managed identity to use to deploy NFs within this SNS. This should be of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. If you wish to use a system assigned identity, set this to a blank string." + } + }, + "required": [ + "ubuntu-vm-nfdg", + "managedIdentity" + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/ubuntu-vm-nfdg_nf.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/ubuntu-vm-nfdg_nf.bicep new file mode 100644 index 00000000000..50f2db8e097 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build/ubuntu-vm-nfdg_nf.bicep @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// The template that the NSD invokes to create the Network Function from a published NFDV. + +@description('Publisher where the NFD is published') +param publisherName string = 'jamie-mobile-publisher' + +@description('NFD Group name for the Network Function') +param networkFunctionDefinitionGroupName string = 'ubuntu-vm-nfdg' + +@description('NFD version') +param ubuntu_vm_nfdg_nfd_version string + +@description('Offering location for the Network Function') +param networkFunctionDefinitionOfferingLocation string = 'eastus' + +@description('The managed identity that should be used to create the NF.') +param managedIdentity string + +param location string = 'eastus' + +param nfviType string = 'AzureCore' + +param resourceGroupId string = resourceGroup().id + +param deploymentParameters array + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = [for (values, i) in deploymentParameters: { + name: 'ubuntu-vm-nfdg${i}' + location: location + identity: identityObject + properties: { + publisherName: publisherName + publisherScope: 'Private' + networkFunctionDefinitionGroupName: networkFunctionDefinitionGroupName + networkFunctionDefinitionVersion: ubuntu_vm_nfdg_nfd_version + networkFunctionDefinitionOfferingLocation: networkFunctionDefinitionOfferingLocation + nfviType: nfviType + nfviId: resourceGroupId + allowSoftwareUpdate: true + deploymentValues: string(values) + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/artifact_manifest.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/artifact_manifest.bicep new file mode 100644 index 00000000000..3192c4ce035 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/artifact_manifest.bicep @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an Artifact Manifest for a NSD +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestNames array +@description('The name under which to store the ARM template') +param armTemplateNames array +@description('The version that you want to name the NFM template artifact, in format A.B.C. e.g. 6.13.0. If testing for development, you can use any numbers you like.') +param armTemplateVersion string + +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +resource acrArtifactManifests 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = [for (values, i) in armTemplateNames: { + parent: acrArtifactStore + name: acrManifestNames[i] + location: location + properties: { + artifacts: [ + { + artifactName: armTemplateNames[i] + artifactType: 'ArmTemplate' + artifactVersion: armTemplateVersion + } + ] + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/configMappings/ubuntu-vm-nfdg_config_mapping.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/configMappings/ubuntu-vm-nfdg_config_mapping.json new file mode 100644 index 00000000000..3da468b8b29 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/configMappings/ubuntu-vm-nfdg_config_mapping.json @@ -0,0 +1,5 @@ +{ + "deploymentParameters": "{configurationparameters('ubuntu_ConfigGroupSchema').ubuntu-vm-nfdg.deploymentParameters}", + "ubuntu_vm_nfdg_nfd_version": "{configurationparameters('ubuntu_ConfigGroupSchema').ubuntu-vm-nfdg.ubuntu_vm_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters('ubuntu_ConfigGroupSchema').managedIdentity}" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/nsd_definition.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/nsd_definition.bicep new file mode 100644 index 00000000000..8969b671381 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/nsd_definition.bicep @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// Bicep template to create an Artifact Manifest, Config Group Schema and NSDV. +// +// Requires an existing NFDV from which the values will be populated. + +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Network Service Design Group') +param nsDesignGroup string +@description('The version of the NSDV you want to create, in format A.B.C') +param nsDesignVersion string +@description('Name of the nfvi site') +param nfviSiteName string = 'ubuntu_NFVI' + +// The publisher resource is the top level AOSM resource under which all other designer resources +// are created. +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// The artifact store is the resource in which all the artifacts required to deploy the NF are stored. +// The artifact store is created by the az aosm CLI before this template is deployed. +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created up-front, the NSD Group is the parent resource under which all NSD versions will be created. +resource nsdGroup 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups@2023-04-01-preview' existing = { + parent: publisher + name: nsDesignGroup +} + +// The configuration group schema defines the configuration required to deploy the NSD. The NSD references this object in the +// `configurationgroupsSchemaReferences` and references the values in the schema in the `parameterValues`. +// The operator will create a config group values object that will satisfy this schema. +resource cgSchema 'Microsoft.Hybridnetwork/publishers/configurationGroupSchemas@2023-04-01-preview' = { + parent: publisher + name: 'ubuntu_ConfigGroupSchema' + location: location + properties: { + schemaDefinition: string(loadJsonContent('schemas/ubuntu_ConfigGroupSchema.json')) + } +} + +// The NSD version +resource nsdVersion 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions@2023-04-01-preview' = { + parent: nsdGroup + name: nsDesignVersion + location: location + properties: { + description: 'Plain ubuntu VM' + // The version state can be Preview, Active or Deprecated. + // Once in an Active state, the NSDV becomes immutable. + versionState: 'Preview' + // The `configurationgroupsSchemaReferences` field contains references to the schemas required to + // be filled out to configure this NSD. + configurationGroupSchemaReferences: { + ubuntu_ConfigGroupSchema: { + id: cgSchema.id + } + } + // This details the NFVIs that should be available in the Site object created by the operator. + nfvisFromSite: { + nfvi1: { + name: nfviSiteName + type: 'AzureCore' + } + } + // This field lists the templates that will be deployed by AOSM and the config mappings + // to the values in the CG schemas. + resourceElementTemplates: [ + { + name: 'ubuntu-vm-nfdg_nf_artifact_resource_element' + // The type of resource element can be ArmResourceDefinition, ConfigurationDefinition or NetworkFunctionDefinition. + type: 'NetworkFunctionDefinition' + // The configuration object may be different for different types of resource element. + configuration: { + // This field points AOSM at the artifact in the artifact store. + artifactProfile: { + artifactStoreReference: { + id: acrArtifactStore.id + } + artifactName: 'ubuntu-vm-nfdg_nf_artifact' + artifactVersion: '1.0.0' + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + parameterValues: string(loadJsonContent('configMappings/ubuntu-vm-nfdg_config_mapping.json')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } + ] + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/schemas/ubuntu_ConfigGroupSchema.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/schemas/ubuntu_ConfigGroupSchema.json new file mode 100644 index 00000000000..5393c2ba01f --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/schemas/ubuntu_ConfigGroupSchema.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "ubuntu_ConfigGroupSchema", + "type": "object", + "properties": { + "ubuntu-vm-nfdg": { + "type": "object", + "properties": { + "deploymentParameters": { + "type": "array", + "items": { + "type": "object", + "properties": { + "location": { + "type": "string" + }, + "subnetName": { + "type": "string" + }, + "virtualNetworkId": { + "type": "string" + }, + "sshPublicKeyAdmin": { + "type": "string" + } + } + } + }, + "ubuntu_vm_nfdg_nfd_version": { + "type": "string", + "description": "The version of the ubuntu-vm-nfdg NFD to use. This version must be compatible with (have the same parameters exposed as) ubuntu-vm-nfdg." + } + }, + "required": [ + "deploymentParameters", + "ubuntu_vm_nfdg_nfd_version" + ] + }, + "managedIdentity": { + "type": "string", + "description": "The managed identity to use to deploy NFs within this SNS. This should be of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. If you wish to use a system assigned identity, set this to a blank string." + } + }, + "required": [ + "ubuntu-vm-nfdg", + "managedIdentity" + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/ubuntu-vm-nfdg_nf.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/ubuntu-vm-nfdg_nf.bicep new file mode 100644 index 00000000000..50f2db8e097 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_instances/ubuntu-vm-nfdg_nf.bicep @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// The template that the NSD invokes to create the Network Function from a published NFDV. + +@description('Publisher where the NFD is published') +param publisherName string = 'jamie-mobile-publisher' + +@description('NFD Group name for the Network Function') +param networkFunctionDefinitionGroupName string = 'ubuntu-vm-nfdg' + +@description('NFD version') +param ubuntu_vm_nfdg_nfd_version string + +@description('Offering location for the Network Function') +param networkFunctionDefinitionOfferingLocation string = 'eastus' + +@description('The managed identity that should be used to create the NF.') +param managedIdentity string + +param location string = 'eastus' + +param nfviType string = 'AzureCore' + +param resourceGroupId string = resourceGroup().id + +param deploymentParameters array + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = [for (values, i) in deploymentParameters: { + name: 'ubuntu-vm-nfdg${i}' + location: location + identity: identityObject + properties: { + publisherName: publisherName + publisherScope: 'Private' + networkFunctionDefinitionGroupName: networkFunctionDefinitionGroupName + networkFunctionDefinitionVersion: ubuntu_vm_nfdg_nfd_version + networkFunctionDefinitionOfferingLocation: networkFunctionDefinitionOfferingLocation + nfviType: nfviType + nfviId: resourceGroupId + allowSoftwareUpdate: true + deploymentValues: string(values) + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/artifact_manifest.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/artifact_manifest.bicep new file mode 100644 index 00000000000..3192c4ce035 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/artifact_manifest.bicep @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. + +// This file creates an Artifact Manifest for a NSD +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of the manifest to deploy for the ACR-backed Artifact Store') +param acrManifestNames array +@description('The name under which to store the ARM template') +param armTemplateNames array +@description('The version that you want to name the NFM template artifact, in format A.B.C. e.g. 6.13.0. If testing for development, you can use any numbers you like.') +param armTemplateVersion string + +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +resource acrArtifactManifests 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = [for (values, i) in armTemplateNames: { + parent: acrArtifactStore + name: acrManifestNames[i] + location: location + properties: { + artifacts: [ + { + artifactName: armTemplateNames[i] + artifactType: 'ArmTemplate' + artifactVersion: armTemplateVersion + } + ] + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/nginx-nfdg_config_mapping.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/nginx-nfdg_config_mapping.json new file mode 100644 index 00000000000..615db31757f --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/nginx-nfdg_config_mapping.json @@ -0,0 +1,8 @@ +{ + "deploymentParameters": [ + "{configurationparameters('multinf_ConfigGroupSchema').nginx-nfdg.deploymentParameters}" + ], + "nginx_nfdg_nfd_version": "{configurationparameters('multinf_ConfigGroupSchema').nginx-nfdg.nginx_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters('multinf_ConfigGroupSchema').managedIdentity}", + "customLocationId": "{configurationparameters('multinf_ConfigGroupSchema').nginx-nfdg.customLocationId}" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/ubuntu-nfdg_config_mapping.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/ubuntu-nfdg_config_mapping.json new file mode 100644 index 00000000000..0d21991ea43 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/configMappings/ubuntu-nfdg_config_mapping.json @@ -0,0 +1,7 @@ +{ + "deploymentParameters": [ + "{configurationparameters('multinf_ConfigGroupSchema').ubuntu-nfdg.deploymentParameters}" + ], + "ubuntu_nfdg_nfd_version": "{configurationparameters('multinf_ConfigGroupSchema').ubuntu-nfdg.ubuntu_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters('multinf_ConfigGroupSchema').managedIdentity}" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nginx-nfdg_nf.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nginx-nfdg_nf.bicep new file mode 100644 index 00000000000..621e3fc6222 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nginx-nfdg_nf.bicep @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// The template that the NSD invokes to create the Network Function from a published NFDV. + +@description('Publisher where the NFD is published') +param publisherName string = 'reference-publisher' + +@description('NFD Group name for the Network Function') +param networkFunctionDefinitionGroupName string = 'nginx-nfdg' + +@description('NFD version') +param nginx_nfdg_nfd_version string + +@description('Offering location for the Network Function') +param networkFunctionDefinitionOfferingLocation string = 'eastus' + +@description('The managed identity that should be used to create the NF.') +param managedIdentity string +@description('The custom location of the ARC-enabled AKS cluster to create the NF.') +param customLocationId string + +param location string = 'eastus' + +param nfviType string = 'AzureArcKubernetes' + +param resourceGroupId string = resourceGroup().id + +param deploymentParameters array + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = [for (values, i) in deploymentParameters: { + name: 'nginx-nfdg${i}' + location: location + identity: identityObject + properties: { + publisherName: publisherName + publisherScope: 'Private' + networkFunctionDefinitionGroupName: networkFunctionDefinitionGroupName + networkFunctionDefinitionVersion: nginx_nfdg_nfd_version + networkFunctionDefinitionOfferingLocation: networkFunctionDefinitionOfferingLocation + nfviType: nfviType + nfviId: customLocationId + allowSoftwareUpdate: true + deploymentValues: string(values) + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nsd_definition.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nsd_definition.bicep new file mode 100644 index 00000000000..e40f9b8dd73 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/nsd_definition.bicep @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// Bicep template to create an Artifact Manifest, Config Group Schema and NSDV. +// +// Requires an existing NFDV from which the values will be populated. + +param location string +@description('Name of an existing publisher, expected to be in the resource group where you deploy the template') +param publisherName string +@description('Name of an existing ACR-backed Artifact Store, deployed under the publisher.') +param acrArtifactStoreName string +@description('Name of an existing Network Service Design Group') +param nsDesignGroup string +@description('The version of the NSDV you want to create, in format A.B.C') +param nsDesignVersion string +@description('Name of the nfvi site') +param nfviSiteName string = 'multinf_NFVI' + +// The publisher resource is the top level AOSM resource under which all other designer resources +// are created. +resource publisher 'Microsoft.HybridNetwork/publishers@2023-04-01-preview' existing = { + name: publisherName + scope: resourceGroup() +} + +// The artifact store is the resource in which all the artifacts required to deploy the NF are stored. +// The artifact store is created by the az aosm CLI before this template is deployed. +resource acrArtifactStore 'Microsoft.HybridNetwork/publishers/artifactStores@2023-04-01-preview' existing = { + parent: publisher + name: acrArtifactStoreName +} + +// Created up-front, the NSD Group is the parent resource under which all NSD versions will be created. +resource nsdGroup 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups@2023-04-01-preview' existing = { + parent: publisher + name: nsDesignGroup +} + +// The configuration group schema defines the configuration required to deploy the NSD. The NSD references this object in the +// `configurationgroupsSchemaReferences` and references the values in the schema in the `parameterValues`. +// The operator will create a config group values object that will satisfy this schema. +resource cgSchema 'Microsoft.Hybridnetwork/publishers/configurationGroupSchemas@2023-04-01-preview' = { + parent: publisher + name: 'multinf_ConfigGroupSchema' + location: location + properties: { + schemaDefinition: string(loadJsonContent('schemas/multinf_ConfigGroupSchema.json')) + } +} + +// The NSD version +resource nsdVersion 'Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions@2023-04-01-preview' = { + parent: nsdGroup + name: nsDesignVersion + location: location + properties: { + description: 'Test deploying multiple NFs' + // The version state can be Preview, Active or Deprecated. + // Once in an Active state, the NSDV becomes immutable. + versionState: 'Preview' + // The `configurationgroupsSchemaReferences` field contains references to the schemas required to + // be filled out to configure this NSD. + configurationGroupSchemaReferences: { + multinf_ConfigGroupSchema: { + id: cgSchema.id + } + } + // This details the NFVIs that should be available in the Site object created by the operator. + nfvisFromSite: { + nfvi1: { + name: nfviSiteName + type: 'AzureCore' + } + } + // This field lists the templates that will be deployed by AOSM and the config mappings + // to the values in the CG schemas. + resourceElementTemplates: [ + { + name: 'nginx-nfdg_nf_artifact_resource_element' + // The type of resource element can be ArmResourceDefinition, ConfigurationDefinition or NetworkFunctionDefinition. + type: 'NetworkFunctionDefinition' + // The configuration object may be different for different types of resource element. + configuration: { + // This field points AOSM at the artifact in the artifact store. + artifactProfile: { + artifactStoreReference: { + id: acrArtifactStore.id + } + artifactName: 'nginx-nfdg_nf_artifact' + artifactVersion: '1.0.1' + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + parameterValues: string(loadJsonContent('configMappings/nginx-nfdg_config_mapping.json')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } + { + name: 'ubuntu-nfdg_nf_artifact_resource_element' + // The type of resource element can be ArmResourceDefinition, ConfigurationDefinition or NetworkFunctionDefinition. + type: 'NetworkFunctionDefinition' + // The configuration object may be different for different types of resource element. + configuration: { + // This field points AOSM at the artifact in the artifact store. + artifactProfile: { + artifactStoreReference: { + id: acrArtifactStore.id + } + artifactName: 'ubuntu-nfdg_nf_artifact' + artifactVersion: '1.0.1' + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + parameterValues: string(loadJsonContent('configMappings/ubuntu-nfdg_config_mapping.json')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } + ] + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/schemas/multinf_ConfigGroupSchema.json b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/schemas/multinf_ConfigGroupSchema.json new file mode 100644 index 00000000000..1d120f6c538 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/schemas/multinf_ConfigGroupSchema.json @@ -0,0 +1,75 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "multinf_ConfigGroupSchema", + "type": "object", + "properties": { + "nginx-nfdg": { + "type": "object", + "properties": { + "deploymentParameters": { + "type": "object", + "properties": { + "serviceAccount_create": { + "type": "boolean" + }, + "service_port": { + "type": "integer" + } + } + }, + "nginx_nfdg_nfd_version": { + "type": "string", + "description": "The version of the nginx-nfdg NFD to use. This version must be compatible with (have the same parameters exposed as) nginx-nfdg." + }, + "customLocationId": { + "type": "string", + "description": "The custom location ID of the ARC-Enabled AKS Cluster to deploy the CNF to. Should be of the form '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}'" + } + }, + "required": [ + "deploymentParameters", + "nginx_nfdg_nfd_version", + "customLocationId" + ] + }, + "ubuntu-nfdg": { + "type": "object", + "properties": { + "deploymentParameters": { + "type": "object", + "properties": { + "location": { + "type": "string" + }, + "subnetName": { + "type": "string" + }, + "virtualNetworkId": { + "type": "string" + }, + "sshPublicKeyAdmin": { + "type": "string" + } + } + }, + "ubuntu_nfdg_nfd_version": { + "type": "string", + "description": "The version of the ubuntu-nfdg NFD to use. This version must be compatible with (have the same parameters exposed as) ubuntu-nfdg." + } + }, + "required": [ + "deploymentParameters", + "ubuntu_nfdg_nfd_version" + ] + }, + "managedIdentity": { + "type": "string", + "description": "The managed identity to use to deploy NFs within this SNS. This should be of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. If you wish to use a system assigned identity, set this to a blank string." + } + }, + "required": [ + "nginx-nfdg", + "ubuntu-nfdg", + "managedIdentity" + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/ubuntu-nfdg_nf.bicep b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/ubuntu-nfdg_nf.bicep new file mode 100644 index 00000000000..e3baa6eff89 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/nsd_output/test_build_multiple_nfs/ubuntu-nfdg_nf.bicep @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Highly Confidential Material +// +// The template that the NSD invokes to create the Network Function from a published NFDV. + +@description('Publisher where the NFD is published') +param publisherName string = 'reference-publisher' + +@description('NFD Group name for the Network Function') +param networkFunctionDefinitionGroupName string = 'ubuntu-nfdg' + +@description('NFD version') +param ubuntu_nfdg_nfd_version string + +@description('Offering location for the Network Function') +param networkFunctionDefinitionOfferingLocation string = 'eastus' + +@description('The managed identity that should be used to create the NF.') +param managedIdentity string + +param location string = 'eastus' + +param nfviType string = 'AzureCore' + +param resourceGroupId string = resourceGroup().id + +param deploymentParameters array + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = [for (values, i) in deploymentParameters: { + name: 'ubuntu-nfdg${i}' + location: location + identity: identityObject + properties: { + publisherName: publisherName + publisherScope: 'Private' + networkFunctionDefinitionGroupName: networkFunctionDefinitionGroupName + networkFunctionDefinitionVersion: ubuntu_nfdg_nfd_version + networkFunctionDefinitionOfferingLocation: networkFunctionDefinitionOfferingLocation + nfviType: nfviType + nfviId: resourceGroupId + allowSoftwareUpdate: true + deploymentValues: string(values) + } +}] \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/recording_processors.py b/src/aosm/azext_aosm/tests/latest/recording_processors.py new file mode 100644 index 00000000000..3bb693f104d --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/recording_processors.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# This file contains recording processors which are used to modify the testing recordings +# before they are saved to file. This is useful for removing sensitive information from +# the recordings so that we can avoid checking in secrets to the repo. +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk.scenario_tests import ( + RecordingProcessor +) +from azure.cli.testsdk.scenario_tests.utilities import is_text_payload +import json +import re + +MOCK_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +MOCK_SAS_URI = "https://xxxxxxxxxxxxxxx.blob.core.windows.net" +MOCK_STORAGE_ACCOUNT_SR = "&si=StorageAccountAccessPolicy&sr=xxxxxxxxxxxxxxxxxxxx" +BLOB_STORE_URI_REGEX = r"https:\/\/[a-zA-Z0-9]+\.blob\.core\.windows\.net" +STORAGE_ACCOUNT_SR_REGEX = r"&si=StorageAccountAccessPolicy&sr=.*" + + +class TokenReplacer(RecordingProcessor): + def process_response(self, response): + ACR_TOKEN = "acrToken" + ACCESS_TOKEN = "access_token" + if is_text_payload(response) and response["body"]["string"]: + try: + response_body = json.loads(response["body"]["string"]) + if ACR_TOKEN in response_body: + response_body[ACR_TOKEN] = MOCK_TOKEN + if ACCESS_TOKEN in response_body: + response_body[ACCESS_TOKEN] = MOCK_TOKEN + response["body"]["string"] = json.dumps(response_body) + except TypeError: + pass + return response + + +class SasUriReplacer(RecordingProcessor): + def process_response(self, response): + CONTAINER_CREDENTIALS = "containerCredentials" + CONTAINER_SAS_URI = "containerSasUri" + if not (is_text_payload(response) and response["body"]["string"]): + return response + + response_body = json.loads(response["body"]["string"]) + try: + if CONTAINER_CREDENTIALS not in response_body: + return response + + credentials_list = response_body[CONTAINER_CREDENTIALS] + new_credentials_list = [] + + for credential in credentials_list: + if CONTAINER_SAS_URI in credential: + credential[CONTAINER_SAS_URI] = re.sub(BLOB_STORE_URI_REGEX, MOCK_SAS_URI, credential[CONTAINER_SAS_URI]) + credential[CONTAINER_SAS_URI] = re.sub(STORAGE_ACCOUNT_SR_REGEX, MOCK_STORAGE_ACCOUNT_SR, credential[CONTAINER_SAS_URI]) + new_credentials_list.append(credential) + + response_body[CONTAINER_CREDENTIALS] = new_credentials_list + response["body"]["string"] = json.dumps(response_body) + except TypeError: + pass + + return response + + +class BlobStoreUriReplacer(RecordingProcessor): + def process_request(self, request): + try: + request.uri = re.sub(BLOB_STORE_URI_REGEX, MOCK_SAS_URI, request.uri) + request.uri = re.sub(STORAGE_ACCOUNT_SR_REGEX, MOCK_STORAGE_ACCOUNT_SR, request.uri) + + except TypeError: + pass + + return request diff --git a/src/aosm/azext_aosm/tests/latest/recordings/test_vnf_nsd_publish_and_delete.yaml b/src/aosm/azext_aosm/tests/latest/recordings/test_vnf_nsd_publish_and_delete.yaml new file mode 100644 index 00000000000..324e03bf383 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/recordings/test_vnf_nsd_publish_and_delete.yaml @@ -0,0 +1,8762 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: HEAD + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001?api-version=2022-09-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:19:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 47E94584D2F04C52B83D750FA4107B96 Ref B: AMS231020512029 Ref C: 2023-08-23T13:19:15Z' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001", + "name": "cli_test_vnf_nsd_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westcentralus", "tags": {"product": "azurecli", "cause": "automation", + "test": "test_vnf_nsd_publish_and_delete", "date": "2023-08-23T13:19:14Z", + "module": "aosm", "autoDelete": "true", "expiresOn": "2023-09-22T13:19:14.2401943Z"}, + "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '476' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:19:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 165A93170C784E26BAF8C69BC3EDEC49 Ref B: AMS231020512029 Ref C: 2023-08-23T13:19:16Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '249' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:19:16 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: 5A8A9616ACC141D7921D357ADA9D69BF Ref B: AMS231032609047 Ref C: 2023-08-23T13:19:16Z' + status: + code: 404 + message: Not Found +- request: + body: '{"location": "westcentralus", "properties": {"scope": "Private"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '65' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "name": "ubuntuPublisher", "type": "microsoft.hybridnetwork/publishers", "location": + "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:19:17.7479447Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:19:17.7479447Z"}, "properties": {"scope": "Private", "provisioningState": + "Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '587' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:19:18 GMT + etag: + - '"1e00e92c-0000-0600-0000-64e607570000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 54228E2713A946538D01F066A1A648EC Ref B: AMS231032609047 Ref C: 2023-08-23T13:19:16Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Accepted", "startTime": "2023-08-23T13:19:18.9911121Z"}' + headers: + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:19:19 GMT + etag: + - '"63003db8-0000-0600-0000-64e607560000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 4E1E771E62DF45B8BCC89B7C0249FCE4 Ref B: AMS231032609047 Ref C: 2023-08-23T13:19:19Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Accepted", "startTime": "2023-08-23T13:19:18.9911121Z"}' + headers: + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:19:50 GMT + etag: + - '"63003db8-0000-0600-0000-64e607560000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 253C358E9D6D4ED8B104BC20A2EB51E1 Ref B: AMS231032609047 Ref C: 2023-08-23T13:19:50Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Accepted", "startTime": "2023-08-23T13:19:18.9911121Z"}' + headers: + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:20 GMT + etag: + - '"63003db8-0000-0600-0000-64e607560000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 120EC304C4B245ACA80B6341D1B93BDA Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:20Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "5c23e65f-0f2e-485e-91e4-e5addf9c6c02*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Succeeded", "startTime": "2023-08-23T13:19:18.9911121Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:51 GMT + etag: + - '"630043b8-0000-0600-0000-64e607990000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 63F455ADC3224D05A3DD5E242BFFFB62 Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:51Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "name": "ubuntuPublisher", "type": "microsoft.hybridnetwork/publishers", "location": + "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:19:17.7479447Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:19:17.7479447Z"}, "properties": {"scope": "Private", "provisioningState": + "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '588' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:52 GMT + etag: + - '"1e00f42c-0000-0600-0000-64e607600000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: D37F72198734406BAB09D43C68B07AAB Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:51Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '275' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:52 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: 929943BEAF99489DA777422416259AE1 Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:52Z' + status: + code: 404 + message: Not Found +- request: + body: '{"location": "westcentralus", "properties": {"storeType": "AzureContainerRegistry"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '84' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "name": "ubuntu-acr", "type": "microsoft.hybridnetwork/publishers/artifactstores", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:20:54.1913568Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:20:54.1913568Z"}, "properties": {"storeType": "AzureContainerRegistry", + "managedResourceGroupConfiguration": {"location": "westcentralus", "name": + "ubuntu-acr-HostedResources-05DF9847"}, "provisioningState": "Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '757' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:55 GMT + etag: + - '"14001efb-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 26CE4BAC3CFB46F19EC2E80A45627217 Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:52Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Accepted", "startTime": "2023-08-23T13:20:55.5683371Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:20:55 GMT + etag: + - '"63004bb8-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: B3358B9020224DE4B25630D32F2144F0 Ref B: AMS231032609047 Ref C: 2023-08-23T13:20:55Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Accepted", "startTime": "2023-08-23T13:20:55.5683371Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:21:26 GMT + etag: + - '"63004bb8-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 80B45FE211424D04A4DD83B0192C6338 Ref B: AMS231032609047 Ref C: 2023-08-23T13:21:26Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Accepted", "startTime": "2023-08-23T13:20:55.5683371Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:21:57 GMT + etag: + - '"63004bb8-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 3A4963E2BAE745BDAB4AC1CF1C122534 Ref B: AMS231032609047 Ref C: 2023-08-23T13:21:57Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Accepted", "startTime": "2023-08-23T13:20:55.5683371Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:22:27 GMT + etag: + - '"63004bb8-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 04C5F5BE1A4849169807708AD509AE5A Ref B: AMS231032609047 Ref C: 2023-08-23T13:22:27Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Accepted", "startTime": "2023-08-23T13:20:55.5683371Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:22:58 GMT + etag: + - '"63004bb8-0000-0600-0000-64e607b70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A1A3D934785B4A9DAD3904A9C8F72D3F Ref B: AMS231032609047 Ref C: 2023-08-23T13:22:58Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "f862b39a-7bfb-4158-9831-b9093b0ac43e*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Succeeded", "startTime": "2023-08-23T13:20:55.5683371Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:23:28 GMT + etag: + - '"330038a2-0000-0700-0000-64e608360000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 4122A99B02844DC3BCBAECA8AD39CE91 Ref B: AMS231032609047 Ref C: 2023-08-23T13:23:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "name": "ubuntu-acr", "type": "microsoft.hybridnetwork/publishers/artifactstores", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:20:54.1913568Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:20:54.1913568Z"}, "properties": {"storeType": "AzureContainerRegistry", + "replicationStrategy": "SingleReplication", "managedResourceGroupConfiguration": + {"name": "ubuntu-acr-HostedResources-05DF9847", "location": "westcentralus"}, + "provisioningState": "Succeeded", "storageResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ubuntu-acr-HostedResources-05DF9847/providers/Microsoft.ContainerRegistry/registries/UbuntupublisherUbuntuAcr150b526dfd"}}' + headers: + cache-control: + - no-cache + content-length: + - '1013' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:23:29 GMT + etag: + - '"140093fb-0000-0600-0000-64e6080b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 37FFFB5EF26D46D5B8F1CE7273D56DF6 Ref B: AMS231032609047 Ref C: 2023-08-23T13:23:29Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '282' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:23:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: DD7061F59CE14E4F9626DBCA3B9E54A2 Ref B: AMS231032609047 Ref C: 2023-08-23T13:23:29Z' + status: + code: 404 + message: Not Found +- request: + body: '{"location": "westcentralus", "properties": {"storeType": "AzureStorageAccount"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '81' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "name": "ubuntu-blob-store", "type": "microsoft.hybridnetwork/publishers/artifactstores", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:23:31.4272143Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:23:31.4272143Z"}, "properties": {"storeType": "AzureStorageAccount", + "managedResourceGroupConfiguration": {"location": "westcentralus", "name": + "ubuntu-blob-store-HostedResources-197B96F2"}, "provisioningState": "Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '775' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:23:32 GMT + etag: + - '"1400effb-0000-0600-0000-64e608550000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: F8F469D46BCC482DB5AD476604D32C30 Ref B: AMS231032609047 Ref C: 2023-08-23T13:23:30Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Accepted", "startTime": "2023-08-23T13:23:32.9584462Z"}' + headers: + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:23:33 GMT + etag: + - '"6300c4b8-0000-0600-0000-64e608540000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 7EE3A822A85243C4BBE5E7EC5B905152 Ref B: AMS231032609047 Ref C: 2023-08-23T13:23:33Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Accepted", "startTime": "2023-08-23T13:23:32.9584462Z"}' + headers: + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:24:03 GMT + etag: + - '"6300c4b8-0000-0600-0000-64e608540000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: C3E734DFCECB4744B962FA1F8C82C40D Ref B: AMS231032609047 Ref C: 2023-08-23T13:24:04Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Accepted", "startTime": "2023-08-23T13:23:32.9584462Z"}' + headers: + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:24:34 GMT + etag: + - '"6300c4b8-0000-0600-0000-64e608540000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: B5AE1BD727A045B684641C8B2104EF99 Ref B: AMS231032609047 Ref C: 2023-08-23T13:24:34Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Accepted", "startTime": "2023-08-23T13:23:32.9584462Z"}' + headers: + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:25:04 GMT + etag: + - '"6300c4b8-0000-0600-0000-64e608540000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 57914A0B0F9545A3BA7567AC90413D1F Ref B: AMS231032609047 Ref C: 2023-08-23T13:25:05Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Accepted", "startTime": "2023-08-23T13:23:32.9584462Z"}' + headers: + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:25:36 GMT + etag: + - '"6300c4b8-0000-0600-0000-64e608540000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0C12B38AD151475DBB32D30B87725DBB Ref B: AMS231032609047 Ref C: 2023-08-23T13:25:35Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "fdb3e7a4-af44-4d75-8013-87c08d8649ed*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Succeeded", "startTime": "2023-08-23T13:23:32.9584462Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '591' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:07 GMT + etag: + - '"490027ac-0000-0100-0000-64e608d40000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: F7117BFAF144470499E4A0B29BF65011 Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:06Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "name": "ubuntu-blob-store", "type": "microsoft.hybridnetwork/publishers/artifactstores", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:23:31.4272143Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:23:31.4272143Z"}, "properties": {"storeType": "AzureStorageAccount", + "replicationStrategy": "SingleReplication", "managedResourceGroupConfiguration": + {"name": "ubuntu-blob-store-HostedResources-197B96F2", "location": "westcentralus"}, + "provisioningState": "Succeeded", "storageResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ubuntu-blob-store-HostedResources-197B96F2/providers/Microsoft.Storage/storageAccounts/197b96f2ubuntublobstore0"}}' + headers: + cache-control: + - no-cache + content-length: + - '1023' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:08 GMT + etag: + - '"140075fc-0000-0600-0000-64e608b00000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: B6110C0B5E6140E0B7ADE468846A50AB Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:07Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '296' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:08 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: 7462E6C9A938471684B3E7F14C8D1A7B Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:08Z' + status: + code: 404 + message: Not Found +- request: + body: '{"location": "westcentralus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '29' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "name": "ubuntu-vm-nfdg", "type": "microsoft.hybridnetwork/publishers/networkfunctiondefinitiongroups", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:26:09.8106057Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:26:09.8106057Z"}, "properties": {"provisioningState": "Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '645' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:11 GMT + etag: + - '"0800b250-0000-0600-0000-64e608f30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: CCB29DA5AB094E90BFEFD253C8BF882B Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:08Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Accepted", "startTime": "2023-08-23T13:26:11.5879791Z"}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:12 GMT + etag: + - '"630027b9-0000-0600-0000-64e608f30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 4E80D65738C044299202844CF2B90658 Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:12Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Accepted", "startTime": "2023-08-23T13:26:11.5879791Z"}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:26:43 GMT + etag: + - '"630027b9-0000-0600-0000-64e608f30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 945F4FF7109546DEABC7D6049FFE8DD6 Ref B: AMS231032609047 Ref C: 2023-08-23T13:26:42Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Accepted", "startTime": "2023-08-23T13:26:11.5879791Z"}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:13 GMT + etag: + - '"630027b9-0000-0600-0000-64e608f30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A8F238F06DA0459781D6E45CA7BB7B04 Ref B: AMS231032609047 Ref C: 2023-08-23T13:27:13Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "749a4b82-6fcf-4682-9535-e7e29e8dde60*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Succeeded", "startTime": "2023-08-23T13:26:11.5879791Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '605' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:44 GMT + etag: + - '"33004dac-0000-0700-0000-64e609360000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 785A38D2BD624BDBA8F525F00023699E Ref B: AMS231032609047 Ref C: 2023-08-23T13:27:44Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "name": "ubuntu-vm-nfdg", "type": "microsoft.hybridnetwork/publishers/networkfunctiondefinitiongroups", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:26:09.8106057Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:26:09.8106057Z"}, "properties": {"description": null, "provisioningState": + "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '667' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:45 GMT + etag: + - '"0800b750-0000-0600-0000-64e608fc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: C7284991EB2E458ABE02BA0A9B847E08 Ref B: AMS231032609047 Ref C: 2023-08-23T13:27:44Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '322' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:45 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: E618D9E82DA04F6CB58BC25888ED69EA Ref B: AMS231032609047 Ref C: 2023-08-23T13:27:45Z' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '328' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:46 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: 0480BACB18C6426887CF86D760E506C8 Ref B: AMS231032609047 Ref C: 2023-08-23T13:27:46Z' + status: + code: 404 + message: Not Found +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "6414151573583976606"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "saArtifactStoreName": {"type": "string", "metadata": {"description": + "Name of an existing Storage Account-backed Artifact Store, deployed under the + publisher."}}, "acrManifestName": {"type": "string", "metadata": {"description": + "Name of the manifest to deploy for the ACR-backed Artifact Store"}}, "saManifestName": + {"type": "string", "metadata": {"description": "Name of the manifest to deploy + for the Storage Account-backed Artifact Store"}}, "nfName": {"type": "string", + "metadata": {"description": "Name of Network Function. Used predominantly as + a prefix for other variable names"}}, "vhdVersion": {"type": "string", "metadata": + {"description": "The version that you want to name the NFM VHD artifact, in + format A-B-C. e.g. 6-13-0"}}, "armTemplateVersion": {"type": "string", "metadata": + {"description": "The name under which to store the ARM template"}}}, "resources": + [{"type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''saArtifactStoreName''), parameters(''saManifestName''))]", "location": + "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[format(''{0}-vhd'', parameters(''nfName''))]", "artifactType": "VhdImageFile", + "artifactVersion": "[parameters(''vhdVersion'')]"}]}}, {"type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''), parameters(''acrManifestName''))]", "location": + "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[format(''{0}-arm-template'', parameters(''nfName''))]", "artifactType": "ArmTemplate", + "artifactVersion": "[parameters(''armTemplateVersion'')]"}]}}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "saArtifactStoreName": {"value": + "ubuntu-blob-store"}, "acrManifestName": {"value": "ubuntu-vm-acr-manifest-1-0-0"}, + "saManifestName": {"value": "ubuntu-vm-sa-manifest-1-0-0"}, "nfName": {"value": + "ubuntu-vm"}, "vhdVersion": {"value": "1-0-0"}, "armTemplateVersion": {"value": + "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '2913' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797270", + "name": "AOSM_CLI_deployment_1692797270", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "6414151573583976606", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "acrManifestName": {"type": "String", "value": "ubuntu-vm-acr-manifest-1-0-0"}, + "saManifestName": {"type": "String", "value": "ubuntu-vm-sa-manifest-1-0-0"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "vhdVersion": {"type": + "String", "value": "1-0-0"}, "armTemplateVersion": {"type": "String", "value": + "1.0.0"}}, "mode": "Incremental", "provisioningState": "Succeeded", "timestamp": + "0001-01-01T00:00:00Z", "duration": "PT0S", "correlationId": "b00d4105-bacc-48da-95f2-0cd9732d9904", + "providers": [{"namespace": "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": + "publishers/artifactStores/artifactManifests", "locations": ["westcentralus"]}]}], + "dependencies": [], "validatedResources": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1780' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:52 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-msedge-ref: + - 'Ref A: 33F78EBD34CB40E1928A774857910D9A Ref B: AMS231020512027 Ref C: 2023-08-23T13:27:50Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "6414151573583976606"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "saArtifactStoreName": {"type": "string", "metadata": {"description": + "Name of an existing Storage Account-backed Artifact Store, deployed under the + publisher."}}, "acrManifestName": {"type": "string", "metadata": {"description": + "Name of the manifest to deploy for the ACR-backed Artifact Store"}}, "saManifestName": + {"type": "string", "metadata": {"description": "Name of the manifest to deploy + for the Storage Account-backed Artifact Store"}}, "nfName": {"type": "string", + "metadata": {"description": "Name of Network Function. Used predominantly as + a prefix for other variable names"}}, "vhdVersion": {"type": "string", "metadata": + {"description": "The version that you want to name the NFM VHD artifact, in + format A-B-C. e.g. 6-13-0"}}, "armTemplateVersion": {"type": "string", "metadata": + {"description": "The name under which to store the ARM template"}}}, "resources": + [{"type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''saArtifactStoreName''), parameters(''saManifestName''))]", "location": + "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[format(''{0}-vhd'', parameters(''nfName''))]", "artifactType": "VhdImageFile", + "artifactVersion": "[parameters(''vhdVersion'')]"}]}}, {"type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''), parameters(''acrManifestName''))]", "location": + "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[format(''{0}-arm-template'', parameters(''nfName''))]", "artifactType": "ArmTemplate", + "artifactVersion": "[parameters(''armTemplateVersion'')]"}]}}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "saArtifactStoreName": {"value": + "ubuntu-blob-store"}, "acrManifestName": {"value": "ubuntu-vm-acr-manifest-1-0-0"}, + "saManifestName": {"value": "ubuntu-vm-sa-manifest-1-0-0"}, "nfName": {"value": + "ubuntu-vm"}, "vhdVersion": {"value": "1-0-0"}, "armTemplateVersion": {"value": + "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '2913' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797270", + "name": "AOSM_CLI_deployment_1692797270", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "6414151573583976606", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "acrManifestName": {"type": "String", "value": "ubuntu-vm-acr-manifest-1-0-0"}, + "saManifestName": {"type": "String", "value": "ubuntu-vm-sa-manifest-1-0-0"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "vhdVersion": {"type": + "String", "value": "1-0-0"}, "armTemplateVersion": {"type": "String", "value": + "1.0.0"}}, "mode": "Incremental", "provisioningState": "Accepted", "timestamp": + "2023-08-23T13:27:56.6803337Z", "duration": "PT0.0007264S", "correlationId": + "7973f8ee-fbb8-4cda-99b8-e47cca6cea49", "providers": [{"namespace": "Microsoft.Hybridnetwork", + "resourceTypes": [{"resourceType": "publishers/artifactStores/artifactManifests", + "locations": ["westcentralus"]}]}], "dependencies": []}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797270/operationStatuses/08585088096109100542?api-version=2022-09-01 + cache-control: + - no-cache + content-length: + - '1293' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:57 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 23C4D73997F44884AB90A0659134F34B Ref B: AMS231020512027 Ref C: 2023-08-23T13:27:52Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088096109100542?api-version=2022-09-01 + response: + body: + string: '{"status": "Accepted"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:27:57 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 88BEF5502C234FC6A2656A9030F437B7 Ref B: AMS231020512027 Ref C: 2023-08-23T13:27:57Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088096109100542?api-version=2022-09-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '23' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:28:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 6A3CA2E223D94A14A5EC6028882E2D95 Ref B: AMS231020512027 Ref C: 2023-08-23T13:28:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797270", + "name": "AOSM_CLI_deployment_1692797270", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "6414151573583976606", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "acrManifestName": {"type": "String", "value": "ubuntu-vm-acr-manifest-1-0-0"}, + "saManifestName": {"type": "String", "value": "ubuntu-vm-sa-manifest-1-0-0"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "vhdVersion": {"type": + "String", "value": "1-0-0"}, "armTemplateVersion": {"type": "String", "value": + "1.0.0"}}, "mode": "Incremental", "provisioningState": "Succeeded", "timestamp": + "2023-08-23T13:28:25.2548023Z", "duration": "PT28.575195S", "correlationId": + "7973f8ee-fbb8-4cda-99b8-e47cca6cea49", "providers": [{"namespace": "Microsoft.Hybridnetwork", + "resourceTypes": [{"resourceType": "publishers/artifactStores/artifactManifests", + "locations": ["westcentralus"]}]}], "dependencies": [], "outputResources": + [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1793' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:28:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 5427A48857D54D9686DAC3CE7E5B95D0 Ref B: AMS231020512027 Ref C: 2023-08-23T13:28:29Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "1529388553420138916"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "saArtifactStoreName": {"type": "string", "metadata": {"description": + "Name of an existing Storage Account-backed Artifact Store, deployed under the + publisher."}}, "nfName": {"type": "string", "metadata": {"description": "Name + of Network Function. Used predominantly as a prefix for other variable names"}}, + "nfDefinitionGroup": {"type": "string", "metadata": {"description": "Name of + an existing Network Function Definition Group"}}, "nfDefinitionVersion": {"type": + "string", "metadata": {"description": "The version of the NFDV you want to deploy, + in format A.B.C"}}, "vhdVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM VHD artifact, in format A-B-C. e.g. + 6-13-0"}}, "armTemplateVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM template artifact, in format A.B.C. + e.g. 6.13.0. If testing for development, you can use any numbers you like."}}}, + "variables": {"$fxv#0": {"$schema": "https://json-schema.org/draft-07/schema#", + "title": "DeployParametersSchema", "type": "object", "properties": {"location": + {"type": "string"}, "subnetName": {"type": "string"}, "ubuntuVmName": {"type": + "string"}, "virtualNetworkId": {"type": "string"}, "sshPublicKeyAdmin": {"type": + "string"}}}, "$fxv#1": {"imageName": "ubuntu-vmImage", "azureDeployLocation": + "{deployParameters.location}"}, "$fxv#2": {"location": "{deployParameters.location}", + "subnetName": "{deployParameters.subnetName}", "ubuntuVmName": "{deployParameters.ubuntuVmName}", + "virtualNetworkId": "{deployParameters.virtualNetworkId}", "sshPublicKeyAdmin": + "{deployParameters.sshPublicKeyAdmin}", "imageName": "ubuntu-vmImage"}}, "resources": + [{"type": "Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''nfDefinitionGroup''), parameters(''nfDefinitionVersion''))]", "location": + "[parameters(''location'')]", "properties": {"versionState": "Preview", "deployParameters": + "[string(variables(''$fxv#0''))]", "networkFunctionType": "VirtualNetworkFunction", + "networkFunctionTemplate": {"nfviType": "AzureCore", "networkFunctionApplications": + [{"artifactType": "VhdImageFile", "name": "[format(''{0}Image'', parameters(''nfName''))]", + "dependsOnProfile": null, "artifactProfile": {"vhdArtifactProfile": {"vhdName": + "[format(''{0}-vhd'', parameters(''nfName''))]", "vhdVersion": "[parameters(''vhdVersion'')]"}, + "artifactStore": {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', + parameters(''publisherName''), parameters(''saArtifactStoreName''))]"}}, "deployParametersMappingRuleProfile": + {"vhdImageMappingRuleProfile": {"userConfiguration": "[string(variables(''$fxv#1''))]"}, + "applicationEnablement": "Unknown"}}, {"artifactType": "ArmTemplate", "name": + "[parameters(''nfName'')]", "dependsOnProfile": null, "artifactProfile": {"templateArtifactProfile": + {"templateName": "[format(''{0}-arm-template'', parameters(''nfName''))]", "templateVersion": + "[parameters(''armTemplateVersion'')]"}, "artifactStore": {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', + parameters(''publisherName''), parameters(''acrArtifactStoreName''))]"}}, "deployParametersMappingRuleProfile": + {"templateMappingRuleProfile": {"templateParameters": "[string(variables(''$fxv#2''))]"}, + "applicationEnablement": "Unknown"}}]}}}]}, "parameters": {"location": {"value": + "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, "acrArtifactStoreName": + {"value": "ubuntu-acr"}, "saArtifactStoreName": {"value": "ubuntu-blob-store"}, + "nfName": {"value": "ubuntu-vm"}, "nfDefinitionGroup": {"value": "ubuntu-vm-nfdg"}, + "nfDefinitionVersion": {"value": "1.0.0"}, "vhdVersion": {"value": "1-0-0"}, + "armTemplateVersion": {"value": "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '4489' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797315", + "name": "AOSM_CLI_deployment_1692797315", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "1529388553420138916", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "nfDefinitionGroup": {"type": + "String", "value": "ubuntu-vm-nfdg"}, "nfDefinitionVersion": {"type": "String", + "value": "1.0.0"}, "vhdVersion": {"type": "String", "value": "1-0-0"}, "armTemplateVersion": + {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", "provisioningState": + "Succeeded", "timestamp": "0001-01-01T00:00:00Z", "duration": "PT0S", "correlationId": + "872483cf-1d5f-4793-bc49-5bc4db650dc4", "providers": [{"namespace": "Microsoft.Hybridnetwork", + "resourceTypes": [{"resourceType": "publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "locations": ["westcentralus"]}]}], "dependencies": [], "validatedResources": + [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkfunctiondefinitiongroups/ubuntu-vm-nfdg/networkfunctiondefinitionversions/1.0.0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1556' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:28:36 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 791E7AFCD2AD4C42ACF560B5236DF288 Ref B: AMS231020512027 Ref C: 2023-08-23T13:28:34Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "1529388553420138916"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "saArtifactStoreName": {"type": "string", "metadata": {"description": + "Name of an existing Storage Account-backed Artifact Store, deployed under the + publisher."}}, "nfName": {"type": "string", "metadata": {"description": "Name + of Network Function. Used predominantly as a prefix for other variable names"}}, + "nfDefinitionGroup": {"type": "string", "metadata": {"description": "Name of + an existing Network Function Definition Group"}}, "nfDefinitionVersion": {"type": + "string", "metadata": {"description": "The version of the NFDV you want to deploy, + in format A.B.C"}}, "vhdVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM VHD artifact, in format A-B-C. e.g. + 6-13-0"}}, "armTemplateVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM template artifact, in format A.B.C. + e.g. 6.13.0. If testing for development, you can use any numbers you like."}}}, + "variables": {"$fxv#0": {"$schema": "https://json-schema.org/draft-07/schema#", + "title": "DeployParametersSchema", "type": "object", "properties": {"location": + {"type": "string"}, "subnetName": {"type": "string"}, "ubuntuVmName": {"type": + "string"}, "virtualNetworkId": {"type": "string"}, "sshPublicKeyAdmin": {"type": + "string"}}}, "$fxv#1": {"imageName": "ubuntu-vmImage", "azureDeployLocation": + "{deployParameters.location}"}, "$fxv#2": {"location": "{deployParameters.location}", + "subnetName": "{deployParameters.subnetName}", "ubuntuVmName": "{deployParameters.ubuntuVmName}", + "virtualNetworkId": "{deployParameters.virtualNetworkId}", "sshPublicKeyAdmin": + "{deployParameters.sshPublicKeyAdmin}", "imageName": "ubuntu-vmImage"}}, "resources": + [{"type": "Microsoft.Hybridnetwork/publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''nfDefinitionGroup''), parameters(''nfDefinitionVersion''))]", "location": + "[parameters(''location'')]", "properties": {"versionState": "Preview", "deployParameters": + "[string(variables(''$fxv#0''))]", "networkFunctionType": "VirtualNetworkFunction", + "networkFunctionTemplate": {"nfviType": "AzureCore", "networkFunctionApplications": + [{"artifactType": "VhdImageFile", "name": "[format(''{0}Image'', parameters(''nfName''))]", + "dependsOnProfile": null, "artifactProfile": {"vhdArtifactProfile": {"vhdName": + "[format(''{0}-vhd'', parameters(''nfName''))]", "vhdVersion": "[parameters(''vhdVersion'')]"}, + "artifactStore": {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', + parameters(''publisherName''), parameters(''saArtifactStoreName''))]"}}, "deployParametersMappingRuleProfile": + {"vhdImageMappingRuleProfile": {"userConfiguration": "[string(variables(''$fxv#1''))]"}, + "applicationEnablement": "Unknown"}}, {"artifactType": "ArmTemplate", "name": + "[parameters(''nfName'')]", "dependsOnProfile": null, "artifactProfile": {"templateArtifactProfile": + {"templateName": "[format(''{0}-arm-template'', parameters(''nfName''))]", "templateVersion": + "[parameters(''armTemplateVersion'')]"}, "artifactStore": {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', + parameters(''publisherName''), parameters(''acrArtifactStoreName''))]"}}, "deployParametersMappingRuleProfile": + {"templateMappingRuleProfile": {"templateParameters": "[string(variables(''$fxv#2''))]"}, + "applicationEnablement": "Unknown"}}]}}}]}, "parameters": {"location": {"value": + "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, "acrArtifactStoreName": + {"value": "ubuntu-acr"}, "saArtifactStoreName": {"value": "ubuntu-blob-store"}, + "nfName": {"value": "ubuntu-vm"}, "nfDefinitionGroup": {"value": "ubuntu-vm-nfdg"}, + "nfDefinitionVersion": {"value": "1.0.0"}, "vhdVersion": {"value": "1-0-0"}, + "armTemplateVersion": {"value": "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '4489' + Content-Type: + - application/json + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797315", + "name": "AOSM_CLI_deployment_1692797315", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "1529388553420138916", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "nfDefinitionGroup": {"type": + "String", "value": "ubuntu-vm-nfdg"}, "nfDefinitionVersion": {"type": "String", + "value": "1.0.0"}, "vhdVersion": {"type": "String", "value": "1-0-0"}, "armTemplateVersion": + {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", "provisioningState": + "Accepted", "timestamp": "2023-08-23T13:28:42.0642169Z", "duration": "PT0.0001057S", + "correlationId": "45352987-be82-4dfc-aabc-d03f5e7954c8", "providers": [{"namespace": + "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": "publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "locations": ["westcentralus"]}]}], "dependencies": []}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797315/operationStatuses/08585088095659387921?api-version=2022-09-01 + cache-control: + - no-cache + content-length: + - '1297' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:28:42 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 95FDED396B604B7A830DED6455034958 Ref B: AMS231020512027 Ref C: 2023-08-23T13:28:37Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088095659387921?api-version=2022-09-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '21' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:28:43 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: FBD375D7523E4F5BBC0A3C2FAD7B6DE5 Ref B: AMS231020512027 Ref C: 2023-08-23T13:28:43Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088095659387921?api-version=2022-09-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '21' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:29:14 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: BD55393F14524D10BAB1FD5994446503 Ref B: AMS231020512027 Ref C: 2023-08-23T13:29:14Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088095659387921?api-version=2022-09-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '21' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:29:45 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: E5E4BABE63B940E3A597A63A24404C34 Ref B: AMS231020512027 Ref C: 2023-08-23T13:29:45Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088095659387921?api-version=2022-09-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '23' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 7EE570EE3784487190914B4403A1DA76 Ref B: AMS231020512027 Ref C: 2023-08-23T13:30:15Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797315", + "name": "AOSM_CLI_deployment_1692797315", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "1529388553420138916", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "saArtifactStoreName": {"type": "String", "value": "ubuntu-blob-store"}, + "nfName": {"type": "String", "value": "ubuntu-vm"}, "nfDefinitionGroup": {"type": + "String", "value": "ubuntu-vm-nfdg"}, "nfDefinitionVersion": {"type": "String", + "value": "1.0.0"}, "vhdVersion": {"type": "String", "value": "1-0-0"}, "armTemplateVersion": + {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", "provisioningState": + "Succeeded", "timestamp": "2023-08-23T13:30:14.3563223Z", "duration": "PT1M32.2922111S", + "correlationId": "45352987-be82-4dfc-aabc-d03f5e7954c8", "providers": [{"namespace": + "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": "publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "locations": ["westcentralus"]}]}], "dependencies": [], "outputResources": + [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkfunctiondefinitiongroups/ubuntu-vm-nfdg/networkfunctiondefinitionversions/1.0.0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1572' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:16 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 1B340828DA964B02B39E418D3A044FED Ref B: AMS231020512027 Ref C: 2023-08-23T13:30:16Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0", + "name": "ubuntu-vm-sa-manifest-1-0-0", "type": "microsoft.hybridnetwork/publishers/artifactstores/artifactmanifests", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:28:01.2861273Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:28:01.2861273Z"}, "properties": {"artifacts": [{"artifactName": + "ubuntu-vm-vhd", "artifactType": "VhdImageFile", "artifactVersion": "1-0-0"}], + "artifactManifestState": "Uploading", "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '840' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:17 GMT + etag: + - '"1d0063c1-0000-0600-0000-64e609660000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 6EEB5ED92E5948BE8E9ECBE21BEF35CA Ref B: AMS231020512031 Ref C: 2023-08-23T13:30:17Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0/listCredential?api-version=2023-04-01-preview + response: + body: + string: '{"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ubuntu-blob-store-HostedResources-197B96F2/providers/Microsoft.Storage/storageAccounts/197b96f2ubuntublobstore0", + "containerCredentials": [{"containerName": "ubuntuvmvhd-1-0-0", "containerSasUri": + "https://xxxxxxxxxxxxxxx.blob.core.windows.net/ubuntuvmvhd-1-0-0?sv=2021-08-06&si=StorageAccountAccessPolicy&sr=xxxxxxxxxxxxxxxxxxxx"}], + "expiry": "2023-08-24T13:30:20.1660999+00:00", "credentialType": "AzureStorageAccountToken"}' + headers: + cache-control: + - no-cache + content-length: + - '515' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:19 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 7EB0C687BE4D4CCEAF9F22B974EE1621 Ref B: AMS231020512031 Ref C: 2023-08-23T13:30:18Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0", + "name": "ubuntu-vm-acr-manifest-1-0-0", "type": "microsoft.hybridnetwork/publishers/artifactstores/artifactmanifests", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:28:01.301714Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:28:01.301714Z"}, "properties": {"artifacts": [{"artifactName": + "ubuntu-vm-arm-template", "artifactType": "ArmTemplate", "artifactVersion": + "1.0.0"}], "artifactManifestState": "Uploading", "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '841' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:20 GMT + etag: + - '"1d008bc1-0000-0600-0000-64e609720000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: F545C6FAEE4D4DC59D7915EBE134954D Ref B: AMS231020512031 Ref C: 2023-08-23T13:30:20Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd publish + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --definition-type + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0/listCredential?api-version=2023-04-01-preview + response: + body: + string: '{"username": "ubuntu-vm-acr-manifest-1-0-0", "acrToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "acrServerUrl": "https://ubuntupublisherubuntuacr150b526dfd.azurecr.io", "repositories": + ["ubuntu-vm-arm-template"], "expiry": "2023-08-24T13:30:22.8525258+00:00", + "credentialType": "AzureContainerRegistryScopedToken"}' + headers: + cache-control: + - no-cache + content-length: + - '331' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:23 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 0FE40D170E1F4FAFAF337383C957D3DD Ref B: AMS231020512031 Ref C: 2023-08-23T13:30:21Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-storage-blob/12.16.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + x-ms-blob-content-length: + - '512' + x-ms-blob-type: + - PageBlob + x-ms-date: + - Wed, 23 Aug 2023 13:30:24 GMT + x-ms-version: + - '2022-11-02' + method: PUT + uri: https://xxxxxxxxxxxxxxx.blob.core.windows.net/ubuntuvmvhd-1-0-0/ubuntuvm-1-0-0.vhd?sv=2021-08-06&si=StorageAccountAccessPolicy&sr=xxxxxxxxxxxxxxxxxxxx + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:24 GMT + etag: + - '"0x8DBA3DD1B177BBC"' + last-modified: + - Wed, 23 Aug 2023 13:30:24 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2022-11-02' + status: + code: 201 + message: Created +- request: + body: "61 38 6b 92 16 4b cc ac 6f d4 02 5c 6f 62 79 b9 \n8e 62 ae 07 02 1c dc + 73 5b 7a 51 e7 56 4e 4a b0 \n54 4a 93 2e 6b dd 3c b5 8b 60 fa 80 b1 80 1b 89 + \n1e 4d 7d 86 8e 25 76 58 24 8d 21 87 83 06 88 d6 \na4 fd 94 9c 66 b6 db ee + 92 46 f0 25 fc 84 bb f5 \n3f d9 49 28 ea 54 6a 2a 33 fa e0 47 eb 22 af 91 \nd4 + 34 a6 d9 fe 58 cb 54 03 35 d6 45 40 96 4e f3 \n31 ea 78 20 45 e9 f2 3a de cb + 38 53 c0 9c b2 b7 \n12 9e 57 d9 f6 1b cb 20 23 8c 86 d3 40 da 84 c3 \n22 5b + 48 61 63 e2 5f 5f 43 6d 8f 41 fc ce c1 87 \n33 e1 e2 61 63 e2 5f 5" + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '512' + Content-Type: + - application/octet-stream + If-Match: + - '"0x8DBA3DD1B177BBC"' + User-Agent: + - azsdk-python-storage-blob/12.16.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + x-ms-date: + - Wed, 23 Aug 2023 13:30:24 GMT + x-ms-page-write: + - update + x-ms-range: + - bytes=0-511 + x-ms-version: + - '2022-11-02' + method: PUT + uri: https://xxxxxxxxxxxxxxx.blob.core.windows.net/ubuntuvmvhd-1-0-0/ubuntuvm-1-0-0.vhd?comp=page&sv=2021-08-06&si=StorageAccountAccessPolicy&sr=xxxxxxxxxxxxxxxxxxxx + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:24 GMT + etag: + - '"0x8DBA3DD1B2E34C6"' + last-modified: + - Wed, 23 Aug 2023 13:30:24 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-blob-sequence-number: + - '0' + x-ms-content-crc64: + - iWvWqElPrJg= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2022-11-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/ + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '302' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:24 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-arm-template:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-arm-template%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:24 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.316667' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/ + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:25 GMT + docker-distribution-api-version: + - registry/2.0 + docker-upload-uuid: + - 6d554ac7-1f18-4dbc-b836-eaec1dc72a47 + location: + - /v2/ubuntu-vm-arm-template/blobs/uploads/6d554ac7-1f18-4dbc-b836-eaec1dc72a47?_nouploadcache=false&_state=aFmSyQRtqn-4Sa19X8aSTT6UPuGiIhIWwWgcgOMJhWt7Ik5hbWUiOiJ1YnVudHUtdm0tYXJtLXRlbXBsYXRlIiwiVVVJRCI6IjZkNTU0YWM3LTFmMTgtNGRiYy1iODM2LWVhZWMxZGM3MmE0NyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0wOC0yM1QxMzozMDoyNS4yMDEyNzAzMjhaIn0%3D + range: + - 0-0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: "{\n \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n + \ \"contentVersion\": \"1.0.0.0\",\n \"metadata\": {\n \"_generator\": {\n + \ \"name\": \"bicep\",\n \"version\": \"0.8.9.13224\",\n \"templateHash\": + \"14979664264804385741\"\n }\n },\n \"parameters\": {\n \"location\": + {\n \"type\": \"string\",\n \"defaultValue\": \"[resourceGroup().location]\"\n + \ },\n \"subnetName\": {\n \"type\": \"string\"\n },\n \"ubuntuVmName\": + {\n \"type\": \"string\",\n \"defaultValue\": \"ubuntu-vm\"\n },\n + \ \"virtualNetworkId\": {\n \"type\": \"string\"\n },\n \"sshPublicKeyAdmin\": + {\n \"type\": \"string\"\n },\n \"imageName\": {\n \"type\": + \"string\"\n }\n },\n \"variables\": {\n \"imageResourceGroup\": \"[resourceGroup().name]\",\n + \ \"subscriptionId\": \"[subscription().subscriptionId]\",\n \"vmSizeSku\": + \"Standard_D2s_v3\"\n },\n \"resources\": [\n {\n \"type\": \"Microsoft.Network/networkInterfaces\",\n + \ \"apiVersion\": \"2021-05-01\",\n \"name\": \"[format('{0}_nic', + parameters('ubuntuVmName'))]\",\n \"location\": \"[parameters('location')]\",\n + \ \"properties\": {\n \"ipConfigurations\": [\n {\n \"name\": + \"ipconfig1\",\n \"properties\": {\n \"subnet\": {\n + \ \"id\": \"[format('{0}/subnets/{1}', parameters('virtualNetworkId'), + parameters('subnetName'))]\"\n },\n \"primary\": true,\n + \ \"privateIPAddressVersion\": \"IPv4\"\n }\n }\n + \ ]\n }\n },\n {\n \"type\": \"Microsoft.Compute/virtualMachines\",\n + \ \"apiVersion\": \"2021-07-01\",\n \"name\": \"[parameters('ubuntuVmName')]\",\n + \ \"location\": \"[parameters('location')]\",\n \"properties\": {\n + \ \"hardwareProfile\": {\n \"vmSize\": \"[variables('vmSizeSku')]\"\n + \ },\n \"storageProfile\": {\n \"imageReference\": {\n + \ \"id\": \"[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', + variables('subscriptionId'), variables('imageResourceGroup')), 'Microsoft.Compute/images', + parameters('imageName'))]\"\n },\n \"osDisk\": {\n \"osType\": + \"Linux\",\n \"name\": \"[format('{0}_disk', parameters('ubuntuVmName'))]\",\n + \ \"createOption\": \"FromImage\",\n \"caching\": \"ReadWrite\",\n + \ \"writeAcceleratorEnabled\": false,\n \"managedDisk\": + \"[json('{\\\"storageAccountType\\\": \\\"Premium_LRS\\\"}')]\",\n \"deleteOption\": + \"Delete\",\n \"diskSizeGB\": 30\n }\n },\n \"osProfile\": + {\n \"computerName\": \"[parameters('ubuntuVmName')]\",\n \"adminUsername\": + \"azureuser\",\n \"linuxConfiguration\": {\n \"disablePasswordAuthentication\": + true,\n \"ssh\": {\n \"publicKeys\": [\n {\n + \ \"path\": \"/home/azureuser/.ssh/authorized_keys\",\n \"keyData\": + \"[parameters('sshPublicKeyAdmin')]\"\n }\n ]\n + \ },\n \"provisionVMAgent\": true,\n \"patchSettings\": + {\n \"patchMode\": \"ImageDefault\",\n \"assessmentMode\": + \"ImageDefault\"\n }\n },\n \"secrets\": [],\n + \ \"allowExtensionOperations\": true\n },\n \"networkProfile\": + {\n \"networkInterfaces\": [\n {\n \"id\": + \"[resourceId('Microsoft.Network/networkInterfaces', format('{0}_nic', parameters('ubuntuVmName')))]\"\n + \ }\n ]\n }\n },\n \"dependsOn\": [\n \"[resourceId('Microsoft.Network/networkInterfaces', + format('{0}_nic', parameters('ubuntuVmName')))]\"\n ]\n }\n ]\n}" + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3591' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/6d554ac7-1f18-4dbc-b836-eaec1dc72a47?_nouploadcache=false&_state=aFmSyQRtqn-4Sa19X8aSTT6UPuGiIhIWwWgcgOMJhWt7Ik5hbWUiOiJ1YnVudHUtdm0tYXJtLXRlbXBsYXRlIiwiVVVJRCI6IjZkNTU0YWM3LTFmMTgtNGRiYy1iODM2LWVhZWMxZGM3MmE0NyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0wOC0yM1QxMzozMDoyNS4yMDEyNzAzMjhaIn0%3D&digest=sha256%3Ae71bf56543dc33dc8e550a0c574efe9a4875754a4ddf74347e448dec2462798b + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:25 GMT + docker-content-digest: + - sha256:e71bf56543dc33dc8e550a0c574efe9a4875754a4ddf74347e448dec2462798b + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-arm-template/blobs/sha256:e71bf56543dc33dc8e550a0c574efe9a4875754a4ddf74347e448dec2462798b + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/ + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '302' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:25 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-arm-template:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-arm-template%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:25 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.3' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/ + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:25 GMT + docker-distribution-api-version: + - registry/2.0 + docker-upload-uuid: + - f77496b6-59a4-4c59-b3ef-d9762d655097 + location: + - /v2/ubuntu-vm-arm-template/blobs/uploads/f77496b6-59a4-4c59-b3ef-d9762d655097?_nouploadcache=false&_state=Aw09DOxqGehD7aQ9B1K7hhjaKq0qAn303HK1-0HWTpR7Ik5hbWUiOiJ1YnVudHUtdm0tYXJtLXRlbXBsYXRlIiwiVVVJRCI6ImY3NzQ5NmI2LTU5YTQtNGM1OS1iM2VmLWQ5NzYyZDY1NTA5NyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0wOC0yM1QxMzozMDoyNS45NjYxNDgzMloifQ%3D%3D + range: + - 0-0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/blobs/uploads/f77496b6-59a4-4c59-b3ef-d9762d655097?_nouploadcache=false&_state=Aw09DOxqGehD7aQ9B1K7hhjaKq0qAn303HK1-0HWTpR7Ik5hbWUiOiJ1YnVudHUtdm0tYXJtLXRlbXBsYXRlIiwiVVVJRCI6ImY3NzQ5NmI2LTU5YTQtNGM1OS1iM2VmLWQ5NzYyZDY1NTA5NyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0wOC0yM1QxMzozMDoyNS45NjYxNDgzMloifQ%3D%3D&digest=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:26 GMT + docker-content-digest: + - sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-arm-template/blobs/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: '{"schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", + "config": {"mediaType": "application/vnd.unknown.config.v1+json", "size": 0, + "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, + "layers": [{"mediaType": "application/vnd.oci.image.layer.v1.tar", "size": 3591, + "digest": "sha256:e71bf56543dc33dc8e550a0c574efe9a4875754a4ddf74347e448dec2462798b", + "annotations": {"org.opencontainers.image.title": "ubuntu_template.json"}}], + "annotations": {}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '504' + Content-Type: + - application/vnd.oci.image.manifest.v1+json + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/manifests/1.0.0 + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-arm-template", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '302' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:26 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-arm-template:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-arm-template%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:26 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.283333' + status: + code: 200 + message: OK +- request: + body: '{"schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", + "config": {"mediaType": "application/vnd.unknown.config.v1+json", "size": 0, + "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, + "layers": [{"mediaType": "application/vnd.oci.image.layer.v1.tar", "size": 3591, + "digest": "sha256:e71bf56543dc33dc8e550a0c574efe9a4875754a4ddf74347e448dec2462798b", + "annotations": {"org.opencontainers.image.title": "ubuntu_template.json"}}], + "annotations": {}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '504' + Content-Type: + - application/vnd.oci.image.manifest.v1+json + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-arm-template/manifests/1.0.0 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:26 GMT + docker-content-digest: + - sha256:8923fa544da97914212bc9173ec512741d331940e4a2c7b6fbad979657a5c507 + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-arm-template/manifests/sha256:8923fa544da97914212bc9173ec512741d331940e4a2c7b6fbad979657a5c507 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd build + Connection: + - keep-alive + ParameterSetName: + - -f --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkfunctiondefinitiongroups/ubuntu-vm-nfdg/networkfunctiondefinitionversions/1.0.0", + "name": "1.0.0", "type": "microsoft.hybridnetwork/publishers/networkfunctiondefinitiongroups/networkfunctiondefinitionversions", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:28:45.2810897Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:28:45.2810897Z"}, "properties": {"networkFunctionTemplate": + {"networkFunctionApplications": [{"artifactProfile": {"vhdArtifactProfile": + {"vhdName": "ubuntu-vm-vhd", "vhdVersion": "1-0-0"}, "artifactStore": {"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store"}}, + "deployParametersMappingRuleProfile": {"vhdImageMappingRuleProfile": {"userConfiguration": + "{\"imageName\":\"ubuntu-vmImage\",\"azureDeployLocation\":\"{deployParameters.location}\"}"}, + "applicationEnablement": "Unknown"}, "artifactType": "VhdImageFile", "dependsOnProfile": + null, "name": "ubuntu-vmImage"}, {"artifactProfile": {"templateArtifactProfile": + {"templateName": "ubuntu-vm-arm-template", "templateVersion": "1.0.0"}, "artifactStore": + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr"}}, + "deployParametersMappingRuleProfile": {"templateMappingRuleProfile": {"templateParameters": + "{\"location\":\"{deployParameters.location}\",\"subnetName\":\"{deployParameters.subnetName}\",\"ubuntuVmName\":\"{deployParameters.ubuntuVmName}\",\"virtualNetworkId\":\"{deployParameters.virtualNetworkId}\",\"sshPublicKeyAdmin\":\"{deployParameters.sshPublicKeyAdmin}\",\"imageName\":\"ubuntu-vmImage\"}"}, + "applicationEnablement": "Unknown"}, "artifactType": "ArmTemplate", "dependsOnProfile": + null, "name": "ubuntu-vm"}], "nfviType": "AzureCore"}, "versionState": "Preview", + "description": null, "deployParameters": "{\"$schema\":\"https://json-schema.org/draft-07/schema#\",\"title\":\"DeployParametersSchema\",\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\"},\"subnetName\":{\"type\":\"string\"},\"ubuntuVmName\":{\"type\":\"string\"},\"virtualNetworkId\":{\"type\":\"string\"},\"sshPublicKeyAdmin\":{\"type\":\"string\"}},\"required\":[\"location\",\"subnetName\",\"ubuntuVmName\",\"virtualNetworkId\",\"sshPublicKeyAdmin\"]}", + "networkFunctionType": "VirtualNetworkFunction", "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '2815' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:27 GMT + etag: + - '"0000ecac-0000-0600-0000-64e6099b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 9819B0E487B54C6EBC95F0D45D66CC29 Ref B: AMS231032608047 Ref C: 2023-08-23T13:30:27Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: HEAD + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001?api-version=2022-09-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:30:27 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D55838506E6E427D94E947520A3586C9 Ref B: AMS231020615031 Ref C: 2023-08-23T13:30:27Z' + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001", + "name": "cli_test_vnf_nsd_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westcentralus", "tags": {"product": "azurecli", "cause": "automation", + "test": "test_vnf_nsd_publish_and_delete", "date": "2023-08-23T13:19:14Z", + "module": "aosm", "autoDelete": "true", "expiresOn": "2023-09-22T13:19:14.2401943Z"}, + "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '476' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:27 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: CF9FB4F5886148D1B3B6C2CD5CBD2668 Ref B: AMS231020615031 Ref C: 2023-08-23T13:30:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "name": "ubuntuPublisher", "type": "microsoft.hybridnetwork/publishers", "location": + "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:19:17.7479447Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:19:17.7479447Z"}, "properties": {"scope": "Private", "provisioningState": + "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '588' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:28 GMT + etag: + - '"1e00f42c-0000-0600-0000-64e607600000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 6E433A35386B4480944C1FEA35A8A1C2 Ref B: AMS231022012009 Ref C: 2023-08-23T13:30:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "name": "ubuntu-acr", "type": "microsoft.hybridnetwork/publishers/artifactstores", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:20:54.1913568Z", "lastModifiedBy": + "b8ed041c-aa91-418e-8f47-20c70abc2de1", "lastModifiedByType": "Application", + "lastModifiedAt": "2023-08-23T13:28:59.1012749Z"}, "properties": {"storeType": + "AzureContainerRegistry", "replicationStrategy": "SingleReplication", "managedResourceGroupConfiguration": + {"name": "ubuntu-acr-HostedResources-05DF9847", "location": "westcentralus"}, + "provisioningState": "Succeeded", "storageResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ubuntu-acr-HostedResources-05DF9847/providers/Microsoft.ContainerRegistry/registries/UbuntupublisherUbuntuAcr150b526dfd"}}' + headers: + cache-control: + - no-cache + content-length: + - '1031' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:29 GMT + etag: + - '"1400d0fd-0000-0600-0000-64e6099b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 9BD9AD430915416C94429118CB686A7C Ref B: AMS231022012009 Ref C: 2023-08-23T13:30:29Z' + status: + code: 200 + message: OK +- request: + body: '{"location": "westcentralus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '29' + Content-Type: + - application/json + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "name": "ubuntu", "type": "microsoft.hybridnetwork/publishers/networkservicedesigngroups", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:30:30.6866919Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:30:30.6866919Z"}, "properties": {"description": null, "provisioningState": + "Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '640' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:32 GMT + etag: + - '"0200006d-0000-0600-0000-64e609f80000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: F8EBA7719BF44381B3F9F5196EE49EBA Ref B: AMS231022012009 Ref C: 2023-08-23T13:30:30Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"error": {"code": "ResourceNotFound", "message": "The Resource ''Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0'' + under resource group ''cli_test_vnf_nsd_000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '330' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:32 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + x-msedge-ref: + - 'Ref A: 1774D5EA0EBD4EF4B071012758B1A8F0 Ref B: AMS231020512033 Ref C: 2023-08-23T13:30:32Z' + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "name": "4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "status": "Accepted", "startTime": "2023-08-23T13:30:31.7812516Z"}' + headers: + cache-control: + - no-cache + content-length: + - '571' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:33 GMT + etag: + - '"630095b9-0000-0600-0000-64e609f70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 70E3CC3B87EA4744B2F6502373619577 Ref B: AMS231022012009 Ref C: 2023-08-23T13:30:32Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "17545683377380589662"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "acrManifestNames": {"type": "array", "metadata": {"description": + "Name of the manifest to deploy for the ACR-backed Artifact Store"}}, "armTemplateNames": + {"type": "array", "metadata": {"description": "The name under which to store + the ARM template"}}, "armTemplateVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM template artifact, in format A.B.C. + e.g. 6.13.0. If testing for development, you can use any numbers you like."}}}, + "resources": [{"copy": {"name": "acrArtifactManifests", "count": "[length(parameters(''armTemplateNames''))]"}, + "type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''), parameters(''acrManifestNames'')[copyIndex()])]", + "location": "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[parameters(''armTemplateNames'')[copyIndex()]]", "artifactType": "ArmTemplate", + "artifactVersion": "[parameters(''armTemplateVersion'')]"}]}}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "acrManifestNames": {"value": + ["ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"]}, "armTemplateNames": {"value": ["ubuntu-vm-nfdg_nf_artifact"]}, + "armTemplateVersion": {"value": "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '2066' + Content-Type: + - application/json + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797438", + "name": "AOSM_CLI_deployment_1692797438", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "17545683377380589662", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "acrManifestNames": {"type": "Array", "value": ["ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"]}, + "armTemplateNames": {"type": "Array", "value": ["ubuntu-vm-nfdg_nf_artifact"]}, + "armTemplateVersion": {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", + "provisioningState": "Succeeded", "timestamp": "0001-01-01T00:00:00Z", "duration": + "PT0S", "correlationId": "9c1c1019-f166-4984-9a5a-563ef983f22e", "providers": + [{"namespace": "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": + "publishers/artifactStores/artifactManifests", "locations": ["westcentralus"]}]}], + "dependencies": [], "validatedResources": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1382' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:39 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 4EB9AF42B2CD4989BC70898FE767AD53 Ref B: AMS231020615031 Ref C: 2023-08-23T13:30:37Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "17545683377380589662"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "acrManifestNames": {"type": "array", "metadata": {"description": + "Name of the manifest to deploy for the ACR-backed Artifact Store"}}, "armTemplateNames": + {"type": "array", "metadata": {"description": "The name under which to store + the ARM template"}}, "armTemplateVersion": {"type": "string", "metadata": {"description": + "The version that you want to name the NFM template artifact, in format A.B.C. + e.g. 6.13.0. If testing for development, you can use any numbers you like."}}}, + "resources": [{"copy": {"name": "acrArtifactManifests", "count": "[length(parameters(''armTemplateNames''))]"}, + "type": "Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''), parameters(''acrManifestNames'')[copyIndex()])]", + "location": "[parameters(''location'')]", "properties": {"artifacts": [{"artifactName": + "[parameters(''armTemplateNames'')[copyIndex()]]", "artifactType": "ArmTemplate", + "artifactVersion": "[parameters(''armTemplateVersion'')]"}]}}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "acrManifestNames": {"value": + ["ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"]}, "armTemplateNames": {"value": ["ubuntu-vm-nfdg_nf_artifact"]}, + "armTemplateVersion": {"value": "1.0.0"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '2066' + Content-Type: + - application/json + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797438", + "name": "AOSM_CLI_deployment_1692797438", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "17545683377380589662", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "acrManifestNames": {"type": "Array", "value": ["ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"]}, + "armTemplateNames": {"type": "Array", "value": ["ubuntu-vm-nfdg_nf_artifact"]}, + "armTemplateVersion": {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", + "provisioningState": "Accepted", "timestamp": "2023-08-23T13:30:43.7722632Z", + "duration": "PT0.0009726S", "correlationId": "7f90f114-3f81-4f18-94de-580f60f7a59b", + "providers": [{"namespace": "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": + "publishers/artifactStores/artifactManifests", "locations": ["westcentralus"]}]}], + "dependencies": []}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797438/operationStatuses/08585088094436682194?api-version=2022-09-01 + cache-control: + - no-cache + content-length: + - '1129' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:43 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 00E5D69722524978A294B0813D542FF9 Ref B: AMS231020615031 Ref C: 2023-08-23T13:30:40Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088094436682194?api-version=2022-09-01 + response: + body: + string: '{"status": "Accepted"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:30:44 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A72A36EFB5B745E880E6EB2735401BC7 Ref B: AMS231020615031 Ref C: 2023-08-23T13:30:44Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "name": "4def94e6-3ee5-4515-a8ef-2cc9bdd5d4c1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "status": "Succeeded", "startTime": "2023-08-23T13:30:31.7812516Z", "endTime": + "2023-08-23T13:30:34.226154Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '634' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:03 GMT + etag: + - '"63009ab9-0000-0600-0000-64e609fa0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 83192A9F1F8E42359F1BE3B3B36FFC60 Ref B: AMS231022012009 Ref C: 2023-08-23T13:31:03Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "name": "ubuntu", "type": "microsoft.hybridnetwork/publishers/networkservicedesigngroups", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:30:30.6866919Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:30:30.6866919Z"}, "properties": {"description": null, "provisioningState": + "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '641' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:04 GMT + etag: + - '"0200016d-0000-0600-0000-64e609fa0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 9E6AEA6AF14E47A18DF246286684F90A Ref B: AMS231022012009 Ref C: 2023-08-23T13:31:04Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088094436682194?api-version=2022-09-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '23' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: BEF52F6203E64CF189CFD7EFEE0F0552 Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:15Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797438", + "name": "AOSM_CLI_deployment_1692797438", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "17545683377380589662", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "acrManifestNames": {"type": "Array", "value": ["ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"]}, + "armTemplateNames": {"type": "Array", "value": ["ubuntu-vm-nfdg_nf_artifact"]}, + "armTemplateVersion": {"type": "String", "value": "1.0.0"}}, "mode": "Incremental", + "provisioningState": "Succeeded", "timestamp": "2023-08-23T13:31:11.9432594Z", + "duration": "PT28.1719688S", "correlationId": "7f90f114-3f81-4f18-94de-580f60f7a59b", + "providers": [{"namespace": "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": + "publishers/artifactStores/artifactManifests", "locations": ["westcentralus"]}]}], + "dependencies": [], "outputResources": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '1396' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: CFC0013E8026411580FC5E620EE6F8A3 Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:15Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "5575727561962422040"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "nsDesignGroup": {"type": "string", "metadata": {"description": + "Name of an existing Network Service Design Group"}}, "nsDesignVersion": {"type": + "string", "metadata": {"description": "The version of the NSDV you want to create, + in format A.B.C"}}, "nfviSiteName": {"type": "string", "defaultValue": "ubuntu_NFVI", + "metadata": {"description": "Name of the nfvi site"}}}, "variables": {"$fxv#0": + {"$schema": "https://json-schema.org/draft-07/schema#", "title": "ubuntu_ConfigGroupSchema", + "type": "object", "properties": {"ubuntu-vm-nfdg": {"type": "object", "properties": + {"deploymentParameters": {"type": "object", "properties": {"location": {"type": + "string"}, "subnetName": {"type": "string"}, "ubuntuVmName": {"type": "string"}, + "virtualNetworkId": {"type": "string"}, "sshPublicKeyAdmin": {"type": "string"}}}, + "ubuntu_vm_nfdg_nfd_version": {"type": "string", "description": "The version + of the ubuntu-vm-nfdg NFD to use. This version must be compatible with (have + the same parameters exposed as) ubuntu-vm-nfdg."}}, "required": ["deploymentParameters", + "ubuntu_vm_nfdg_nfd_version"]}, "managedIdentity": {"type": "string", "description": + "The managed identity to use to deploy NFs within this SNS. This should be + of the form ''/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. If + you wish to use a system assigned identity, set this to a blank string."}}, + "required": ["ubuntu-vm-nfdg", "managedIdentity"]}, "$fxv#1": {"deploymentParameters": + ["{configurationparameters(''ubuntu_ConfigGroupSchema'').ubuntu-vm-nfdg.deploymentParameters}"], + "ubuntu_vm_nfdg_nfd_version": "{configurationparameters(''ubuntu_ConfigGroupSchema'').ubuntu-vm-nfdg.ubuntu_vm_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters(''ubuntu_ConfigGroupSchema'').managedIdentity}"}}, + "resources": [{"type": "Microsoft.Hybridnetwork/publishers/configurationGroupSchemas", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}'', parameters(''publisherName''), + ''ubuntu_ConfigGroupSchema'')]", "location": "[parameters(''location'')]", "properties": + {"schemaDefinition": "[string(variables(''$fxv#0''))]"}}, {"type": "Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''nsDesignGroup''), parameters(''nsDesignVersion''))]", "location": + "[parameters(''location'')]", "properties": {"description": "Plain ubuntu VM", + "versionState": "Preview", "configurationGroupSchemaReferences": {"ubuntu_ConfigGroupSchema": + {"id": "[resourceId(''Microsoft.Hybridnetwork/publishers/configurationGroupSchemas'', + parameters(''publisherName''), ''ubuntu_ConfigGroupSchema'')]"}}, "nfvisFromSite": + {"nfvi1": {"name": "[parameters(''nfviSiteName'')]", "type": "AzureCore"}}, + "resourceElementTemplates": [{"name": "ubuntu-vm-nfdg_nf_artifact_resource_element", + "type": "NetworkFunctionDefinition", "configuration": {"artifactProfile": {"artifactStoreReference": + {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''))]"}, "artifactName": "ubuntu-vm-nfdg_nf_artifact", + "artifactVersion": "1.0.0"}, "templateType": "ArmTemplate", "parameterValues": + "[string(variables(''$fxv#1''))]"}, "dependsOnProfile": {"installDependsOn": + [], "uninstallDependsOn": [], "updateDependsOn": []}}]}, "dependsOn": ["[resourceId(''Microsoft.Hybridnetwork/publishers/configurationGroupSchemas'', + parameters(''publisherName''), ''ubuntu_ConfigGroupSchema'')]"]}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "nsDesignGroup": {"value": + "ubuntu"}, "nsDesignVersion": {"value": "1.0.0"}, "nfviSiteName": {"value": + "ubuntu_NFVI"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '4530' + Content-Type: + - application/json + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797481", + "name": "AOSM_CLI_deployment_1692797481", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "5575727561962422040", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "nsDesignGroup": {"type": "String", "value": "ubuntu"}, "nsDesignVersion": + {"type": "String", "value": "1.0.0"}, "nfviSiteName": {"type": "String", "value": + "ubuntu_NFVI"}}, "mode": "Incremental", "provisioningState": "Succeeded", + "timestamp": "0001-01-01T00:00:00Z", "duration": "PT0S", "correlationId": + "f1cd0986-fe37-4089-b01d-101c1525ada1", "providers": [{"namespace": "Microsoft.Hybridnetwork", + "resourceTypes": [{"resourceType": "publishers/configurationGroupSchemas", + "locations": ["westcentralus"]}, {"resourceType": "publishers/networkservicedesigngroups/networkservicedesignversions", + "locations": ["westcentralus"]}]}], "dependencies": [{"dependsOn": [{"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "resourceType": "Microsoft.Hybridnetwork/publishers/configurationGroupSchemas", + "resourceName": "ubuntuPublisher/ubuntu_ConfigGroupSchema"}], "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkservicedesigngroups/ubuntu/networkservicedesignversions/1.0.0", + "resourceType": "Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions", + "resourceName": "ubuntuPublisher/ubuntu/1.0.0"}], "validatedResources": [{"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkservicedesigngroups/ubuntu/networkservicedesignversions/1.0.0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '2396' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:22 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-msedge-ref: + - 'Ref A: AEDC0CCE94AB44CD9E2F451CC82BE293 Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:20Z' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": + "0.8.9.13224", "templateHash": "5575727561962422040"}}, "parameters": {"location": + {"type": "string"}, "publisherName": {"type": "string", "metadata": {"description": + "Name of an existing publisher, expected to be in the resource group where you + deploy the template"}}, "acrArtifactStoreName": {"type": "string", "metadata": + {"description": "Name of an existing ACR-backed Artifact Store, deployed under + the publisher."}}, "nsDesignGroup": {"type": "string", "metadata": {"description": + "Name of an existing Network Service Design Group"}}, "nsDesignVersion": {"type": + "string", "metadata": {"description": "The version of the NSDV you want to create, + in format A.B.C"}}, "nfviSiteName": {"type": "string", "defaultValue": "ubuntu_NFVI", + "metadata": {"description": "Name of the nfvi site"}}}, "variables": {"$fxv#0": + {"$schema": "https://json-schema.org/draft-07/schema#", "title": "ubuntu_ConfigGroupSchema", + "type": "object", "properties": {"ubuntu-vm-nfdg": {"type": "object", "properties": + {"deploymentParameters": {"type": "object", "properties": {"location": {"type": + "string"}, "subnetName": {"type": "string"}, "ubuntuVmName": {"type": "string"}, + "virtualNetworkId": {"type": "string"}, "sshPublicKeyAdmin": {"type": "string"}}}, + "ubuntu_vm_nfdg_nfd_version": {"type": "string", "description": "The version + of the ubuntu-vm-nfdg NFD to use. This version must be compatible with (have + the same parameters exposed as) ubuntu-vm-nfdg."}}, "required": ["deploymentParameters", + "ubuntu_vm_nfdg_nfd_version"]}, "managedIdentity": {"type": "string", "description": + "The managed identity to use to deploy NFs within this SNS. This should be + of the form ''/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. If + you wish to use a system assigned identity, set this to a blank string."}}, + "required": ["ubuntu-vm-nfdg", "managedIdentity"]}, "$fxv#1": {"deploymentParameters": + ["{configurationparameters(''ubuntu_ConfigGroupSchema'').ubuntu-vm-nfdg.deploymentParameters}"], + "ubuntu_vm_nfdg_nfd_version": "{configurationparameters(''ubuntu_ConfigGroupSchema'').ubuntu-vm-nfdg.ubuntu_vm_nfdg_nfd_version}", + "managedIdentity": "{configurationparameters(''ubuntu_ConfigGroupSchema'').managedIdentity}"}}, + "resources": [{"type": "Microsoft.Hybridnetwork/publishers/configurationGroupSchemas", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}'', parameters(''publisherName''), + ''ubuntu_ConfigGroupSchema'')]", "location": "[parameters(''location'')]", "properties": + {"schemaDefinition": "[string(variables(''$fxv#0''))]"}}, {"type": "Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions", + "apiVersion": "2023-04-01-preview", "name": "[format(''{0}/{1}/{2}'', parameters(''publisherName''), + parameters(''nsDesignGroup''), parameters(''nsDesignVersion''))]", "location": + "[parameters(''location'')]", "properties": {"description": "Plain ubuntu VM", + "versionState": "Preview", "configurationGroupSchemaReferences": {"ubuntu_ConfigGroupSchema": + {"id": "[resourceId(''Microsoft.Hybridnetwork/publishers/configurationGroupSchemas'', + parameters(''publisherName''), ''ubuntu_ConfigGroupSchema'')]"}}, "nfvisFromSite": + {"nfvi1": {"name": "[parameters(''nfviSiteName'')]", "type": "AzureCore"}}, + "resourceElementTemplates": [{"name": "ubuntu-vm-nfdg_nf_artifact_resource_element", + "type": "NetworkFunctionDefinition", "configuration": {"artifactProfile": {"artifactStoreReference": + {"id": "[resourceId(''Microsoft.HybridNetwork/publishers/artifactStores'', parameters(''publisherName''), + parameters(''acrArtifactStoreName''))]"}, "artifactName": "ubuntu-vm-nfdg_nf_artifact", + "artifactVersion": "1.0.0"}, "templateType": "ArmTemplate", "parameterValues": + "[string(variables(''$fxv#1''))]"}, "dependsOnProfile": {"installDependsOn": + [], "uninstallDependsOn": [], "updateDependsOn": []}}]}, "dependsOn": ["[resourceId(''Microsoft.Hybridnetwork/publishers/configurationGroupSchemas'', + parameters(''publisherName''), ''ubuntu_ConfigGroupSchema'')]"]}]}, "parameters": + {"location": {"value": "westcentralus"}, "publisherName": {"value": "ubuntuPublisher"}, + "acrArtifactStoreName": {"value": "ubuntu-acr"}, "nsDesignGroup": {"value": + "ubuntu"}, "nsDesignVersion": {"value": "1.0.0"}, "nfviSiteName": {"value": + "ubuntu_NFVI"}}, "mode": "Incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '4530' + Content-Type: + - application/json + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797481", + "name": "AOSM_CLI_deployment_1692797481", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "5575727561962422040", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "nsDesignGroup": {"type": "String", "value": "ubuntu"}, "nsDesignVersion": + {"type": "String", "value": "1.0.0"}, "nfviSiteName": {"type": "String", "value": + "ubuntu_NFVI"}}, "mode": "Incremental", "provisioningState": "Accepted", "timestamp": + "2023-08-23T13:31:27.2990528Z", "duration": "PT0.0004229S", "correlationId": + "53d62bd6-e5d3-4708-a419-d70b0eb5003a", "providers": [{"namespace": "Microsoft.Hybridnetwork", + "resourceTypes": [{"resourceType": "publishers/configurationGroupSchemas", + "locations": ["westcentralus"]}, {"resourceType": "publishers/networkservicedesigngroups/networkservicedesignversions", + "locations": ["westcentralus"]}]}], "dependencies": [{"dependsOn": [{"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "resourceType": "Microsoft.Hybridnetwork/publishers/configurationGroupSchemas", + "resourceName": "ubuntuPublisher/ubuntu_ConfigGroupSchema"}], "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkservicedesigngroups/ubuntu/networkservicedesignversions/1.0.0", + "resourceType": "Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions", + "resourceName": "ubuntuPublisher/ubuntu/1.0.0"}]}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797481/operationStatuses/08585088094002750011?api-version=2022-09-01 + cache-control: + - no-cache + content-length: + - '1941' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:27 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 76DFD44B4005452094E20DFB79AFADE7 Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:23Z' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088094002750011?api-version=2022-09-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '21' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 177AA8789D404E2F93DF46215FFF8BDE Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:28Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088094002750011?api-version=2022-09-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '21' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:31:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: C677E530E60042C1A8FD8B9352583E88 Ref B: AMS231020615031 Ref C: 2023-08-23T13:31:59Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585088094002750011?api-version=2022-09-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '23' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 81F2D4A3A4384530BBEF27041FE8186D Ref B: AMS231020615031 Ref C: 2023-08-23T13:32:29Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.8.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2022-09-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Resources/deployments/AOSM_CLI_deployment_1692797481", + "name": "AOSM_CLI_deployment_1692797481", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "5575727561962422040", "parameters": {"location": + {"type": "String", "value": "westcentralus"}, "publisherName": {"type": "String", + "value": "ubuntuPublisher"}, "acrArtifactStoreName": {"type": "String", "value": + "ubuntu-acr"}, "nsDesignGroup": {"type": "String", "value": "ubuntu"}, "nsDesignVersion": + {"type": "String", "value": "1.0.0"}, "nfviSiteName": {"type": "String", "value": + "ubuntu_NFVI"}}, "mode": "Incremental", "provisioningState": "Succeeded", + "timestamp": "2023-08-23T13:32:18.3636965Z", "duration": "PT51.0650666S", + "correlationId": "53d62bd6-e5d3-4708-a419-d70b0eb5003a", "providers": [{"namespace": + "Microsoft.Hybridnetwork", "resourceTypes": [{"resourceType": "publishers/configurationGroupSchemas", + "locations": ["westcentralus"]}, {"resourceType": "publishers/networkservicedesigngroups/networkservicedesignversions", + "locations": ["westcentralus"]}]}], "dependencies": [{"dependsOn": [{"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "resourceType": "Microsoft.Hybridnetwork/publishers/configurationGroupSchemas", + "resourceName": "ubuntuPublisher/ubuntu_ConfigGroupSchema"}], "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkservicedesigngroups/ubuntu/networkservicedesignversions/1.0.0", + "resourceType": "Microsoft.Hybridnetwork/publishers/networkservicedesigngroups/networkservicedesignversions", + "resourceName": "ubuntuPublisher/ubuntu/1.0.0"}], "outputResources": [{"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/networkservicedesigngroups/ubuntu/networkservicedesignversions/1.0.0"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '2410' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A7BE932F5D5B4902898091B4FFB692E9 Ref B: AMS231020615031 Ref C: 2023-08-23T13:32:30Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.Hybridnetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", + "name": "ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", "type": "microsoft.hybridnetwork/publishers/artifactstores/artifactmanifests", + "location": "westcentralus", "systemData": {"createdBy": "patrykkulik@microsoft.com", + "createdByType": "User", "createdAt": "2023-08-23T13:30:47.9525391Z", "lastModifiedBy": + "patrykkulik@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2023-08-23T13:30:47.9525391Z"}, "properties": {"artifacts": [{"artifactName": + "ubuntu-vm-nfdg_nf_artifact", "artifactType": "ArmTemplate", "artifactVersion": + "1.0.0"}], "artifactManifestState": "Uploading", "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '863' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:31 GMT + etag: + - '"1d0042c4-0000-0600-0000-64e60a190000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 325BA79E57EC4A319A464EEF50275A43 Ref B: AMS231020614049 Ref C: 2023-08-23T13:32:30Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd publish + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0/listCredential?api-version=2023-04-01-preview + response: + body: + string: '{"username": "ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", "acrToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "acrServerUrl": "https://ubuntupublisherubuntuacr150b526dfd.azurecr.io", "repositories": + ["ubuntu-vm-nfdg_nf_artifact"], "expiry": "2023-08-24T13:32:32.9691096+00:00", + "credentialType": "AzureContainerRegistryScopedToken"}' + headers: + cache-control: + - no-cache + content-length: + - '343' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:33 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: B7E922860FDC4CA39A522E00720F2C67 Ref B: AMS231020614049 Ref C: 2023-08-23T13:32:31Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/ + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '310' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:38 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-nfdg_nf_artifact:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-nfdg_nf_artifact%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:38 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.316667' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/ + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:32:38 GMT + docker-distribution-api-version: + - registry/2.0 + docker-upload-uuid: + - d7ac81d7-41be-43d7-9414-cc4007859f13 + location: + - /v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/d7ac81d7-41be-43d7-9414-cc4007859f13?_nouploadcache=false&_state=L0xV913E0cG0kpbDOqEaSXVszIcujT3pkWbi6nOYol17Ik5hbWUiOiJ1YnVudHUtdm0tbmZkZ19uZl9hcnRpZmFjdCIsIlVVSUQiOiJkN2FjODFkNy00MWJlLTQzZDctOTQxNC1jYzQwMDc4NTlmMTMiLCJPZmZzZXQiOjAsIlN0YXJ0ZWRBdCI6IjIwMjMtMDgtMjNUMTM6MzI6MzguNTU3NDU1NzJaIn0%3D + range: + - 0-0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: "{\n \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n + \ \"contentVersion\": \"1.0.0.0\",\n \"metadata\": {\n \"_generator\": + {\n \"name\": \"bicep\",\n \"version\": \"0.8.9.13224\",\n + \ \"templateHash\": \"9178335578538463634\"\n }\n },\n \"parameters\": + {\n \"publisherName\": {\n \"type\": \"string\",\n \"defaultValue\": + \"ubuntuPublisher\",\n \"metadata\": {\n \"description\": + \"Publisher where the NFD is published\"\n }\n },\n \"networkFunctionDefinitionGroupName\": + {\n \"type\": \"string\",\n \"defaultValue\": \"ubuntu-vm-nfdg\",\n + \ \"metadata\": {\n \"description\": \"NFD Group name + for the Network Function\"\n }\n },\n \"ubuntu_vm_nfdg_nfd_version\": + {\n \"type\": \"string\",\n \"metadata\": {\n \"description\": + \"NFD version\"\n }\n },\n \"networkFunctionDefinitionOfferingLocation\": + {\n \"type\": \"string\",\n \"defaultValue\": \"westcentralus\",\n + \ \"metadata\": {\n \"description\": \"Offering location + for the Network Function\"\n }\n },\n \"managedIdentity\": + {\n \"type\": \"string\",\n \"metadata\": {\n \"description\": + \"The managed identity that should be used to create the NF.\"\n }\n + \ },\n \"location\": {\n \"type\": \"string\",\n \"defaultValue\": + \"westcentralus\"\n },\n \"nfviType\": {\n \"type\": + \"string\",\n \"defaultValue\": \"AzureCore\"\n },\n \"resourceGroupId\": + {\n \"type\": \"string\",\n \"defaultValue\": \"[resourceGroup().id]\"\n + \ },\n \"deploymentParameters\": {\n \"type\": \"array\"\n + \ }\n },\n \"variables\": {\n \"identityObject\": \"[if(equals(parameters('managedIdentity'), + ''), createObject('type', 'SystemAssigned'), createObject('type', 'UserAssigned', + 'userAssignedIdentities', createObject(format('{0}', parameters('managedIdentity')), + createObject())))]\"\n },\n \"resources\": [\n {\n \"copy\": + {\n \"name\": \"nf_resource\",\n \"count\": \"[length(parameters('deploymentParameters'))]\"\n + \ },\n \"type\": \"Microsoft.HybridNetwork/networkFunctions\",\n + \ \"apiVersion\": \"2023-04-01-preview\",\n \"name\": \"[format('ubuntu-vm-nfdg{0}', + copyIndex())]\",\n \"location\": \"[parameters('location')]\",\n + \ \"identity\": \"[variables('identityObject')]\",\n \"properties\": + {\n \"publisherName\": \"[parameters('publisherName')]\",\n \"publisherScope\": + \"Private\",\n \"networkFunctionDefinitionGroupName\": \"[parameters('networkFunctionDefinitionGroupName')]\",\n + \ \"networkFunctionDefinitionVersion\": \"[parameters('ubuntu_vm_nfdg_nfd_version')]\",\n + \ \"networkFunctionDefinitionOfferingLocation\": \"[parameters('networkFunctionDefinitionOfferingLocation')]\",\n + \ \"nfviType\": \"[parameters('nfviType')]\",\n \"nfviId\": + \"[parameters('resourceGroupId')]\",\n \"allowSoftwareUpdate\": + true,\n \"deploymentValues\": \"[string(parameters('deploymentParameters')[copyIndex()])]\"\n + \ }\n }\n ]\n}" + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3339' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/d7ac81d7-41be-43d7-9414-cc4007859f13?_nouploadcache=false&_state=L0xV913E0cG0kpbDOqEaSXVszIcujT3pkWbi6nOYol17Ik5hbWUiOiJ1YnVudHUtdm0tbmZkZ19uZl9hcnRpZmFjdCIsIlVVSUQiOiJkN2FjODFkNy00MWJlLTQzZDctOTQxNC1jYzQwMDc4NTlmMTMiLCJPZmZzZXQiOjAsIlN0YXJ0ZWRBdCI6IjIwMjMtMDgtMjNUMTM6MzI6MzguNTU3NDU1NzJaIn0%3D&digest=sha256%3A74456c769ca631208db3437888cb962133f504715a93a544577206d00ae07a45 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:32:38 GMT + docker-content-digest: + - sha256:74456c769ca631208db3437888cb962133f504715a93a544577206d00ae07a45 + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-nfdg_nf_artifact/blobs/sha256:74456c769ca631208db3437888cb962133f504715a93a544577206d00ae07a45 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/ + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '310' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:38 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-nfdg_nf_artifact:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-nfdg_nf_artifact%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:39 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.3' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: POST + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/ + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:32:39 GMT + docker-distribution-api-version: + - registry/2.0 + docker-upload-uuid: + - b34ace2f-d9e2-4dc4-97bc-d4117d1c89e7 + location: + - /v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/b34ace2f-d9e2-4dc4-97bc-d4117d1c89e7?_nouploadcache=false&_state=tqHACiRaNGY5frW8328toDDJG-ZQZcO7_2B1bctfr_57Ik5hbWUiOiJ1YnVudHUtdm0tbmZkZ19uZl9hcnRpZmFjdCIsIlVVSUQiOiJiMzRhY2UyZi1kOWUyLTRkYzQtOTdiYy1kNDExN2QxYzg5ZTciLCJPZmZzZXQiOjAsIlN0YXJ0ZWRBdCI6IjIwMjMtMDgtMjNUMTM6MzI6MzkuMzAyNjI3MzUyWiJ9 + range: + - 0-0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/octet-stream + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/blobs/uploads/b34ace2f-d9e2-4dc4-97bc-d4117d1c89e7?_nouploadcache=false&_state=tqHACiRaNGY5frW8328toDDJG-ZQZcO7_2B1bctfr_57Ik5hbWUiOiJ1YnVudHUtdm0tbmZkZ19uZl9hcnRpZmFjdCIsIlVVSUQiOiJiMzRhY2UyZi1kOWUyLTRkYzQtOTdiYy1kNDExN2QxYzg5ZTciLCJPZmZzZXQiOjAsIlN0YXJ0ZWRBdCI6IjIwMjMtMDgtMjNUMTM6MzI6MzkuMzAyNjI3MzUyWiJ9&digest=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:32:39 GMT + docker-content-digest: + - sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-nfdg_nf_artifact/blobs/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: '{"schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", + "config": {"mediaType": "application/vnd.unknown.config.v1+json", "size": 0, + "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, + "layers": [{"mediaType": "application/vnd.oci.image.layer.v1.tar", "size": 3339, + "digest": "sha256:74456c769ca631208db3437888cb962133f504715a93a544577206d00ae07a45", + "annotations": {"org.opencontainers.image.title": "nf_definition.json"}}], "annotations": + {}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '502' + Content-Type: + - application/vnd.oci.image.manifest.v1+json + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/manifests/1.0.0 + response: + body: + string: '{"errors": [{"code": "UNAUTHORIZED", "message": "authentication required, + visit https://aka.ms/acr/authorization for more information.", "detail": [{"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "pull"}, {"Type": + "repository", "Name": "ubuntu-vm-nfdg_nf_artifact", "Action": "push"}]}]}' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '310' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:39 GMT + docker-distribution-api-version: + - registry/2.0 + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + www-authenticate: + - Bearer realm="https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token",service="ubuntupublisherubuntuacr150b526dfd.azurecr.io",scope="repository:ubuntu-vm-nfdg_nf_artifact:pull,push" + x-content-type-options: + - nosniff + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Service: + - ubuntupublisherubuntuacr150b526dfd.azurecr.io + User-Agent: + - oras-py + method: GET + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/oauth2/token?service=ubuntupublisherubuntuacr150b526dfd.azurecr.io&scope=repository%3Aubuntu-vm-nfdg_nf_artifact%3Apull%2Cpush + response: + body: + string: '{"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}' + headers: + connection: + - keep-alive + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:39 GMT + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + x-ms-ratelimit-remaining-calls-per-second: + - '333.283333' + status: + code: 200 + message: OK +- request: + body: '{"schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", + "config": {"mediaType": "application/vnd.unknown.config.v1+json", "size": 0, + "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, + "layers": [{"mediaType": "application/vnd.oci.image.layer.v1.tar", "size": 3339, + "digest": "sha256:74456c769ca631208db3437888cb962133f504715a93a544577206d00ae07a45", + "annotations": {"org.opencontainers.image.title": "nf_definition.json"}}], "annotations": + {}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '502' + Content-Type: + - application/vnd.oci.image.manifest.v1+json + User-Agent: + - python-requests/2.26.0 + method: PUT + uri: https://ubuntupublisherubuntuacr150b526dfd.azurecr.io/v2/ubuntu-vm-nfdg_nf_artifact/manifests/1.0.0 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Docker-Content-Digest + - WWW-Authenticate + - Link + - X-Ms-Correlation-Request-Id + connection: + - keep-alive + content-length: + - '0' + date: + - Wed, 23 Aug 2023 13:32:40 GMT + docker-content-digest: + - sha256:ede017e9949c70e3393ee2de9556ea73fcb605b163f646cd87d6439710b4104c + docker-distribution-api-version: + - registry/2.0 + location: + - /v2/ubuntu-vm-nfdg_nf_artifact/manifests/sha256:ede017e9949c70e3393ee2de9556ea73fcb605b163f646cd87d6439710b4104c + server: + - openresty + strict-transport-security: + - max-age=31536000; includeSubDomains + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu/networkServiceDesignVersions/1.0.0?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:42 GMT + etag: + - '"a0035831-0000-0600-0000-64e60a7a0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 4C41377DFE1E4D6EA148C484C1F83608 Ref B: AMS231032609025 Ref C: 2023-08-23T13:32:40Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "name": "276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu/networkServiceDesignVersions/1.0.0", + "status": "Deleting", "startTime": "2023-08-23T13:32:42.1711762Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '606' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:32:43 GMT + etag: + - '"6300c5b9-0000-0600-0000-64e60a7a0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A755CD994AA84170BF82C4CEFB024F55 Ref B: AMS231032609025 Ref C: 2023-08-23T13:32:42Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "name": "276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu/networkServiceDesignVersions/1.0.0", + "status": "Succeeded", "startTime": "2023-08-23T13:32:42.1711762Z", "endTime": + "2023-08-23T13:32:45.2195576Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '670' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:13 GMT + etag: + - '"6300cab9-0000-0600-0000-64e60a7d0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: EA1EC7F1E2B243B1AA6739FBDD239B88 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:13Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "name": "276121fd-a290-48b0-b0dd-35feebe8d904*A50ADB58CC78327F633AC4D297D1CB3A713A96FCB08A88EDDCEC45E61072A5CC", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu/networkServiceDesignVersions/1.0.0", + "status": "Succeeded", "startTime": "2023-08-23T13:32:42.1711762Z", "endTime": + "2023-08-23T13:32:45.2195576Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '670' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:14 GMT + etag: + - '"6300cab9-0000-0600-0000-64e60a7d0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 673131B7DD924458B78463C58798BE51 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:14Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:17 GMT + etag: + - '"1d0093c6-0000-0600-0000-64e60a9d0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 7CC6302F1C69463DAAF06E892AC5C071 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:14Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "name": "60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", + "status": "Deleting", "startTime": "2023-08-23T13:33:17.3000971Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:17 GMT + etag: + - '"0b00dcc7-0000-0600-0000-64e60a9d0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 9FADAF0A865545748145B3EEECBCE89D Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:17Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "name": "60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:33:17.3000971Z", "endTime": + "2023-08-23T13:33:26.1127374Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '682' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:48 GMT + etag: + - '"0b00ecc7-0000-0600-0000-64e60aa60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0A3B21235F174670BF72C2223DAB5DD3 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:48Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "name": "60f437c5-493c-4351-b0cf-fbb16cae4c41*D73C2263A1F158E93995743B75A119F392504048ACA9609F0A5C966BDD020109", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-nfdg-nf-acr-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:33:17.3000971Z", "endTime": + "2023-08-23T13:33:26.1127374Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '682' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:49 GMT + etag: + - '"0b00ecc7-0000-0600-0000-64e60aa60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 1A28E0914E2949FC9B59B5A564109578 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:49Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:51 GMT + etag: + - '"a2002808-0000-0600-0000-64e60ac00000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 8BE8C25960CE454FBE941FE45351D50B Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:50Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "name": "d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "status": "Deleting", "startTime": "2023-08-23T13:33:51.7898419Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '588' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:33:51 GMT + etag: + - '"0b0005c8-0000-0600-0000-64e60abf0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 744263D4C1FB48BBA6E05046E61991B9 Ref B: AMS231032609025 Ref C: 2023-08-23T13:33:52Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "name": "d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "status": "Succeeded", "startTime": "2023-08-23T13:33:51.7898419Z", "endTime": + "2023-08-23T13:33:55.9280871Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '652' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:22 GMT + etag: + - '"0b0006c8-0000-0600-0000-64e60ac30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: FD49CF495CCE4269974647DED9352EFD Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:22Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "name": "d5dd5283-fd87-4531-89a6-321dbfec5554*79C6A856D2B641B87046EF811AA0E881CB2BEC20ABB5B9E687F39CB19BC7DAC1", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/configurationGroupSchemas/ubuntu_ConfigGroupSchema", + "status": "Succeeded", "startTime": "2023-08-23T13:33:51.7898419Z", "endTime": + "2023-08-23T13:33:55.9280871Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '652' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:22 GMT + etag: + - '"0b0006c8-0000-0600-0000-64e60ac30000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: B712C598D7BD40F1B41C14835882FCFA Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:23Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:25 GMT + etag: + - '"0200356d-0000-0600-0000-64e60ae10000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: DD8FF40C8D2D4B7990BC4CAA81AF76AA Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:23Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "name": "5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "status": "Deleting", "startTime": "2023-08-23T13:34:25.3977649Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '571' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:25 GMT + etag: + - '"630011ba-0000-0600-0000-64e60ae10000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D4B54D8C188B444193437D2F474FDC58 Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:25Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "name": "5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "status": "Succeeded", "startTime": "2023-08-23T13:34:25.3977649Z", "endTime": + "2023-08-23T13:34:29.5243594Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '635' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:57 GMT + etag: + - '"630014ba-0000-0600-0000-64e60ae50000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: ECABE8A194A34BF596149CBDB753C523 Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:57Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nsd delete + Connection: + - keep-alive + ParameterSetName: + - -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "name": "5bc1815d-c503-4e53-bf21-14f666fb83a1*8764BC89B0DD8DA53580470B87E55AC3EF94DDE2BC5F6B58B507AE1D6B321C98", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkServiceDesignGroups/ubuntu", + "status": "Succeeded", "startTime": "2023-08-23T13:34:25.3977649Z", "endTime": + "2023-08-23T13:34:29.5243594Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '635' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:57 GMT + etag: + - '"630014ba-0000-0600-0000-64e60ae50000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 36FBF718BD3744D4B8FDED303B7707A8 Ref B: AMS231032609025 Ref C: 2023-08-23T13:34:57Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:34:59 GMT + etag: + - '"0000edac-0000-0600-0000-64e60b040000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: E12C3C7DF4F84CB997CCDA76F0FEF89D Ref B: AMS231020614045 Ref C: 2023-08-23T13:34:58Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "name": "6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0", + "status": "Deleting", "startTime": "2023-08-23T13:34:59.9260009Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:35:00 GMT + etag: + - '"630021ba-0000-0600-0000-64e60b030000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 1853A86F4A3E41D2BA4D72F6721AF974 Ref B: AMS231020614045 Ref C: 2023-08-23T13:35:00Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "name": "6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0", + "status": "Deleting", "startTime": "2023-08-23T13:34:59.9260009Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:35:30 GMT + etag: + - '"630021ba-0000-0600-0000-64e60b030000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: F58508CE90B5425DB2F8F68B78EA748A Ref B: AMS231020614045 Ref C: 2023-08-23T13:35:30Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "name": "6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0", + "status": "Deleting", "startTime": "2023-08-23T13:34:59.9260009Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:36:01 GMT + etag: + - '"630021ba-0000-0600-0000-64e60b030000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 7A06FAA331024C4CBB6CC86D0B1E9163 Ref B: AMS231020614045 Ref C: 2023-08-23T13:36:01Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "name": "6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0", + "status": "Succeeded", "startTime": "2023-08-23T13:34:59.9260009Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '645' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:36:32 GMT + etag: + - '"49002ef1-0000-0100-0000-64e60b470000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: D0D2FA46463A4D01B1D88B1D9EFE7F73 Ref B: AMS231020614045 Ref C: 2023-08-23T13:36:32Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "name": "6edfca8b-f3a6-4176-89a8-4b532eb53e5b*4560AE05C5F1D5C0708CB0E8D0296D298F9DB5F78C8224EC59E9B8DC93624054", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg/networkFunctionDefinitionVersions/1.0.0", + "status": "Succeeded", "startTime": "2023-08-23T13:34:59.9260009Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '645' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:36:32 GMT + etag: + - '"49002ef1-0000-0100-0000-64e60b470000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 03F328AFFFFC4C1DAB65E6A7EE6DB76A Ref B: AMS231020614045 Ref C: 2023-08-23T13:36:32Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:36:34 GMT + etag: + - '"1d00f6c9-0000-0600-0000-64e60b630000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 567C0589C3074D0BBC09E91ABB76ABB8 Ref B: AMS231020614045 Ref C: 2023-08-23T13:36:33Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "name": "383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0", + "status": "Deleting", "startTime": "2023-08-23T13:36:34.8633292Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '616' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:36:35 GMT + etag: + - '"630058ba-0000-0600-0000-64e60b620000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 72DA3EA496C94FF693979117BC3F25D9 Ref B: AMS231020614045 Ref C: 2023-08-23T13:36:35Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "name": "383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:36:34.8633292Z", "endTime": + "2023-08-23T13:36:38.5071949Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '680' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:05 GMT + etag: + - '"63005bba-0000-0600-0000-64e60b660000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: ADA546F564F8430AADFC1ED17885D2BD Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:05Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "name": "383a9cbc-7d68-489c-a5a4-6645bf6a5d40*098ACB5ED11E22748F18624AC3E397767D9CCC45196F88787A90BD39DB4CD5B4", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store/artifactManifests/ubuntu-vm-sa-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:36:34.8633292Z", "endTime": + "2023-08-23T13:36:38.5071949Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '680' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:06 GMT + etag: + - '"63005bba-0000-0600-0000-64e60b660000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: FF167B225D954D729BF5058F9EAEBF1A Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:05Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:08 GMT + etag: + - '"1d006eca-0000-0600-0000-64e60b840000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 826F9EFE6F464D2D83CCAEE7A183E614 Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:06Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "name": "3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0", + "status": "Deleting", "startTime": "2023-08-23T13:37:08.0414638Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '610' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:08 GMT + etag: + - '"63007aba-0000-0600-0000-64e60b840000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 824D4F69177B4A35BF088C9A86192548 Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:08Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "name": "3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:37:08.0414638Z", "endTime": + "2023-08-23T13:37:15.2262422Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '674' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:39 GMT + etag: + - '"63007eba-0000-0600-0000-64e60b8b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0C5414E5E8B64C7E832C9787BD55BF7F Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:39Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "name": "3e02266b-bfcd-4b66-8ffc-b6ee6c09bd55*CA4E056F550749BCAD7F8D946AD9CDFE09A912BF373E25F534F2B00489066634", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr/artifactManifests/ubuntu-vm-acr-manifest-1-0-0", + "status": "Succeeded", "startTime": "2023-08-23T13:37:08.0414638Z", "endTime": + "2023-08-23T13:37:15.2262422Z", "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '674' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:40 GMT + etag: + - '"63007eba-0000-0600-0000-64e60b8b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 6B6B13FB5E834FEA9C7A6C320C91559E Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:40Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:43 GMT + etag: + - '"0800ad51-0000-0600-0000-64e60ba70000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: C4864BF969604504BA5D67FDE1264441 Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:40Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Deleting", "startTime": "2023-08-23T13:37:43.3731362Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:37:43 GMT + etag: + - '"63008aba-0000-0600-0000-64e60ba70000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 619C970AF06745D78331D536982A3C6C Ref B: AMS231020614045 Ref C: 2023-08-23T13:37:43Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Deleting", "startTime": "2023-08-23T13:37:43.3731362Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:38:15 GMT + etag: + - '"63008aba-0000-0600-0000-64e60ba70000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 269049C8AFD749DB991DFFF1F4DC9405 Ref B: AMS231020614045 Ref C: 2023-08-23T13:38:15Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Deleting", "startTime": "2023-08-23T13:37:43.3731362Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:38:44 GMT + etag: + - '"63008aba-0000-0600-0000-64e60ba70000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: AF86EEE2B85E409CADA480CE6B4662E6 Ref B: AMS231020614045 Ref C: 2023-08-23T13:38:44Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Succeeded", "startTime": "2023-08-23T13:37:43.3731362Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '605' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:39:15 GMT + etag: + - '"33007ec4-0000-0700-0000-64e60bea0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 3E34E49448E14E9AAD23EC627D164F6B Ref B: AMS231020614045 Ref C: 2023-08-23T13:39:15Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "name": "86bbfaf7-acf1-4f21-8859-a899235e03b2*00D411DCAB4DA54C7C6B50AD66332A6FA6B320D4E4C8B612D800C8136C9EA7B0", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/networkFunctionDefinitionGroups/ubuntu-vm-nfdg", + "status": "Succeeded", "startTime": "2023-08-23T13:37:43.3731362Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '605' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:39:16 GMT + etag: + - '"33007ec4-0000-0700-0000-64e60bea0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0513AF4BDD5A4C0EA6EBFF68C368457B Ref B: AMS231020614045 Ref C: 2023-08-23T13:39:16Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:39:17 GMT + etag: + - '"15003001-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 09402429A3174C37A2A8C446C92438EB Ref B: AMS231020614045 Ref C: 2023-08-23T13:39:16Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Deleting", "startTime": "2023-08-23T13:39:18.3146329Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:39:18 GMT + etag: + - '"6300b1ba-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0AF7E5E0D485437CBD35458772EBCBB9 Ref B: AMS231020614045 Ref C: 2023-08-23T13:39:18Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Deleting", "startTime": "2023-08-23T13:39:18.3146329Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:39:49 GMT + etag: + - '"6300b1ba-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 4A8ACF9167E94E66A923472F349EF71D Ref B: AMS231020614045 Ref C: 2023-08-23T13:39:49Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Deleting", "startTime": "2023-08-23T13:39:18.3146329Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:40:19 GMT + etag: + - '"6300b1ba-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 328A65FD7E0F485A82D64792788D43BC Ref B: AMS231020614045 Ref C: 2023-08-23T13:40:19Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Deleting", "startTime": "2023-08-23T13:39:18.3146329Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:40:50 GMT + etag: + - '"6300b1ba-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 16F6AA71D0FD43188B929A19300C3AE7 Ref B: AMS231020614045 Ref C: 2023-08-23T13:40:50Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Deleting", "startTime": "2023-08-23T13:39:18.3146329Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:41:21 GMT + etag: + - '"6300b1ba-0000-0600-0000-64e60c060000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 2DDB2CF172884F0A8ABCF8C586D261CA Ref B: AMS231020614045 Ref C: 2023-08-23T13:41:21Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Succeeded", "startTime": "2023-08-23T13:39:18.3146329Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:41:51 GMT + etag: + - '"6300d1ba-0000-0600-0000-64e60c850000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: B6C2AA3CB834473B9EF667CBC2DAFEB5 Ref B: AMS231020614045 Ref C: 2023-08-23T13:41:52Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "name": "1a792c9d-483a-4193-b137-cf9f5b208a10*555C6F2DA6B2F3732AF36E9BDC93870B5B9B34B96AA768E5AF7D460EA7D8C2FF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-acr", + "status": "Succeeded", "startTime": "2023-08-23T13:39:18.3146329Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '584' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:41:52 GMT + etag: + - '"6300d1ba-0000-0600-0000-64e60c850000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 5CD30F0C83114EC7B6C93E13FC46C379 Ref B: AMS231020614045 Ref C: 2023-08-23T13:41:52Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:41:54 GMT + etag: + - '"15004802-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 810E453B30B34DCDA2C86F20C1ABEFAB Ref B: AMS231020614045 Ref C: 2023-08-23T13:41:53Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:41:54 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 92A88A54FBBB44CFAFF1B415DC7FE802 Ref B: AMS231020614045 Ref C: 2023-08-23T13:41:55Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:42:25 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: CD3E17D36A8B4C3BB9A4056078A9EF93 Ref B: AMS231020614045 Ref C: 2023-08-23T13:42:26Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:42:56 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 6784AFE36FA4482E83645381039D5A5C Ref B: AMS231020614045 Ref C: 2023-08-23T13:42:56Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:43:26 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 0022D067687646E39CA68602FE77C848 Ref B: AMS231020614045 Ref C: 2023-08-23T13:43:27Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:43:57 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A2B521804CF34D25A1F364596AE248E8 Ref B: AMS231020614045 Ref C: 2023-08-23T13:43:57Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:44:29 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: C028B430296549AA8D06228E4EF1F6B5 Ref B: AMS231020614045 Ref C: 2023-08-23T13:44:29Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Deleting", "startTime": "2023-08-23T13:41:54.7138508Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '570' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:44:59 GMT + etag: + - '"6300ddba-0000-0600-0000-64e60ca20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 9E3CF35F72F545F38FFABCF49FA97B58 Ref B: AMS231020614045 Ref C: 2023-08-23T13:44:59Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Succeeded", "startTime": "2023-08-23T13:41:54.7138508Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '591' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:45:30 GMT + etag: + - '"ee00af76-0000-0800-0000-64e60d5d0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 3F4C9C35974A4E84A9456573FE244986 Ref B: AMS231020614045 Ref C: 2023-08-23T13:45:29Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "name": "b63756d6-c93b-4863-a08d-70e58b355a79*2AE68C8A7AADAF179181B5D773879B54D592C91F23B272CAAFFD2ECCBAB2D1E7", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher/artifactStores/ubuntu-blob-store", + "status": "Succeeded", "startTime": "2023-08-23T13:41:54.7138508Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '591' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:45:31 GMT + etag: + - '"ee00af76-0000-0800-0000-64e60d5d0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 5928285184124E8985E3DA0EF5666F5C Ref B: AMS231020614045 Ref C: 2023-08-23T13:45:30Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher?api-version=2023-04-01-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:45:35 GMT + etag: + - '"1e00693b-0000-0600-0000-64e60d7f0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-build-version: + - 1.0.02386.1640 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: 79B259E57E274203A4DEB300E30BFC00 Ref B: AMS231020614045 Ref C: 2023-08-23T13:45:31Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Deleting", "startTime": "2023-08-23T13:45:35.6085346Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:45:36 GMT + etag: + - '"63005ebb-0000-0600-0000-64e60d7f0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 6EAD48176AB84540872BFEE44875DC1A Ref B: AMS231020614045 Ref C: 2023-08-23T13:45:35Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Deleting", "startTime": "2023-08-23T13:45:35.6085346Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:46:06 GMT + etag: + - '"63005ebb-0000-0600-0000-64e60d7f0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: A89396B4341448639DD2B6E1A05B5A3D Ref B: AMS231020614045 Ref C: 2023-08-23T13:46:06Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Deleting", "startTime": "2023-08-23T13:45:35.6085346Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + cache-control: + - no-cache + content-length: + - '537' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:46:37 GMT + etag: + - '"63005ebb-0000-0600-0000-64e60d7f0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.HybridNetwork/locations/westcentralus/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 3C70093E93A94E72BF88020496EA431C Ref B: AMS231020614045 Ref C: 2023-08-23T13:46:37Z' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Succeeded", "startTime": "2023-08-23T13:45:35.6085346Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:47:07 GMT + etag: + - '"330003d8-0000-0700-0000-64e60dc10000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 06FE1FBA98EB4B9E8FACC17F3754624F Ref B: AMS231020614045 Ref C: 2023-08-23T13:47:07Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aosm nfd delete + Connection: + - keep-alive + ParameterSetName: + - --definition-type -f --clean --force + User-Agent: + - AZURECLI/2.48.1 azsdk-python-hybridnetwork/2020-01-01-preview Python/3.8.10 + (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685?api-version=2020-01-01-preview + response: + body: + string: '{"id": "/providers/Microsoft.HybridNetwork/locations/WESTCENTRALUS/operationStatuses/495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "name": "495cbac5-3f8a-4350-86b2-e5b511b5379d*680FEED73462C74523C7495BE4EECE7240DADFE41A5E01B9242E486BCB96B685", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vnf_nsd_000001/providers/Microsoft.HybridNetwork/publishers/ubuntuPublisher", + "status": "Succeeded", "startTime": "2023-08-23T13:45:35.6085346Z", "properties": + null}' + headers: + cache-control: + - no-cache + content-length: + - '558' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Aug 2023 13:47:08 GMT + etag: + - '"330003d8-0000-0700-0000-64e60dc10000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 88C45BB10A524D48A23D698B2DFEB906 Ref B: AMS231020614045 Ref C: 2023-08-23T13:47:08Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/cnf_mocks/nginxdemo-0.1.0.tgz b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/cnf_mocks/nginxdemo-0.1.0.tgz new file mode 100644 index 00000000000..06a7a4ae7ba Binary files /dev/null and b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/cnf_mocks/nginxdemo-0.1.0.tgz differ diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_input_template.json b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_input_template.json new file mode 100644 index 00000000000..e55db7712a2 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_input_template.json @@ -0,0 +1,18 @@ +{ + "publisher_name": "nginx-publisher", + "publisher_resource_group_name": "{{publisher_resource_group_name}}", + "nf_name": "nginx", + "version": "1.0.0", + "acr_artifact_store_name": "nginx-nsd-acr", + "location": "westcentralus", + "source_registry_id": "{{source_registry_id}}", + "source_registry_namespace": "", + "helm_packages": [ + { + "name": "nginxdemo", + "path_to_chart": "{{path_to_chart}}", + "path_to_mappings": "", + "depends_on": [] + } + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_nsd_input_template.json b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_nsd_input_template.json new file mode 100644 index 00000000000..3517df38fb8 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/cnf_nsd_input_template.json @@ -0,0 +1,20 @@ +{ + "location": "westcentralus", + "publisher_name": "nginx-publisher", + "publisher_resource_group_name": "{{publisher_resource_group_name}}", + "acr_artifact_store_name": "nginx-nsd-acr", + "network_functions": [ + { + "name": "nginx-nfdg", + "version": "1.0.0", + "publisher_offering_location": "westcentralus", + "type": "cnf", + "multiple_instances": false, + "publisher": "nginx-publisher", + "publisher_resource_group": "{{publisher_resource_group_name}}" + } + ], + "nsdg_name": "nginx", + "nsd_version": "1.0.0", + "nsdv_description": "Deploys a basic NGINX CNF" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_input_template.json b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_input_template.json new file mode 100644 index 00000000000..b8ba87110ca --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_input_template.json @@ -0,0 +1,18 @@ +{ + "publisher_name": "ubuntuPublisher", + "publisher_resource_group_name": "{{publisher_resource_group_name}}", + "acr_artifact_store_name": "ubuntu-acr", + "location": "westcentralus", + "nf_name": "ubuntu-vm", + "version": "1.0.0", + "blob_artifact_store_name": "ubuntu-blob-store", + "image_name_parameter": "imageName", + "arm_template": { + "file_path": "../vnf_mocks/ubuntu_template.json", + "version": "1.0.0" + }, + "vhd": { + "file_path": "../vnf_mocks/ubuntu.vhd", + "version": "1-0-0" + } +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_nsd_input_template.json b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_nsd_input_template.json new file mode 100644 index 00000000000..694b543c320 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/mock_input_templates/vnf_nsd_input_template.json @@ -0,0 +1,20 @@ +{ + "location": "westcentralus", + "publisher_name": "ubuntuPublisher", + "publisher_resource_group_name": "{{publisher_resource_group_name}}", + "acr_artifact_store_name": "ubuntu-acr", + "network_functions": [ + { + "name": "ubuntu-vm-nfdg", + "version": "1.0.0", + "publisher_offering_location": "westcentralus", + "type": "vnf", + "multiple_instances": false, + "publisher": "ubuntuPublisher", + "publisher_resource_group": "{{publisher_resource_group_name}}" + } + ], + "nsdg_name": "ubuntu", + "nsd_version": "1.0.0", + "nsdv_description": "Plain ubuntu VM" +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu.vhd b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu.vhd new file mode 100644 index 00000000000..8f1a1c99b84 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu.vhd @@ -0,0 +1,11 @@ +61 38 6b 92 16 4b cc ac 6f d4 02 5c 6f 62 79 b9 +8e 62 ae 07 02 1c dc 73 5b 7a 51 e7 56 4e 4a b0 +54 4a 93 2e 6b dd 3c b5 8b 60 fa 80 b1 80 1b 89 +1e 4d 7d 86 8e 25 76 58 24 8d 21 87 83 06 88 d6 +a4 fd 94 9c 66 b6 db ee 92 46 f0 25 fc 84 bb f5 +3f d9 49 28 ea 54 6a 2a 33 fa e0 47 eb 22 af 91 +d4 34 a6 d9 fe 58 cb 54 03 35 d6 45 40 96 4e f3 +31 ea 78 20 45 e9 f2 3a de cb 38 53 c0 9c b2 b7 +12 9e 57 d9 f6 1b cb 20 23 8c 86 d3 40 da 84 c3 +22 5b 48 61 63 e2 5f 5f 43 6d 8f 41 fc ce c1 87 +33 e1 e2 61 63 e2 5f 5 \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu_template.json b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu_template.json new file mode 100644 index 00000000000..fe7b586ab23 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/scenario_test_mocks/vnf_mocks/ubuntu_template.json @@ -0,0 +1,118 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.8.9.13224", + "templateHash": "14979664264804385741" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "subnetName": { + "type": "string" + }, + "ubuntuVmName": { + "type": "string", + "defaultValue": "ubuntu-vm" + }, + "virtualNetworkId": { + "type": "string" + }, + "sshPublicKeyAdmin": { + "type": "string" + }, + "imageName": { + "type": "string" + } + }, + "variables": { + "imageResourceGroup": "[resourceGroup().name]", + "subscriptionId": "[subscription().subscriptionId]", + "vmSizeSku": "Standard_D2s_v3" + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2021-05-01", + "name": "[format('{0}_nic', parameters('ubuntuVmName'))]", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[format('{0}/subnets/{1}', parameters('virtualNetworkId'), parameters('subnetName'))]" + }, + "primary": true, + "privateIPAddressVersion": "IPv4" + } + } + ] + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2021-07-01", + "name": "[parameters('ubuntuVmName')]", + "location": "[parameters('location')]", + "properties": { + "hardwareProfile": { + "vmSize": "[variables('vmSizeSku')]" + }, + "storageProfile": { + "imageReference": { + "id": "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('subscriptionId'), variables('imageResourceGroup')), 'Microsoft.Compute/images', parameters('imageName'))]" + }, + "osDisk": { + "osType": "Linux", + "name": "[format('{0}_disk', parameters('ubuntuVmName'))]", + "createOption": "FromImage", + "caching": "ReadWrite", + "writeAcceleratorEnabled": false, + "managedDisk": "[json('{\"storageAccountType\": \"Premium_LRS\"}')]", + "deleteOption": "Delete", + "diskSizeGB": 30 + } + }, + "osProfile": { + "computerName": "[parameters('ubuntuVmName')]", + "adminUsername": "azureuser", + "linuxConfiguration": { + "disablePasswordAuthentication": true, + "ssh": { + "publicKeys": [ + { + "path": "/home/azureuser/.ssh/authorized_keys", + "keyData": "[parameters('sshPublicKeyAdmin')]" + } + ] + }, + "provisionVMAgent": true, + "patchSettings": { + "patchMode": "ImageDefault", + "assessmentMode": "ImageDefault" + } + }, + "secrets": [], + "allowExtensionOperations": true + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}_nic', parameters('ubuntuVmName')))]" + } + ] + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', format('{0}_nic', parameters('ubuntuVmName')))]" + ] + } + ] +} \ No newline at end of file diff --git a/src/aosm/azext_aosm/tests/latest/test_aosm_cnf_publish_and_delete.py b/src/aosm/azext_aosm/tests/latest/test_aosm_cnf_publish_and_delete.py new file mode 100644 index 00000000000..5b67996adee --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_aosm_cnf_publish_and_delete.py @@ -0,0 +1,116 @@ +# # -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Integration tests for the aosm extension. They test the following commands for the +# cnf definition type: +# aosm nfd build +# aosm nfd publish +# aosm nfd delete +# aosm nsd build +# aosm nsd publish +# aosm nsd delete +# +# -------------------------------------------------------------------------------------------- + +import os +from typing import Dict +from azure.cli.testsdk import LiveScenarioTest, ResourceGroupPreparer +from knack.log import get_logger +from jinja2 import Template + +logger = get_logger(__name__) + +NFD_INPUT_TEMPLATE_NAME = "cnf_input_template.json" +NFD_INPUT_FILE_NAME = "cnf_input.json" +NSD_INPUT_TEMPLATE_NAME = "cnf_nsd_input_template.json" +NSD_INPUT_FILE_NAME = "nsd_cnf_input.json" +CHART_NAME = "nginxdemo-0.1.0.tgz" + + +def get_path_to_chart(): + code_dir = os.path.dirname(__file__) + templates_dir = os.path.join(code_dir, "scenario_test_mocks", "cnf_mocks") + chart_path = os.path.join(templates_dir, CHART_NAME) + return chart_path + + +def update_input_file(input_template_name, output_file_name, params: Dict[str, str]): + code_dir = os.path.dirname(__file__) + templates_dir = os.path.join( + code_dir, "scenario_test_mocks", "mock_input_templates" + ) + input_template_path = os.path.join(templates_dir, input_template_name) + + with open(input_template_path, "r", encoding="utf-8") as file: + contents = file.read() + + jinja_template = Template(contents) + + rendered_template = jinja_template.render(**params) + + output_path = os.path.join(templates_dir, output_file_name) + + with open(output_path, "w", encoding="utf-8") as file: + file.write(rendered_template) + + return output_path + + +class CnfNsdTest(LiveScenarioTest): + """ + Integration tests for the aosm extension for cnf definition type. + + This test uses Live Scenario Test because it depends on using the `az login` command which + does not work when playing back from the recording. + """ + + @ResourceGroupPreparer(name_prefix="cli_test_cnf_nsd_", location="westcentralus") + def test_cnf_nsd_publish_and_delete(self, resource_group): + """ + This test creates a cnf nfd and nsd, publishes them, and then deletes them. + + :param resource_group: The name of the resource group to use for the test. + This is passed in by the ResourceGroupPreparer decorator. + """ + + chart_path = get_path_to_chart() + + nfd_input_file_path = update_input_file( + NFD_INPUT_TEMPLATE_NAME, + NFD_INPUT_FILE_NAME, + params={ + "publisher_resource_group_name": resource_group, + "path_to_chart": chart_path, + }, + ) + + self.cmd( + f'az aosm nfd build -f "{nfd_input_file_path}" --definition-type cnf --force' + ) + + try: + self.cmd( + f'az aosm nfd publish -f "{nfd_input_file_path}" --definition-type cnf --debug --skip image-upload' + ) + except Exception: + self.cmd( + f'az aosm nfd delete --definition-type cnf -f "{nfd_input_file_path}" --debug --force' + ) + raise + + nsd_input_file_path = update_input_file( + NSD_INPUT_TEMPLATE_NAME, + NSD_INPUT_FILE_NAME, + params={"publisher_resource_group_name": resource_group}, + ) + + self.cmd(f'az aosm nsd build -f "{nsd_input_file_path}" --debug --force') + + try: + self.cmd(f'az aosm nsd publish -f "{nsd_input_file_path}" --debug') + finally: + self.cmd( + f'az aosm nfd delete --definition-type cnf -f "{nfd_input_file_path}" --debug --force' + ) + self.cmd(f'az aosm nsd delete -f "{nsd_input_file_path}" --debug --force') diff --git a/src/aosm/azext_aosm/tests/latest/test_aosm_scenario.py b/src/aosm/azext_aosm/tests/latest/test_aosm_scenario.py new file mode 100644 index 00000000000..fe10ce0d1de --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_aosm_scenario.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest + +# from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ResourceGroupPreparer, ScenarioTest + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), "..")) + +## Note: keeping this only as an example for what we could do +# class AosmScenarioTest(ScenarioTest): +# @ResourceGroupPreparer(name_prefix="cli_test_aosm") +# def test_aosm(self, resource_group): +# self.kwargs.update({"name": "test1"}) + +# self.cmd( +# "aosm create -g {rg} -n {name} --tags foo=doo", +# checks=[self.check("tags.foo", "doo"), self.check("name", "{name}")], +# ) +# self.cmd( +# "aosm update -g {rg} -n {name} --tags foo=boo", +# checks=[self.check("tags.foo", "boo")], +# ) +# count = len(self.cmd("aosm list").get_output_in_json()) +# self.cmd( +# "aosm show - {rg} -n {name}", +# checks=[ +# self.check("name", "{name}"), +# self.check("resourceGroup", "{rg}"), +# self.check("tags.foo", "boo"), +# ], +# ) +# self.cmd("aosm delete -g {rg} -n {name}") +# final_count = len(self.cmd("aosm list").get_output_in_json()) +# self.assertTrue(final_count, count - 1) diff --git a/src/aosm/azext_aosm/tests/latest/test_aosm_vnf_publish_and_delete.py b/src/aosm/azext_aosm/tests/latest/test_aosm_vnf_publish_and_delete.py new file mode 100644 index 00000000000..8c4a158bca3 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_aosm_vnf_publish_and_delete.py @@ -0,0 +1,125 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# This is an integration tests for the aosm extension. It tests the following commands for the +# vnf definition type: +# aosm nfd build +# aosm nfd publish +# aosm nfd delete +# aosm nsd build +# aosm nsd publish +# aosm nsd delete +# -------------------------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer +from knack.log import get_logger +from jinja2 import Template +from .recording_processors import TokenReplacer, SasUriReplacer, BlobStoreUriReplacer + + +logger = get_logger(__name__) + +NFD_INPUT_TEMPLATE_NAME = "vnf_input_template.json" +NFD_INPUT_FILE_NAME = "vnf_input.json" +NSD_INPUT_TEMPLATE_NAME = "vnf_nsd_input_template.json" +NSD_INPUT_FILE_NAME = "nsd_input.json" +ARM_TEMPLATE_RELATIVE_PATH = "scenario_test_mocks/vnf_mocks/ubuntu_template.json" + + +def update_resource_group_in_input_file( + input_template_name: str, output_file_name: str, resource_group: str +) -> str: + """ + This function updates the resource group name in the input template file and returns the + path to the updated file. + + :param input_template_name: The name of the input template file. + :param output_file_name: The name of the output file. + :param resource_group: The name of the resource group to update the input template with. + :return: The path to the updated input template file.""" + code_dir = os.path.dirname(__file__) + templates_dir = os.path.join( + code_dir, "scenario_test_mocks", "mock_input_templates" + ) + input_template_path = os.path.join(templates_dir, input_template_name) + + with open(input_template_path, "r", encoding="utf-8") as file: + contents = file.read() + + jinja_template = Template(contents) + + rendered_template = jinja_template.render( + publisher_resource_group_name=resource_group + ) + + output_path = os.path.join(templates_dir, output_file_name) + + with open(output_path, "w", encoding="utf-8") as file: + file.write(rendered_template) + + return output_path + + +class VnfNsdTest(ScenarioTest): + """ + This class contains the integration tests for the aosm extension for vnf definition type. + """ + def __init__(self, method_name): + """ + This constructor initializes the class + + :param method_name: The name of the test method. + :param recording_processors: The recording processors to use for the test. + These recording processors modify the recording of a test before it is saved, + helping to remove sensitive information from the recording. + """ + super(VnfNsdTest, self).__init__( + method_name, + recording_processors=[TokenReplacer(), SasUriReplacer(), BlobStoreUriReplacer()] + ) + + @ResourceGroupPreparer(name_prefix="cli_test_vnf_nsd_", location="westcentralus") + def test_vnf_nsd_publish_and_delete(self, resource_group): + """ + This test creates a vnf nfd and nsd, publishes them, and then deletes them. + + :param resource_group: The name of the resource group to use for the test. + This is passed in by the ResourceGroupPreparer decorator. + """ + nfd_input_file_path = update_resource_group_in_input_file( + NFD_INPUT_TEMPLATE_NAME, NFD_INPUT_FILE_NAME, resource_group + ) + + self.cmd( + f'az aosm nfd build -f "{nfd_input_file_path}" --definition-type vnf --force' + ) + + try: + self.cmd( + f'az aosm nfd publish -f "{nfd_input_file_path}" --definition-type vnf' + ) + except Exception: + # If the command fails, then the test should fail. + # We still need to clean up the resources, so we run the delete command. + self.cmd( + f'az aosm nfd delete --definition-type vnf -f "{nfd_input_file_path}" --clean --force' + ) + raise + + nsd_input_file_path = update_resource_group_in_input_file( + NSD_INPUT_TEMPLATE_NAME, NSD_INPUT_FILE_NAME, resource_group + ) + + self.cmd(f'az aosm nsd build -f "{nsd_input_file_path}" --force') + + try: + self.cmd(f'az aosm nsd publish -f "{nsd_input_file_path}"') + finally: + # If the command fails, then the test should fail. + # We still need to clean up the resources, so we run the delete command. + self.cmd(f'az aosm nsd delete -f "{nsd_input_file_path}" --clean --force') + self.cmd( + f'az aosm nfd delete --definition-type vnf -f "{nfd_input_file_path}" --clean --force' + ) diff --git a/src/aosm/azext_aosm/tests/latest/test_cnf.py b/src/aosm/azext_aosm/tests/latest/test_cnf.py new file mode 100644 index 00000000000..a0137be2346 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_cnf.py @@ -0,0 +1,61 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +import unittest +import os +from pathlib import Path +from tempfile import TemporaryDirectory + +from azext_aosm.custom import build_definition, generate_definition_config + + +mock_cnf_folder = ((Path(__file__).parent) / "mock_cnf").resolve() + + +class TestCNF(unittest.TestCase): + def test_generate_config(self): + """Test generating a config file for a VNF.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + generate_definition_config("cnf") + assert os.path.exists("input.json") + finally: + os.chdir(starting_directory) + + def test_build(self): + """Test the build command for CNFs.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_definition( + "cnf", str(mock_cnf_folder / "input-nfconfigchart.json") + ) + assert os.path.exists("nfd-bicep-nginx-basic-test") + finally: + os.chdir(starting_directory) + + def test_build_no_mapping(self): + """ + Test the build command for CNFs where no mapping file is supplied. + + Also reorder the parameters. + """ + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_definition( + "cnf", + str(mock_cnf_folder / "input-nf-agent-cnf.json"), + order_params=True, + ) + assert os.path.exists("nfd-bicep-nf-agent-cnf") + finally: + os.chdir(starting_directory) diff --git a/src/aosm/azext_aosm/tests/latest/test_nsd.py b/src/aosm/azext_aosm/tests/latest/test_nsd.py new file mode 100644 index 00000000000..9e07363e11d --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_nsd.py @@ -0,0 +1,303 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +from dataclasses import dataclass +from distutils.dir_util import copy_tree +import json +import shutil +import subprocess +from filecmp import dircmp +from pathlib import Path +from unittest.mock import patch +from tempfile import TemporaryDirectory + +import jsonschema + +from azext_aosm.custom import generate_design_config, build_design + +mock_nsd_folder = ((Path(__file__).parent) / "mock_nsd").resolve() +output_folder = ((Path(__file__).parent) / "nsd_output").resolve() + + +CGV_DATA = { + "ubuntu-vm-nfdg": { + "deploymentParameters": { + "location": "eastus", + "subnetName": "subnet", + "virtualNetworkId": "bar", + "sshPublicKeyAdmin": "foo", + }, + "ubuntu_vm_nfdg_nfd_version": "1.0.0", + }, + "managedIdentity": "blah", +} + + +MULTIPLE_INSTANCES_CGV_DATA = { + "ubuntu-vm-nfdg": { + "deploymentParameters": [ + { + "location": "eastus", + "subnetName": "subnet", + "virtualNetworkId": "bar", + "sshPublicKeyAdmin": "foo", + }, + { + "location": "eastus", + "subnetName": "subnet2", + "virtualNetworkId": "bar2", + "sshPublicKeyAdmin": "foo2", + }, + ], + "ubuntu_vm_nfdg_nfd_version": "1.0.0", + }, + "managedIdentity": "blah", +} + + +MULTIPLE_NFs_CGV_DATA = { + "managedIdentity": "managed_identity", + "nginx-nfdg": { + "customLocationId": "custom_location", + "nginx_nfdg_nfd_version": "1.0.0", + "deploymentParameters": {"service_port": 5222, "serviceAccount_create": False}, + }, + "ubuntu-nfdg": { + "ubuntu_nfdg_nfd_version": "1.0.0", + "deploymentParameters": { + "location": "eastus", + "subnetName": "ubuntu-vm-subnet", + "ubuntuVmName": "ubuntu-vm", + "virtualNetworkId": "ubuntu-vm-vnet", + "sshPublicKeyAdmin": "public_key", + }, + }, +} + + +ubuntu_deploy_parameters = { + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "DeployParametersSchema", + "type": "object", + "properties": { + "location": {"type": "string"}, + "subnetName": {"type": "string"}, + "virtualNetworkId": {"type": "string"}, + "sshPublicKeyAdmin": {"type": "string"}, + }, +} + +nginx_deploy_parameters = { + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "DeployParametersSchema", + "type": "object", + "properties": { + "serviceAccount_create": {"type": "boolean"}, + "service_port": {"type": "integer"}, + }, + "required": ["serviceAccount_create", "service_port"], +} + + +# We don't want to get details from a real NFD (calling out to Azure) in a UT. +# Therefore we pass in a fake client to supply the deployment parameters from the "NFD". +@dataclass +class NFDV: + deploy_parameters: str + + +class NFDVs: + def get(self, network_function_definition_group_name, **_): + if "nginx" in network_function_definition_group_name: + return NFDV(json.dumps(nginx_deploy_parameters)) + else: + return NFDV(json.dumps(ubuntu_deploy_parameters)) + + +class AOSMClient: + def __init__(self) -> None: + self.network_function_definition_versions = NFDVs() + + +mock_client = AOSMClient() + + +class FakeCmd: + def __init__(self) -> None: + self.cli_ctx = None + + +mock_cmd = FakeCmd() + + +def validate_schema_against_metaschema(schema_data): + """Validate that the schema produced by the CLI matches the AOSM metaschema.""" + + # There is a bug in the jsonschema module that means that it hits an error in with + # the "$id" bit of the metaschema. Here we use a modified version of the metaschema + # with that small section removed. + metaschema_file_path = ( + (Path(__file__).parent) / "metaschema_modified.json" + ).resolve() + with open(metaschema_file_path, "r", encoding="utf8") as f: + metaschema = json.load(f) + + jsonschema.validate(instance=schema_data, schema=metaschema) + + +def validate_json_against_schema(json_data, schema_file): + """Validate some test data against the schema produced by the CLI.""" + with open(schema_file, "r", encoding="utf8") as f: + schema = json.load(f) + + validate_schema_against_metaschema(schema) + + jsonschema.validate(instance=json_data, schema=schema) + + +def build_bicep(bicep_template_path): + bicep_output = subprocess.run( # noqa + [ + str(shutil.which("az")), + "bicep", + "build", + "--file", + bicep_template_path, + ], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + + if bicep_output.returncode != 0: + print(f"Invalid bicep: {bicep_template_path}") + print(str(bicep_output.stderr).replace("\\n", "\n").replace("\\t", "\t")) + raise RuntimeError("Invalid Bicep") + + +def compare_to_expected_output(expected_folder_name: str): + """ + Compares nsd-bicep-templates to the supplied folder name. + + :param expected_folder_name: The name of the folder within nsd_output to compare + with. + """ + # Check files and folders within the top level directory are the same. + expected_output_path = output_folder / expected_folder_name + comparison = dircmp("nsd-bicep-templates", expected_output_path) + + try: + assert len(comparison.diff_files) == 0 + assert len(comparison.left_only) == 0 + assert len(comparison.right_only) == 0 + + # Check the files and folders within each of the subdirectories are the same. + for subdir in comparison.subdirs.values(): + assert len(subdir.diff_files) == 0 + assert len(subdir.left_only) == 0 + assert len(subdir.right_only) == 0 + except: + copy_tree("nsd-bicep-templates", str(expected_output_path)) + print( + f"Output has changed in {expected_output_path}, use git diff to check if " + f"you are happy with those changes." + ) + raise + + +class TestNSDGenerator: + def test_generate_config(self): + """Test generating a config file for a VNF.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + generate_design_config() + assert os.path.exists("input.json") + finally: + os.chdir(starting_directory) + + @patch("azext_aosm.custom.cf_resources") + def test_build(self, cf_resources): + """Test building the NSD bicep templates.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_design( + mock_cmd, + client=mock_client, + config_file=str(mock_nsd_folder / "input.json"), + ) + + assert os.path.exists("nsd-bicep-templates") + validate_json_against_schema( + CGV_DATA, + "nsd-bicep-templates/schemas/ubuntu_ConfigGroupSchema.json", + ) + + compare_to_expected_output("test_build") + finally: + os.chdir(starting_directory) + + @patch("azext_aosm.custom.cf_resources") + def test_build_multiple_instances(self, cf_resources): + """Test building the NSD bicep templates with multiple NFs allowed.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_design( + mock_cmd, + client=mock_client, + config_file=str(mock_nsd_folder / "input_multiple_instances.json"), + ) + + assert os.path.exists("nsd-bicep-templates") + validate_json_against_schema( + MULTIPLE_INSTANCES_CGV_DATA, + "nsd-bicep-templates/schemas/ubuntu_ConfigGroupSchema.json", + ) + + compare_to_expected_output("test_build_multiple_instances") + finally: + os.chdir(starting_directory) + + @patch("azext_aosm.custom.cf_resources") + def test_build_multiple_nfs(self, cf_resources): + """Test building the NSD bicep templates with multiple NFs allowed.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_design( + mock_cmd, + client=mock_client, + config_file=str(mock_nsd_folder / "input_multi_nf_nsd.json"), + ) + + assert os.path.exists("nsd-bicep-templates") + validate_json_against_schema( + MULTIPLE_NFs_CGV_DATA, + "nsd-bicep-templates/schemas/multinf_ConfigGroupSchema.json", + ) + + # The bicep checks take a while, so we would only do them here and not + # on the other tests. However, they are disabled until we can look at + # them further, as the version of Bicep used ends up in the built file, + # and we don't control what version of bicep is used in the pipeline or + # on the user's machine. + # build_bicep("nsd-bicep-templates/nginx-nfdg_nf.bicep") + # build_bicep("nsd-bicep-templates/ubuntu-nfdg_nf.bicep") + # build_bicep("nsd-bicep-templates/nsd_definition.bicep") + # build_bicep("nsd-bicep-templates/artifact_manifest.bicep") + + compare_to_expected_output("test_build_multiple_nfs") + finally: + os.chdir(starting_directory) diff --git a/src/aosm/azext_aosm/tests/latest/test_vnf.py b/src/aosm/azext_aosm/tests/latest/test_vnf.py new file mode 100644 index 00000000000..eacc91a4727 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_vnf.py @@ -0,0 +1,64 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import unittest +from pathlib import Path +from tempfile import TemporaryDirectory + +from azext_aosm.custom import build_definition, generate_definition_config + +mock_vnf_folder = ((Path(__file__).parent) / "mock_vnf").resolve() + + +class TestVNF(unittest.TestCase): + def test_generate_config(self): + """Test generating a config file for a VNF.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + generate_definition_config("vnf") + assert os.path.exists("input.json") + finally: + os.chdir(starting_directory) + + def test_build(self): + """Test building an NFDV for a VNF.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_definition("vnf", str(mock_vnf_folder / "input_with_fp.json")) + assert os.path.exists("nfd-bicep-ubuntu-template") + finally: + os.chdir(starting_directory) + + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_definition("vnf", str(mock_vnf_folder / "input_with_sas.json")) + assert os.path.exists("nfd-bicep-ubuntu-template") + finally: + os.chdir(starting_directory) + + def test_build_with_ordered_params(self): + """Test building an NFDV for a VNF.""" + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_definition( + "vnf", + str(mock_vnf_folder / "input_with_fp.json"), + order_params=True, + ) + assert os.path.exists("nfd-bicep-ubuntu-template") + finally: + os.chdir(starting_directory) diff --git a/src/aosm/azext_aosm/util/__init__.py b/src/aosm/azext_aosm/util/__init__.py new file mode 100644 index 00000000000..99c0f28cd71 --- /dev/null +++ b/src/aosm/azext_aosm/util/__init__.py @@ -0,0 +1,5 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ----------------------------------------------------------------------------- diff --git a/src/aosm/azext_aosm/util/constants.py b/src/aosm/azext_aosm/util/constants.py new file mode 100644 index 00000000000..9612402fcac --- /dev/null +++ b/src/aosm/azext_aosm/util/constants.py @@ -0,0 +1,100 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +"""Constants used across aosm cli extension.""" + +from enum import Enum + +# The types of definition that can be generated +VNF = "vnf" +CNF = "cnf" +NSD = "nsd" + + +class DeployableResourceTypes(str, Enum): + VNF = VNF + CNF = CNF + NSD = NSD + + +# Skip steps +BICEP_PUBLISH = "bicep-publish" +ARTIFACT_UPLOAD = "artifact-upload" +IMAGE_UPLOAD = "image-upload" + + +class SkipSteps(Enum): + BICEP_PUBLISH = BICEP_PUBLISH + ARTIFACT_UPLOAD = ARTIFACT_UPLOAD + IMAGE_UPLOAD = IMAGE_UPLOAD + + +# Names of files used in the repo +NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE = "nf_template.bicep.j2" +NF_DEFINITION_JSON_FILENAME = "nf_definition.json" +NF_DEFINITION_OUTPUT_BICEP_PREFIX = "nfd-bicep-" +NSD_DEFINITION_JINJA2_SOURCE_TEMPLATE = "nsd_template.bicep.j2" +NSD_BICEP_FILENAME = "nsd_definition.bicep" +NSD_OUTPUT_BICEP_PREFIX = "nsd-bicep-templates" +NSD_ARTIFACT_MANIFEST_BICEP_FILENAME = "artifact_manifest.bicep" +NSD_ARTIFACT_MANIFEST_SOURCE_TEMPLATE_FILENAME = "artifact_manifest_template.bicep" + +VNF_DEFINITION_BICEP_TEMPLATE_FILENAME = "vnfdefinition.bicep" +VNF_MANIFEST_BICEP_TEMPLATE_FILENAME = "vnfartifactmanifests.bicep" + +CNF_DEFINITION_JINJA2_SOURCE_TEMPLATE_FILENAME = "cnfdefinition.bicep.j2" +CNF_MANIFEST_JINJA2_SOURCE_TEMPLATE_FILENAME = "cnfartifactmanifest.bicep.j2" +CNF_DEFINITION_BICEP_TEMPLATE_FILENAME = "cnfdefinition.bicep" +CNF_MANIFEST_BICEP_TEMPLATE_FILENAME = "cnfartifactmanifest.bicep" +CNF_VALUES_SCHEMA_FILENAME = "values.schema.json" + + +# Names of directories used in the repo +CONFIG_MAPPINGS_DIR_NAME = "configMappings" +SCHEMAS_DIR_NAME = "schemas" +TEMPLATES_DIR_NAME = "templates" +GENERATED_VALUES_MAPPINGS_DIR_NAME = "generatedValuesMappings" + +# Items used when building NFDs/NSDs +DEPLOYMENT_PARAMETERS_FILENAME = "deploymentParameters.json" +OPTIONAL_DEPLOYMENT_PARAMETERS_FILENAME = "optionalDeploymentParameters.txt" +TEMPLATE_PARAMETERS_FILENAME = "templateParameters.json" +VHD_PARAMETERS_FILENAME = "vhdParameters.json" +OPTIONAL_DEPLOYMENT_PARAMETERS_HEADING = ( + "# The following parameters are optional as they have default values.\n" + "# If you do not wish to expose them in the NFD, find and remove them from both\n" + f"# {DEPLOYMENT_PARAMETERS_FILENAME} and {TEMPLATE_PARAMETERS_FILENAME} (and {VHD_PARAMETERS_FILENAME} if\n" + "they are there)\n" + "# You can re-run the build command with the --order-params flag to order those\n" + "# files with the optional parameters at the end of the file, and with the \n" + "# --interactive flag to interactively choose y/n for each parameter to expose.\n\n" +) + +# Deployment Schema +SCHEMA_PREFIX = { + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "DeployParametersSchema", + "type": "object", + "properties": {}, +} + +# For CNF NFD Generator +# To match the image path if image: is present in the yaml file +IMAGE_START_STRING = "image:" +IMAGE_PATH_REGEX = r".Values\.([^\s})]*)" + +# To match the image name and version if 'imagePullSecrets:' is present in the yaml file +IMAGE_PULL_SECRETS_START_STRING = "imagePullSecrets:" +IMAGE_NAME_AND_VERSION_REGEX = r"\/(?P[^\s]*):(?P[^\s)\"}]*)" + +DEPLOYMENT_PARAMETER_MAPPING_REGEX = r"\{deployParameters.(.+?)\}" + +# Assume that the registry id is of the form: +# /subscriptions//resourceGroups//providers/ +# Microsoft.ContainerRegistry/registries/ +# This returns groups for the resource group name and registry name +SOURCE_ACR_REGEX = ( + r".*\/resourceGroups\/(?P[^\/]*)\/providers\/Microsoft." + r"ContainerRegistry\/registries\/(?P[^\/]*)" +) diff --git a/src/aosm/azext_aosm/util/management_clients.py b/src/aosm/azext_aosm/util/management_clients.py new file mode 100644 index 00000000000..fff9aa5c0a9 --- /dev/null +++ b/src/aosm/azext_aosm/util/management_clients.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +"""Clients for the python SDK along with useful caches.""" + +from dataclasses import dataclass +from typing import Optional + +from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.resource import ResourceManagementClient +from knack.log import get_logger + +from azext_aosm.vendored_sdks import HybridNetworkManagementClient + +logger = get_logger(__name__) + + +@dataclass +class ApiClients: + """A class for API Clients needed throughout.""" + + aosm_client: HybridNetworkManagementClient + resource_client: ResourceManagementClient + container_registry_client: Optional[ContainerRegistryManagementClient] = None diff --git a/src/aosm/azext_aosm/util/utils.py b/src/aosm/azext_aosm/util/utils.py new file mode 100644 index 00000000000..93e42f28dd0 --- /dev/null +++ b/src/aosm/azext_aosm/util/utils.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +"""Utility functions.""" + + +def input_ack(ack: str, request_to_user: str) -> bool: + """ + Overarching function to request, sanitise and return True if input is specified ack. + + This prints the question string and asks for user input. which is santised by + removing all whitespaces in the string, and made lowercase. True is returned if the + user input is equal to supplied acknowledgement string and False if anything else + """ + unsanitised_ans = input(request_to_user) + return str(unsanitised_ans.strip().replace(" ", "").lower()) == ack diff --git a/src/aosm/azext_aosm/vendored_sdks/__init__.py b/src/aosm/azext_aosm/vendored_sdks/__init__.py new file mode 100644 index 00000000000..9226444c2b5 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._hybrid_network_management_client import HybridNetworkManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ["HybridNetworkManagementClient"] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk + +patch_sdk() diff --git a/src/aosm/azext_aosm/vendored_sdks/_configuration.py b/src/aosm/azext_aosm/vendored_sdks/_configuration.py new file mode 100644 index 00000000000..326f02605ad --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/_configuration.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ( + ARMChallengeAuthenticationPolicy, + ARMHttpLoggingPolicy, +) + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class HybridNetworkManagementClientConfiguration( + Configuration +): # pylint: disable=too-many-instance-attributes + """ + Configuration for HybridNetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. The default value is "2023-04-01-preview". Note + that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + super(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2023-04-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop( + "credential_scopes", ["https://management.azure.com/.default"] + ) + kwargs.setdefault("sdk_moniker", "hybridnetwork/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get( + "user_agent_policy" + ) or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy( + **kwargs + ) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get( + "logging_policy" + ) or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get( + "http_logging_policy" + ) or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get( + "custom_hook_policy" + ) or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy( + **kwargs + ) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/src/aosm/azext_aosm/vendored_sdks/_hybrid_network_management_client.py b/src/aosm/azext_aosm/vendored_sdks/_hybrid_network_management_client.py new file mode 100644 index 00000000000..fa704c623bc --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/_hybrid_network_management_client.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import HybridNetworkManagementClientConfiguration +from .operations import ArtifactManifestsOperations, ArtifactStoresOperations, ComponentsOperations, ConfigurationGroupSchemasOperations, ConfigurationGroupValuesOperations, HybridNetworkManagementClientOperationsMixin, NetworkFunctionDefinitionGroupsOperations, NetworkFunctionDefinitionVersionsOperations, NetworkFunctionReadyK8SOperations, NetworkFunctionsOperations, NetworkServiceDesignGroupsOperations, NetworkServiceDesignVersionsOperations, Operations, PreviewSubscriptionsOperations, ProxyArtifactOperations, ProxyNetworkFunctionDefinitionGroupsOperations, ProxyNetworkFunctionDefinitionVersionsOperations, ProxyPublisherOperations, PublishersOperations, SiteNetworkServicesOperations, SitesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class HybridNetworkManagementClient(HybridNetworkManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """The definitions in this swagger specification will be used to manage the Hybrid Network + resources. + + :ivar configuration_group_schemas: ConfigurationGroupSchemasOperations operations + :vartype configuration_group_schemas: + Microsoft.HybridNetwork.operations.ConfigurationGroupSchemasOperations + :ivar configuration_group_values: ConfigurationGroupValuesOperations operations + :vartype configuration_group_values: + Microsoft.HybridNetwork.operations.ConfigurationGroupValuesOperations + :ivar network_functions: NetworkFunctionsOperations operations + :vartype network_functions: Microsoft.HybridNetwork.operations.NetworkFunctionsOperations + :ivar components: ComponentsOperations operations + :vartype components: Microsoft.HybridNetwork.operations.ComponentsOperations + :ivar network_function_definition_groups: NetworkFunctionDefinitionGroupsOperations operations + :vartype network_function_definition_groups: + Microsoft.HybridNetwork.operations.NetworkFunctionDefinitionGroupsOperations + :ivar preview_subscriptions: PreviewSubscriptionsOperations operations + :vartype preview_subscriptions: + Microsoft.HybridNetwork.operations.PreviewSubscriptionsOperations + :ivar network_function_definition_versions: NetworkFunctionDefinitionVersionsOperations + operations + :vartype network_function_definition_versions: + Microsoft.HybridNetwork.operations.NetworkFunctionDefinitionVersionsOperations + :ivar network_function_ready_k8_s: NetworkFunctionReadyK8SOperations operations + :vartype network_function_ready_k8_s: + Microsoft.HybridNetwork.operations.NetworkFunctionReadyK8SOperations + :ivar network_service_design_groups: NetworkServiceDesignGroupsOperations operations + :vartype network_service_design_groups: + Microsoft.HybridNetwork.operations.NetworkServiceDesignGroupsOperations + :ivar network_service_design_versions: NetworkServiceDesignVersionsOperations operations + :vartype network_service_design_versions: + Microsoft.HybridNetwork.operations.NetworkServiceDesignVersionsOperations + :ivar operations: Operations operations + :vartype operations: Microsoft.HybridNetwork.operations.Operations + :ivar proxy_publisher: ProxyPublisherOperations operations + :vartype proxy_publisher: Microsoft.HybridNetwork.operations.ProxyPublisherOperations + :ivar proxy_network_function_definition_groups: ProxyNetworkFunctionDefinitionGroupsOperations + operations + :vartype proxy_network_function_definition_groups: + Microsoft.HybridNetwork.operations.ProxyNetworkFunctionDefinitionGroupsOperations + :ivar proxy_network_function_definition_versions: + ProxyNetworkFunctionDefinitionVersionsOperations operations + :vartype proxy_network_function_definition_versions: + Microsoft.HybridNetwork.operations.ProxyNetworkFunctionDefinitionVersionsOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: Microsoft.HybridNetwork.operations.PublishersOperations + :ivar artifact_stores: ArtifactStoresOperations operations + :vartype artifact_stores: Microsoft.HybridNetwork.operations.ArtifactStoresOperations + :ivar artifact_manifests: ArtifactManifestsOperations operations + :vartype artifact_manifests: Microsoft.HybridNetwork.operations.ArtifactManifestsOperations + :ivar proxy_artifact: ProxyArtifactOperations operations + :vartype proxy_artifact: Microsoft.HybridNetwork.operations.ProxyArtifactOperations + :ivar sites: SitesOperations operations + :vartype sites: Microsoft.HybridNetwork.operations.SitesOperations + :ivar site_network_services: SiteNetworkServicesOperations operations + :vartype site_network_services: + Microsoft.HybridNetwork.operations.SiteNetworkServicesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword api_version: Api Version. The default value is "2023-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url="https://management.azure.com", # type: str + **kwargs # type: Any + ): + # type: (...) -> None + self._config = HybridNetworkManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.configuration_group_schemas = ConfigurationGroupSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_group_values = ConfigurationGroupValuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_functions = NetworkFunctionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_groups = NetworkFunctionDefinitionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.preview_subscriptions = PreviewSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_versions = NetworkFunctionDefinitionVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_ready_k8_s = NetworkFunctionReadyK8SOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_service_design_groups = NetworkServiceDesignGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_service_design_versions = NetworkServiceDesignVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_publisher = ProxyPublisherOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_network_function_definition_groups = ProxyNetworkFunctionDefinitionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_network_function_definition_versions = ProxyNetworkFunctionDefinitionVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_stores = ArtifactStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_manifests = ArtifactManifestsOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_artifact = ProxyArtifactOperations(self._client, self._config, self._serialize, self._deserialize) + self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.site_network_services = SiteNetworkServicesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> HybridNetworkManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/aosm/azext_aosm/vendored_sdks/_patch.py b/src/aosm/azext_aosm/vendored_sdks/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/aosm/azext_aosm/vendored_sdks/_vendor.py b/src/aosm/azext_aosm/vendored_sdks/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +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) diff --git a/src/aosm/azext_aosm/vendored_sdks/_version.py b/src/aosm/azext_aosm/vendored_sdks/_version.py new file mode 100644 index 00000000000..8d45d4618da --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2020-01-01-preview" diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/__init__.py b/src/aosm/azext_aosm/vendored_sdks/aio/__init__.py new file mode 100644 index 00000000000..85453c0838b --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._hybrid_network_management_client import HybridNetworkManagementClient +__all__ = ['HybridNetworkManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/_configuration.py b/src/aosm/azext_aosm/vendored_sdks/aio/_configuration.py new file mode 100644 index 00000000000..68dc449b003 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class HybridNetworkManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for HybridNetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. The default value is "2023-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'hybridnetwork/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/_hybrid_network_management_client.py b/src/aosm/azext_aosm/vendored_sdks/aio/_hybrid_network_management_client.py new file mode 100644 index 00000000000..891ddcb7041 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/_hybrid_network_management_client.py @@ -0,0 +1,166 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import HybridNetworkManagementClientConfiguration +from .operations import ArtifactManifestsOperations, ArtifactStoresOperations, ComponentsOperations, ConfigurationGroupSchemasOperations, ConfigurationGroupValuesOperations, HybridNetworkManagementClientOperationsMixin, NetworkFunctionDefinitionGroupsOperations, NetworkFunctionDefinitionVersionsOperations, NetworkFunctionReadyK8SOperations, NetworkFunctionsOperations, NetworkServiceDesignGroupsOperations, NetworkServiceDesignVersionsOperations, Operations, PreviewSubscriptionsOperations, ProxyArtifactOperations, ProxyNetworkFunctionDefinitionGroupsOperations, ProxyNetworkFunctionDefinitionVersionsOperations, ProxyPublisherOperations, PublishersOperations, SiteNetworkServicesOperations, SitesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class HybridNetworkManagementClient(HybridNetworkManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """The definitions in this swagger specification will be used to manage the Hybrid Network + resources. + + :ivar configuration_group_schemas: ConfigurationGroupSchemasOperations operations + :vartype configuration_group_schemas: + Microsoft.HybridNetwork.aio.operations.ConfigurationGroupSchemasOperations + :ivar configuration_group_values: ConfigurationGroupValuesOperations operations + :vartype configuration_group_values: + Microsoft.HybridNetwork.aio.operations.ConfigurationGroupValuesOperations + :ivar network_functions: NetworkFunctionsOperations operations + :vartype network_functions: Microsoft.HybridNetwork.aio.operations.NetworkFunctionsOperations + :ivar components: ComponentsOperations operations + :vartype components: Microsoft.HybridNetwork.aio.operations.ComponentsOperations + :ivar network_function_definition_groups: NetworkFunctionDefinitionGroupsOperations operations + :vartype network_function_definition_groups: + Microsoft.HybridNetwork.aio.operations.NetworkFunctionDefinitionGroupsOperations + :ivar preview_subscriptions: PreviewSubscriptionsOperations operations + :vartype preview_subscriptions: + Microsoft.HybridNetwork.aio.operations.PreviewSubscriptionsOperations + :ivar network_function_definition_versions: NetworkFunctionDefinitionVersionsOperations + operations + :vartype network_function_definition_versions: + Microsoft.HybridNetwork.aio.operations.NetworkFunctionDefinitionVersionsOperations + :ivar network_function_ready_k8_s: NetworkFunctionReadyK8SOperations operations + :vartype network_function_ready_k8_s: + Microsoft.HybridNetwork.aio.operations.NetworkFunctionReadyK8SOperations + :ivar network_service_design_groups: NetworkServiceDesignGroupsOperations operations + :vartype network_service_design_groups: + Microsoft.HybridNetwork.aio.operations.NetworkServiceDesignGroupsOperations + :ivar network_service_design_versions: NetworkServiceDesignVersionsOperations operations + :vartype network_service_design_versions: + Microsoft.HybridNetwork.aio.operations.NetworkServiceDesignVersionsOperations + :ivar operations: Operations operations + :vartype operations: Microsoft.HybridNetwork.aio.operations.Operations + :ivar proxy_publisher: ProxyPublisherOperations operations + :vartype proxy_publisher: Microsoft.HybridNetwork.aio.operations.ProxyPublisherOperations + :ivar proxy_network_function_definition_groups: ProxyNetworkFunctionDefinitionGroupsOperations + operations + :vartype proxy_network_function_definition_groups: + Microsoft.HybridNetwork.aio.operations.ProxyNetworkFunctionDefinitionGroupsOperations + :ivar proxy_network_function_definition_versions: + ProxyNetworkFunctionDefinitionVersionsOperations operations + :vartype proxy_network_function_definition_versions: + Microsoft.HybridNetwork.aio.operations.ProxyNetworkFunctionDefinitionVersionsOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: Microsoft.HybridNetwork.aio.operations.PublishersOperations + :ivar artifact_stores: ArtifactStoresOperations operations + :vartype artifact_stores: Microsoft.HybridNetwork.aio.operations.ArtifactStoresOperations + :ivar artifact_manifests: ArtifactManifestsOperations operations + :vartype artifact_manifests: Microsoft.HybridNetwork.aio.operations.ArtifactManifestsOperations + :ivar proxy_artifact: ProxyArtifactOperations operations + :vartype proxy_artifact: Microsoft.HybridNetwork.aio.operations.ProxyArtifactOperations + :ivar sites: SitesOperations operations + :vartype sites: Microsoft.HybridNetwork.aio.operations.SitesOperations + :ivar site_network_services: SiteNetworkServicesOperations operations + :vartype site_network_services: + Microsoft.HybridNetwork.aio.operations.SiteNetworkServicesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword api_version: Api Version. The default value is "2023-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = HybridNetworkManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.configuration_group_schemas = ConfigurationGroupSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_group_values = ConfigurationGroupValuesOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_functions = NetworkFunctionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_groups = NetworkFunctionDefinitionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.preview_subscriptions = PreviewSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_definition_versions = NetworkFunctionDefinitionVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_function_ready_k8_s = NetworkFunctionReadyK8SOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_service_design_groups = NetworkServiceDesignGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_service_design_versions = NetworkServiceDesignVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_publisher = ProxyPublisherOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_network_function_definition_groups = ProxyNetworkFunctionDefinitionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_network_function_definition_versions = ProxyNetworkFunctionDefinitionVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_stores = ArtifactStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_manifests = ArtifactManifestsOperations(self._client, self._config, self._serialize, self._deserialize) + self.proxy_artifact = ProxyArtifactOperations(self._client, self._config, self._serialize, self._deserialize) + self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) + self.site_network_services = SiteNetworkServicesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "HybridNetworkManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/_patch.py b/src/aosm/azext_aosm/vendored_sdks/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/__init__.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/__init__.py new file mode 100644 index 00000000000..6c86a395e1f --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/__init__.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._configuration_group_schemas_operations import ConfigurationGroupSchemasOperations +from ._configuration_group_values_operations import ConfigurationGroupValuesOperations +from ._network_functions_operations import NetworkFunctionsOperations +from ._components_operations import ComponentsOperations +from ._network_function_definition_groups_operations import NetworkFunctionDefinitionGroupsOperations +from ._preview_subscriptions_operations import PreviewSubscriptionsOperations +from ._network_function_definition_versions_operations import NetworkFunctionDefinitionVersionsOperations +from ._network_function_ready_k8_s_operations import NetworkFunctionReadyK8SOperations +from ._network_service_design_groups_operations import NetworkServiceDesignGroupsOperations +from ._network_service_design_versions_operations import NetworkServiceDesignVersionsOperations +from ._operations import Operations +from ._proxy_publisher_operations import ProxyPublisherOperations +from ._proxy_network_function_definition_groups_operations import ProxyNetworkFunctionDefinitionGroupsOperations +from ._proxy_network_function_definition_versions_operations import ProxyNetworkFunctionDefinitionVersionsOperations +from ._publishers_operations import PublishersOperations +from ._artifact_stores_operations import ArtifactStoresOperations +from ._artifact_manifests_operations import ArtifactManifestsOperations +from ._proxy_artifact_operations import ProxyArtifactOperations +from ._hybrid_network_management_client_operations import HybridNetworkManagementClientOperationsMixin +from ._sites_operations import SitesOperations +from ._site_network_services_operations import SiteNetworkServicesOperations + +__all__ = [ + 'ConfigurationGroupSchemasOperations', + 'ConfigurationGroupValuesOperations', + 'NetworkFunctionsOperations', + 'ComponentsOperations', + 'NetworkFunctionDefinitionGroupsOperations', + 'PreviewSubscriptionsOperations', + 'NetworkFunctionDefinitionVersionsOperations', + 'NetworkFunctionReadyK8SOperations', + 'NetworkServiceDesignGroupsOperations', + 'NetworkServiceDesignVersionsOperations', + 'Operations', + 'ProxyPublisherOperations', + 'ProxyNetworkFunctionDefinitionGroupsOperations', + 'ProxyNetworkFunctionDefinitionVersionsOperations', + 'PublishersOperations', + 'ArtifactStoresOperations', + 'ArtifactManifestsOperations', + 'ProxyArtifactOperations', + 'HybridNetworkManagementClientOperationsMixin', + 'SitesOperations', + 'SiteNetworkServicesOperations', +] diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_manifests_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_manifests_operations.py new file mode 100644 index 00000000000..e95fa73c3cf --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_manifests_operations.py @@ -0,0 +1,738 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._artifact_manifests_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_artifact_store_request, build_list_credential_request, build_update_request, build_update_state_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ArtifactManifestsOperations: + """ArtifactManifestsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_artifact_store( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArtifactManifestListResult"]: + """Gets information about the artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactManifestListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ArtifactManifestListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifestListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_artifact_store.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ArtifactManifestListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_artifact_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: "_models.ArtifactManifest", + **kwargs: Any + ) -> "_models.ArtifactManifest": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactManifest') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: "_models.ArtifactManifest", + **kwargs: Any + ) -> AsyncLROPoller["_models.ArtifactManifest"]: + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactManifest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ArtifactManifest] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> "_models.ArtifactManifest": + """Gets information about a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ArtifactManifest": + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace_async + async def list_credential( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + **kwargs: Any + ) -> "_models.ArtifactAccessCredential": + """List credential for publishing artifacts defined in artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactAccessCredential, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactAccessCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactAccessCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_list_credential_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactAccessCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credential.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential"} # type: ignore + + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: "_models.ArtifactManifestUpdateState", + **kwargs: Any + ) -> Optional["_models.ArtifactManifestUpdateState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArtifactManifestUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactManifestUpdateState') + + request = build_update_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArtifactManifestUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState"} # type: ignore + + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_manifest_name: str, + parameters: "_models.ArtifactManifestUpdateState", + **kwargs: Any + ) -> AsyncLROPoller["_models.ArtifactManifestUpdateState"]: + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactManifestUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ArtifactManifestUpdateState or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ArtifactManifestUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifestUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactManifestUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_stores_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_stores_operations.py new file mode 100644 index 00000000000..49ee5c761fe --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_artifact_stores_operations.py @@ -0,0 +1,508 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._artifact_stores_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_publisher_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ArtifactStoresOperations: + """ArtifactStoresOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArtifactStoreListResult"]: + """Gets information of the ArtifactStores under publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactStoreListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ArtifactStoreListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStoreListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ArtifactStoreListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: "_models.ArtifactStore", + **kwargs: Any + ) -> "_models.ArtifactStore": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactStore') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: "_models.ArtifactStore", + **kwargs: Any + ) -> AsyncLROPoller["_models.ArtifactStore"]: + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactStore + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ArtifactStore or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ArtifactStore] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactStore', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + **kwargs: Any + ) -> "_models.ArtifactStore": + """Gets information about the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactStore, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactStore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ArtifactStore": + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactStore, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactStore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_components_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_components_operations.py new file mode 100644 index 00000000000..54d99e5ba17 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_components_operations.py @@ -0,0 +1,192 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._components_operations import build_get_request, build_list_by_network_function_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ComponentsOperations: + """ComponentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_function_name: str, + component_name: str, + **kwargs: Any + ) -> "_models.Component": + """Gets information about the specified application instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :param component_name: The name of the component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Component, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Component + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Component"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Component', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}"} # type: ignore + + + @distributed_trace + def list_by_network_function( + self, + resource_group_name: str, + network_function_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ComponentListResult"]: + """Lists all the component resources in a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ComponentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComponentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + network_function_name=network_function_name, + api_version=api_version, + template_url=self.list_by_network_function.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + network_function_name=network_function_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_function.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_schemas_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_schemas_operations.py new file mode 100644 index 00000000000..2d44a98c030 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_schemas_operations.py @@ -0,0 +1,643 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._configuration_group_schemas_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_publisher_request, build_update_request, build_update_state_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationGroupSchemasOperations: + """ConfigurationGroupSchemasOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationGroupSchemaListResult"]: + """Gets information of the configuration group schemas under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupSchemaListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchemaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupSchemaListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: "_models.ConfigurationGroupSchema", + **kwargs: Any + ) -> "_models.ConfigurationGroupSchema": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupSchema') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: "_models.ConfigurationGroupSchema", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationGroupSchema"]: + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationGroupSchema or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + **kwargs: Any + ) -> "_models.ConfigurationGroupSchema": + """Gets information about the specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ConfigurationGroupSchema": + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: "_models.ConfigurationGroupSchemaVersionUpdateState", + **kwargs: Any + ) -> Optional["_models.ConfigurationGroupSchemaVersionUpdateState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationGroupSchemaVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupSchemaVersionUpdateState') + + request = build_update_state_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupSchemaVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState"} # type: ignore + + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + configuration_group_schema_name: str, + parameters: "_models.ConfigurationGroupSchemaVersionUpdateState", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationGroupSchemaVersionUpdateState"]: + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchemaVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupSchemaVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_values_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_values_operations.py new file mode 100644 index 00000000000..3eed798cd56 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_configuration_group_values_operations.py @@ -0,0 +1,559 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._configuration_group_values_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationGroupValuesOperations: + """ConfigurationGroupValuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + configuration_group_value_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + configuration_group_value_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + configuration_group_value_name: str, + **kwargs: Any + ) -> "_models.ConfigurationGroupValue": + """Gets information about the specified hybrid configuration group values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: "_models.ConfigurationGroupValue", + **kwargs: Any + ) -> "_models.ConfigurationGroupValue": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupValue') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: "_models.ConfigurationGroupValue", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationGroupValue"]: + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationGroupValue or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + configuration_group_value_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ConfigurationGroupValue": + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationGroupValueListResult"]: + """Lists all sites in the configuration group value in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValueListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupValueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationGroupValueListResult"]: + """Lists all the hybrid network configurationGroupValues in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValueListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupValueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_hybrid_network_management_client_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_hybrid_network_management_client_operations.py new file mode 100644 index 00000000000..b58d7765e8f --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_hybrid_network_management_client_operations.py @@ -0,0 +1,170 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hybrid_network_management_client_operations import build_change_artifact_state_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class HybridNetworkManagementClientOperationsMixin: + + async def _change_artifact_state_initial( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: "_models.ArtifactChangeState", + **kwargs: Any + ) -> Optional["_models.ProxyArtifactVersionsListOverview"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProxyArtifactVersionsListOverview"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactChangeState') + + request = build_change_artifact_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_version_name=artifact_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + artifact_name=artifact_name, + json=_json, + template_url=self._change_artifact_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProxyArtifactVersionsListOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _change_artifact_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}"} # type: ignore + + + @distributed_trace_async + async def begin_change_artifact_state( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + artifact_version_name: str, + parameters: "_models.ArtifactChangeState", + **kwargs: Any + ) -> AsyncLROPoller["_models.ProxyArtifactVersionsListOverview"]: + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactChangeState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProxyArtifactVersionsListOverview or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactVersionsListOverview"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._change_artifact_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_name=artifact_name, + artifact_version_name=artifact_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ProxyArtifactVersionsListOverview', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_change_artifact_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_groups_operations.py new file mode 100644 index 00000000000..1676124ba37 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_groups_operations.py @@ -0,0 +1,515 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_function_definition_groups_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_publisher_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionDefinitionGroupsOperations: + """NetworkFunctionDefinitionGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionGroupListResult"]: + """Gets information of the network function definition groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroupListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: "_models.NetworkFunctionDefinitionGroup", + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionGroup": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionGroup') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: "_models.NetworkFunctionDefinitionGroup", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkFunctionDefinitionGroup"]: + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFunctionDefinitionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionGroup": + """Gets information about the specified networkFunctionDefinition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionGroup": + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_versions_operations.py new file mode 100644 index 00000000000..75cb89c1e2a --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_definition_versions_operations.py @@ -0,0 +1,692 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_function_definition_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_network_function_definition_group_request, build_update_request, build_update_state_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionDefinitionVersionsOperations: + """NetworkFunctionDefinitionVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: "_models.NetworkFunctionDefinitionVersion", + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionVersion') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: "_models.NetworkFunctionDefinitionVersion", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkFunctionDefinitionVersion"]: + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFunctionDefinitionVersion or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionVersion": + """Gets information about a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionVersion": + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace + def list_by_network_function_definition_group( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionVersionListResult"]: + """Gets information about a list of network function definition versions under a network function + definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionVersionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions"} # type: ignore + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: "_models.NetworkFunctionDefinitionVersionUpdateState", + **kwargs: Any + ) -> Optional["_models.NetworkFunctionDefinitionVersionUpdateState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkFunctionDefinitionVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionVersionUpdateState') + + request = build_update_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState"} # type: ignore + + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + parameters: "_models.NetworkFunctionDefinitionVersionUpdateState", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkFunctionDefinitionVersionUpdateState"]: + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_ready_k8_s_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_ready_k8_s_operations.py new file mode 100644 index 00000000000..29c43a13148 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_function_ready_k8_s_operations.py @@ -0,0 +1,559 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_function_ready_k8_s_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionReadyK8SOperations: + """NetworkFunctionReadyK8SOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + **kwargs: Any + ) -> "_models.NetworkFunctionReadyK8S": + """Gets information about the specified network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionReadyK8S, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + parameters: "_models.NetworkFunctionReadyK8S", + **kwargs: Any + ) -> "_models.NetworkFunctionReadyK8S": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionReadyK8S') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + parameters: "_models.NetworkFunctionReadyK8S", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkFunctionReadyK8S"]: + """Creates or updates a network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :param parameters: Parameters supplied to the create or update network function ready K8s + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFunctionReadyK8S or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_function_ready_k8_s_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkFunctionReadyK8S": + """Updates a network function ready K8s update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :param parameters: Parameters supplied to update network function ready K8s tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionReadyK8S, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionReadyK8SListResult"]: + """Lists all network function ready K8s in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionReadyK8SListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8SListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8SListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionReadyK8SListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionReadyK8SListResult"]: + """Lists all network function ready K8s in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionReadyK8SListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8SListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8SListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionReadyK8SListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_functions_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_functions_operations.py new file mode 100644 index 00000000000..720906c97c9 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_functions_operations.py @@ -0,0 +1,673 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_functions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_execute_request_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionsOperations: + """NetworkFunctionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_function_name: str, + **kwargs: Any + ) -> "_models.NetworkFunction": + """Gets information about the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.NetworkFunction", + **kwargs: Any + ) -> "_models.NetworkFunction": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunction') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.NetworkFunction", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkFunction"]: + """Creates or updates a network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied in the body to the create or update network function + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFunction or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkFunction] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunction', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkFunction": + """Updates the tags for the network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied to the update network function tags operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionListResult"]: + """Lists all the network functions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionListResult"]: + """Lists all the network function resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions"} # type: ignore + + async def _execute_request_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.ExecuteRequestParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ExecuteRequestParameters') + + request = build_execute_request_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._execute_request_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _execute_request_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest"} # type: ignore + + + @distributed_trace_async + async def begin_execute_request( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.ExecuteRequestParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Execute a request to services on a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :param parameters: Payload for execute request post call. + :type parameters: ~Microsoft.HybridNetwork.models.ExecuteRequestParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._execute_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_execute_request.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_groups_operations.py new file mode 100644 index 00000000000..9a422fbe03e --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_groups_operations.py @@ -0,0 +1,511 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_service_design_groups_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_publisher_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkServiceDesignGroupsOperations: + """NetworkServiceDesignGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkServiceDesignGroupListResult"]: + """Gets information of the network service design groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkServiceDesignGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkServiceDesignGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: "_models.NetworkServiceDesignGroup", + **kwargs: Any + ) -> "_models.NetworkServiceDesignGroup": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignGroup') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: "_models.NetworkServiceDesignGroup", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkServiceDesignGroup"]: + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkServiceDesignGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + **kwargs: Any + ) -> "_models.NetworkServiceDesignGroup": + """Gets information about the specified networkServiceDesign group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkServiceDesignGroup": + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_versions_operations.py new file mode 100644 index 00000000000..e5cd4c64c09 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_network_service_design_versions_operations.py @@ -0,0 +1,680 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_service_design_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_network_service_design_group_request, build_update_request, build_update_state_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkServiceDesignVersionsOperations: + """NetworkServiceDesignVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: "_models.NetworkServiceDesignVersion", + **kwargs: Any + ) -> "_models.NetworkServiceDesignVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: "_models.NetworkServiceDesignVersion", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkServiceDesignVersion"]: + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkServiceDesignVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + **kwargs: Any + ) -> "_models.NetworkServiceDesignVersion": + """Gets information about a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.NetworkServiceDesignVersion": + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace + def list_by_network_service_design_group( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkServiceDesignVersionListResult"]: + """Gets information about a list of network service design versions under a network service design + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkServiceDesignVersionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_service_design_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self.list_by_network_service_design_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_service_design_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkServiceDesignVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_service_design_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions"} # type: ignore + + async def _update_state_initial( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: "_models.NetworkServiceDesignVersionUpdateState", + **kwargs: Any + ) -> Optional["_models.NetworkServiceDesignVersionUpdateState"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkServiceDesignVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignVersionUpdateState') + + request = build_update_state_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState"} # type: ignore + + + @distributed_trace_async + async def begin_update_state( + self, + resource_group_name: str, + publisher_name: str, + network_service_design_group_name: str, + network_service_design_version_name: str, + parameters: "_models.NetworkServiceDesignVersionUpdateState", + **kwargs: Any + ) -> AsyncLROPoller["_models.NetworkServiceDesignVersionUpdateState"]: + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + NetworkServiceDesignVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_operations.py new file mode 100644 index 00000000000..6a0c29c8809 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationList"]: + """Gets a list of the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.HybridNetwork/operations"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_preview_subscriptions_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_preview_subscriptions_operations.py new file mode 100644 index 00000000000..4a34c882a88 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_preview_subscriptions_operations.py @@ -0,0 +1,540 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._preview_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_network_function_definition_group_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PreviewSubscriptionsOperations: + """PreviewSubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_network_function_definition_group( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PreviewSubscriptionsList"]: + """Lists all the preview subscriptions of a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PreviewSubscriptionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.PreviewSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PreviewSubscriptionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + parameters: "_models.PreviewSubscription", + **kwargs: Any + ) -> "_models.PreviewSubscription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PreviewSubscription') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + parameters: "_models.PreviewSubscription", + **kwargs: Any + ) -> AsyncLROPoller["_models.PreviewSubscription"]: + """Creates or updates preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update publisher preview subscription + operation. + :type parameters: ~Microsoft.HybridNetwork.models.PreviewSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PreviewSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.PreviewSubscription] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + **kwargs: Any + ) -> "_models.PreviewSubscription": + """Gets the preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + network_function_definition_group_name: str, + preview_subscription: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.PreviewSubscription": + """Update a preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update publisher preview subscription + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_artifact_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_artifact_operations.py new file mode 100644 index 00000000000..0f25526d888 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_artifact_operations.py @@ -0,0 +1,228 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._proxy_artifact_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProxyArtifactOperations: + """ProxyArtifactOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProxyArtifactOverviewListResult"]: + """Lists all the available artifacts in the parent Artifact Store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactOverviewListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyArtifactOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + publisher_name: str, + artifact_store_name: str, + artifact_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProxyArtifactVersionsOverviewListResult"]: + """Get a Artifact overview information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactVersionsOverviewListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactVersionsOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + artifact_name=artifact_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + artifact_name=artifact_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyArtifactVersionsOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_groups_operations.py new file mode 100644 index 00000000000..2f4332009a3 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_groups_operations.py @@ -0,0 +1,203 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._proxy_network_function_definition_groups_operations import build_get_request, build_list_by_publisher_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProxyNetworkFunctionDefinitionGroupsOperations: + """ProxyNetworkFunctionDefinitionGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + publisher_scope_name: str, + publisher_location_name: str, + proxy_publisher_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionGroupOverviewListResult"]: + """Lists all available network function definition group under a publisher. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroupOverviewListResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionGroupOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups"} # type: ignore + + @distributed_trace_async + async def get( + self, + publisher_scope_name: str, + publisher_location_name: str, + proxy_publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionGroupOverview": + """Get information about network function definition overview. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroupOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroupOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_versions_operations.py new file mode 100644 index 00000000000..2faea08c44b --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_network_function_definition_versions_operations.py @@ -0,0 +1,215 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._proxy_network_function_definition_versions_operations import build_get_request, build_list_by_network_function_definition_group_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProxyNetworkFunctionDefinitionVersionsOperations: + """ProxyNetworkFunctionDefinitionVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_network_function_definition_group( + self, + publisher_scope_name: str, + publisher_location_name: str, + proxy_publisher_name: str, + network_function_definition_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkFunctionDefinitionVersionOverviewListResult"]: + """Lists available network function versions under a network function definition group. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionVersionOverviewListResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionVersionOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions"} # type: ignore + + @distributed_trace_async + async def get( + self, + publisher_scope_name: str, + publisher_location_name: str, + proxy_publisher_name: str, + network_function_definition_group_name: str, + network_function_definition_version_name: str, + **kwargs: Any + ) -> "_models.NetworkFunctionDefinitionVersionOverview": + """Get information about network function definition version overview. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersionOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersionOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_publisher_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_publisher_operations.py new file mode 100644 index 00000000000..48718b9442c --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_proxy_publisher_operations.py @@ -0,0 +1,193 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._proxy_publisher_operations import build_get_request, build_list_by_location_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProxyPublisherOperations: + """ProxyPublisherOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + publisher_scope_name: str, + publisher_location_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProxyPublisherOverviewListResult"]: + """Lists all the available network function definition and network service design publishers. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyPublisherOverviewListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.ProxyPublisherOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyPublisherOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyPublisherOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers"} # type: ignore + + @distributed_trace_async + async def get( + self, + publisher_scope_name: str, + publisher_location_name: str, + proxy_publisher_name: str, + **kwargs: Any + ) -> "_models.ProxyPublisherOverview": + """Get a publisher overview information. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProxyPublisherOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ProxyPublisherOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyPublisherOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProxyPublisherOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_publishers_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_publishers_operations.py new file mode 100644 index 00000000000..f2b322c3b3e --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_publishers_operations.py @@ -0,0 +1,561 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._publishers_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PublishersOperations: + """PublishersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PublisherListResult"]: + """Lists all the publishers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublisherListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.PublisherListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublisherListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PublisherListResult"]: + """Lists all the publishers in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublisherListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.PublisherListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublisherListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + publisher_name: str, + **kwargs: Any + ) -> "_models.Publisher": + """Gets information about the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Publisher + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional["_models.Publisher"] = None, + **kwargs: Any + ) -> "_models.Publisher": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'Publisher') + else: + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Publisher', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional["_models.Publisher"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.Publisher"]: + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. + :type parameters: ~Microsoft.HybridNetwork.models.Publisher + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Publisher or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.Publisher] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Publisher', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + publisher_name: str, + parameters: Optional["_models.TagsObject"] = None, + **kwargs: Any + ) -> "_models.Publisher": + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Publisher + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'TagsObject') + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_site_network_services_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_site_network_services_operations.py new file mode 100644 index 00000000000..c79bce18e9d --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_site_network_services_operations.py @@ -0,0 +1,557 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._site_network_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SiteNetworkServicesOperations: + """SiteNetworkServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + site_network_service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + site_network_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + site_network_service_name: str, + **kwargs: Any + ) -> "_models.SiteNetworkService": + """Gets information about the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteNetworkService, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.SiteNetworkService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: "_models.SiteNetworkService", + **kwargs: Any + ) -> "_models.SiteNetworkService": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SiteNetworkService') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: "_models.SiteNetworkService", + **kwargs: Any + ) -> AsyncLROPoller["_models.SiteNetworkService"]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + :type parameters: ~Microsoft.HybridNetwork.models.SiteNetworkService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.SiteNetworkService] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + site_network_service_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.SiteNetworkService": + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteNetworkService, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.SiteNetworkService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SiteNetworkServiceListResult"]: + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteNetworkServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.SiteNetworkServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SiteNetworkServiceListResult"]: + """Lists all site network services. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteNetworkServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.SiteNetworkServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/aio/operations/_sites_operations.py b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_sites_operations.py new file mode 100644 index 00000000000..2bdc955c7dc --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/aio/operations/_sites_operations.py @@ -0,0 +1,552 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sites_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SitesOperations: + """SitesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + site_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + site_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + site_name: str, + **kwargs: Any + ) -> "_models.Site": + """Gets information about the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + site_name: str, + parameters: "_models.Site", + **kwargs: Any + ) -> "_models.Site": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Site') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + site_name: str, + parameters: "_models.Site", + **kwargs: Any + ) -> AsyncLROPoller["_models.Site"]: + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + :type parameters: ~Microsoft.HybridNetwork.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~Microsoft.HybridNetwork.models.Site] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + site_name=site_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Site', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + site_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.Site": + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SiteListResult"]: + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.SiteListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SiteListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SiteListResult"]: + """Lists all sites in the network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~Microsoft.HybridNetwork.models.SiteListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SiteListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/models/__init__.py b/src/aosm/azext_aosm/vendored_sdks/models/__init__.py new file mode 100644 index 00000000000..31d9f39617d --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/models/__init__.py @@ -0,0 +1,484 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ArcConnectedK8SNetworkFunctionReadyK8S + from ._models_py3 import ArmResourceDefinitionResourceElementTemplate + from ._models_py3 import ArmResourceDefinitionResourceElementTemplateDetails + from ._models_py3 import ArmTemplateApplicationOverview + from ._models_py3 import ArmTemplateArtifactProfile + from ._models_py3 import ArmTemplateMappingRuleProfile + from ._models_py3 import ArtifactAccessCredential + from ._models_py3 import ArtifactChangeState + from ._models_py3 import ArtifactChangeStateProperties + from ._models_py3 import ArtifactManifest + from ._models_py3 import ArtifactManifestListResult + from ._models_py3 import ArtifactManifestUpdateState + from ._models_py3 import ArtifactProfile + from ._models_py3 import ArtifactStore + from ._models_py3 import ArtifactStoreListResult + from ._models_py3 import ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + from ._models_py3 import AzureArcK8SClusterNFVIDetails + from ._models_py3 import AzureArcKubernetesArtifactProfile + from ._models_py3 import AzureArcKubernetesDeployMappingRuleProfile + from ._models_py3 import AzureArcKubernetesHelmApplication + from ._models_py3 import AzureArcKubernetesNetworkFunctionApplication + from ._models_py3 import AzureArcKubernetesNetworkFunctionTemplate + from ._models_py3 import AzureContainerRegistryScopedTokenCredential + from ._models_py3 import AzureCoreArmTemplateArtifactProfile + from ._models_py3 import AzureCoreArmTemplateDeployMappingRuleProfile + from ._models_py3 import AzureCoreDelegatedImageArtifactProfile + from ._models_py3 import AzureCoreDelegatedImageDeployMappingRuleProfile + from ._models_py3 import AzureCoreDelegatedNetworkFunctionApplication + from ._models_py3 import AzureCoreDelegatedNetworkFunctionImageApplication + from ._models_py3 import AzureCoreDelegatedNetworkFunctionTemplate + from ._models_py3 import AzureCoreNFVIDetails + from ._models_py3 import AzureCoreNetworkFunctionApplication + from ._models_py3 import AzureCoreNetworkFunctionArmTemplateApplication + from ._models_py3 import AzureCoreNetworkFunctionTemplate + from ._models_py3 import AzureCoreNetworkFunctionVhdApplication + from ._models_py3 import AzureCoreVhdImageArtifactProfile + from ._models_py3 import AzureCoreVhdImageDeployMappingRuleProfile + from ._models_py3 import AzureKubernetesServiceNetworkFunctionReadyK8S + from ._models_py3 import AzureOperatorNexusArmTemplateArtifactProfile + from ._models_py3 import AzureOperatorNexusArmTemplateDeployMappingRuleProfile + from ._models_py3 import AzureOperatorNexusClusterNFVIDetails + from ._models_py3 import AzureOperatorNexusImageArtifactProfile + from ._models_py3 import AzureOperatorNexusImageDeployMappingRuleProfile + from ._models_py3 import AzureOperatorNexusNetworkFunctionApplication + from ._models_py3 import AzureOperatorNexusNetworkFunctionArmTemplateApplication + from ._models_py3 import AzureOperatorNexusNetworkFunctionImageApplication + from ._models_py3 import AzureOperatorNexusNetworkFunctionTemplate + from ._models_py3 import AzureStorageAccountContainerCredential + from ._models_py3 import AzureStorageAccountCredential + from ._models_py3 import Component + from ._models_py3 import ComponentListResult + from ._models_py3 import ConfigurationDefinitionResourceElementTemplate + from ._models_py3 import ConfigurationDefinitionResourceElementTemplateDetails + from ._models_py3 import ConfigurationGroupSchema + from ._models_py3 import ConfigurationGroupSchemaListResult + from ._models_py3 import ConfigurationGroupSchemaVersionUpdateState + from ._models_py3 import ConfigurationGroupValue + from ._models_py3 import ConfigurationGroupValueListResult + from ._models_py3 import ContainerizedNetworkFunctionDefinitionVersion + from ._models_py3 import ContainerizedNetworkFunctionTemplate + from ._models_py3 import CustomLocationResourceId + from ._models_py3 import DelegatedNetworkFunctionDefinitionVersion + from ._models_py3 import DelegatedNetworkFunctionTemplate + from ._models_py3 import DependsOnProfile + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ExecuteRequestParameters + from ._models_py3 import HelmArtifactProfile + from ._models_py3 import HelmMappingRuleProfile + from ._models_py3 import HelmPackageApplicationOverview + from ._models_py3 import HybridAKSNetworkFunctionReadyK8S + from ._models_py3 import ImageArtifactProfile + from ._models_py3 import ImageFileApplicationOverview + from ._models_py3 import ImageMappingRuleProfile + from ._models_py3 import ManagedResourceGroupConfiguration + from ._models_py3 import ManagedServiceIdentity + from ._models_py3 import ManifestArtifactFormat + from ._models_py3 import MappingRuleProfile + from ._models_py3 import NFVIs + from ._models_py3 import NSDArtifactProfile + from ._models_py3 import NetworkFunction + from ._models_py3 import NetworkFunctionApplication + from ._models_py3 import NetworkFunctionDefinitionApplicationOverview + from ._models_py3 import NetworkFunctionDefinitionGroup + from ._models_py3 import NetworkFunctionDefinitionGroupListResult + from ._models_py3 import NetworkFunctionDefinitionGroupOverview + from ._models_py3 import NetworkFunctionDefinitionGroupOverviewListResult + from ._models_py3 import NetworkFunctionDefinitionResourceElementTemplateDetails + from ._models_py3 import NetworkFunctionDefinitionVersion + from ._models_py3 import NetworkFunctionDefinitionVersionListResult + from ._models_py3 import NetworkFunctionDefinitionVersionOverview + from ._models_py3 import NetworkFunctionDefinitionVersionOverviewListResult + from ._models_py3 import NetworkFunctionDefinitionVersionPropertiesFormat + from ._models_py3 import NetworkFunctionDefinitionVersionUpdateState + from ._models_py3 import NetworkFunctionListResult + from ._models_py3 import NetworkFunctionReadyK8S + from ._models_py3 import NetworkFunctionReadyK8SListResult + from ._models_py3 import NetworkFunctionReadyK8SPropertiesFormat + from ._models_py3 import NetworkServiceDesignGroup + from ._models_py3 import NetworkServiceDesignGroupListResult + from ._models_py3 import NetworkServiceDesignVersion + from ._models_py3 import NetworkServiceDesignVersionListResult + from ._models_py3 import NetworkServiceDesignVersionUpdateState + from ._models_py3 import NfviDetails + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import PreviewSubscription + from ._models_py3 import PreviewSubscriptionsList + from ._models_py3 import ProxyArtifactListOverview + from ._models_py3 import ProxyArtifactOverview + from ._models_py3 import ProxyArtifactOverviewListResult + from ._models_py3 import ProxyArtifactOverviewPropertiesValue + from ._models_py3 import ProxyArtifactVersionsListOverview + from ._models_py3 import ProxyArtifactVersionsOverviewListResult + from ._models_py3 import ProxyPublisherOverview + from ._models_py3 import ProxyPublisherOverviewListResult + from ._models_py3 import ProxyResource + from ._models_py3 import Publisher + from ._models_py3 import PublisherListResult + from ._models_py3 import ReferencedResource + from ._models_py3 import RequestMetadata + from ._models_py3 import Resource + from ._models_py3 import ResourceElementTemplate + from ._models_py3 import Site + from ._models_py3 import SiteListResult + from ._models_py3 import SiteNetworkService + from ._models_py3 import SiteNetworkServiceListResult + from ._models_py3 import SystemData + from ._models_py3 import TagsObject + from ._models_py3 import TrackedResource + from ._models_py3 import UserAssignedIdentity + from ._models_py3 import VhdImageArtifactProfile + from ._models_py3 import VhdImageFileApplicationOverview + from ._models_py3 import VhdImageMappingRuleProfile + from ._models_py3 import VirtualNetworkFunctionDefinitionVersion + from ._models_py3 import VirtualNetworkFunctionTemplate +except (SyntaxError, ImportError): + from ._models import ArcConnectedK8SNetworkFunctionReadyK8S # type: ignore + from ._models import ArmResourceDefinitionResourceElementTemplate # type: ignore + from ._models import ArmResourceDefinitionResourceElementTemplateDetails # type: ignore + from ._models import ArmTemplateApplicationOverview # type: ignore + from ._models import ArmTemplateArtifactProfile # type: ignore + from ._models import ArmTemplateMappingRuleProfile # type: ignore + from ._models import ArtifactAccessCredential # type: ignore + from ._models import ArtifactChangeState # type: ignore + from ._models import ArtifactChangeStateProperties # type: ignore + from ._models import ArtifactManifest # type: ignore + from ._models import ArtifactManifestListResult # type: ignore + from ._models import ArtifactManifestUpdateState # type: ignore + from ._models import ArtifactProfile # type: ignore + from ._models import ArtifactStore # type: ignore + from ._models import ArtifactStoreListResult # type: ignore + from ._models import ArtifactStorePropertiesFormatManagedResourceGroupConfiguration # type: ignore + from ._models import AzureArcK8SClusterNFVIDetails # type: ignore + from ._models import AzureArcKubernetesArtifactProfile # type: ignore + from ._models import AzureArcKubernetesDeployMappingRuleProfile # type: ignore + from ._models import AzureArcKubernetesHelmApplication # type: ignore + from ._models import AzureArcKubernetesNetworkFunctionApplication # type: ignore + from ._models import AzureArcKubernetesNetworkFunctionTemplate # type: ignore + from ._models import AzureContainerRegistryScopedTokenCredential # type: ignore + from ._models import AzureCoreArmTemplateArtifactProfile # type: ignore + from ._models import AzureCoreArmTemplateDeployMappingRuleProfile # type: ignore + from ._models import AzureCoreDelegatedImageArtifactProfile # type: ignore + from ._models import AzureCoreDelegatedImageDeployMappingRuleProfile # type: ignore + from ._models import AzureCoreDelegatedNetworkFunctionApplication # type: ignore + from ._models import AzureCoreDelegatedNetworkFunctionImageApplication # type: ignore + from ._models import AzureCoreDelegatedNetworkFunctionTemplate # type: ignore + from ._models import AzureCoreNFVIDetails # type: ignore + from ._models import AzureCoreNetworkFunctionApplication # type: ignore + from ._models import AzureCoreNetworkFunctionArmTemplateApplication # type: ignore + from ._models import AzureCoreNetworkFunctionTemplate # type: ignore + from ._models import AzureCoreNetworkFunctionVhdApplication # type: ignore + from ._models import AzureCoreVhdImageArtifactProfile # type: ignore + from ._models import AzureCoreVhdImageDeployMappingRuleProfile # type: ignore + from ._models import AzureKubernetesServiceNetworkFunctionReadyK8S # type: ignore + from ._models import AzureOperatorNexusArmTemplateArtifactProfile # type: ignore + from ._models import AzureOperatorNexusArmTemplateDeployMappingRuleProfile # type: ignore + from ._models import AzureOperatorNexusClusterNFVIDetails # type: ignore + from ._models import AzureOperatorNexusImageArtifactProfile # type: ignore + from ._models import AzureOperatorNexusImageDeployMappingRuleProfile # type: ignore + from ._models import AzureOperatorNexusNetworkFunctionApplication # type: ignore + from ._models import AzureOperatorNexusNetworkFunctionArmTemplateApplication # type: ignore + from ._models import AzureOperatorNexusNetworkFunctionImageApplication # type: ignore + from ._models import AzureOperatorNexusNetworkFunctionTemplate # type: ignore + from ._models import AzureStorageAccountContainerCredential # type: ignore + from ._models import AzureStorageAccountCredential # type: ignore + from ._models import Component # type: ignore + from ._models import ComponentListResult # type: ignore + from ._models import ConfigurationDefinitionResourceElementTemplate # type: ignore + from ._models import ConfigurationDefinitionResourceElementTemplateDetails # type: ignore + from ._models import ConfigurationGroupSchema # type: ignore + from ._models import ConfigurationGroupSchemaListResult # type: ignore + from ._models import ConfigurationGroupSchemaVersionUpdateState # type: ignore + from ._models import ConfigurationGroupValue # type: ignore + from ._models import ConfigurationGroupValueListResult # type: ignore + from ._models import ContainerizedNetworkFunctionDefinitionVersion # type: ignore + from ._models import ContainerizedNetworkFunctionTemplate # type: ignore + from ._models import CustomLocationResourceId # type: ignore + from ._models import DelegatedNetworkFunctionDefinitionVersion # type: ignore + from ._models import DelegatedNetworkFunctionTemplate # type: ignore + from ._models import DependsOnProfile # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExecuteRequestParameters # type: ignore + from ._models import HelmArtifactProfile # type: ignore + from ._models import HelmMappingRuleProfile # type: ignore + from ._models import HelmPackageApplicationOverview # type: ignore + from ._models import HybridAKSNetworkFunctionReadyK8S # type: ignore + from ._models import ImageArtifactProfile # type: ignore + from ._models import ImageFileApplicationOverview # type: ignore + from ._models import ImageMappingRuleProfile # type: ignore + from ._models import ManagedResourceGroupConfiguration # type: ignore + from ._models import ManagedServiceIdentity # type: ignore + from ._models import ManifestArtifactFormat # type: ignore + from ._models import MappingRuleProfile # type: ignore + from ._models import NFVIs # type: ignore + from ._models import NSDArtifactProfile # type: ignore + from ._models import NetworkFunction # type: ignore + from ._models import NetworkFunctionApplication # type: ignore + from ._models import NetworkFunctionDefinitionApplicationOverview # type: ignore + from ._models import NetworkFunctionDefinitionGroup # type: ignore + from ._models import NetworkFunctionDefinitionGroupListResult # type: ignore + from ._models import NetworkFunctionDefinitionGroupOverview # type: ignore + from ._models import NetworkFunctionDefinitionGroupOverviewListResult # type: ignore + from ._models import NetworkFunctionDefinitionResourceElementTemplateDetails # type: ignore + from ._models import NetworkFunctionDefinitionVersion # type: ignore + from ._models import NetworkFunctionDefinitionVersionListResult # type: ignore + from ._models import NetworkFunctionDefinitionVersionOverview # type: ignore + from ._models import NetworkFunctionDefinitionVersionOverviewListResult # type: ignore + from ._models import NetworkFunctionDefinitionVersionPropertiesFormat # type: ignore + from ._models import NetworkFunctionDefinitionVersionUpdateState # type: ignore + from ._models import NetworkFunctionListResult # type: ignore + from ._models import NetworkFunctionReadyK8S # type: ignore + from ._models import NetworkFunctionReadyK8SListResult # type: ignore + from ._models import NetworkFunctionReadyK8SPropertiesFormat # type: ignore + from ._models import NetworkServiceDesignGroup # type: ignore + from ._models import NetworkServiceDesignGroupListResult # type: ignore + from ._models import NetworkServiceDesignVersion # type: ignore + from ._models import NetworkServiceDesignVersionListResult # type: ignore + from ._models import NetworkServiceDesignVersionUpdateState # type: ignore + from ._models import NfviDetails # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import PreviewSubscription # type: ignore + from ._models import PreviewSubscriptionsList # type: ignore + from ._models import ProxyArtifactListOverview # type: ignore + from ._models import ProxyArtifactOverview # type: ignore + from ._models import ProxyArtifactOverviewListResult # type: ignore + from ._models import ProxyArtifactOverviewPropertiesValue # type: ignore + from ._models import ProxyArtifactVersionsListOverview # type: ignore + from ._models import ProxyArtifactVersionsOverviewListResult # type: ignore + from ._models import ProxyPublisherOverview # type: ignore + from ._models import ProxyPublisherOverviewListResult # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Publisher # type: ignore + from ._models import PublisherListResult # type: ignore + from ._models import ReferencedResource # type: ignore + from ._models import RequestMetadata # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceElementTemplate # type: ignore + from ._models import Site # type: ignore + from ._models import SiteListResult # type: ignore + from ._models import SiteNetworkService # type: ignore + from ._models import SiteNetworkServiceListResult # type: ignore + from ._models import SystemData # type: ignore + from ._models import TagsObject # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserAssignedIdentity # type: ignore + from ._models import VhdImageArtifactProfile # type: ignore + from ._models import VhdImageFileApplicationOverview # type: ignore + from ._models import VhdImageMappingRuleProfile # type: ignore + from ._models import VirtualNetworkFunctionDefinitionVersion # type: ignore + from ._models import VirtualNetworkFunctionTemplate # type: ignore + +from ._hybrid_network_management_client_enums import ( + ApplicationEnablement, + ArtifactManifestState, + ArtifactReplicationStrategy, + ArtifactState, + ArtifactStoreType, + ArtifactType, + AzureArcKubernetesArtifactType, + AzureCoreArtifactType, + AzureCoreDelegatedArtifactType, + AzureOperatorNexusArtifactType, + ClusterType, + ConfigurationGenerationType, + ContainerizedNetworkFunctionNFVIType, + CreatedByType, + CredentialType, + DelegatedNetworkFunctionNFVIType, + HttpMethod, + ManagedServiceIdentityType, + NFVIType, + NetworkFunctionPublisherArtifactType, + NetworkFunctionType, + ProvisioningState, + PublisherScope, + TemplateType, + Type, + VersionState, + VirtualNetworkFunctionNFVIType, +) + +__all__ = [ + 'ArcConnectedK8SNetworkFunctionReadyK8S', + 'ArmResourceDefinitionResourceElementTemplate', + 'ArmResourceDefinitionResourceElementTemplateDetails', + 'ArmTemplateApplicationOverview', + 'ArmTemplateArtifactProfile', + 'ArmTemplateMappingRuleProfile', + 'ArtifactAccessCredential', + 'ArtifactChangeState', + 'ArtifactChangeStateProperties', + 'ArtifactManifest', + 'ArtifactManifestListResult', + 'ArtifactManifestUpdateState', + 'ArtifactProfile', + 'ArtifactStore', + 'ArtifactStoreListResult', + 'ArtifactStorePropertiesFormatManagedResourceGroupConfiguration', + 'AzureArcK8SClusterNFVIDetails', + 'AzureArcKubernetesArtifactProfile', + 'AzureArcKubernetesDeployMappingRuleProfile', + 'AzureArcKubernetesHelmApplication', + 'AzureArcKubernetesNetworkFunctionApplication', + 'AzureArcKubernetesNetworkFunctionTemplate', + 'AzureContainerRegistryScopedTokenCredential', + 'AzureCoreArmTemplateArtifactProfile', + 'AzureCoreArmTemplateDeployMappingRuleProfile', + 'AzureCoreDelegatedImageArtifactProfile', + 'AzureCoreDelegatedImageDeployMappingRuleProfile', + 'AzureCoreDelegatedNetworkFunctionApplication', + 'AzureCoreDelegatedNetworkFunctionImageApplication', + 'AzureCoreDelegatedNetworkFunctionTemplate', + 'AzureCoreNFVIDetails', + 'AzureCoreNetworkFunctionApplication', + 'AzureCoreNetworkFunctionArmTemplateApplication', + 'AzureCoreNetworkFunctionTemplate', + 'AzureCoreNetworkFunctionVhdApplication', + 'AzureCoreVhdImageArtifactProfile', + 'AzureCoreVhdImageDeployMappingRuleProfile', + 'AzureKubernetesServiceNetworkFunctionReadyK8S', + 'AzureOperatorNexusArmTemplateArtifactProfile', + 'AzureOperatorNexusArmTemplateDeployMappingRuleProfile', + 'AzureOperatorNexusClusterNFVIDetails', + 'AzureOperatorNexusImageArtifactProfile', + 'AzureOperatorNexusImageDeployMappingRuleProfile', + 'AzureOperatorNexusNetworkFunctionApplication', + 'AzureOperatorNexusNetworkFunctionArmTemplateApplication', + 'AzureOperatorNexusNetworkFunctionImageApplication', + 'AzureOperatorNexusNetworkFunctionTemplate', + 'AzureStorageAccountContainerCredential', + 'AzureStorageAccountCredential', + 'Component', + 'ComponentListResult', + 'ConfigurationDefinitionResourceElementTemplate', + 'ConfigurationDefinitionResourceElementTemplateDetails', + 'ConfigurationGroupSchema', + 'ConfigurationGroupSchemaListResult', + 'ConfigurationGroupSchemaVersionUpdateState', + 'ConfigurationGroupValue', + 'ConfigurationGroupValueListResult', + 'ContainerizedNetworkFunctionDefinitionVersion', + 'ContainerizedNetworkFunctionTemplate', + 'CustomLocationResourceId', + 'DelegatedNetworkFunctionDefinitionVersion', + 'DelegatedNetworkFunctionTemplate', + 'DependsOnProfile', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExecuteRequestParameters', + 'HelmArtifactProfile', + 'HelmMappingRuleProfile', + 'HelmPackageApplicationOverview', + 'HybridAKSNetworkFunctionReadyK8S', + 'ImageArtifactProfile', + 'ImageFileApplicationOverview', + 'ImageMappingRuleProfile', + 'ManagedResourceGroupConfiguration', + 'ManagedServiceIdentity', + 'ManifestArtifactFormat', + 'MappingRuleProfile', + 'NFVIs', + 'NSDArtifactProfile', + 'NetworkFunction', + 'NetworkFunctionApplication', + 'NetworkFunctionDefinitionApplicationOverview', + 'NetworkFunctionDefinitionGroup', + 'NetworkFunctionDefinitionGroupListResult', + 'NetworkFunctionDefinitionGroupOverview', + 'NetworkFunctionDefinitionGroupOverviewListResult', + 'NetworkFunctionDefinitionResourceElementTemplateDetails', + 'NetworkFunctionDefinitionVersion', + 'NetworkFunctionDefinitionVersionListResult', + 'NetworkFunctionDefinitionVersionOverview', + 'NetworkFunctionDefinitionVersionOverviewListResult', + 'NetworkFunctionDefinitionVersionPropertiesFormat', + 'NetworkFunctionDefinitionVersionUpdateState', + 'NetworkFunctionListResult', + 'NetworkFunctionReadyK8S', + 'NetworkFunctionReadyK8SListResult', + 'NetworkFunctionReadyK8SPropertiesFormat', + 'NetworkServiceDesignGroup', + 'NetworkServiceDesignGroupListResult', + 'NetworkServiceDesignVersion', + 'NetworkServiceDesignVersionListResult', + 'NetworkServiceDesignVersionUpdateState', + 'NfviDetails', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'PreviewSubscription', + 'PreviewSubscriptionsList', + 'ProxyArtifactListOverview', + 'ProxyArtifactOverview', + 'ProxyArtifactOverviewListResult', + 'ProxyArtifactOverviewPropertiesValue', + 'ProxyArtifactVersionsListOverview', + 'ProxyArtifactVersionsOverviewListResult', + 'ProxyPublisherOverview', + 'ProxyPublisherOverviewListResult', + 'ProxyResource', + 'Publisher', + 'PublisherListResult', + 'ReferencedResource', + 'RequestMetadata', + 'Resource', + 'ResourceElementTemplate', + 'Site', + 'SiteListResult', + 'SiteNetworkService', + 'SiteNetworkServiceListResult', + 'SystemData', + 'TagsObject', + 'TrackedResource', + 'UserAssignedIdentity', + 'VhdImageArtifactProfile', + 'VhdImageFileApplicationOverview', + 'VhdImageMappingRuleProfile', + 'VirtualNetworkFunctionDefinitionVersion', + 'VirtualNetworkFunctionTemplate', + 'ApplicationEnablement', + 'ArtifactManifestState', + 'ArtifactReplicationStrategy', + 'ArtifactState', + 'ArtifactStoreType', + 'ArtifactType', + 'AzureArcKubernetesArtifactType', + 'AzureCoreArtifactType', + 'AzureCoreDelegatedArtifactType', + 'AzureOperatorNexusArtifactType', + 'ClusterType', + 'ConfigurationGenerationType', + 'ContainerizedNetworkFunctionNFVIType', + 'CreatedByType', + 'CredentialType', + 'DelegatedNetworkFunctionNFVIType', + 'HttpMethod', + 'ManagedServiceIdentityType', + 'NFVIType', + 'NetworkFunctionPublisherArtifactType', + 'NetworkFunctionType', + 'ProvisioningState', + 'PublisherScope', + 'TemplateType', + 'Type', + 'VersionState', + 'VirtualNetworkFunctionNFVIType', +] diff --git a/src/aosm/azext_aosm/vendored_sdks/models/_hybrid_network_management_client_enums.py b/src/aosm/azext_aosm/vendored_sdks/models/_hybrid_network_management_client_enums.py new file mode 100644 index 00000000000..052b924987e --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/models/_hybrid_network_management_client_enums.py @@ -0,0 +1,247 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ApplicationEnablement(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The application enablement. + """ + + UNKNOWN = "Unknown" + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ArtifactManifestState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact manifest state. + """ + + UNKNOWN = "Unknown" + UPLOADING = "Uploading" + UPLOADED = "Uploaded" + VALIDATING = "Validating" + VALIDATION_FAILED = "ValidationFailed" + SUCCEEDED = "Succeeded" + +class ArtifactReplicationStrategy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The replication strategy. + """ + + UNKNOWN = "Unknown" + SINGLE_REPLICATION = "SingleReplication" + GEO_REPLICATION = "GeoReplication" + +class ArtifactState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact state. + """ + + UNKNOWN = "Unknown" + PREVIEW = "Preview" + ACTIVE = "Active" + DEPRECATED = "Deprecated" + +class ArtifactStoreType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact store type. + """ + + UNKNOWN = "Unknown" + AZURE_CONTAINER_REGISTRY = "AzureContainerRegistry" + AZURE_STORAGE_ACCOUNT = "AzureStorageAccount" + +class ArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact type. + """ + + UNKNOWN = "Unknown" + OCI_ARTIFACT = "OCIArtifact" + VHD_IMAGE_FILE = "VhdImageFile" + ARM_TEMPLATE = "ArmTemplate" + IMAGE_FILE = "ImageFile" + +class AzureArcKubernetesArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact type. + """ + + UNKNOWN = "Unknown" + HELM_PACKAGE = "HelmPackage" + +class AzureCoreArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact type. + """ + + UNKNOWN = "Unknown" + VHD_IMAGE_FILE = "VhdImageFile" + ARM_TEMPLATE = "ArmTemplate" + +class AzureCoreDelegatedArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact type. + """ + + UNKNOWN = "Unknown" + IMAGE_FILE = "ImageFile" + +class AzureOperatorNexusArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The artifact type. + """ + + UNKNOWN = "Unknown" + IMAGE_FILE = "ImageFile" + ARM_TEMPLATE = "ArmTemplate" + +class ClusterType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The cluster type. + """ + + AZURE_KUBERNETES_SERVICE = "AzureKubernetesService" + ARC_CONNECTED_K8_S = "ArcConnectedK8s" + HYBRID_AKS = "HybridAKS" + +class ConfigurationGenerationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The configuration generation type. + """ + + UNKNOWN = "Unknown" + HANDLEBAR_TEMPLATE = "HandlebarTemplate" + +class ContainerizedNetworkFunctionNFVIType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The network function type. + """ + + UNKNOWN = "Unknown" + AZURE_ARC_KUBERNETES = "AzureArcKubernetes" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class CredentialType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The credential type. + """ + + UNKNOWN = "Unknown" + AZURE_CONTAINER_REGISTRY_SCOPED_TOKEN = "AzureContainerRegistryScopedToken" + AZURE_STORAGE_ACCOUNT_TOKEN = "AzureStorageAccountToken" + +class DelegatedNetworkFunctionNFVIType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The network function type. + """ + + UNKNOWN = "Unknown" + AZURE_CORE = "AzureCore" + +class HttpMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The http method of the request. + """ + + UNKNOWN = "Unknown" + POST = "Post" + PUT = "Put" + GET = "Get" + PATCH = "Patch" + DELETE = "Delete" + +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class NetworkFunctionPublisherArtifactType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Network Function publisher artifact type. + """ + + UNKNOWN = "Unknown" + HELM_PACKAGE = "HelmPackage" + VHD_IMAGE_FILE = "VhdImageFile" + ARM_TEMPLATE = "ArmTemplate" + IMAGE_FILE = "ImageFile" + +class NetworkFunctionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The network function type. + """ + + UNKNOWN = "Unknown" + VIRTUAL_NETWORK_FUNCTION = "VirtualNetworkFunction" + CONTAINERIZED_NETWORK_FUNCTION = "ContainerizedNetworkFunction" + DELEGATED_NETWORK_FUNCTION = "DelegatedNetworkFunction" + +class NFVIType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The NFVI type. + """ + + UNKNOWN = "Unknown" + AZURE_ARC_KUBERNETES = "AzureArcKubernetes" + AZURE_CORE = "AzureCore" + AZURE_OPERATOR_NEXUS = "AzureOperatorNexus" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + ACCEPTED = "Accepted" + DELETING = "Deleting" + FAILED = "Failed" + CANCELED = "Canceled" + DELETED = "Deleted" + CONVERGING = "Converging" + +class PublisherScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Publisher Scope. + """ + + UNKNOWN = "Unknown" + PUBLIC = "Public" + PRIVATE = "Private" + +class TemplateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The template type. + """ + + UNKNOWN = "Unknown" + ARM_TEMPLATE = "ArmTemplate" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The resource element template type. + """ + + UNKNOWN = "Unknown" + ARM_RESOURCE_DEFINITION = "ArmResourceDefinition" + CONFIGURATION_DEFINITION = "ConfigurationDefinition" + NETWORK_FUNCTION_DEFINITION = "NetworkFunctionDefinition" + +class VersionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The configuration group schema state. + """ + + UNKNOWN = "Unknown" + PREVIEW = "Preview" + ACTIVE = "Active" + DEPRECATED = "Deprecated" + VALIDATING = "Validating" + VALIDATION_FAILED = "ValidationFailed" + +class VirtualNetworkFunctionNFVIType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The network function type. + """ + + UNKNOWN = "Unknown" + AZURE_CORE = "AzureCore" + AZURE_OPERATOR_NEXUS = "AzureOperatorNexus" diff --git a/src/aosm/azext_aosm/vendored_sdks/models/_models.py b/src/aosm/azext_aosm/vendored_sdks/models/_models.py new file mode 100644 index 00000000000..6f0814e429a --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/models/_models.py @@ -0,0 +1,6039 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class NetworkFunctionReadyK8SPropertiesFormat(msrest.serialization.Model): + """NetworkFunctionReadyK8s properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArcConnectedK8SNetworkFunctionReadyK8S, AzureKubernetesServiceNetworkFunctionReadyK8S, HybridAKSNetworkFunctionReadyK8S. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + _subtype_map = { + 'cluster_type': {'ArcConnectedK8s': 'ArcConnectedK8SNetworkFunctionReadyK8S', 'AzureKubernetesService': 'AzureKubernetesServiceNetworkFunctionReadyK8S', 'HybridAKS': 'HybridAKSNetworkFunctionReadyK8S'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(NetworkFunctionReadyK8SPropertiesFormat, self).__init__(**kwargs) + self.provisioning_state = None + self.cluster_type = None # type: Optional[str] + self.cluster_reference = kwargs['cluster_reference'] + self.custom_location_reference = None + + +class ArcConnectedK8SNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Arc Connected kubernetes cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + which has access to the connected cluster. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + 'user_assigned_managed_identity': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + which has access to the connected cluster. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(ArcConnectedK8SNetworkFunctionReadyK8S, self).__init__(**kwargs) + self.cluster_type = 'ArcConnectedK8s' # type: str + self.user_assigned_managed_identity = kwargs['user_assigned_managed_identity'] + + +class ArmResourceDefinitionResourceElementTemplate(msrest.serialization.Model): + """The arm template RE. + + :ivar template_type: The template type. Possible values include: "Unknown", "ArmTemplate". + :vartype template_type: str or ~Microsoft.HybridNetwork.models.TemplateType + :ivar parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :vartype parameter_values: str + :ivar artifact_profile: Artifact profile properties. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + """ + + _attribute_map = { + 'template_type': {'key': 'templateType', 'type': 'str'}, + 'parameter_values': {'key': 'parameterValues', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'NSDArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword template_type: The template type. Possible values include: "Unknown", "ArmTemplate". + :paramtype template_type: str or ~Microsoft.HybridNetwork.models.TemplateType + :keyword parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :paramtype parameter_values: str + :keyword artifact_profile: Artifact profile properties. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + """ + super(ArmResourceDefinitionResourceElementTemplate, self).__init__(**kwargs) + self.template_type = kwargs.get('template_type', None) + self.parameter_values = kwargs.get('parameter_values', None) + self.artifact_profile = kwargs.get('artifact_profile', None) + + +class ResourceElementTemplate(msrest.serialization.Model): + """The resource element template object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArmResourceDefinitionResourceElementTemplateDetails, ConfigurationDefinitionResourceElementTemplateDetails, NetworkFunctionDefinitionResourceElementTemplateDetails. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + } + + _subtype_map = { + 'type': {'ArmResourceDefinition': 'ArmResourceDefinitionResourceElementTemplateDetails', 'ConfigurationDefinition': 'ConfigurationDefinitionResourceElementTemplateDetails', 'NetworkFunctionDefinition': 'NetworkFunctionDefinitionResourceElementTemplateDetails'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(ResourceElementTemplate, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = None # type: Optional[str] + self.depends_on_profile = kwargs.get('depends_on_profile', None) + + +class ArmResourceDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The arm resource definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ArmResourceDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super(ArmResourceDefinitionResourceElementTemplateDetails, self).__init__(**kwargs) + self.type = 'ArmResourceDefinition' # type: str + self.configuration = kwargs.get('configuration', None) + + +class NetworkFunctionDefinitionApplicationOverview(msrest.serialization.Model): + """The network function definition application overview. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArmTemplateApplicationOverview, HelmPackageApplicationOverview, ImageFileApplicationOverview, VhdImageFileApplicationOverview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'ArmTemplateApplicationOverview', 'HelmPackage': 'HelmPackageApplicationOverview', 'ImageFile': 'ImageFileApplicationOverview', 'VhdImageFile': 'VhdImageFileApplicationOverview'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkFunctionDefinitionApplicationOverview, self).__init__(**kwargs) + self.name = None + self.artifact_type = None # type: Optional[str] + + +class ArmTemplateApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Arm template Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArmTemplateApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class ArmTemplateArtifactProfile(msrest.serialization.Model): + """Template artifact profile. + + :ivar template_name: Template name. + :vartype template_name: str + :ivar template_version: Template version. + :vartype template_version: str + """ + + _attribute_map = { + 'template_name': {'key': 'templateName', 'type': 'str'}, + 'template_version': {'key': 'templateVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword template_name: Template name. + :paramtype template_name: str + :keyword template_version: Template version. + :paramtype template_version: str + """ + super(ArmTemplateArtifactProfile, self).__init__(**kwargs) + self.template_name = kwargs.get('template_name', None) + self.template_version = kwargs.get('template_version', None) + + +class ArmTemplateMappingRuleProfile(msrest.serialization.Model): + """Template mapping rule profile. + + :ivar template_parameters: List of template parameters. + :vartype template_parameters: str + """ + + _attribute_map = { + 'template_parameters': {'key': 'templateParameters', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword template_parameters: List of template parameters. + :paramtype template_parameters: str + """ + super(ArmTemplateMappingRuleProfile, self).__init__(**kwargs) + self.template_parameters = kwargs.get('template_parameters', None) + + +class ArtifactAccessCredential(msrest.serialization.Model): + """The artifact manifest credential definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureContainerRegistryScopedTokenCredential, AzureStorageAccountCredential. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + } + + _subtype_map = { + 'credential_type': {'AzureContainerRegistryScopedToken': 'AzureContainerRegistryScopedTokenCredential', 'AzureStorageAccountToken': 'AzureStorageAccountCredential'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArtifactAccessCredential, self).__init__(**kwargs) + self.credential_type = None # type: Optional[str] + + +class ArtifactChangeState(msrest.serialization.Model): + """The artifact updating request payload. + + :ivar properties: Artifact update state properties. + :vartype properties: ~Microsoft.HybridNetwork.models.ArtifactChangeStateProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'ArtifactChangeStateProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Artifact update state properties. + :paramtype properties: ~Microsoft.HybridNetwork.models.ArtifactChangeStateProperties + """ + super(ArtifactChangeState, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ArtifactChangeStateProperties(msrest.serialization.Model): + """The artifact update state properties. + + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _attribute_map = { + 'artifact_state': {'key': 'artifactState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ArtifactChangeStateProperties, self).__init__(**kwargs) + self.artifact_state = kwargs.get('artifact_state', None) + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class ArtifactManifest(TrackedResource): + """Artifact manifest properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the ArtifactManifest resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar artifact_manifest_state: The artifact manifest state. Possible values include: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :vartype artifact_manifest_state: str or ~Microsoft.HybridNetwork.models.ArtifactManifestState + :ivar artifacts: The artifacts list. + :vartype artifacts: list[~Microsoft.HybridNetwork.models.ManifestArtifactFormat] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'artifact_manifest_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'artifact_manifest_state': {'key': 'properties.artifactManifestState', 'type': 'str'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[ManifestArtifactFormat]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword artifacts: The artifacts list. + :paramtype artifacts: list[~Microsoft.HybridNetwork.models.ManifestArtifactFormat] + """ + super(ArtifactManifest, self).__init__(**kwargs) + self.provisioning_state = None + self.artifact_manifest_state = None + self.artifacts = kwargs.get('artifacts', None) + + +class ArtifactManifestListResult(msrest.serialization.Model): + """A list of artifact manifests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of artifact manifests. + :vartype value: list[~Microsoft.HybridNetwork.models.ArtifactManifest] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArtifactManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of artifact manifests. + :paramtype value: list[~Microsoft.HybridNetwork.models.ArtifactManifest] + """ + super(ArtifactManifestListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ArtifactManifestUpdateState(msrest.serialization.Model): + """The artifact manifest updating request payload. Only the 'Uploaded' state is allowed for updates. Other states are used for internal state transitioning. + + :ivar artifact_manifest_state: The artifact manifest state. Possible values include: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :vartype artifact_manifest_state: str or ~Microsoft.HybridNetwork.models.ArtifactManifestState + """ + + _attribute_map = { + 'artifact_manifest_state': {'key': 'artifactManifestState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_manifest_state: The artifact manifest state. Possible values include: + "Unknown", "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :paramtype artifact_manifest_state: str or + ~Microsoft.HybridNetwork.models.ArtifactManifestState + """ + super(ArtifactManifestUpdateState, self).__init__(**kwargs) + self.artifact_manifest_state = kwargs.get('artifact_manifest_state', None) + + +class ArtifactProfile(msrest.serialization.Model): + """Artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(ArtifactProfile, self).__init__(**kwargs) + self.artifact_store = kwargs.get('artifact_store', None) + + +class ArtifactStore(TrackedResource): + """Artifact store properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the application groups resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar store_type: The artifact store type. Possible values include: "Unknown", + "AzureContainerRegistry", "AzureStorageAccount". + :vartype store_type: str or ~Microsoft.HybridNetwork.models.ArtifactStoreType + :ivar replication_strategy: The replication strategy. Possible values include: "Unknown", + "SingleReplication", "GeoReplication". + :vartype replication_strategy: str or + ~Microsoft.HybridNetwork.models.ArtifactReplicationStrategy + :ivar managed_resource_group_configuration: + :vartype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + :ivar storage_resource_id: The created storage resource id. + :vartype storage_resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'storage_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'store_type': {'key': 'properties.storeType', 'type': 'str'}, + 'replication_strategy': {'key': 'properties.replicationStrategy', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ArtifactStorePropertiesFormatManagedResourceGroupConfiguration'}, + 'storage_resource_id': {'key': 'properties.storageResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword store_type: The artifact store type. Possible values include: "Unknown", + "AzureContainerRegistry", "AzureStorageAccount". + :paramtype store_type: str or ~Microsoft.HybridNetwork.models.ArtifactStoreType + :keyword replication_strategy: The replication strategy. Possible values include: "Unknown", + "SingleReplication", "GeoReplication". + :paramtype replication_strategy: str or + ~Microsoft.HybridNetwork.models.ArtifactReplicationStrategy + :keyword managed_resource_group_configuration: + :paramtype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + """ + super(ArtifactStore, self).__init__(**kwargs) + self.provisioning_state = None + self.store_type = kwargs.get('store_type', None) + self.replication_strategy = kwargs.get('replication_strategy', None) + self.managed_resource_group_configuration = kwargs.get('managed_resource_group_configuration', None) + self.storage_resource_id = None + + +class ArtifactStoreListResult(msrest.serialization.Model): + """A list of artifact stores. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of artifact stores. + :vartype value: list[~Microsoft.HybridNetwork.models.ArtifactStore] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArtifactStore]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of artifact stores. + :paramtype value: list[~Microsoft.HybridNetwork.models.ArtifactStore] + """ + super(ArtifactStoreListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(msrest.serialization.Model): + """ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + + :ivar name: The managed resource group name. + :vartype name: str + :ivar location: The managed resource group location. + :vartype location: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The managed resource group name. + :paramtype name: str + :keyword location: The managed resource group location. + :paramtype location: str + """ + super(ArtifactStorePropertiesFormatManagedResourceGroupConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs.get('location', None) + + +class NFVIs(msrest.serialization.Model): + """The NFVI object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcK8SClusterNFVIDetails, AzureCoreNFVIDetails, AzureOperatorNexusClusterNFVIDetails. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureArcKubernetes': 'AzureArcK8SClusterNFVIDetails', 'AzureCore': 'AzureCoreNFVIDetails', 'AzureOperatorNexus': 'AzureOperatorNexusClusterNFVIDetails'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + """ + super(NFVIs, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.nfvi_type = None # type: Optional[str] + + +class AzureArcK8SClusterNFVIDetails(NFVIs): + """The AzureArcK8sCluster NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureArcK8SClusterNFVIDetails, self).__init__(**kwargs) + self.nfvi_type = 'AzureArcKubernetes' # type: str + self.custom_location_reference = kwargs.get('custom_location_reference', None) + + +class AzureArcKubernetesArtifactProfile(ArtifactProfile): + """Azure arc kubernetes artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar helm_artifact_profile: Helm artifact profile. + :vartype helm_artifact_profile: ~Microsoft.HybridNetwork.models.HelmArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'helm_artifact_profile': {'key': 'helmArtifactProfile', 'type': 'HelmArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword helm_artifact_profile: Helm artifact profile. + :paramtype helm_artifact_profile: ~Microsoft.HybridNetwork.models.HelmArtifactProfile + """ + super(AzureArcKubernetesArtifactProfile, self).__init__(**kwargs) + self.helm_artifact_profile = kwargs.get('helm_artifact_profile', None) + + +class MappingRuleProfile(msrest.serialization.Model): + """Mapping rule profile properties. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + """ + super(MappingRuleProfile, self).__init__(**kwargs) + self.application_enablement = kwargs.get('application_enablement', None) + + +class AzureArcKubernetesDeployMappingRuleProfile(MappingRuleProfile): + """Azure arc kubernetes deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar helm_mapping_rule_profile: The helm mapping rule profile. + :vartype helm_mapping_rule_profile: ~Microsoft.HybridNetwork.models.HelmMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'helm_mapping_rule_profile': {'key': 'helmMappingRuleProfile', 'type': 'HelmMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword helm_mapping_rule_profile: The helm mapping rule profile. + :paramtype helm_mapping_rule_profile: ~Microsoft.HybridNetwork.models.HelmMappingRuleProfile + """ + super(AzureArcKubernetesDeployMappingRuleProfile, self).__init__(**kwargs) + self.helm_mapping_rule_profile = kwargs.get('helm_mapping_rule_profile', None) + + +class NetworkFunctionApplication(msrest.serialization.Model): + """Network function application definition. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(NetworkFunctionApplication, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.depends_on_profile = kwargs.get('depends_on_profile', None) + + +class AzureArcKubernetesNetworkFunctionApplication(NetworkFunctionApplication): + """Azure arc kubernetes network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcKubernetesHelmApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "HelmPackage". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'HelmPackage': 'AzureArcKubernetesHelmApplication'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureArcKubernetesNetworkFunctionApplication, self).__init__(**kwargs) + self.artifact_type = 'AzureArcKubernetesNetworkFunctionApplication' # type: str + + +class AzureArcKubernetesHelmApplication(AzureArcKubernetesNetworkFunctionApplication): + """Azure arc kubernetes helm application configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "HelmPackage". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactType + :ivar artifact_profile: Azure arc kubernetes artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureArcKubernetesArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureArcKubernetesDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure arc kubernetes artifact profile. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + super(AzureArcKubernetesHelmApplication, self).__init__(**kwargs) + self.artifact_type = 'HelmPackage' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class ContainerizedNetworkFunctionTemplate(msrest.serialization.Model): + """Containerized network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcKubernetesNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureArcKubernetes". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureArcKubernetes': 'AzureArcKubernetesNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContainerizedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureArcKubernetesNetworkFunctionTemplate(ContainerizedNetworkFunctionTemplate): + """Azure Arc kubernetes network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureArcKubernetes". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureArcKubernetesNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureArcKubernetesNetworkFunctionApplication]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureArcKubernetesNetworkFunctionApplication] + """ + super(AzureArcKubernetesNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureArcKubernetes' # type: str + self.network_function_applications = kwargs.get('network_function_applications', None) + + +class AzureContainerRegistryScopedTokenCredential(ArtifactAccessCredential): + """The azure container registry scoped token credential definition. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + :ivar username: The username of the credential. + :vartype username: str + :ivar acr_token: The credential value. + :vartype acr_token: str + :ivar acr_server_url: The Acr server url. + :vartype acr_server_url: str + :ivar repositories: The repositories that could be accessed using the current credential. + :vartype repositories: list[str] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'acr_token': {'key': 'acrToken', 'type': 'str'}, + 'acr_server_url': {'key': 'acrServerUrl', 'type': 'str'}, + 'repositories': {'key': 'repositories', 'type': '[str]'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword username: The username of the credential. + :paramtype username: str + :keyword acr_token: The credential value. + :paramtype acr_token: str + :keyword acr_server_url: The Acr server url. + :paramtype acr_server_url: str + :keyword repositories: The repositories that could be accessed using the current credential. + :paramtype repositories: list[str] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime + """ + super(AzureContainerRegistryScopedTokenCredential, self).__init__(**kwargs) + self.credential_type = 'AzureContainerRegistryScopedToken' # type: str + self.username = kwargs.get('username', None) + self.acr_token = kwargs.get('acr_token', None) + self.acr_server_url = kwargs.get('acr_server_url', None) + self.repositories = kwargs.get('repositories', None) + self.expiry = kwargs.get('expiry', None) + + +class AzureCoreArmTemplateArtifactProfile(ArtifactProfile): + """Azure template artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'template_artifact_profile': {'key': 'templateArtifactProfile', 'type': 'ArmTemplateArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + super(AzureCoreArmTemplateArtifactProfile, self).__init__(**kwargs) + self.template_artifact_profile = kwargs.get('template_artifact_profile', None) + + +class AzureCoreArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure template deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'template_mapping_rule_profile': {'key': 'templateMappingRuleProfile', 'type': 'ArmTemplateMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + super(AzureCoreArmTemplateDeployMappingRuleProfile, self).__init__(**kwargs) + self.template_mapping_rule_profile = kwargs.get('template_mapping_rule_profile', None) + + +class AzureCoreDelegatedImageArtifactProfile(ArtifactProfile): + """Azure Image artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar image_artifact_profile: Image artifact profile. + :vartype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'image_artifact_profile': {'key': 'imageArtifactProfile', 'type': 'ImageArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword image_artifact_profile: Image artifact profile. + :paramtype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + super(AzureCoreDelegatedImageArtifactProfile, self).__init__(**kwargs) + self.image_artifact_profile = kwargs.get('image_artifact_profile', None) + + +class AzureCoreDelegatedImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure Image deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar image_mapping_rule_profile: The Image mapping rule profile. + :vartype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'image_mapping_rule_profile': {'key': 'imageMappingRuleProfile', 'type': 'ImageMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword image_mapping_rule_profile: The Image mapping rule profile. + :paramtype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + super(AzureCoreDelegatedImageDeployMappingRuleProfile, self).__init__(**kwargs) + self.image_mapping_rule_profile = kwargs.get('image_mapping_rule_profile', None) + + +class AzureCoreDelegatedNetworkFunctionApplication(NetworkFunctionApplication): + """Azure delegated network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreDelegatedNetworkFunctionImageApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreDelegatedArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ImageFile': 'AzureCoreDelegatedNetworkFunctionImageApplication'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureCoreDelegatedNetworkFunctionApplication, self).__init__(**kwargs) + self.artifact_type = 'AzureCoreDelegatedNetworkFunctionApplication' # type: str + + +class AzureCoreDelegatedNetworkFunctionImageApplication(AzureCoreDelegatedNetworkFunctionApplication): + """Azure core network function Image application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreDelegatedArtifactType + :ivar artifact_profile: Azure Image artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreDelegatedImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreDelegatedImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Image artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + super(AzureCoreDelegatedNetworkFunctionImageApplication, self).__init__(**kwargs) + self.artifact_type = 'ImageFile' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class DelegatedNetworkFunctionTemplate(msrest.serialization.Model): + """Delegated network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreDelegatedNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureCore': 'AzureCoreDelegatedNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DelegatedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureCoreDelegatedNetworkFunctionTemplate(DelegatedNetworkFunctionTemplate): + """Azure delegated network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreDelegatedNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureCoreDelegatedNetworkFunctionApplication]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreDelegatedNetworkFunctionApplication] + """ + super(AzureCoreDelegatedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.network_function_applications = kwargs.get('network_function_applications', None) + + +class AzureCoreNetworkFunctionApplication(NetworkFunctionApplication): + """Azure virtual network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreNetworkFunctionArmTemplateApplication, AzureCoreNetworkFunctionVhdApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'AzureCoreNetworkFunctionArmTemplateApplication', 'VhdImageFile': 'AzureCoreNetworkFunctionVhdApplication'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureCoreNetworkFunctionApplication, self).__init__(**kwargs) + self.artifact_type = 'AzureCoreNetworkFunctionApplication' # type: str + + +class AzureCoreNetworkFunctionArmTemplateApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function Template application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure template artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreArmTemplateArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure template artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + super(AzureCoreNetworkFunctionArmTemplateApplication, self).__init__(**kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class VirtualNetworkFunctionTemplate(msrest.serialization.Model): + """Virtual network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreNetworkFunctionTemplate, AzureOperatorNexusNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureCore': 'AzureCoreNetworkFunctionTemplate', 'AzureOperatorNexus': 'AzureOperatorNexusNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureCoreNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure virtual network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureCoreNetworkFunctionApplication]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreNetworkFunctionApplication] + """ + super(AzureCoreNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.network_function_applications = kwargs.get('network_function_applications', None) + + +class AzureCoreNetworkFunctionVhdApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function vhd application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure vhd image artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreVhdImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreVhdImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreVhdImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure vhd image artifact profile. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreVhdImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + super(AzureCoreNetworkFunctionVhdApplication, self).__init__(**kwargs) + self.artifact_type = 'VhdImageFile' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class AzureCoreNFVIDetails(NFVIs): + """The Azure Core NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar location: Location of the Azure core. + :vartype location: str + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword location: Location of the Azure core. + :paramtype location: str + """ + super(AzureCoreNFVIDetails, self).__init__(**kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.location = kwargs.get('location', None) + + +class AzureCoreVhdImageArtifactProfile(ArtifactProfile): + """Azure vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar vhd_artifact_profile: Vhd artifact profile. + :vartype vhd_artifact_profile: ~Microsoft.HybridNetwork.models.VhdImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'vhd_artifact_profile': {'key': 'vhdArtifactProfile', 'type': 'VhdImageArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword vhd_artifact_profile: Vhd artifact profile. + :paramtype vhd_artifact_profile: ~Microsoft.HybridNetwork.models.VhdImageArtifactProfile + """ + super(AzureCoreVhdImageArtifactProfile, self).__init__(**kwargs) + self.vhd_artifact_profile = kwargs.get('vhd_artifact_profile', None) + + +class AzureCoreVhdImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure vhd deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :vartype vhd_image_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.VhdImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'vhd_image_mapping_rule_profile': {'key': 'vhdImageMappingRuleProfile', 'type': 'VhdImageMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype vhd_image_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.VhdImageMappingRuleProfile + """ + super(AzureCoreVhdImageDeployMappingRuleProfile, self).__init__(**kwargs) + self.vhd_image_mapping_rule_profile = kwargs.get('vhd_image_mapping_rule_profile', None) + + +class AzureKubernetesServiceNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Azure based kubernetes service cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + enabled on the AKS cluster. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + 'user_assigned_managed_identity': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + enabled on the AKS cluster. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureKubernetesServiceNetworkFunctionReadyK8S, self).__init__(**kwargs) + self.cluster_type = 'AzureKubernetesService' # type: str + self.user_assigned_managed_identity = kwargs['user_assigned_managed_identity'] + + +class AzureOperatorNexusArmTemplateArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'template_artifact_profile': {'key': 'templateArtifactProfile', 'type': 'ArmTemplateArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + super(AzureOperatorNexusArmTemplateArtifactProfile, self).__init__(**kwargs) + self.template_artifact_profile = kwargs.get('template_artifact_profile', None) + + +class AzureOperatorNexusArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services template deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'template_mapping_rule_profile': {'key': 'templateMappingRuleProfile', 'type': 'ArmTemplateMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + super(AzureOperatorNexusArmTemplateDeployMappingRuleProfile, self).__init__(**kwargs) + self.template_mapping_rule_profile = kwargs.get('template_mapping_rule_profile', None) + + +class AzureOperatorNexusClusterNFVIDetails(NFVIs): + """The AzureOperatorNexusCluster NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureOperatorNexusClusterNFVIDetails, self).__init__(**kwargs) + self.nfvi_type = 'AzureOperatorNexus' # type: str + self.custom_location_reference = kwargs.get('custom_location_reference', None) + + +class AzureOperatorNexusImageArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services image artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar image_artifact_profile: Image artifact profile. + :vartype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'image_artifact_profile': {'key': 'imageArtifactProfile', 'type': 'ImageArtifactProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword image_artifact_profile: Image artifact profile. + :paramtype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + super(AzureOperatorNexusImageArtifactProfile, self).__init__(**kwargs) + self.image_artifact_profile = kwargs.get('image_artifact_profile', None) + + +class AzureOperatorNexusImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services image deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar image_mapping_rule_profile: The vhd mapping rule profile. + :vartype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'image_mapping_rule_profile': {'key': 'imageMappingRuleProfile', 'type': 'ImageMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + super(AzureOperatorNexusImageDeployMappingRuleProfile, self).__init__(**kwargs) + self.image_mapping_rule_profile = kwargs.get('image_mapping_rule_profile', None) + + +class AzureOperatorNexusNetworkFunctionApplication(NetworkFunctionApplication): + """Azure Operator Distributed Services network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureOperatorNexusNetworkFunctionArmTemplateApplication, AzureOperatorNexusNetworkFunctionImageApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'AzureOperatorNexusNetworkFunctionArmTemplateApplication', 'ImageFile': 'AzureOperatorNexusNetworkFunctionImageApplication'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureOperatorNexusNetworkFunctionApplication, self).__init__(**kwargs) + self.artifact_type = 'AzureOperatorNexusNetworkFunctionApplication' # type: str + + +class AzureOperatorNexusNetworkFunctionArmTemplateApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function Template application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services Template artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureOperatorNexusArmTemplateArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureOperatorNexusArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services Template artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + super(AzureOperatorNexusNetworkFunctionArmTemplateApplication, self).__init__(**kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class AzureOperatorNexusNetworkFunctionImageApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function image application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services image artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureOperatorNexusImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureOperatorNexusImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services image artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + super(AzureOperatorNexusNetworkFunctionImageApplication, self).__init__(**kwargs) + self.artifact_type = 'ImageFile' # type: str + self.artifact_profile = kwargs.get('artifact_profile', None) + self.deploy_parameters_mapping_rule_profile = kwargs.get('deploy_parameters_mapping_rule_profile', None) + + +class AzureOperatorNexusNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure Operator Distributed Services network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureOperatorNexusNetworkFunctionApplication]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + super(AzureOperatorNexusNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureOperatorNexus' # type: str + self.network_function_applications = kwargs.get('network_function_applications', None) + + +class AzureStorageAccountContainerCredential(msrest.serialization.Model): + """The azure storage account container credential definition. + + :ivar container_name: The storage account container name. + :vartype container_name: str + :ivar container_sas_uri: The storage account container sas uri. + :vartype container_sas_uri: str + """ + + _attribute_map = { + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'container_sas_uri': {'key': 'containerSasUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword container_name: The storage account container name. + :paramtype container_name: str + :keyword container_sas_uri: The storage account container sas uri. + :paramtype container_sas_uri: str + """ + super(AzureStorageAccountContainerCredential, self).__init__(**kwargs) + self.container_name = kwargs.get('container_name', None) + self.container_sas_uri = kwargs.get('container_sas_uri', None) + + +class AzureStorageAccountCredential(ArtifactAccessCredential): + """The azure storage account credential definition. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + :ivar storage_account_id: The storage account Id. + :vartype storage_account_id: str + :ivar container_credentials: The containers that could be accessed using the current + credential. + :vartype container_credentials: + list[~Microsoft.HybridNetwork.models.AzureStorageAccountContainerCredential] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'container_credentials': {'key': 'containerCredentials', 'type': '[AzureStorageAccountContainerCredential]'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword storage_account_id: The storage account Id. + :paramtype storage_account_id: str + :keyword container_credentials: The containers that could be accessed using the current + credential. + :paramtype container_credentials: + list[~Microsoft.HybridNetwork.models.AzureStorageAccountContainerCredential] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime + """ + super(AzureStorageAccountCredential, self).__init__(**kwargs) + self.credential_type = 'AzureStorageAccountToken' # type: str + self.storage_account_id = kwargs.get('storage_account_id', None) + self.container_credentials = kwargs.get('container_credentials', None) + self.expiry = kwargs.get('expiry', None) + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class Component(ProxyResource): + """The component sub resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar provisioning_state: The provisioning state of the component resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar deployment_profile: The JSON-serialized deployment profile of the component resource. + :vartype deployment_profile: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'deployment_profile': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'deployment_profile': {'key': 'properties.deploymentProfile', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Component, self).__init__(**kwargs) + self.provisioning_state = None + self.deployment_profile = None + + +class ComponentListResult(msrest.serialization.Model): + """Response for list component API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of component resources in a networkFunction. + :vartype value: list[~Microsoft.HybridNetwork.models.Component] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Component]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of component resources in a networkFunction. + :paramtype value: list[~Microsoft.HybridNetwork.models.Component] + """ + super(ComponentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ConfigurationDefinitionResourceElementTemplate(msrest.serialization.Model): + """The configuration definition resource element template details. + + :ivar name: The name of the network function to apply the configuration to. + :vartype name: str + :ivar nf_agent_type: The type of NF agent that should handle this configuration. + :vartype nf_agent_type: str + :ivar configuration_type: The type of configuration to be handled by the NF agent. + :vartype configuration_type: str + :ivar configuration_generation_type: The configuration generation type. Possible values + include: "Unknown", "HandlebarTemplate". + :vartype configuration_generation_type: str or + ~Microsoft.HybridNetwork.models.ConfigurationGenerationType + :ivar parameter_values: Name and value pairs that define the parameter values. It can be a well + formed escaped JSON string. + :vartype parameter_values: str + :ivar artifact_profile: Artifact profile properties. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + :ivar extra_artifact_profiles: List of extra artifact profiles required by the configuration. + :vartype extra_artifact_profiles: list[~Microsoft.HybridNetwork.models.NSDArtifactProfile] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nf_agent_type': {'key': 'nfAgentType', 'type': 'str'}, + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + 'configuration_generation_type': {'key': 'configurationGenerationType', 'type': 'str'}, + 'parameter_values': {'key': 'parameterValues', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'NSDArtifactProfile'}, + 'extra_artifact_profiles': {'key': 'extraArtifactProfiles', 'type': '[NSDArtifactProfile]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the network function to apply the configuration to. + :paramtype name: str + :keyword nf_agent_type: The type of NF agent that should handle this configuration. + :paramtype nf_agent_type: str + :keyword configuration_type: The type of configuration to be handled by the NF agent. + :paramtype configuration_type: str + :keyword configuration_generation_type: The configuration generation type. Possible values + include: "Unknown", "HandlebarTemplate". + :paramtype configuration_generation_type: str or + ~Microsoft.HybridNetwork.models.ConfigurationGenerationType + :keyword parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :paramtype parameter_values: str + :keyword artifact_profile: Artifact profile properties. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + :keyword extra_artifact_profiles: List of extra artifact profiles required by the + configuration. + :paramtype extra_artifact_profiles: list[~Microsoft.HybridNetwork.models.NSDArtifactProfile] + """ + super(ConfigurationDefinitionResourceElementTemplate, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.nf_agent_type = kwargs.get('nf_agent_type', None) + self.configuration_type = kwargs.get('configuration_type', None) + self.configuration_generation_type = kwargs.get('configuration_generation_type', None) + self.parameter_values = kwargs.get('parameter_values', None) + self.artifact_profile = kwargs.get('artifact_profile', None) + self.extra_artifact_profiles = kwargs.get('extra_artifact_profiles', None) + + +class ConfigurationDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The configuration definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ConfigurationDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ConfigurationDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ConfigurationDefinitionResourceElementTemplate + """ + super(ConfigurationDefinitionResourceElementTemplateDetails, self).__init__(**kwargs) + self.type = 'ConfigurationDefinition' # type: str + self.configuration = kwargs.get('configuration', None) + + +class ConfigurationGroupSchema(TrackedResource): + """Configuration group schema resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the Configuration group schema resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The configuration group schema version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar schema_definition: Name and value pairs that define the configuration value. It can be a + well formed escaped JSON string. + :vartype schema_definition: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'schema_definition': {'key': 'properties.schemaDefinition', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword schema_definition: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :paramtype schema_definition: str + """ + super(ConfigurationGroupSchema, self).__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.schema_definition = kwargs.get('schema_definition', None) + + +class ConfigurationGroupSchemaListResult(msrest.serialization.Model): + """A list of configuration group schema resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of configuration group schema. + :vartype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationGroupSchema]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of configuration group schema. + :paramtype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + """ + super(ConfigurationGroupSchemaListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ConfigurationGroupSchemaVersionUpdateState(msrest.serialization.Model): + """Publisher configuration group schema update request definition. + + :ivar version_state: The configuration group schema state. Possible values include: "Unknown", + "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword version_state: The configuration group schema state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(ConfigurationGroupSchemaVersionUpdateState, self).__init__(**kwargs) + self.version_state = kwargs.get('version_state', None) + + +class ConfigurationGroupValue(TrackedResource): + """Hybrid configuration group value resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the site resource. Possible values include: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the configuration group schema. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar configuration_group_schema_name: The configuration group schema name. + :vartype configuration_group_schema_name: str + :ivar configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :vartype configuration_group_schema_offering_location: str + :ivar configuration_value: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :vartype configuration_value: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'configuration_group_schema_name': {'key': 'properties.configurationGroupSchemaName', 'type': 'str'}, + 'configuration_group_schema_offering_location': {'key': 'properties.configurationGroupSchemaOfferingLocation', 'type': 'str'}, + 'configuration_value': {'key': 'properties.configurationValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword publisher_name: The publisher name for the configuration group schema. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword configuration_group_schema_name: The configuration group schema name. + :paramtype configuration_group_schema_name: str + :keyword configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :paramtype configuration_group_schema_offering_location: str + :keyword configuration_value: Name and value pairs that define the configuration value. It can + be a well formed escaped JSON string. + :paramtype configuration_value: str + """ + super(ConfigurationGroupValue, self).__init__(**kwargs) + self.provisioning_state = None + self.publisher_name = kwargs.get('publisher_name', None) + self.publisher_scope = kwargs.get('publisher_scope', None) + self.configuration_group_schema_name = kwargs.get('configuration_group_schema_name', None) + self.configuration_group_schema_offering_location = kwargs.get('configuration_group_schema_offering_location', None) + self.configuration_value = kwargs.get('configuration_value', None) + + +class ConfigurationGroupValueListResult(msrest.serialization.Model): + """Response for hybrid configurationGroups API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of hybrid configurationGroups. + :vartype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationGroupValue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of hybrid configurationGroups. + :paramtype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + """ + super(ConfigurationGroupValueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionDefinitionVersionPropertiesFormat(msrest.serialization.Model): + """Network function definition version properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContainerizedNetworkFunctionDefinitionVersion, DelegatedNetworkFunctionDefinitionVersion, VirtualNetworkFunctionDefinitionVersion. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + } + + _subtype_map = { + 'network_function_type': {'ContainerizedNetworkFunction': 'ContainerizedNetworkFunctionDefinitionVersion', 'DelegatedNetworkFunction': 'DelegatedNetworkFunctionDefinitionVersion', 'VirtualNetworkFunction': 'VirtualNetworkFunctionDefinitionVersion'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + """ + super(NetworkFunctionDefinitionVersionPropertiesFormat, self).__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = kwargs.get('description', None) + self.deploy_parameters = kwargs.get('deploy_parameters', None) + self.network_function_type = None # type: Optional[str] + + +class ContainerizedNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Containerized network function network function definition version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Containerized network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'ContainerizedNetworkFunctionTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Containerized network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionTemplate + """ + super(ContainerizedNetworkFunctionDefinitionVersion, self).__init__(**kwargs) + self.network_function_type = 'ContainerizedNetworkFunction' # type: str + self.network_function_template = kwargs.get('network_function_template', None) + + +class CustomLocationResourceId(msrest.serialization.Model): + """Reference to an Azure ARC custom location resource. + + :ivar id: Azure ARC custom location resource ID. + :vartype id: str + """ + + _validation = { + 'id': {'pattern': r'^/[sS][uU][bB][sS][cC][rR][iI][pP][tT][iI][oO][nN][sS]/[^/?#]+/[rR][eE][sS][oO][uU][rR][cC][eE][gG][rR][oO][uU][pP][sS]/[^/?#]+/[pP][rR][oO][vV][iI][dD][eE][rR][sS]/[mM][iI][cC][rR][oO][sS][oO][fF][tT]\.[eE][xX][tT][eE][nN][dD][eE][dD][lL][oO][cC][aA][tT][iI][oO][nN]/[cC][uU][sS][tT][oO][mM][lL][oO][cC][aA][tT][iI][oO][nN][sS]/[^/?#]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: Azure ARC custom location resource ID. + :paramtype id: str + """ + super(CustomLocationResourceId, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class DelegatedNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Delegated network function network function definition version properties . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Delegated network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'DelegatedNetworkFunctionTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Delegated network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionTemplate + """ + super(DelegatedNetworkFunctionDefinitionVersion, self).__init__(**kwargs) + self.network_function_type = 'DelegatedNetworkFunction' # type: str + self.network_function_template = kwargs.get('network_function_template', None) + + +class DependsOnProfile(msrest.serialization.Model): + """Depends on profile definition. + + :ivar install_depends_on: Application installation operation dependency. + :vartype install_depends_on: list[str] + :ivar uninstall_depends_on: Application deletion operation dependency. + :vartype uninstall_depends_on: list[str] + :ivar update_depends_on: Application update operation dependency. + :vartype update_depends_on: list[str] + """ + + _attribute_map = { + 'install_depends_on': {'key': 'installDependsOn', 'type': '[str]'}, + 'uninstall_depends_on': {'key': 'uninstallDependsOn', 'type': '[str]'}, + 'update_depends_on': {'key': 'updateDependsOn', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword install_depends_on: Application installation operation dependency. + :paramtype install_depends_on: list[str] + :keyword uninstall_depends_on: Application deletion operation dependency. + :paramtype uninstall_depends_on: list[str] + :keyword update_depends_on: Application update operation dependency. + :paramtype update_depends_on: list[str] + """ + super(DependsOnProfile, self).__init__(**kwargs) + self.install_depends_on = kwargs.get('install_depends_on', None) + self.uninstall_depends_on = kwargs.get('uninstall_depends_on', None) + self.update_depends_on = kwargs.get('update_depends_on', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~Microsoft.HybridNetwork.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~Microsoft.HybridNetwork.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~Microsoft.HybridNetwork.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~Microsoft.HybridNetwork.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ExecuteRequestParameters(msrest.serialization.Model): + """Payload for execute request post call. + + All required parameters must be populated in order to send to Azure. + + :ivar service_endpoint: Required. The endpoint of service to call. + :vartype service_endpoint: str + :ivar request_metadata: Required. The request metadata. + :vartype request_metadata: ~Microsoft.HybridNetwork.models.RequestMetadata + """ + + _validation = { + 'service_endpoint': {'required': True}, + 'request_metadata': {'required': True}, + } + + _attribute_map = { + 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, + 'request_metadata': {'key': 'requestMetadata', 'type': 'RequestMetadata'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_endpoint: Required. The endpoint of service to call. + :paramtype service_endpoint: str + :keyword request_metadata: Required. The request metadata. + :paramtype request_metadata: ~Microsoft.HybridNetwork.models.RequestMetadata + """ + super(ExecuteRequestParameters, self).__init__(**kwargs) + self.service_endpoint = kwargs['service_endpoint'] + self.request_metadata = kwargs['request_metadata'] + + +class HelmArtifactProfile(msrest.serialization.Model): + """Helm artifact profile. + + :ivar helm_package_name: Helm package name. + :vartype helm_package_name: str + :ivar helm_package_version_range: Helm package version range. + :vartype helm_package_version_range: str + :ivar registry_values_paths: The registry values path list. + :vartype registry_values_paths: list[str] + :ivar image_pull_secrets_values_paths: The image pull secrets values path list. + :vartype image_pull_secrets_values_paths: list[str] + """ + + _attribute_map = { + 'helm_package_name': {'key': 'helmPackageName', 'type': 'str'}, + 'helm_package_version_range': {'key': 'helmPackageVersionRange', 'type': 'str'}, + 'registry_values_paths': {'key': 'registryValuesPaths', 'type': '[str]'}, + 'image_pull_secrets_values_paths': {'key': 'imagePullSecretsValuesPaths', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword helm_package_name: Helm package name. + :paramtype helm_package_name: str + :keyword helm_package_version_range: Helm package version range. + :paramtype helm_package_version_range: str + :keyword registry_values_paths: The registry values path list. + :paramtype registry_values_paths: list[str] + :keyword image_pull_secrets_values_paths: The image pull secrets values path list. + :paramtype image_pull_secrets_values_paths: list[str] + """ + super(HelmArtifactProfile, self).__init__(**kwargs) + self.helm_package_name = kwargs.get('helm_package_name', None) + self.helm_package_version_range = kwargs.get('helm_package_version_range', None) + self.registry_values_paths = kwargs.get('registry_values_paths', None) + self.image_pull_secrets_values_paths = kwargs.get('image_pull_secrets_values_paths', None) + + +class HelmMappingRuleProfile(msrest.serialization.Model): + """Helm mapping rule profile. + + :ivar release_namespace: Helm release namespace. + :vartype release_namespace: str + :ivar release_name: Helm release name. + :vartype release_name: str + :ivar helm_package_version: Helm package version. + :vartype helm_package_version: str + :ivar values: Helm release values. + :vartype values: str + """ + + _attribute_map = { + 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, + 'release_name': {'key': 'releaseName', 'type': 'str'}, + 'helm_package_version': {'key': 'helmPackageVersion', 'type': 'str'}, + 'values': {'key': 'values', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword release_namespace: Helm release namespace. + :paramtype release_namespace: str + :keyword release_name: Helm release name. + :paramtype release_name: str + :keyword helm_package_version: Helm package version. + :paramtype helm_package_version: str + :keyword values: Helm release values. + :paramtype values: str + """ + super(HelmMappingRuleProfile, self).__init__(**kwargs) + self.release_namespace = kwargs.get('release_namespace', None) + self.release_name = kwargs.get('release_name', None) + self.helm_package_version = kwargs.get('helm_package_version', None) + self.values = kwargs.get('values', None) + + +class HelmPackageApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Helm Package Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureArcKubernetesDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(HelmPackageApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'HelmPackage' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class HybridAKSNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Azure based kubernetes service cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: The User Assigned Managed Identity ARM id giving access + to the HybridAKS cluster if outside AOSM flow. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: The User Assigned Managed Identity ARM id giving + access to the HybridAKS cluster if outside AOSM flow. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(HybridAKSNetworkFunctionReadyK8S, self).__init__(**kwargs) + self.cluster_type = 'HybridAKS' # type: str + self.user_assigned_managed_identity = kwargs.get('user_assigned_managed_identity', None) + + +class ImageArtifactProfile(msrest.serialization.Model): + """Image artifact profile. + + :ivar image_name: Image name. + :vartype image_name: str + :ivar image_version: Image version. + :vartype image_version: str + """ + + _attribute_map = { + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'image_version': {'key': 'imageVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword image_name: Image name. + :paramtype image_name: str + :keyword image_version: Image version. + :paramtype image_version: str + """ + super(ImageArtifactProfile, self).__init__(**kwargs) + self.image_name = kwargs.get('image_name', None) + self.image_version = kwargs.get('image_version', None) + + +class ImageFileApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Image file Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreDelegatedImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ImageFileApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'ImageFile' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class ImageMappingRuleProfile(msrest.serialization.Model): + """Image mapping rule profile. + + :ivar user_configuration: List of values. + :vartype user_configuration: str + """ + + _attribute_map = { + 'user_configuration': {'key': 'userConfiguration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword user_configuration: List of values. + :paramtype user_configuration: str + """ + super(ImageMappingRuleProfile, self).__init__(**kwargs) + self.user_configuration = kwargs.get('user_configuration', None) + + +class ManagedResourceGroupConfiguration(msrest.serialization.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :vartype name: str + :ivar location: Managed resource group location. + :vartype location: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Managed resource group name. + :paramtype name: str + :keyword location: Managed resource group location. + :paramtype location: str + """ + super(ManagedResourceGroupConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs.get('location', None) + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~Microsoft.HybridNetwork.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~Microsoft.HybridNetwork.models.UserAssignedIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~Microsoft.HybridNetwork.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~Microsoft.HybridNetwork.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs['type'] + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ManifestArtifactFormat(msrest.serialization.Model): + """Manifest artifact properties. + + :ivar artifact_name: The artifact name. + :vartype artifact_name: str + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_name: The artifact name. + :paramtype artifact_name: str + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + """ + super(ManifestArtifactFormat, self).__init__(**kwargs) + self.artifact_name = kwargs.get('artifact_name', None) + self.artifact_type = kwargs.get('artifact_type', None) + self.artifact_version = kwargs.get('artifact_version', None) + + +class NetworkFunction(TrackedResource): + """Network function resource response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar identity: The managed identity of the Network function, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the network function resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the network function. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar network_function_definition_group_name: The network function definition group name for + the network function. + :vartype network_function_definition_group_name: str + :ivar network_function_definition_version: The network function definition version for the + network function. + :vartype network_function_definition_version: str + :ivar network_function_definition_offering_location: The location of the network function + definition offering. + :vartype network_function_definition_offering_location: str + :ivar nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar nfvi_id: The nfviId for the network function. + :vartype nfvi_id: str + :ivar allow_software_update: Indicates if software updates are allowed during deployment. + :vartype allow_software_update: bool + :ivar deployment_values: The JSON-serialized deployment values from the user. + :vartype deployment_values: str + :ivar role_override_values: The role configuration override values from the user. + :vartype role_override_values: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'network_function_definition_group_name': {'key': 'properties.networkFunctionDefinitionGroupName', 'type': 'str'}, + 'network_function_definition_version': {'key': 'properties.networkFunctionDefinitionVersion', 'type': 'str'}, + 'network_function_definition_offering_location': {'key': 'properties.networkFunctionDefinitionOfferingLocation', 'type': 'str'}, + 'nfvi_type': {'key': 'properties.nfviType', 'type': 'str'}, + 'nfvi_id': {'key': 'properties.nfviId', 'type': 'str'}, + 'allow_software_update': {'key': 'properties.allowSoftwareUpdate', 'type': 'bool'}, + 'deployment_values': {'key': 'properties.deploymentValues', 'type': 'str'}, + 'role_override_values': {'key': 'properties.roleOverrideValues', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword etag: A unique read-only string that changes whenever the resource is updated. + :paramtype etag: str + :keyword identity: The managed identity of the Network function, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword publisher_name: The publisher name for the network function. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword network_function_definition_group_name: The network function definition group name for + the network function. + :paramtype network_function_definition_group_name: str + :keyword network_function_definition_version: The network function definition version for the + network function. + :paramtype network_function_definition_version: str + :keyword network_function_definition_offering_location: The location of the network function + definition offering. + :paramtype network_function_definition_offering_location: str + :keyword nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :paramtype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :keyword nfvi_id: The nfviId for the network function. + :paramtype nfvi_id: str + :keyword allow_software_update: Indicates if software updates are allowed during deployment. + :paramtype allow_software_update: bool + :keyword deployment_values: The JSON-serialized deployment values from the user. + :paramtype deployment_values: str + :keyword role_override_values: The role configuration override values from the user. + :paramtype role_override_values: list[str] + """ + super(NetworkFunction, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.publisher_name = kwargs.get('publisher_name', None) + self.publisher_scope = kwargs.get('publisher_scope', None) + self.network_function_definition_group_name = kwargs.get('network_function_definition_group_name', None) + self.network_function_definition_version = kwargs.get('network_function_definition_version', None) + self.network_function_definition_offering_location = kwargs.get('network_function_definition_offering_location', None) + self.nfvi_type = kwargs.get('nfvi_type', None) + self.nfvi_id = kwargs.get('nfvi_id', None) + self.allow_software_update = kwargs.get('allow_software_update', None) + self.deployment_values = kwargs.get('deployment_values', None) + self.role_override_values = kwargs.get('role_override_values', None) + + +class NetworkFunctionDefinitionGroup(TrackedResource): + """Network function definition group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network function definition groups + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar description: The network function definition group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network function definition group description. + :paramtype description: str + """ + super(NetworkFunctionDefinitionGroup, self).__init__(**kwargs) + self.provisioning_state = None + self.description = kwargs.get('description', None) + + +class NetworkFunctionDefinitionGroupListResult(msrest.serialization.Model): + """A list of network function definition group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network function definition group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + """ + super(NetworkFunctionDefinitionGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionDefinitionGroupOverview(ProxyResource): + """Network function definition group overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar description: Network function definition group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkFunctionDefinitionGroupOverview, self).__init__(**kwargs) + self.description = None + + +class NetworkFunctionDefinitionGroupOverviewListResult(msrest.serialization.Model): + """A list of available network function definition groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The network function group list properties. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionGroupOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The network function group list properties. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview] + """ + super(NetworkFunctionDefinitionGroupOverviewListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The network function definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ArmResourceDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super(NetworkFunctionDefinitionResourceElementTemplateDetails, self).__init__(**kwargs) + self.type = 'NetworkFunctionDefinition' # type: str + self.configuration = kwargs.get('configuration', None) + + +class NetworkFunctionDefinitionVersion(TrackedResource): + """Network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: The network function type.Constant filled by server. Possible + values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'deploy_parameters': {'key': 'properties.deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'properties.networkFunctionType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + """ + super(NetworkFunctionDefinitionVersion, self).__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = kwargs.get('description', None) + self.deploy_parameters = kwargs.get('deploy_parameters', None) + self.network_function_type = None # type: Optional[str] + + +class NetworkFunctionDefinitionVersionListResult(msrest.serialization.Model): + """A list of network function definition versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition versions. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network function definition versions. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + """ + super(NetworkFunctionDefinitionVersionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionDefinitionVersionOverview(ProxyResource): + """Network function definition version overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar description: The network function definition version description properties. + :vartype description: str + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar network_function_type: The network function type. Possible values include: "Unknown", + "VirtualNetworkFunction", "ContainerizedNetworkFunction", "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar deploy_parameters: The deployment parameters. + :vartype deploy_parameters: str + :ivar network_function_applications: The network function definition application overview. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionApplicationOverview] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'description': {'readonly': True}, + 'deploy_parameters': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'network_function_type': {'key': 'properties.networkFunctionType', 'type': 'str'}, + 'nfvi_type': {'key': 'properties.nfviType', 'type': 'str'}, + 'deploy_parameters': {'key': 'properties.deployParameters', 'type': 'str'}, + 'network_function_applications': {'key': 'properties.networkFunctionApplications', 'type': '[NetworkFunctionDefinitionApplicationOverview]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :keyword network_function_type: The network function type. Possible values include: "Unknown", + "VirtualNetworkFunction", "ContainerizedNetworkFunction", "DelegatedNetworkFunction". + :paramtype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :keyword nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :paramtype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :keyword network_function_applications: The network function definition application overview. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionApplicationOverview] + """ + super(NetworkFunctionDefinitionVersionOverview, self).__init__(**kwargs) + self.description = None + self.version_state = kwargs.get('version_state', None) + self.network_function_type = kwargs.get('network_function_type', None) + self.nfvi_type = kwargs.get('nfvi_type', None) + self.deploy_parameters = None + self.network_function_applications = kwargs.get('network_function_applications', None) + + +class NetworkFunctionDefinitionVersionOverviewListResult(msrest.serialization.Model): + """A list of available network function definition groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The network function definition overview properties. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionVersionOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The network function definition overview properties. + :paramtype value: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview] + """ + super(NetworkFunctionDefinitionVersionOverviewListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionDefinitionVersionUpdateState(msrest.serialization.Model): + """Publisher network function definition version update request definition. + + :ivar version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Possible values include: "Unknown", "Preview", "Active", "Deprecated", + "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Possible values include: "Unknown", "Preview", "Active", "Deprecated", + "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(NetworkFunctionDefinitionVersionUpdateState, self).__init__(**kwargs) + self.version_state = kwargs.get('version_state', None) + + +class NetworkFunctionListResult(msrest.serialization.Model): + """Response for network function API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function resources in a subscription or resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network function resources in a subscription or resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunction] + """ + super(NetworkFunctionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionReadyK8S(TrackedResource): + """NetworkFunctionReadyK8s resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: The managed identity of the NetworkFunctionReadyK8s, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: The cluster type.Constant filled by server. Possible values include: + "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'properties.clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'properties.clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'properties.customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The managed identity of the NetworkFunctionReadyK8s, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword cluster_reference: The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(NetworkFunctionReadyK8S, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.cluster_type = None # type: Optional[str] + self.cluster_reference = kwargs.get('cluster_reference', None) + self.custom_location_reference = None + + +class NetworkFunctionReadyK8SListResult(msrest.serialization.Model): + """Response for NetworkFunctionReadyK8s API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function ready K8s. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionReadyK8S]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network function ready K8s. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + """ + super(NetworkFunctionReadyK8SListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkServiceDesignGroup(TrackedResource): + """network service design group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network service design groups resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar description: The network service design group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network service design group description. + :paramtype description: str + """ + super(NetworkServiceDesignGroup, self).__init__(**kwargs) + self.provisioning_state = None + self.description = kwargs.get('description', None) + + +class NetworkServiceDesignGroupListResult(msrest.serialization.Model): + """A list of network service design group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkServiceDesignGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network service design group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + """ + super(NetworkServiceDesignGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkServiceDesignVersion(TrackedResource): + """network service design version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network service design version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network service design version description. + :vartype description: str + :ivar configuration_group_schema_references: The configuration schemas to used to define the + values. + :vartype configuration_group_schema_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :ivar nfvis_from_site: The nfvis from the site. + :vartype nfvis_from_site: dict[str, ~Microsoft.HybridNetwork.models.NfviDetails] + :ivar resource_element_templates: List of resource element template. + :vartype resource_element_templates: + list[~Microsoft.HybridNetwork.models.ResourceElementTemplate] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'configuration_group_schema_references': {'key': 'properties.configurationGroupSchemaReferences', 'type': '{ReferencedResource}'}, + 'nfvis_from_site': {'key': 'properties.nfvisFromSite', 'type': '{NfviDetails}'}, + 'resource_element_templates': {'key': 'properties.resourceElementTemplates', 'type': '[ResourceElementTemplate]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network service design version description. + :paramtype description: str + :keyword configuration_group_schema_references: The configuration schemas to used to define the + values. + :paramtype configuration_group_schema_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :keyword nfvis_from_site: The nfvis from the site. + :paramtype nfvis_from_site: dict[str, ~Microsoft.HybridNetwork.models.NfviDetails] + :keyword resource_element_templates: List of resource element template. + :paramtype resource_element_templates: + list[~Microsoft.HybridNetwork.models.ResourceElementTemplate] + """ + super(NetworkServiceDesignVersion, self).__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = kwargs.get('description', None) + self.configuration_group_schema_references = kwargs.get('configuration_group_schema_references', None) + self.nfvis_from_site = kwargs.get('nfvis_from_site', None) + self.resource_element_templates = kwargs.get('resource_element_templates', None) + + +class NetworkServiceDesignVersionListResult(msrest.serialization.Model): + """A list of network service design versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design versions. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkServiceDesignVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of network service design versions. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + """ + super(NetworkServiceDesignVersionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkServiceDesignVersionUpdateState(msrest.serialization.Model): + """Publisher network service design version update request definition. + + :ivar version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(NetworkServiceDesignVersionUpdateState, self).__init__(**kwargs) + self.version_state = kwargs.get('version_state', None) + + +class NfviDetails(msrest.serialization.Model): + """The nfvi details. + + :ivar name: The nfvi name. + :vartype name: str + :ivar type: The nfvi type. + :vartype type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The nfvi name. + :paramtype name: str + :keyword type: The nfvi type. + :paramtype type: str + """ + super(NfviDetails, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class NSDArtifactProfile(msrest.serialization.Model): + """Artifact profile properties. + + :ivar artifact_store_reference: The artifact store resource id. + :vartype artifact_store_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar artifact_name: Artifact name. + :vartype artifact_name: str + :ivar artifact_version: Artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + 'artifact_store_reference': {'key': 'artifactStoreReference', 'type': 'ReferencedResource'}, + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_store_reference: The artifact store resource id. + :paramtype artifact_store_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword artifact_name: Artifact name. + :paramtype artifact_name: str + :keyword artifact_version: Artifact version. + :paramtype artifact_version: str + """ + super(NSDArtifactProfile, self).__init__(**kwargs) + self.artifact_store_reference = kwargs.get('artifact_store_reference', None) + self.artifact_name = kwargs.get('artifact_name', None) + self.artifact_version = kwargs.get('artifact_version', None) + + +class Operation(msrest.serialization.Model): + """Object that describes a single Microsoft.HybridNetwork operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~Microsoft.HybridNetwork.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :ivar provider: Service provider: Microsoft.HybridNetwork. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword provider: Service provider: Microsoft.HybridNetwork. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationList(msrest.serialization.Model): + """A list of the operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of Microsoft.HybridNetwork operations. + :vartype value: list[~Microsoft.HybridNetwork.models.Operation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PreviewSubscription(TrackedResource): + """Customer subscription which can use a preview network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the preview subscription resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(PreviewSubscription, self).__init__(**kwargs) + self.provisioning_state = None + + +class PreviewSubscriptionsList(msrest.serialization.Model): + """A list of customer subscriptions which can use a preview network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of preview subscriptions. + :vartype value: list[~Microsoft.HybridNetwork.models.PreviewSubscription] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PreviewSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of preview subscriptions. + :paramtype value: list[~Microsoft.HybridNetwork.models.PreviewSubscription] + """ + super(PreviewSubscriptionsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProxyArtifactListOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyArtifactListOverview, self).__init__(**kwargs) + + +class ProxyArtifactOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar artifact_versions: The proxy artifact overview properties. + :vartype artifact_versions: + list[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewPropertiesValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'artifact_versions': {'key': 'properties.artifactVersions', 'type': '[ProxyArtifactOverviewPropertiesValue]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_versions: The proxy artifact overview properties. + :paramtype artifact_versions: + list[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewPropertiesValue] + """ + super(ProxyArtifactOverview, self).__init__(**kwargs) + self.artifact_versions = kwargs.get('artifact_versions', None) + + +class ProxyArtifactOverviewListResult(msrest.serialization.Model): + """The proxy artifact list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy artifacts. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactListOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyArtifactListOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactListOverview] + """ + super(ProxyArtifactOverviewListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProxyArtifactOverviewPropertiesValue(msrest.serialization.Model): + """ProxyArtifactOverviewPropertiesValue. + + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _attribute_map = { + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + 'artifact_state': {'key': 'artifactState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ProxyArtifactOverviewPropertiesValue, self).__init__(**kwargs) + self.artifact_type = kwargs.get('artifact_type', None) + self.artifact_version = kwargs.get('artifact_version', None) + self.artifact_state = kwargs.get('artifact_state', None) + + +class ProxyArtifactVersionsListOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'artifact_type': {'key': 'properties.artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'properties.artifactVersion', 'type': 'str'}, + 'artifact_state': {'key': 'properties.artifactState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ProxyArtifactVersionsListOverview, self).__init__(**kwargs) + self.artifact_type = kwargs.get('artifact_type', None) + self.artifact_version = kwargs.get('artifact_version', None) + self.artifact_state = kwargs.get('artifact_state', None) + + +class ProxyArtifactVersionsOverviewListResult(msrest.serialization.Model): + """The proxy artifact list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy artifacts. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyArtifactVersionsListOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + """ + super(ProxyArtifactVersionsOverviewListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProxyPublisherOverview(ProxyResource): + """The proxy publisher overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyPublisherOverview, self).__init__(**kwargs) + + +class ProxyPublisherOverviewListResult(msrest.serialization.Model): + """The proxy publisher list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy publishers. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyPublisherOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyPublisherOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of available proxy publishers. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyPublisherOverview] + """ + super(ProxyPublisherOverviewListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class Publisher(TrackedResource): + """publisher resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the publisher resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar scope: The publisher scope. Possible values include: "Unknown", "Public", "Private". + :vartype scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword scope: The publisher scope. Possible values include: "Unknown", "Public", "Private". + :paramtype scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + """ + super(Publisher, self).__init__(**kwargs) + self.provisioning_state = None + self.scope = kwargs.get('scope', None) + + +class PublisherListResult(msrest.serialization.Model): + """A list of publishers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of publishers. + :vartype value: list[~Microsoft.HybridNetwork.models.Publisher] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Publisher]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of publishers. + :paramtype value: list[~Microsoft.HybridNetwork.models.Publisher] + """ + super(PublisherListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ReferencedResource(msrest.serialization.Model): + """Reference to another resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ReferencedResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class RequestMetadata(msrest.serialization.Model): + """Request metadata of execute request post call payload. + + All required parameters must be populated in order to send to Azure. + + :ivar relative_path: Required. The relative path of the request. + :vartype relative_path: str + :ivar http_method: Required. The http method of the request. Possible values include: + "Unknown", "Post", "Put", "Get", "Patch", "Delete". + :vartype http_method: str or ~Microsoft.HybridNetwork.models.HttpMethod + :ivar serialized_body: Required. The serialized body of the request. + :vartype serialized_body: str + :ivar api_version: The api version of the request. + :vartype api_version: str + """ + + _validation = { + 'relative_path': {'required': True}, + 'http_method': {'required': True}, + 'serialized_body': {'required': True}, + } + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + 'serialized_body': {'key': 'serializedBody', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword relative_path: Required. The relative path of the request. + :paramtype relative_path: str + :keyword http_method: Required. The http method of the request. Possible values include: + "Unknown", "Post", "Put", "Get", "Patch", "Delete". + :paramtype http_method: str or ~Microsoft.HybridNetwork.models.HttpMethod + :keyword serialized_body: Required. The serialized body of the request. + :paramtype serialized_body: str + :keyword api_version: The api version of the request. + :paramtype api_version: str + """ + super(RequestMetadata, self).__init__(**kwargs) + self.relative_path = kwargs['relative_path'] + self.http_method = kwargs['http_method'] + self.serialized_body = kwargs['serialized_body'] + self.api_version = kwargs.get('api_version', None) + + +class Site(TrackedResource): + """Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the site resource. **TODO**\ : Confirm if + this is needed. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", + "Failed", "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar nfvis: List of NFVIs. + :vartype nfvis: list[~Microsoft.HybridNetwork.models.NFVIs] + :ivar site_network_service_references: The list of site network services on the site. + :vartype site_network_service_references: + list[~Microsoft.HybridNetwork.models.ReferencedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'site_network_service_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'nfvis': {'key': 'properties.nfvis', 'type': '[NFVIs]'}, + 'site_network_service_references': {'key': 'properties.siteNetworkServiceReferences', 'type': '[ReferencedResource]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword nfvis: List of NFVIs. + :paramtype nfvis: list[~Microsoft.HybridNetwork.models.NFVIs] + """ + super(Site, self).__init__(**kwargs) + self.provisioning_state = None + self.nfvis = kwargs.get('nfvis', None) + self.site_network_service_references = None + + +class SiteListResult(msrest.serialization.Model): + """Response for sites API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of sites in a resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.Site] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Site]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of sites in a resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.Site] + """ + super(SiteListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SiteNetworkService(TrackedResource): + """Site network service resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: The managed identity of the Site network service, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the site network service resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ManagedResourceGroupConfiguration + :ivar site_reference: The site details. + :vartype site_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar publisher_name: The publisher name for the site network service. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar network_service_design_group_name: The network service design group name for the site + network service. + :vartype network_service_design_group_name: str + :ivar network_service_design_version_name: The network service design version for the site + network service. + :vartype network_service_design_version_name: str + :ivar network_service_design_version_offering_location: The location of the network service + design offering. + :vartype network_service_design_version_offering_location: str + :ivar desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :vartype desired_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :ivar last_state_network_service_design_version_name: The network service design version for + the site network service. + :vartype last_state_network_service_design_version_name: str + :ivar last_state_configuration_group_value_references: The last state of the site network + service resource. + :vartype last_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'network_service_design_version_name': {'pattern': r'^[0-9]+\.[0-9]+\.[0-9]+$'}, + 'last_state_network_service_design_version_name': {'readonly': True, 'pattern': r'^[0-9]+\.[0-9]+\.[0-9]+$'}, + 'last_state_configuration_group_value_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ManagedResourceGroupConfiguration'}, + 'site_reference': {'key': 'properties.siteReference', 'type': 'ReferencedResource'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'network_service_design_group_name': {'key': 'properties.networkServiceDesignGroupName', 'type': 'str'}, + 'network_service_design_version_name': {'key': 'properties.networkServiceDesignVersionName', 'type': 'str'}, + 'network_service_design_version_offering_location': {'key': 'properties.networkServiceDesignVersionOfferingLocation', 'type': 'str'}, + 'desired_state_configuration_group_value_references': {'key': 'properties.desiredStateConfigurationGroupValueReferences', 'type': '{ReferencedResource}'}, + 'last_state_network_service_design_version_name': {'key': 'properties.lastStateNetworkServiceDesignVersionName', 'type': 'str'}, + 'last_state_configuration_group_value_references': {'key': 'properties.lastStateConfigurationGroupValueReferences', 'type': '{ReferencedResource}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The managed identity of the Site network service, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ManagedResourceGroupConfiguration + :keyword site_reference: The site details. + :paramtype site_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword publisher_name: The publisher name for the site network service. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword network_service_design_group_name: The network service design group name for the site + network service. + :paramtype network_service_design_group_name: str + :keyword network_service_design_version_name: The network service design version for the site + network service. + :paramtype network_service_design_version_name: str + :keyword network_service_design_version_offering_location: The location of the network service + design offering. + :paramtype network_service_design_version_offering_location: str + :keyword desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :paramtype desired_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + """ + super(SiteNetworkService, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.managed_resource_group_configuration = kwargs.get('managed_resource_group_configuration', None) + self.site_reference = kwargs.get('site_reference', None) + self.publisher_name = kwargs.get('publisher_name', None) + self.publisher_scope = kwargs.get('publisher_scope', None) + self.network_service_design_group_name = kwargs.get('network_service_design_group_name', None) + self.network_service_design_version_name = kwargs.get('network_service_design_version_name', None) + self.network_service_design_version_offering_location = kwargs.get('network_service_design_version_offering_location', None) + self.desired_state_configuration_group_value_references = kwargs.get('desired_state_configuration_group_value_references', None) + self.last_state_network_service_design_version_name = None + self.last_state_configuration_group_value_references = None + + +class SiteNetworkServiceListResult(msrest.serialization.Model): + """Response for site network services API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of site network services in a resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.SiteNetworkService] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteNetworkService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: A list of site network services in a resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.SiteNetworkService] + """ + super(SiteNetworkServiceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(TagsObject, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class UserAssignedIdentity(msrest.serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VhdImageArtifactProfile(msrest.serialization.Model): + """Vhd artifact profile. + + :ivar vhd_name: Vhd name. + :vartype vhd_name: str + :ivar vhd_version: Vhd version. + :vartype vhd_version: str + """ + + _attribute_map = { + 'vhd_name': {'key': 'vhdName', 'type': 'str'}, + 'vhd_version': {'key': 'vhdVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword vhd_name: Vhd name. + :paramtype vhd_name: str + :keyword vhd_version: Vhd version. + :paramtype vhd_version: str + """ + super(VhdImageArtifactProfile, self).__init__(**kwargs) + self.vhd_name = kwargs.get('vhd_name', None) + self.vhd_version = kwargs.get('vhd_version', None) + + +class VhdImageFileApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Vhd image file Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreVhdImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VhdImageFileApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'VhdImageFile' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class VhdImageMappingRuleProfile(msrest.serialization.Model): + """Vhd mapping rule profile. + + :ivar user_configuration: List of values. + :vartype user_configuration: str + """ + + _attribute_map = { + 'user_configuration': {'key': 'userConfiguration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword user_configuration: List of values. + :paramtype user_configuration: str + """ + super(VhdImageMappingRuleProfile, self).__init__(**kwargs) + self.user_configuration = kwargs.get('user_configuration', None) + + +class VirtualNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Virtual network function network function definition version properties . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Virtual network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'VirtualNetworkFunctionTemplate'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Virtual network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionTemplate + """ + super(VirtualNetworkFunctionDefinitionVersion, self).__init__(**kwargs) + self.network_function_type = 'VirtualNetworkFunction' # type: str + self.network_function_template = kwargs.get('network_function_template', None) diff --git a/src/aosm/azext_aosm/vendored_sdks/models/_models_py3.py b/src/aosm/azext_aosm/vendored_sdks/models/_models_py3.py new file mode 100644 index 00000000000..3acbe9f86a8 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/models/_models_py3.py @@ -0,0 +1,6446 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._hybrid_network_management_client_enums import * + + +class NetworkFunctionReadyK8SPropertiesFormat(msrest.serialization.Model): + """NetworkFunctionReadyK8s properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArcConnectedK8SNetworkFunctionReadyK8S, AzureKubernetesServiceNetworkFunctionReadyK8S, HybridAKSNetworkFunctionReadyK8S. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + _subtype_map = { + 'cluster_type': {'ArcConnectedK8s': 'ArcConnectedK8SNetworkFunctionReadyK8S', 'AzureKubernetesService': 'AzureKubernetesServiceNetworkFunctionReadyK8S', 'HybridAKS': 'HybridAKSNetworkFunctionReadyK8S'} + } + + def __init__( + self, + *, + cluster_reference: "ReferencedResource", + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(NetworkFunctionReadyK8SPropertiesFormat, self).__init__(**kwargs) + self.provisioning_state = None + self.cluster_type = None # type: Optional[str] + self.cluster_reference = cluster_reference + self.custom_location_reference = None + + +class ArcConnectedK8SNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Arc Connected kubernetes cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + which has access to the connected cluster. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + 'user_assigned_managed_identity': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + cluster_reference: "ReferencedResource", + user_assigned_managed_identity: "ReferencedResource", + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + which has access to the connected cluster. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(ArcConnectedK8SNetworkFunctionReadyK8S, self).__init__(cluster_reference=cluster_reference, **kwargs) + self.cluster_type = 'ArcConnectedK8s' # type: str + self.user_assigned_managed_identity = user_assigned_managed_identity + + +class ArmResourceDefinitionResourceElementTemplate(msrest.serialization.Model): + """The arm template RE. + + :ivar template_type: The template type. Possible values include: "Unknown", "ArmTemplate". + :vartype template_type: str or ~Microsoft.HybridNetwork.models.TemplateType + :ivar parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :vartype parameter_values: str + :ivar artifact_profile: Artifact profile properties. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + """ + + _attribute_map = { + 'template_type': {'key': 'templateType', 'type': 'str'}, + 'parameter_values': {'key': 'parameterValues', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'NSDArtifactProfile'}, + } + + def __init__( + self, + *, + template_type: Optional[Union[str, "TemplateType"]] = None, + parameter_values: Optional[str] = None, + artifact_profile: Optional["NSDArtifactProfile"] = None, + **kwargs + ): + """ + :keyword template_type: The template type. Possible values include: "Unknown", "ArmTemplate". + :paramtype template_type: str or ~Microsoft.HybridNetwork.models.TemplateType + :keyword parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :paramtype parameter_values: str + :keyword artifact_profile: Artifact profile properties. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + """ + super(ArmResourceDefinitionResourceElementTemplate, self).__init__(**kwargs) + self.template_type = template_type + self.parameter_values = parameter_values + self.artifact_profile = artifact_profile + + +class ResourceElementTemplate(msrest.serialization.Model): + """The resource element template object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArmResourceDefinitionResourceElementTemplateDetails, ConfigurationDefinitionResourceElementTemplateDetails, NetworkFunctionDefinitionResourceElementTemplateDetails. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + } + + _subtype_map = { + 'type': {'ArmResourceDefinition': 'ArmResourceDefinitionResourceElementTemplateDetails', 'ConfigurationDefinition': 'ConfigurationDefinitionResourceElementTemplateDetails', 'NetworkFunctionDefinition': 'NetworkFunctionDefinitionResourceElementTemplateDetails'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(ResourceElementTemplate, self).__init__(**kwargs) + self.name = name + self.type = None # type: Optional[str] + self.depends_on_profile = depends_on_profile + + +class ArmResourceDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The arm resource definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ArmResourceDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + configuration: Optional["ArmResourceDefinitionResourceElementTemplate"] = None, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super(ArmResourceDefinitionResourceElementTemplateDetails, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.type = 'ArmResourceDefinition' # type: str + self.configuration = configuration + + +class NetworkFunctionDefinitionApplicationOverview(msrest.serialization.Model): + """The network function definition application overview. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ArmTemplateApplicationOverview, HelmPackageApplicationOverview, ImageFileApplicationOverview, VhdImageFileApplicationOverview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'ArmTemplateApplicationOverview', 'HelmPackage': 'HelmPackageApplicationOverview', 'ImageFile': 'ImageFileApplicationOverview', 'VhdImageFile': 'VhdImageFileApplicationOverview'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkFunctionDefinitionApplicationOverview, self).__init__(**kwargs) + self.name = None + self.artifact_type = None # type: Optional[str] + + +class ArmTemplateApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Arm template Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArmTemplateApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class ArmTemplateArtifactProfile(msrest.serialization.Model): + """Template artifact profile. + + :ivar template_name: Template name. + :vartype template_name: str + :ivar template_version: Template version. + :vartype template_version: str + """ + + _attribute_map = { + 'template_name': {'key': 'templateName', 'type': 'str'}, + 'template_version': {'key': 'templateVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + template_name: Optional[str] = None, + template_version: Optional[str] = None, + **kwargs + ): + """ + :keyword template_name: Template name. + :paramtype template_name: str + :keyword template_version: Template version. + :paramtype template_version: str + """ + super(ArmTemplateArtifactProfile, self).__init__(**kwargs) + self.template_name = template_name + self.template_version = template_version + + +class ArmTemplateMappingRuleProfile(msrest.serialization.Model): + """Template mapping rule profile. + + :ivar template_parameters: List of template parameters. + :vartype template_parameters: str + """ + + _attribute_map = { + 'template_parameters': {'key': 'templateParameters', 'type': 'str'}, + } + + def __init__( + self, + *, + template_parameters: Optional[str] = None, + **kwargs + ): + """ + :keyword template_parameters: List of template parameters. + :paramtype template_parameters: str + """ + super(ArmTemplateMappingRuleProfile, self).__init__(**kwargs) + self.template_parameters = template_parameters + + +class ArtifactAccessCredential(msrest.serialization.Model): + """The artifact manifest credential definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureContainerRegistryScopedTokenCredential, AzureStorageAccountCredential. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + } + + _subtype_map = { + 'credential_type': {'AzureContainerRegistryScopedToken': 'AzureContainerRegistryScopedTokenCredential', 'AzureStorageAccountToken': 'AzureStorageAccountCredential'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArtifactAccessCredential, self).__init__(**kwargs) + self.credential_type = None # type: Optional[str] + + +class ArtifactChangeState(msrest.serialization.Model): + """The artifact updating request payload. + + :ivar properties: Artifact update state properties. + :vartype properties: ~Microsoft.HybridNetwork.models.ArtifactChangeStateProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'ArtifactChangeStateProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ArtifactChangeStateProperties"] = None, + **kwargs + ): + """ + :keyword properties: Artifact update state properties. + :paramtype properties: ~Microsoft.HybridNetwork.models.ArtifactChangeStateProperties + """ + super(ArtifactChangeState, self).__init__(**kwargs) + self.properties = properties + + +class ArtifactChangeStateProperties(msrest.serialization.Model): + """The artifact update state properties. + + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _attribute_map = { + 'artifact_state': {'key': 'artifactState', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_state: Optional[Union[str, "ArtifactState"]] = None, + **kwargs + ): + """ + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ArtifactChangeStateProperties, self).__init__(**kwargs) + self.artifact_state = artifact_state + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class ArtifactManifest(TrackedResource): + """Artifact manifest properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the ArtifactManifest resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar artifact_manifest_state: The artifact manifest state. Possible values include: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :vartype artifact_manifest_state: str or ~Microsoft.HybridNetwork.models.ArtifactManifestState + :ivar artifacts: The artifacts list. + :vartype artifacts: list[~Microsoft.HybridNetwork.models.ManifestArtifactFormat] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'artifact_manifest_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'artifact_manifest_state': {'key': 'properties.artifactManifestState', 'type': 'str'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[ManifestArtifactFormat]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + artifacts: Optional[List["ManifestArtifactFormat"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword artifacts: The artifacts list. + :paramtype artifacts: list[~Microsoft.HybridNetwork.models.ManifestArtifactFormat] + """ + super(ArtifactManifest, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.artifact_manifest_state = None + self.artifacts = artifacts + + +class ArtifactManifestListResult(msrest.serialization.Model): + """A list of artifact manifests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of artifact manifests. + :vartype value: list[~Microsoft.HybridNetwork.models.ArtifactManifest] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArtifactManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArtifactManifest"]] = None, + **kwargs + ): + """ + :keyword value: A list of artifact manifests. + :paramtype value: list[~Microsoft.HybridNetwork.models.ArtifactManifest] + """ + super(ArtifactManifestListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ArtifactManifestUpdateState(msrest.serialization.Model): + """The artifact manifest updating request payload. Only the 'Uploaded' state is allowed for updates. Other states are used for internal state transitioning. + + :ivar artifact_manifest_state: The artifact manifest state. Possible values include: "Unknown", + "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :vartype artifact_manifest_state: str or ~Microsoft.HybridNetwork.models.ArtifactManifestState + """ + + _attribute_map = { + 'artifact_manifest_state': {'key': 'artifactManifestState', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_manifest_state: Optional[Union[str, "ArtifactManifestState"]] = None, + **kwargs + ): + """ + :keyword artifact_manifest_state: The artifact manifest state. Possible values include: + "Unknown", "Uploading", "Uploaded", "Validating", "ValidationFailed", "Succeeded". + :paramtype artifact_manifest_state: str or + ~Microsoft.HybridNetwork.models.ArtifactManifestState + """ + super(ArtifactManifestUpdateState, self).__init__(**kwargs) + self.artifact_manifest_state = artifact_manifest_state + + +class ArtifactProfile(msrest.serialization.Model): + """Artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(ArtifactProfile, self).__init__(**kwargs) + self.artifact_store = artifact_store + + +class ArtifactStore(TrackedResource): + """Artifact store properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the application groups resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar store_type: The artifact store type. Possible values include: "Unknown", + "AzureContainerRegistry", "AzureStorageAccount". + :vartype store_type: str or ~Microsoft.HybridNetwork.models.ArtifactStoreType + :ivar replication_strategy: The replication strategy. Possible values include: "Unknown", + "SingleReplication", "GeoReplication". + :vartype replication_strategy: str or + ~Microsoft.HybridNetwork.models.ArtifactReplicationStrategy + :ivar managed_resource_group_configuration: + :vartype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + :ivar storage_resource_id: The created storage resource id. + :vartype storage_resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'storage_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'store_type': {'key': 'properties.storeType', 'type': 'str'}, + 'replication_strategy': {'key': 'properties.replicationStrategy', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ArtifactStorePropertiesFormatManagedResourceGroupConfiguration'}, + 'storage_resource_id': {'key': 'properties.storageResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + store_type: Optional[Union[str, "ArtifactStoreType"]] = None, + replication_strategy: Optional[Union[str, "ArtifactReplicationStrategy"]] = None, + managed_resource_group_configuration: Optional["ArtifactStorePropertiesFormatManagedResourceGroupConfiguration"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword store_type: The artifact store type. Possible values include: "Unknown", + "AzureContainerRegistry", "AzureStorageAccount". + :paramtype store_type: str or ~Microsoft.HybridNetwork.models.ArtifactStoreType + :keyword replication_strategy: The replication strategy. Possible values include: "Unknown", + "SingleReplication", "GeoReplication". + :paramtype replication_strategy: str or + ~Microsoft.HybridNetwork.models.ArtifactReplicationStrategy + :keyword managed_resource_group_configuration: + :paramtype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + """ + super(ArtifactStore, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.store_type = store_type + self.replication_strategy = replication_strategy + self.managed_resource_group_configuration = managed_resource_group_configuration + self.storage_resource_id = None + + +class ArtifactStoreListResult(msrest.serialization.Model): + """A list of artifact stores. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of artifact stores. + :vartype value: list[~Microsoft.HybridNetwork.models.ArtifactStore] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArtifactStore]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArtifactStore"]] = None, + **kwargs + ): + """ + :keyword value: A list of artifact stores. + :paramtype value: list[~Microsoft.HybridNetwork.models.ArtifactStore] + """ + super(ArtifactStoreListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(msrest.serialization.Model): + """ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + + :ivar name: The managed resource group name. + :vartype name: str + :ivar location: The managed resource group location. + :vartype location: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The managed resource group name. + :paramtype name: str + :keyword location: The managed resource group location. + :paramtype location: str + """ + super(ArtifactStorePropertiesFormatManagedResourceGroupConfiguration, self).__init__(**kwargs) + self.name = name + self.location = location + + +class NFVIs(msrest.serialization.Model): + """The NFVI object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcK8SClusterNFVIDetails, AzureCoreNFVIDetails, AzureOperatorNexusClusterNFVIDetails. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureArcKubernetes': 'AzureArcK8SClusterNFVIDetails', 'AzureCore': 'AzureCoreNFVIDetails', 'AzureOperatorNexus': 'AzureOperatorNexusClusterNFVIDetails'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + """ + super(NFVIs, self).__init__(**kwargs) + self.name = name + self.nfvi_type = None # type: Optional[str] + + +class AzureArcK8SClusterNFVIDetails(NFVIs): + """The AzureArcK8sCluster NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + custom_location_reference: Optional["ReferencedResource"] = None, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureArcK8SClusterNFVIDetails, self).__init__(name=name, **kwargs) + self.nfvi_type = 'AzureArcKubernetes' # type: str + self.custom_location_reference = custom_location_reference + + +class AzureArcKubernetesArtifactProfile(ArtifactProfile): + """Azure arc kubernetes artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar helm_artifact_profile: Helm artifact profile. + :vartype helm_artifact_profile: ~Microsoft.HybridNetwork.models.HelmArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'helm_artifact_profile': {'key': 'helmArtifactProfile', 'type': 'HelmArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + helm_artifact_profile: Optional["HelmArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword helm_artifact_profile: Helm artifact profile. + :paramtype helm_artifact_profile: ~Microsoft.HybridNetwork.models.HelmArtifactProfile + """ + super(AzureArcKubernetesArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.helm_artifact_profile = helm_artifact_profile + + +class MappingRuleProfile(msrest.serialization.Model): + """Mapping rule profile properties. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + """ + super(MappingRuleProfile, self).__init__(**kwargs) + self.application_enablement = application_enablement + + +class AzureArcKubernetesDeployMappingRuleProfile(MappingRuleProfile): + """Azure arc kubernetes deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar helm_mapping_rule_profile: The helm mapping rule profile. + :vartype helm_mapping_rule_profile: ~Microsoft.HybridNetwork.models.HelmMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'helm_mapping_rule_profile': {'key': 'helmMappingRuleProfile', 'type': 'HelmMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + helm_mapping_rule_profile: Optional["HelmMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword helm_mapping_rule_profile: The helm mapping rule profile. + :paramtype helm_mapping_rule_profile: ~Microsoft.HybridNetwork.models.HelmMappingRuleProfile + """ + super(AzureArcKubernetesDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.helm_mapping_rule_profile = helm_mapping_rule_profile + + +class NetworkFunctionApplication(msrest.serialization.Model): + """Network function application definition. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(NetworkFunctionApplication, self).__init__(**kwargs) + self.name = name + self.depends_on_profile = depends_on_profile + + +class AzureArcKubernetesNetworkFunctionApplication(NetworkFunctionApplication): + """Azure arc kubernetes network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcKubernetesHelmApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "HelmPackage". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'HelmPackage': 'AzureArcKubernetesHelmApplication'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureArcKubernetesNetworkFunctionApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'AzureArcKubernetesNetworkFunctionApplication' # type: str + + +class AzureArcKubernetesHelmApplication(AzureArcKubernetesNetworkFunctionApplication): + """Azure arc kubernetes helm application configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "HelmPackage". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactType + :ivar artifact_profile: Azure arc kubernetes artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureArcKubernetesArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureArcKubernetesDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureArcKubernetesArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureArcKubernetesDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure arc kubernetes artifact profile. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.AzureArcKubernetesArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + super(AzureArcKubernetesHelmApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'HelmPackage' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class ContainerizedNetworkFunctionTemplate(msrest.serialization.Model): + """Containerized network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureArcKubernetesNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureArcKubernetes". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureArcKubernetes': 'AzureArcKubernetesNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContainerizedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureArcKubernetesNetworkFunctionTemplate(ContainerizedNetworkFunctionTemplate): + """Azure Arc kubernetes network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureArcKubernetes". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureArcKubernetesNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureArcKubernetesNetworkFunctionApplication]'}, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["AzureArcKubernetesNetworkFunctionApplication"]] = None, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureArcKubernetesNetworkFunctionApplication] + """ + super(AzureArcKubernetesNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureArcKubernetes' # type: str + self.network_function_applications = network_function_applications + + +class AzureContainerRegistryScopedTokenCredential(ArtifactAccessCredential): + """The azure container registry scoped token credential definition. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + :ivar username: The username of the credential. + :vartype username: str + :ivar acr_token: The credential value. + :vartype acr_token: str + :ivar acr_server_url: The Acr server url. + :vartype acr_server_url: str + :ivar repositories: The repositories that could be accessed using the current credential. + :vartype repositories: list[str] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'acr_token': {'key': 'acrToken', 'type': 'str'}, + 'acr_server_url': {'key': 'acrServerUrl', 'type': 'str'}, + 'repositories': {'key': 'repositories', 'type': '[str]'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + acr_token: Optional[str] = None, + acr_server_url: Optional[str] = None, + repositories: Optional[List[str]] = None, + expiry: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword username: The username of the credential. + :paramtype username: str + :keyword acr_token: The credential value. + :paramtype acr_token: str + :keyword acr_server_url: The Acr server url. + :paramtype acr_server_url: str + :keyword repositories: The repositories that could be accessed using the current credential. + :paramtype repositories: list[str] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime + """ + super(AzureContainerRegistryScopedTokenCredential, self).__init__(**kwargs) + self.credential_type = 'AzureContainerRegistryScopedToken' # type: str + self.username = username + self.acr_token = acr_token + self.acr_server_url = acr_server_url + self.repositories = repositories + self.expiry = expiry + + +class AzureCoreArmTemplateArtifactProfile(ArtifactProfile): + """Azure template artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'template_artifact_profile': {'key': 'templateArtifactProfile', 'type': 'ArmTemplateArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + template_artifact_profile: Optional["ArmTemplateArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + super(AzureCoreArmTemplateArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.template_artifact_profile = template_artifact_profile + + +class AzureCoreArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure template deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'template_mapping_rule_profile': {'key': 'templateMappingRuleProfile', 'type': 'ArmTemplateMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + template_mapping_rule_profile: Optional["ArmTemplateMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + super(AzureCoreArmTemplateDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.template_mapping_rule_profile = template_mapping_rule_profile + + +class AzureCoreDelegatedImageArtifactProfile(ArtifactProfile): + """Azure Image artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar image_artifact_profile: Image artifact profile. + :vartype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'image_artifact_profile': {'key': 'imageArtifactProfile', 'type': 'ImageArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + image_artifact_profile: Optional["ImageArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword image_artifact_profile: Image artifact profile. + :paramtype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + super(AzureCoreDelegatedImageArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.image_artifact_profile = image_artifact_profile + + +class AzureCoreDelegatedImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure Image deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar image_mapping_rule_profile: The Image mapping rule profile. + :vartype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'image_mapping_rule_profile': {'key': 'imageMappingRuleProfile', 'type': 'ImageMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + image_mapping_rule_profile: Optional["ImageMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword image_mapping_rule_profile: The Image mapping rule profile. + :paramtype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + super(AzureCoreDelegatedImageDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.image_mapping_rule_profile = image_mapping_rule_profile + + +class AzureCoreDelegatedNetworkFunctionApplication(NetworkFunctionApplication): + """Azure delegated network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreDelegatedNetworkFunctionImageApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreDelegatedArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ImageFile': 'AzureCoreDelegatedNetworkFunctionImageApplication'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureCoreDelegatedNetworkFunctionApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'AzureCoreDelegatedNetworkFunctionApplication' # type: str + + +class AzureCoreDelegatedNetworkFunctionImageApplication(AzureCoreDelegatedNetworkFunctionApplication): + """Azure core network function Image application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreDelegatedArtifactType + :ivar artifact_profile: Azure Image artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreDelegatedImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreDelegatedImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureCoreDelegatedImageArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureCoreDelegatedImageDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Image artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + super(AzureCoreDelegatedNetworkFunctionImageApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'ImageFile' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class DelegatedNetworkFunctionTemplate(msrest.serialization.Model): + """Delegated network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreDelegatedNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureCore': 'AzureCoreDelegatedNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DelegatedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureCoreDelegatedNetworkFunctionTemplate(DelegatedNetworkFunctionTemplate): + """Azure delegated network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreDelegatedNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureCoreDelegatedNetworkFunctionApplication]'}, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["AzureCoreDelegatedNetworkFunctionApplication"]] = None, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreDelegatedNetworkFunctionApplication] + """ + super(AzureCoreDelegatedNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.network_function_applications = network_function_applications + + +class AzureCoreNetworkFunctionApplication(NetworkFunctionApplication): + """Azure virtual network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreNetworkFunctionArmTemplateApplication, AzureCoreNetworkFunctionVhdApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'AzureCoreNetworkFunctionArmTemplateApplication', 'VhdImageFile': 'AzureCoreNetworkFunctionVhdApplication'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureCoreNetworkFunctionApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'AzureCoreNetworkFunctionApplication' # type: str + + +class AzureCoreNetworkFunctionArmTemplateApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function Template application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure template artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreArmTemplateArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureCoreArmTemplateArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureCoreArmTemplateDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure template artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreArmTemplateDeployMappingRuleProfile + """ + super(AzureCoreNetworkFunctionArmTemplateApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class VirtualNetworkFunctionTemplate(msrest.serialization.Model): + """Virtual network function template. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureCoreNetworkFunctionTemplate, AzureOperatorNexusNetworkFunctionTemplate. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + } + + _subtype_map = { + 'nfvi_type': {'AzureCore': 'AzureCoreNetworkFunctionTemplate', 'AzureOperatorNexus': 'AzureOperatorNexusNetworkFunctionTemplate'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = None # type: Optional[str] + + +class AzureCoreNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure virtual network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureCoreNetworkFunctionApplication]'}, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["AzureCoreNetworkFunctionApplication"]] = None, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureCoreNetworkFunctionApplication] + """ + super(AzureCoreNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.network_function_applications = network_function_applications + + +class AzureCoreNetworkFunctionVhdApplication(AzureCoreNetworkFunctionApplication): + """Azure core network function vhd application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "VhdImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureCoreArtifactType + :ivar artifact_profile: Azure vhd image artifact profile. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreVhdImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureCoreVhdImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreVhdImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureCoreVhdImageArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureCoreVhdImageDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure vhd image artifact profile. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.AzureCoreVhdImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + super(AzureCoreNetworkFunctionVhdApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'VhdImageFile' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureCoreNFVIDetails(NFVIs): + """The Azure Core NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar location: Location of the Azure core. + :vartype location: str + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword location: Location of the Azure core. + :paramtype location: str + """ + super(AzureCoreNFVIDetails, self).__init__(name=name, **kwargs) + self.nfvi_type = 'AzureCore' # type: str + self.location = location + + +class AzureCoreVhdImageArtifactProfile(ArtifactProfile): + """Azure vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar vhd_artifact_profile: Vhd artifact profile. + :vartype vhd_artifact_profile: ~Microsoft.HybridNetwork.models.VhdImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'vhd_artifact_profile': {'key': 'vhdArtifactProfile', 'type': 'VhdImageArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + vhd_artifact_profile: Optional["VhdImageArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword vhd_artifact_profile: Vhd artifact profile. + :paramtype vhd_artifact_profile: ~Microsoft.HybridNetwork.models.VhdImageArtifactProfile + """ + super(AzureCoreVhdImageArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.vhd_artifact_profile = vhd_artifact_profile + + +class AzureCoreVhdImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure vhd deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :vartype vhd_image_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.VhdImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'vhd_image_mapping_rule_profile': {'key': 'vhdImageMappingRuleProfile', 'type': 'VhdImageMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + vhd_image_mapping_rule_profile: Optional["VhdImageMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword vhd_image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype vhd_image_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.VhdImageMappingRuleProfile + """ + super(AzureCoreVhdImageDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.vhd_image_mapping_rule_profile = vhd_image_mapping_rule_profile + + +class AzureKubernetesServiceNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Azure based kubernetes service cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + enabled on the AKS cluster. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + 'user_assigned_managed_identity': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + cluster_reference: "ReferencedResource", + user_assigned_managed_identity: "ReferencedResource", + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: Required. The User Assigned Managed Identity ARM id + enabled on the AKS cluster. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureKubernetesServiceNetworkFunctionReadyK8S, self).__init__(cluster_reference=cluster_reference, **kwargs) + self.cluster_type = 'AzureKubernetesService' # type: str + self.user_assigned_managed_identity = user_assigned_managed_identity + + +class AzureOperatorNexusArmTemplateArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services vhd artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar template_artifact_profile: Template artifact profile. + :vartype template_artifact_profile: ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'template_artifact_profile': {'key': 'templateArtifactProfile', 'type': 'ArmTemplateArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + template_artifact_profile: Optional["ArmTemplateArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword template_artifact_profile: Template artifact profile. + :paramtype template_artifact_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateArtifactProfile + """ + super(AzureOperatorNexusArmTemplateArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.template_artifact_profile = template_artifact_profile + + +class AzureOperatorNexusArmTemplateDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services template deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar template_mapping_rule_profile: The template mapping rule profile. + :vartype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'template_mapping_rule_profile': {'key': 'templateMappingRuleProfile', 'type': 'ArmTemplateMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + template_mapping_rule_profile: Optional["ArmTemplateMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword template_mapping_rule_profile: The template mapping rule profile. + :paramtype template_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.ArmTemplateMappingRuleProfile + """ + super(AzureOperatorNexusArmTemplateDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.template_mapping_rule_profile = template_mapping_rule_profile + + +class AzureOperatorNexusClusterNFVIDetails(NFVIs): + """The AzureOperatorNexusCluster NFVI detail. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the nfvi. + :vartype name: str + :ivar nfvi_type: Required. The NFVI type.Constant filled by server. Possible values include: + "Unknown", "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar custom_location_reference: The reference to the custom location. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + custom_location_reference: Optional["ReferencedResource"] = None, + **kwargs + ): + """ + :keyword name: Name of the nfvi. + :paramtype name: str + :keyword custom_location_reference: The reference to the custom location. + :paramtype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(AzureOperatorNexusClusterNFVIDetails, self).__init__(name=name, **kwargs) + self.nfvi_type = 'AzureOperatorNexus' # type: str + self.custom_location_reference = custom_location_reference + + +class AzureOperatorNexusImageArtifactProfile(ArtifactProfile): + """Azure Operator Distributed Services image artifact profile properties. + + :ivar artifact_store: The reference to artifact store. + :vartype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar image_artifact_profile: Image artifact profile. + :vartype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + + _attribute_map = { + 'artifact_store': {'key': 'artifactStore', 'type': 'ReferencedResource'}, + 'image_artifact_profile': {'key': 'imageArtifactProfile', 'type': 'ImageArtifactProfile'}, + } + + def __init__( + self, + *, + artifact_store: Optional["ReferencedResource"] = None, + image_artifact_profile: Optional["ImageArtifactProfile"] = None, + **kwargs + ): + """ + :keyword artifact_store: The reference to artifact store. + :paramtype artifact_store: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword image_artifact_profile: Image artifact profile. + :paramtype image_artifact_profile: ~Microsoft.HybridNetwork.models.ImageArtifactProfile + """ + super(AzureOperatorNexusImageArtifactProfile, self).__init__(artifact_store=artifact_store, **kwargs) + self.image_artifact_profile = image_artifact_profile + + +class AzureOperatorNexusImageDeployMappingRuleProfile(MappingRuleProfile): + """Azure Operator Distributed Services image deploy mapping rule profile. + + :ivar application_enablement: The application enablement. Possible values include: "Unknown", + "Enabled", "Disabled". + :vartype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :ivar image_mapping_rule_profile: The vhd mapping rule profile. + :vartype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + + _attribute_map = { + 'application_enablement': {'key': 'applicationEnablement', 'type': 'str'}, + 'image_mapping_rule_profile': {'key': 'imageMappingRuleProfile', 'type': 'ImageMappingRuleProfile'}, + } + + def __init__( + self, + *, + application_enablement: Optional[Union[str, "ApplicationEnablement"]] = None, + image_mapping_rule_profile: Optional["ImageMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword application_enablement: The application enablement. Possible values include: + "Unknown", "Enabled", "Disabled". + :paramtype application_enablement: str or ~Microsoft.HybridNetwork.models.ApplicationEnablement + :keyword image_mapping_rule_profile: The vhd mapping rule profile. + :paramtype image_mapping_rule_profile: ~Microsoft.HybridNetwork.models.ImageMappingRuleProfile + """ + super(AzureOperatorNexusImageDeployMappingRuleProfile, self).__init__(application_enablement=application_enablement, **kwargs) + self.image_mapping_rule_profile = image_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionApplication(NetworkFunctionApplication): + """Azure Operator Distributed Services network function application definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureOperatorNexusNetworkFunctionArmTemplateApplication, AzureOperatorNexusNetworkFunctionImageApplication. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'ArmTemplate': 'AzureOperatorNexusNetworkFunctionArmTemplateApplication', 'ImageFile': 'AzureOperatorNexusNetworkFunctionImageApplication'} + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + """ + super(AzureOperatorNexusNetworkFunctionApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'AzureOperatorNexusNetworkFunctionApplication' # type: str + + +class AzureOperatorNexusNetworkFunctionArmTemplateApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function Template application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services Template artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureOperatorNexusArmTemplateArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureOperatorNexusArmTemplateDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureOperatorNexusArmTemplateArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureOperatorNexusArmTemplateDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services Template artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile + """ + super(AzureOperatorNexusNetworkFunctionArmTemplateApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'ArmTemplate' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionImageApplication(AzureOperatorNexusNetworkFunctionApplication): + """Azure Operator Distributed Services network function image application definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the network function application. + :vartype name: str + :ivar depends_on_profile: Depends on profile definition. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar artifact_type: Required. The artifact type.Constant filled by server. Possible values + include: "Unknown", "ImageFile", "ArmTemplate". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.AzureOperatorNexusArtifactType + :ivar artifact_profile: Azure Operator Distributed Services image artifact profile. + :vartype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageArtifactProfile + :ivar deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + + _validation = { + 'artifact_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'AzureOperatorNexusImageArtifactProfile'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureOperatorNexusImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + artifact_profile: Optional["AzureOperatorNexusImageArtifactProfile"] = None, + deploy_parameters_mapping_rule_profile: Optional["AzureOperatorNexusImageDeployMappingRuleProfile"] = None, + **kwargs + ): + """ + :keyword name: The name of the network function application. + :paramtype name: str + :keyword depends_on_profile: Depends on profile definition. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword artifact_profile: Azure Operator Distributed Services image artifact profile. + :paramtype artifact_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageArtifactProfile + :keyword deploy_parameters_mapping_rule_profile: Deploy mapping rule profile. + :paramtype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureOperatorNexusImageDeployMappingRuleProfile + """ + super(AzureOperatorNexusNetworkFunctionImageApplication, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.artifact_type = 'ImageFile' # type: str + self.artifact_profile = artifact_profile + self.deploy_parameters_mapping_rule_profile = deploy_parameters_mapping_rule_profile + + +class AzureOperatorNexusNetworkFunctionTemplate(VirtualNetworkFunctionTemplate): + """Azure Operator Distributed Services network function template. + + All required parameters must be populated in order to send to Azure. + + :ivar nfvi_type: Required. The network function type.Constant filled by server. Possible values + include: "Unknown", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionNFVIType + :ivar network_function_applications: Network function applications. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + + _validation = { + 'nfvi_type': {'required': True}, + } + + _attribute_map = { + 'nfvi_type': {'key': 'nfviType', 'type': 'str'}, + 'network_function_applications': {'key': 'networkFunctionApplications', 'type': '[AzureOperatorNexusNetworkFunctionApplication]'}, + } + + def __init__( + self, + *, + network_function_applications: Optional[List["AzureOperatorNexusNetworkFunctionApplication"]] = None, + **kwargs + ): + """ + :keyword network_function_applications: Network function applications. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.AzureOperatorNexusNetworkFunctionApplication] + """ + super(AzureOperatorNexusNetworkFunctionTemplate, self).__init__(**kwargs) + self.nfvi_type = 'AzureOperatorNexus' # type: str + self.network_function_applications = network_function_applications + + +class AzureStorageAccountContainerCredential(msrest.serialization.Model): + """The azure storage account container credential definition. + + :ivar container_name: The storage account container name. + :vartype container_name: str + :ivar container_sas_uri: The storage account container sas uri. + :vartype container_sas_uri: str + """ + + _attribute_map = { + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'container_sas_uri': {'key': 'containerSasUri', 'type': 'str'}, + } + + def __init__( + self, + *, + container_name: Optional[str] = None, + container_sas_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword container_name: The storage account container name. + :paramtype container_name: str + :keyword container_sas_uri: The storage account container sas uri. + :paramtype container_sas_uri: str + """ + super(AzureStorageAccountContainerCredential, self).__init__(**kwargs) + self.container_name = container_name + self.container_sas_uri = container_sas_uri + + +class AzureStorageAccountCredential(ArtifactAccessCredential): + """The azure storage account credential definition. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. The credential type.Constant filled by server. Possible values + include: "Unknown", "AzureContainerRegistryScopedToken", "AzureStorageAccountToken". + :vartype credential_type: str or ~Microsoft.HybridNetwork.models.CredentialType + :ivar storage_account_id: The storage account Id. + :vartype storage_account_id: str + :ivar container_credentials: The containers that could be accessed using the current + credential. + :vartype container_credentials: + list[~Microsoft.HybridNetwork.models.AzureStorageAccountContainerCredential] + :ivar expiry: The UTC time when credential will expire. + :vartype expiry: ~datetime.datetime + """ + + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'container_credentials': {'key': 'containerCredentials', 'type': '[AzureStorageAccountContainerCredential]'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + container_credentials: Optional[List["AzureStorageAccountContainerCredential"]] = None, + expiry: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword storage_account_id: The storage account Id. + :paramtype storage_account_id: str + :keyword container_credentials: The containers that could be accessed using the current + credential. + :paramtype container_credentials: + list[~Microsoft.HybridNetwork.models.AzureStorageAccountContainerCredential] + :keyword expiry: The UTC time when credential will expire. + :paramtype expiry: ~datetime.datetime + """ + super(AzureStorageAccountCredential, self).__init__(**kwargs) + self.credential_type = 'AzureStorageAccountToken' # type: str + self.storage_account_id = storage_account_id + self.container_credentials = container_credentials + self.expiry = expiry + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class Component(ProxyResource): + """The component sub resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar provisioning_state: The provisioning state of the component resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar deployment_profile: The JSON-serialized deployment profile of the component resource. + :vartype deployment_profile: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'deployment_profile': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'deployment_profile': {'key': 'properties.deploymentProfile', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Component, self).__init__(**kwargs) + self.provisioning_state = None + self.deployment_profile = None + + +class ComponentListResult(msrest.serialization.Model): + """Response for list component API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of component resources in a networkFunction. + :vartype value: list[~Microsoft.HybridNetwork.models.Component] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Component]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Component"]] = None, + **kwargs + ): + """ + :keyword value: A list of component resources in a networkFunction. + :paramtype value: list[~Microsoft.HybridNetwork.models.Component] + """ + super(ComponentListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConfigurationDefinitionResourceElementTemplate(msrest.serialization.Model): + """The configuration definition resource element template details. + + :ivar name: The name of the network function to apply the configuration to. + :vartype name: str + :ivar nf_agent_type: The type of NF agent that should handle this configuration. + :vartype nf_agent_type: str + :ivar configuration_type: The type of configuration to be handled by the NF agent. + :vartype configuration_type: str + :ivar configuration_generation_type: The configuration generation type. Possible values + include: "Unknown", "HandlebarTemplate". + :vartype configuration_generation_type: str or + ~Microsoft.HybridNetwork.models.ConfigurationGenerationType + :ivar parameter_values: Name and value pairs that define the parameter values. It can be a well + formed escaped JSON string. + :vartype parameter_values: str + :ivar artifact_profile: Artifact profile properties. + :vartype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + :ivar extra_artifact_profiles: List of extra artifact profiles required by the configuration. + :vartype extra_artifact_profiles: list[~Microsoft.HybridNetwork.models.NSDArtifactProfile] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'nf_agent_type': {'key': 'nfAgentType', 'type': 'str'}, + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + 'configuration_generation_type': {'key': 'configurationGenerationType', 'type': 'str'}, + 'parameter_values': {'key': 'parameterValues', 'type': 'str'}, + 'artifact_profile': {'key': 'artifactProfile', 'type': 'NSDArtifactProfile'}, + 'extra_artifact_profiles': {'key': 'extraArtifactProfiles', 'type': '[NSDArtifactProfile]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + nf_agent_type: Optional[str] = None, + configuration_type: Optional[str] = None, + configuration_generation_type: Optional[Union[str, "ConfigurationGenerationType"]] = None, + parameter_values: Optional[str] = None, + artifact_profile: Optional["NSDArtifactProfile"] = None, + extra_artifact_profiles: Optional[List["NSDArtifactProfile"]] = None, + **kwargs + ): + """ + :keyword name: The name of the network function to apply the configuration to. + :paramtype name: str + :keyword nf_agent_type: The type of NF agent that should handle this configuration. + :paramtype nf_agent_type: str + :keyword configuration_type: The type of configuration to be handled by the NF agent. + :paramtype configuration_type: str + :keyword configuration_generation_type: The configuration generation type. Possible values + include: "Unknown", "HandlebarTemplate". + :paramtype configuration_generation_type: str or + ~Microsoft.HybridNetwork.models.ConfigurationGenerationType + :keyword parameter_values: Name and value pairs that define the parameter values. It can be a + well formed escaped JSON string. + :paramtype parameter_values: str + :keyword artifact_profile: Artifact profile properties. + :paramtype artifact_profile: ~Microsoft.HybridNetwork.models.NSDArtifactProfile + :keyword extra_artifact_profiles: List of extra artifact profiles required by the + configuration. + :paramtype extra_artifact_profiles: list[~Microsoft.HybridNetwork.models.NSDArtifactProfile] + """ + super(ConfigurationDefinitionResourceElementTemplate, self).__init__(**kwargs) + self.name = name + self.nf_agent_type = nf_agent_type + self.configuration_type = configuration_type + self.configuration_generation_type = configuration_generation_type + self.parameter_values = parameter_values + self.artifact_profile = artifact_profile + self.extra_artifact_profiles = extra_artifact_profiles + + +class ConfigurationDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The configuration definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ConfigurationDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ConfigurationDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + configuration: Optional["ConfigurationDefinitionResourceElementTemplate"] = None, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ConfigurationDefinitionResourceElementTemplate + """ + super(ConfigurationDefinitionResourceElementTemplateDetails, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.type = 'ConfigurationDefinition' # type: str + self.configuration = configuration + + +class ConfigurationGroupSchema(TrackedResource): + """Configuration group schema resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the Configuration group schema resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The configuration group schema version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar schema_definition: Name and value pairs that define the configuration value. It can be a + well formed escaped JSON string. + :vartype schema_definition: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'schema_definition': {'key': 'properties.schemaDefinition', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + schema_definition: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword schema_definition: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :paramtype schema_definition: str + """ + super(ConfigurationGroupSchema, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.version_state = None + self.schema_definition = schema_definition + + +class ConfigurationGroupSchemaListResult(msrest.serialization.Model): + """A list of configuration group schema resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of configuration group schema. + :vartype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationGroupSchema]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationGroupSchema"]] = None, + **kwargs + ): + """ + :keyword value: A list of configuration group schema. + :paramtype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + """ + super(ConfigurationGroupSchemaListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConfigurationGroupSchemaVersionUpdateState(msrest.serialization.Model): + """Publisher configuration group schema update request definition. + + :ivar version_state: The configuration group schema state. Possible values include: "Unknown", + "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + *, + version_state: Optional[Union[str, "VersionState"]] = None, + **kwargs + ): + """ + :keyword version_state: The configuration group schema state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(ConfigurationGroupSchemaVersionUpdateState, self).__init__(**kwargs) + self.version_state = version_state + + +class ConfigurationGroupValue(TrackedResource): + """Hybrid configuration group value resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the site resource. Possible values include: + "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the configuration group schema. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar configuration_group_schema_name: The configuration group schema name. + :vartype configuration_group_schema_name: str + :ivar configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :vartype configuration_group_schema_offering_location: str + :ivar configuration_value: Name and value pairs that define the configuration value. It can be + a well formed escaped JSON string. + :vartype configuration_value: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'configuration_group_schema_name': {'key': 'properties.configurationGroupSchemaName', 'type': 'str'}, + 'configuration_group_schema_offering_location': {'key': 'properties.configurationGroupSchemaOfferingLocation', 'type': 'str'}, + 'configuration_value': {'key': 'properties.configurationValue', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + publisher_name: Optional[str] = None, + publisher_scope: Optional[Union[str, "PublisherScope"]] = None, + configuration_group_schema_name: Optional[str] = None, + configuration_group_schema_offering_location: Optional[str] = None, + configuration_value: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword publisher_name: The publisher name for the configuration group schema. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword configuration_group_schema_name: The configuration group schema name. + :paramtype configuration_group_schema_name: str + :keyword configuration_group_schema_offering_location: The location of the configuration group + schema offering. + :paramtype configuration_group_schema_offering_location: str + :keyword configuration_value: Name and value pairs that define the configuration value. It can + be a well formed escaped JSON string. + :paramtype configuration_value: str + """ + super(ConfigurationGroupValue, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.publisher_name = publisher_name + self.publisher_scope = publisher_scope + self.configuration_group_schema_name = configuration_group_schema_name + self.configuration_group_schema_offering_location = configuration_group_schema_offering_location + self.configuration_value = configuration_value + + +class ConfigurationGroupValueListResult(msrest.serialization.Model): + """Response for hybrid configurationGroups API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of hybrid configurationGroups. + :vartype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationGroupValue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationGroupValue"]] = None, + **kwargs + ): + """ + :keyword value: A list of hybrid configurationGroups. + :paramtype value: list[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + """ + super(ConfigurationGroupValueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionVersionPropertiesFormat(msrest.serialization.Model): + """Network function definition version properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContainerizedNetworkFunctionDefinitionVersion, DelegatedNetworkFunctionDefinitionVersion, VirtualNetworkFunctionDefinitionVersion. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + } + + _subtype_map = { + 'network_function_type': {'ContainerizedNetworkFunction': 'ContainerizedNetworkFunctionDefinitionVersion', 'DelegatedNetworkFunction': 'DelegatedNetworkFunctionDefinitionVersion', 'VirtualNetworkFunction': 'VirtualNetworkFunctionDefinitionVersion'} + } + + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + """ + super(NetworkFunctionDefinitionVersionPropertiesFormat, self).__init__(**kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.deploy_parameters = deploy_parameters + self.network_function_type = None # type: Optional[str] + + +class ContainerizedNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Containerized network function network function definition version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Containerized network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'ContainerizedNetworkFunctionTemplate'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + network_function_template: Optional["ContainerizedNetworkFunctionTemplate"] = None, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Containerized network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.ContainerizedNetworkFunctionTemplate + """ + super(ContainerizedNetworkFunctionDefinitionVersion, self).__init__(description=description, deploy_parameters=deploy_parameters, **kwargs) + self.network_function_type = 'ContainerizedNetworkFunction' # type: str + self.network_function_template = network_function_template + + +class CustomLocationResourceId(msrest.serialization.Model): + """Reference to an Azure ARC custom location resource. + + :ivar id: Azure ARC custom location resource ID. + :vartype id: str + """ + + _validation = { + 'id': {'pattern': r'^/[sS][uU][bB][sS][cC][rR][iI][pP][tT][iI][oO][nN][sS]/[^/?#]+/[rR][eE][sS][oO][uU][rR][cC][eE][gG][rR][oO][uU][pP][sS]/[^/?#]+/[pP][rR][oO][vV][iI][dD][eE][rR][sS]/[mM][iI][cC][rR][oO][sS][oO][fF][tT]\.[eE][xX][tT][eE][nN][dD][eE][dD][lL][oO][cC][aA][tT][iI][oO][nN]/[cC][uU][sS][tT][oO][mM][lL][oO][cC][aA][tT][iI][oO][nN][sS]/[^/?#]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Azure ARC custom location resource ID. + :paramtype id: str + """ + super(CustomLocationResourceId, self).__init__(**kwargs) + self.id = id + + +class DelegatedNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Delegated network function network function definition version properties . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Delegated network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'DelegatedNetworkFunctionTemplate'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + network_function_template: Optional["DelegatedNetworkFunctionTemplate"] = None, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Delegated network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.DelegatedNetworkFunctionTemplate + """ + super(DelegatedNetworkFunctionDefinitionVersion, self).__init__(description=description, deploy_parameters=deploy_parameters, **kwargs) + self.network_function_type = 'DelegatedNetworkFunction' # type: str + self.network_function_template = network_function_template + + +class DependsOnProfile(msrest.serialization.Model): + """Depends on profile definition. + + :ivar install_depends_on: Application installation operation dependency. + :vartype install_depends_on: list[str] + :ivar uninstall_depends_on: Application deletion operation dependency. + :vartype uninstall_depends_on: list[str] + :ivar update_depends_on: Application update operation dependency. + :vartype update_depends_on: list[str] + """ + + _attribute_map = { + 'install_depends_on': {'key': 'installDependsOn', 'type': '[str]'}, + 'uninstall_depends_on': {'key': 'uninstallDependsOn', 'type': '[str]'}, + 'update_depends_on': {'key': 'updateDependsOn', 'type': '[str]'}, + } + + def __init__( + self, + *, + install_depends_on: Optional[List[str]] = None, + uninstall_depends_on: Optional[List[str]] = None, + update_depends_on: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword install_depends_on: Application installation operation dependency. + :paramtype install_depends_on: list[str] + :keyword uninstall_depends_on: Application deletion operation dependency. + :paramtype uninstall_depends_on: list[str] + :keyword update_depends_on: Application update operation dependency. + :paramtype update_depends_on: list[str] + """ + super(DependsOnProfile, self).__init__(**kwargs) + self.install_depends_on = install_depends_on + self.uninstall_depends_on = uninstall_depends_on + self.update_depends_on = update_depends_on + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~Microsoft.HybridNetwork.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~Microsoft.HybridNetwork.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~Microsoft.HybridNetwork.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~Microsoft.HybridNetwork.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ExecuteRequestParameters(msrest.serialization.Model): + """Payload for execute request post call. + + All required parameters must be populated in order to send to Azure. + + :ivar service_endpoint: Required. The endpoint of service to call. + :vartype service_endpoint: str + :ivar request_metadata: Required. The request metadata. + :vartype request_metadata: ~Microsoft.HybridNetwork.models.RequestMetadata + """ + + _validation = { + 'service_endpoint': {'required': True}, + 'request_metadata': {'required': True}, + } + + _attribute_map = { + 'service_endpoint': {'key': 'serviceEndpoint', 'type': 'str'}, + 'request_metadata': {'key': 'requestMetadata', 'type': 'RequestMetadata'}, + } + + def __init__( + self, + *, + service_endpoint: str, + request_metadata: "RequestMetadata", + **kwargs + ): + """ + :keyword service_endpoint: Required. The endpoint of service to call. + :paramtype service_endpoint: str + :keyword request_metadata: Required. The request metadata. + :paramtype request_metadata: ~Microsoft.HybridNetwork.models.RequestMetadata + """ + super(ExecuteRequestParameters, self).__init__(**kwargs) + self.service_endpoint = service_endpoint + self.request_metadata = request_metadata + + +class HelmArtifactProfile(msrest.serialization.Model): + """Helm artifact profile. + + :ivar helm_package_name: Helm package name. + :vartype helm_package_name: str + :ivar helm_package_version_range: Helm package version range. + :vartype helm_package_version_range: str + :ivar registry_values_paths: The registry values path list. + :vartype registry_values_paths: list[str] + :ivar image_pull_secrets_values_paths: The image pull secrets values path list. + :vartype image_pull_secrets_values_paths: list[str] + """ + + _attribute_map = { + 'helm_package_name': {'key': 'helmPackageName', 'type': 'str'}, + 'helm_package_version_range': {'key': 'helmPackageVersionRange', 'type': 'str'}, + 'registry_values_paths': {'key': 'registryValuesPaths', 'type': '[str]'}, + 'image_pull_secrets_values_paths': {'key': 'imagePullSecretsValuesPaths', 'type': '[str]'}, + } + + def __init__( + self, + *, + helm_package_name: Optional[str] = None, + helm_package_version_range: Optional[str] = None, + registry_values_paths: Optional[List[str]] = None, + image_pull_secrets_values_paths: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword helm_package_name: Helm package name. + :paramtype helm_package_name: str + :keyword helm_package_version_range: Helm package version range. + :paramtype helm_package_version_range: str + :keyword registry_values_paths: The registry values path list. + :paramtype registry_values_paths: list[str] + :keyword image_pull_secrets_values_paths: The image pull secrets values path list. + :paramtype image_pull_secrets_values_paths: list[str] + """ + super(HelmArtifactProfile, self).__init__(**kwargs) + self.helm_package_name = helm_package_name + self.helm_package_version_range = helm_package_version_range + self.registry_values_paths = registry_values_paths + self.image_pull_secrets_values_paths = image_pull_secrets_values_paths + + +class HelmMappingRuleProfile(msrest.serialization.Model): + """Helm mapping rule profile. + + :ivar release_namespace: Helm release namespace. + :vartype release_namespace: str + :ivar release_name: Helm release name. + :vartype release_name: str + :ivar helm_package_version: Helm package version. + :vartype helm_package_version: str + :ivar values: Helm release values. + :vartype values: str + """ + + _attribute_map = { + 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, + 'release_name': {'key': 'releaseName', 'type': 'str'}, + 'helm_package_version': {'key': 'helmPackageVersion', 'type': 'str'}, + 'values': {'key': 'values', 'type': 'str'}, + } + + def __init__( + self, + *, + release_namespace: Optional[str] = None, + release_name: Optional[str] = None, + helm_package_version: Optional[str] = None, + values: Optional[str] = None, + **kwargs + ): + """ + :keyword release_namespace: Helm release namespace. + :paramtype release_namespace: str + :keyword release_name: Helm release name. + :paramtype release_name: str + :keyword helm_package_version: Helm package version. + :paramtype helm_package_version: str + :keyword values: Helm release values. + :paramtype values: str + """ + super(HelmMappingRuleProfile, self).__init__(**kwargs) + self.release_namespace = release_namespace + self.release_name = release_name + self.helm_package_version = helm_package_version + self.values = values + + +class HelmPackageApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Helm Package Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureArcKubernetesDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureArcKubernetesDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(HelmPackageApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'HelmPackage' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class HybridAKSNetworkFunctionReadyK8S(NetworkFunctionReadyK8SPropertiesFormat): + """Azure based kubernetes service cluster prerequisite properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: Required. The cluster type.Constant filled by server. Possible values + include: "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: Required. The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar user_assigned_managed_identity: The User Assigned Managed Identity ARM id giving access + to the HybridAKS cluster if outside AOSM flow. + :vartype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'cluster_type': {'required': True}, + 'cluster_reference': {'required': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'customLocationReference', 'type': 'ReferencedResource'}, + 'user_assigned_managed_identity': {'key': 'userAssignedManagedIdentity', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + cluster_reference: "ReferencedResource", + user_assigned_managed_identity: Optional["ReferencedResource"] = None, + **kwargs + ): + """ + :keyword cluster_reference: Required. The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword user_assigned_managed_identity: The User Assigned Managed Identity ARM id giving + access to the HybridAKS cluster if outside AOSM flow. + :paramtype user_assigned_managed_identity: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(HybridAKSNetworkFunctionReadyK8S, self).__init__(cluster_reference=cluster_reference, **kwargs) + self.cluster_type = 'HybridAKS' # type: str + self.user_assigned_managed_identity = user_assigned_managed_identity + + +class ImageArtifactProfile(msrest.serialization.Model): + """Image artifact profile. + + :ivar image_name: Image name. + :vartype image_name: str + :ivar image_version: Image version. + :vartype image_version: str + """ + + _attribute_map = { + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'image_version': {'key': 'imageVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + image_name: Optional[str] = None, + image_version: Optional[str] = None, + **kwargs + ): + """ + :keyword image_name: Image name. + :paramtype image_name: str + :keyword image_version: Image version. + :paramtype image_version: str + """ + super(ImageArtifactProfile, self).__init__(**kwargs) + self.image_name = image_name + self.image_version = image_version + + +class ImageFileApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Image file Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreDelegatedImageDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreDelegatedImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ImageFileApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'ImageFile' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class ImageMappingRuleProfile(msrest.serialization.Model): + """Image mapping rule profile. + + :ivar user_configuration: List of values. + :vartype user_configuration: str + """ + + _attribute_map = { + 'user_configuration': {'key': 'userConfiguration', 'type': 'str'}, + } + + def __init__( + self, + *, + user_configuration: Optional[str] = None, + **kwargs + ): + """ + :keyword user_configuration: List of values. + :paramtype user_configuration: str + """ + super(ImageMappingRuleProfile, self).__init__(**kwargs) + self.user_configuration = user_configuration + + +class ManagedResourceGroupConfiguration(msrest.serialization.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :vartype name: str + :ivar location: Managed resource group location. + :vartype location: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Managed resource group name. + :paramtype name: str + :keyword location: Managed resource group location. + :paramtype location: str + """ + super(ManagedResourceGroupConfiguration, self).__init__(**kwargs) + self.name = name + self.location = location + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~Microsoft.HybridNetwork.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~Microsoft.HybridNetwork.models.UserAssignedIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~Microsoft.HybridNetwork.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~Microsoft.HybridNetwork.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManifestArtifactFormat(msrest.serialization.Model): + """Manifest artifact properties. + + :ivar artifact_name: The artifact name. + :vartype artifact_name: str + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_name: Optional[str] = None, + artifact_type: Optional[Union[str, "ArtifactType"]] = None, + artifact_version: Optional[str] = None, + **kwargs + ): + """ + :keyword artifact_name: The artifact name. + :paramtype artifact_name: str + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + """ + super(ManifestArtifactFormat, self).__init__(**kwargs) + self.artifact_name = artifact_name + self.artifact_type = artifact_type + self.artifact_version = artifact_version + + +class NetworkFunction(TrackedResource): + """Network function resource response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar identity: The managed identity of the Network function, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the network function resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar publisher_name: The publisher name for the network function. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar network_function_definition_group_name: The network function definition group name for + the network function. + :vartype network_function_definition_group_name: str + :ivar network_function_definition_version: The network function definition version for the + network function. + :vartype network_function_definition_version: str + :ivar network_function_definition_offering_location: The location of the network function + definition offering. + :vartype network_function_definition_offering_location: str + :ivar nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar nfvi_id: The nfviId for the network function. + :vartype nfvi_id: str + :ivar allow_software_update: Indicates if software updates are allowed during deployment. + :vartype allow_software_update: bool + :ivar deployment_values: The JSON-serialized deployment values from the user. + :vartype deployment_values: str + :ivar role_override_values: The role configuration override values from the user. + :vartype role_override_values: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'network_function_definition_group_name': {'key': 'properties.networkFunctionDefinitionGroupName', 'type': 'str'}, + 'network_function_definition_version': {'key': 'properties.networkFunctionDefinitionVersion', 'type': 'str'}, + 'network_function_definition_offering_location': {'key': 'properties.networkFunctionDefinitionOfferingLocation', 'type': 'str'}, + 'nfvi_type': {'key': 'properties.nfviType', 'type': 'str'}, + 'nfvi_id': {'key': 'properties.nfviId', 'type': 'str'}, + 'allow_software_update': {'key': 'properties.allowSoftwareUpdate', 'type': 'bool'}, + 'deployment_values': {'key': 'properties.deploymentValues', 'type': 'str'}, + 'role_override_values': {'key': 'properties.roleOverrideValues', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + identity: Optional["ManagedServiceIdentity"] = None, + publisher_name: Optional[str] = None, + publisher_scope: Optional[Union[str, "PublisherScope"]] = None, + network_function_definition_group_name: Optional[str] = None, + network_function_definition_version: Optional[str] = None, + network_function_definition_offering_location: Optional[str] = None, + nfvi_type: Optional[Union[str, "NFVIType"]] = None, + nfvi_id: Optional[str] = None, + allow_software_update: Optional[bool] = None, + deployment_values: Optional[str] = None, + role_override_values: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword etag: A unique read-only string that changes whenever the resource is updated. + :paramtype etag: str + :keyword identity: The managed identity of the Network function, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword publisher_name: The publisher name for the network function. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword network_function_definition_group_name: The network function definition group name for + the network function. + :paramtype network_function_definition_group_name: str + :keyword network_function_definition_version: The network function definition version for the + network function. + :paramtype network_function_definition_version: str + :keyword network_function_definition_offering_location: The location of the network function + definition offering. + :paramtype network_function_definition_offering_location: str + :keyword nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :paramtype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :keyword nfvi_id: The nfviId for the network function. + :paramtype nfvi_id: str + :keyword allow_software_update: Indicates if software updates are allowed during deployment. + :paramtype allow_software_update: bool + :keyword deployment_values: The JSON-serialized deployment values from the user. + :paramtype deployment_values: str + :keyword role_override_values: The role configuration override values from the user. + :paramtype role_override_values: list[str] + """ + super(NetworkFunction, self).__init__(tags=tags, location=location, **kwargs) + self.etag = etag + self.identity = identity + self.provisioning_state = None + self.publisher_name = publisher_name + self.publisher_scope = publisher_scope + self.network_function_definition_group_name = network_function_definition_group_name + self.network_function_definition_version = network_function_definition_version + self.network_function_definition_offering_location = network_function_definition_offering_location + self.nfvi_type = nfvi_type + self.nfvi_id = nfvi_id + self.allow_software_update = allow_software_update + self.deployment_values = deployment_values + self.role_override_values = role_override_values + + +class NetworkFunctionDefinitionGroup(TrackedResource): + """Network function definition group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network function definition groups + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar description: The network function definition group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network function definition group description. + :paramtype description: str + """ + super(NetworkFunctionDefinitionGroup, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.description = description + + +class NetworkFunctionDefinitionGroupListResult(msrest.serialization.Model): + """A list of network function definition group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionDefinitionGroup"]] = None, + **kwargs + ): + """ + :keyword value: A list of network function definition group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + """ + super(NetworkFunctionDefinitionGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionGroupOverview(ProxyResource): + """Network function definition group overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar description: Network function definition group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkFunctionDefinitionGroupOverview, self).__init__(**kwargs) + self.description = None + + +class NetworkFunctionDefinitionGroupOverviewListResult(msrest.serialization.Model): + """A list of available network function definition groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The network function group list properties. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionGroupOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionDefinitionGroupOverview"]] = None, + **kwargs + ): + """ + :keyword value: The network function group list properties. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview] + """ + super(NetworkFunctionDefinitionGroupOverviewListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionResourceElementTemplateDetails(ResourceElementTemplate): + """The network function definition resource element template details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the resource element template. + :vartype name: str + :ivar type: Required. The resource element template type.Constant filled by server. Possible + values include: "Unknown", "ArmResourceDefinition", "ConfigurationDefinition", + "NetworkFunctionDefinition". + :vartype type: str or ~Microsoft.HybridNetwork.models.Type + :ivar depends_on_profile: The depends on profile. + :vartype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :ivar configuration: The resource element template type. + :vartype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'depends_on_profile': {'key': 'dependsOnProfile', 'type': 'DependsOnProfile'}, + 'configuration': {'key': 'configuration', 'type': 'ArmResourceDefinitionResourceElementTemplate'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + depends_on_profile: Optional["DependsOnProfile"] = None, + configuration: Optional["ArmResourceDefinitionResourceElementTemplate"] = None, + **kwargs + ): + """ + :keyword name: Name of the resource element template. + :paramtype name: str + :keyword depends_on_profile: The depends on profile. + :paramtype depends_on_profile: ~Microsoft.HybridNetwork.models.DependsOnProfile + :keyword configuration: The resource element template type. + :paramtype configuration: + ~Microsoft.HybridNetwork.models.ArmResourceDefinitionResourceElementTemplate + """ + super(NetworkFunctionDefinitionResourceElementTemplateDetails, self).__init__(name=name, depends_on_profile=depends_on_profile, **kwargs) + self.type = 'NetworkFunctionDefinition' # type: str + self.configuration = configuration + + +class NetworkFunctionDefinitionVersion(TrackedResource): + """Network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: The network function type.Constant filled by server. Possible + values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'deploy_parameters': {'key': 'properties.deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'properties.networkFunctionType', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + """ + super(NetworkFunctionDefinitionVersion, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.deploy_parameters = deploy_parameters + self.network_function_type = None # type: Optional[str] + + +class NetworkFunctionDefinitionVersionListResult(msrest.serialization.Model): + """A list of network function definition versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function definition versions. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionDefinitionVersion"]] = None, + **kwargs + ): + """ + :keyword value: A list of network function definition versions. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + """ + super(NetworkFunctionDefinitionVersionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionVersionOverview(ProxyResource): + """Network function definition version overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar description: The network function definition version description properties. + :vartype description: str + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar network_function_type: The network function type. Possible values include: "Unknown", + "VirtualNetworkFunction", "ContainerizedNetworkFunction", "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :vartype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :ivar deploy_parameters: The deployment parameters. + :vartype deploy_parameters: str + :ivar network_function_applications: The network function definition application overview. + :vartype network_function_applications: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionApplicationOverview] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'description': {'readonly': True}, + 'deploy_parameters': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'network_function_type': {'key': 'properties.networkFunctionType', 'type': 'str'}, + 'nfvi_type': {'key': 'properties.nfviType', 'type': 'str'}, + 'deploy_parameters': {'key': 'properties.deployParameters', 'type': 'str'}, + 'network_function_applications': {'key': 'properties.networkFunctionApplications', 'type': '[NetworkFunctionDefinitionApplicationOverview]'}, + } + + def __init__( + self, + *, + version_state: Optional[Union[str, "VersionState"]] = None, + network_function_type: Optional[Union[str, "NetworkFunctionType"]] = None, + nfvi_type: Optional[Union[str, "NFVIType"]] = None, + network_function_applications: Optional[List["NetworkFunctionDefinitionApplicationOverview"]] = None, + **kwargs + ): + """ + :keyword version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :keyword network_function_type: The network function type. Possible values include: "Unknown", + "VirtualNetworkFunction", "ContainerizedNetworkFunction", "DelegatedNetworkFunction". + :paramtype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :keyword nfvi_type: The nfvi type for the network function. Possible values include: "Unknown", + "AzureArcKubernetes", "AzureCore", "AzureOperatorNexus". + :paramtype nfvi_type: str or ~Microsoft.HybridNetwork.models.NFVIType + :keyword network_function_applications: The network function definition application overview. + :paramtype network_function_applications: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionApplicationOverview] + """ + super(NetworkFunctionDefinitionVersionOverview, self).__init__(**kwargs) + self.description = None + self.version_state = version_state + self.network_function_type = network_function_type + self.nfvi_type = nfvi_type + self.deploy_parameters = None + self.network_function_applications = network_function_applications + + +class NetworkFunctionDefinitionVersionOverviewListResult(msrest.serialization.Model): + """A list of available network function definition groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The network function definition overview properties. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionDefinitionVersionOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionDefinitionVersionOverview"]] = None, + **kwargs + ): + """ + :keyword value: The network function definition overview properties. + :paramtype value: + list[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview] + """ + super(NetworkFunctionDefinitionVersionOverviewListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionDefinitionVersionUpdateState(msrest.serialization.Model): + """Publisher network function definition version update request definition. + + :ivar version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Possible values include: "Unknown", "Preview", "Active", "Deprecated", + "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + *, + version_state: Optional[Union[str, "VersionState"]] = None, + **kwargs + ): + """ + :keyword version_state: The network function definition version state. Only the 'Active' and + 'Deprecated' states are allowed for updates. Other states are used for internal state + transitioning. Possible values include: "Unknown", "Preview", "Active", "Deprecated", + "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(NetworkFunctionDefinitionVersionUpdateState, self).__init__(**kwargs) + self.version_state = version_state + + +class NetworkFunctionListResult(msrest.serialization.Model): + """Response for network function API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function resources in a subscription or resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunction"]] = None, + **kwargs + ): + """ + :keyword value: A list of network function resources in a subscription or resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunction] + """ + super(NetworkFunctionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionReadyK8S(TrackedResource): + """NetworkFunctionReadyK8s resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: The managed identity of the NetworkFunctionReadyK8s, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the NetworkFunctionReadyK8s resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar cluster_type: The cluster type.Constant filled by server. Possible values include: + "AzureKubernetesService", "ArcConnectedK8s", "HybridAKS". + :vartype cluster_type: str or ~Microsoft.HybridNetwork.models.ClusterType + :ivar cluster_reference: The k8s/Connected cluster ARM id. + :vartype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar custom_location_reference: The read only custom location ARM id. + :vartype custom_location_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'custom_location_reference': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_type': {'key': 'properties.clusterType', 'type': 'str'}, + 'cluster_reference': {'key': 'properties.clusterReference', 'type': 'ReferencedResource'}, + 'custom_location_reference': {'key': 'properties.customLocationReference', 'type': 'ReferencedResource'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + cluster_reference: Optional["ReferencedResource"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The managed identity of the NetworkFunctionReadyK8s, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword cluster_reference: The k8s/Connected cluster ARM id. + :paramtype cluster_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + """ + super(NetworkFunctionReadyK8S, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.provisioning_state = None + self.cluster_type = None # type: Optional[str] + self.cluster_reference = cluster_reference + self.custom_location_reference = None + + +class NetworkFunctionReadyK8SListResult(msrest.serialization.Model): + """Response for NetworkFunctionReadyK8s API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network function ready K8s. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionReadyK8S]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionReadyK8S"]] = None, + **kwargs + ): + """ + :keyword value: A list of network function ready K8s. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + """ + super(NetworkFunctionReadyK8SListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkServiceDesignGroup(TrackedResource): + """network service design group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network service design groups resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar description: The network service design group description. + :vartype description: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network service design group description. + :paramtype description: str + """ + super(NetworkServiceDesignGroup, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.description = description + + +class NetworkServiceDesignGroupListResult(msrest.serialization.Model): + """A list of network service design group resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design group. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkServiceDesignGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkServiceDesignGroup"]] = None, + **kwargs + ): + """ + :keyword value: A list of network service design group. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + """ + super(NetworkServiceDesignGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkServiceDesignVersion(TrackedResource): + """network service design version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the network service design version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network service design version description. + :vartype description: str + :ivar configuration_group_schema_references: The configuration schemas to used to define the + values. + :vartype configuration_group_schema_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :ivar nfvis_from_site: The nfvis from the site. + :vartype nfvis_from_site: dict[str, ~Microsoft.HybridNetwork.models.NfviDetails] + :ivar resource_element_templates: List of resource element template. + :vartype resource_element_templates: + list[~Microsoft.HybridNetwork.models.ResourceElementTemplate] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version_state': {'key': 'properties.versionState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'configuration_group_schema_references': {'key': 'properties.configurationGroupSchemaReferences', 'type': '{ReferencedResource}'}, + 'nfvis_from_site': {'key': 'properties.nfvisFromSite', 'type': '{NfviDetails}'}, + 'resource_element_templates': {'key': 'properties.resourceElementTemplates', 'type': '[ResourceElementTemplate]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + configuration_group_schema_references: Optional[Dict[str, "ReferencedResource"]] = None, + nfvis_from_site: Optional[Dict[str, "NfviDetails"]] = None, + resource_element_templates: Optional[List["ResourceElementTemplate"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword description: The network service design version description. + :paramtype description: str + :keyword configuration_group_schema_references: The configuration schemas to used to define the + values. + :paramtype configuration_group_schema_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :keyword nfvis_from_site: The nfvis from the site. + :paramtype nfvis_from_site: dict[str, ~Microsoft.HybridNetwork.models.NfviDetails] + :keyword resource_element_templates: List of resource element template. + :paramtype resource_element_templates: + list[~Microsoft.HybridNetwork.models.ResourceElementTemplate] + """ + super(NetworkServiceDesignVersion, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.version_state = None + self.description = description + self.configuration_group_schema_references = configuration_group_schema_references + self.nfvis_from_site = nfvis_from_site + self.resource_element_templates = resource_element_templates + + +class NetworkServiceDesignVersionListResult(msrest.serialization.Model): + """A list of network service design versions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network service design versions. + :vartype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkServiceDesignVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkServiceDesignVersion"]] = None, + **kwargs + ): + """ + :keyword value: A list of network service design versions. + :paramtype value: list[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + """ + super(NetworkServiceDesignVersionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkServiceDesignVersionUpdateState(msrest.serialization.Model): + """Publisher network service design version update request definition. + + :ivar version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + + _attribute_map = { + 'version_state': {'key': 'versionState', 'type': 'str'}, + } + + def __init__( + self, + *, + version_state: Optional[Union[str, "VersionState"]] = None, + **kwargs + ): + """ + :keyword version_state: The network service design version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :paramtype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + """ + super(NetworkServiceDesignVersionUpdateState, self).__init__(**kwargs) + self.version_state = version_state + + +class NfviDetails(msrest.serialization.Model): + """The nfvi details. + + :ivar name: The nfvi name. + :vartype name: str + :ivar type: The nfvi type. + :vartype type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The nfvi name. + :paramtype name: str + :keyword type: The nfvi type. + :paramtype type: str + """ + super(NfviDetails, self).__init__(**kwargs) + self.name = name + self.type = type + + +class NSDArtifactProfile(msrest.serialization.Model): + """Artifact profile properties. + + :ivar artifact_store_reference: The artifact store resource id. + :vartype artifact_store_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar artifact_name: Artifact name. + :vartype artifact_name: str + :ivar artifact_version: Artifact version. + :vartype artifact_version: str + """ + + _attribute_map = { + 'artifact_store_reference': {'key': 'artifactStoreReference', 'type': 'ReferencedResource'}, + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_store_reference: Optional["ReferencedResource"] = None, + artifact_name: Optional[str] = None, + artifact_version: Optional[str] = None, + **kwargs + ): + """ + :keyword artifact_store_reference: The artifact store resource id. + :paramtype artifact_store_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword artifact_name: Artifact name. + :paramtype artifact_name: str + :keyword artifact_version: Artifact version. + :paramtype artifact_version: str + """ + super(NSDArtifactProfile, self).__init__(**kwargs) + self.artifact_store_reference = artifact_store_reference + self.artifact_name = artifact_name + self.artifact_version = artifact_version + + +class Operation(msrest.serialization.Model): + """Object that describes a single Microsoft.HybridNetwork operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~Microsoft.HybridNetwork.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :ivar provider: Service provider: Microsoft.HybridNetwork. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Service provider: Microsoft.HybridNetwork. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(msrest.serialization.Model): + """A list of the operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of Microsoft.HybridNetwork operations. + :vartype value: list[~Microsoft.HybridNetwork.models.Operation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PreviewSubscription(TrackedResource): + """Customer subscription which can use a preview network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the preview subscription resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(PreviewSubscription, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + + +class PreviewSubscriptionsList(msrest.serialization.Model): + """A list of customer subscriptions which can use a preview network function definition version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of preview subscriptions. + :vartype value: list[~Microsoft.HybridNetwork.models.PreviewSubscription] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PreviewSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PreviewSubscription"]] = None, + **kwargs + ): + """ + :keyword value: A list of preview subscriptions. + :paramtype value: list[~Microsoft.HybridNetwork.models.PreviewSubscription] + """ + super(PreviewSubscriptionsList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyArtifactListOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyArtifactListOverview, self).__init__(**kwargs) + + +class ProxyArtifactOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar artifact_versions: The proxy artifact overview properties. + :vartype artifact_versions: + list[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewPropertiesValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'artifact_versions': {'key': 'properties.artifactVersions', 'type': '[ProxyArtifactOverviewPropertiesValue]'}, + } + + def __init__( + self, + *, + artifact_versions: Optional[List["ProxyArtifactOverviewPropertiesValue"]] = None, + **kwargs + ): + """ + :keyword artifact_versions: The proxy artifact overview properties. + :paramtype artifact_versions: + list[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewPropertiesValue] + """ + super(ProxyArtifactOverview, self).__init__(**kwargs) + self.artifact_versions = artifact_versions + + +class ProxyArtifactOverviewListResult(msrest.serialization.Model): + """The proxy artifact list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy artifacts. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactListOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyArtifactListOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProxyArtifactListOverview"]] = None, + **kwargs + ): + """ + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactListOverview] + """ + super(ProxyArtifactOverviewListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyArtifactOverviewPropertiesValue(msrest.serialization.Model): + """ProxyArtifactOverviewPropertiesValue. + + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _attribute_map = { + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'artifactVersion', 'type': 'str'}, + 'artifact_state': {'key': 'artifactState', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_type: Optional[Union[str, "ArtifactType"]] = None, + artifact_version: Optional[str] = None, + artifact_state: Optional[Union[str, "ArtifactState"]] = None, + **kwargs + ): + """ + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ProxyArtifactOverviewPropertiesValue, self).__init__(**kwargs) + self.artifact_type = artifact_type + self.artifact_version = artifact_version + self.artifact_state = artifact_state + + +class ProxyArtifactVersionsListOverview(ProxyResource): + """The proxy artifact overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :vartype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :ivar artifact_version: The artifact version. + :vartype artifact_version: str + :ivar artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :vartype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'artifact_type': {'key': 'properties.artifactType', 'type': 'str'}, + 'artifact_version': {'key': 'properties.artifactVersion', 'type': 'str'}, + 'artifact_state': {'key': 'properties.artifactState', 'type': 'str'}, + } + + def __init__( + self, + *, + artifact_type: Optional[Union[str, "ArtifactType"]] = None, + artifact_version: Optional[str] = None, + artifact_state: Optional[Union[str, "ArtifactState"]] = None, + **kwargs + ): + """ + :keyword artifact_type: The artifact type. Possible values include: "Unknown", "OCIArtifact", + "VhdImageFile", "ArmTemplate", "ImageFile". + :paramtype artifact_type: str or ~Microsoft.HybridNetwork.models.ArtifactType + :keyword artifact_version: The artifact version. + :paramtype artifact_version: str + :keyword artifact_state: The artifact state. Possible values include: "Unknown", "Preview", + "Active", "Deprecated". + :paramtype artifact_state: str or ~Microsoft.HybridNetwork.models.ArtifactState + """ + super(ProxyArtifactVersionsListOverview, self).__init__(**kwargs) + self.artifact_type = artifact_type + self.artifact_version = artifact_version + self.artifact_state = artifact_state + + +class ProxyArtifactVersionsOverviewListResult(msrest.serialization.Model): + """The proxy artifact list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy artifacts. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyArtifactVersionsListOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProxyArtifactVersionsListOverview"]] = None, + **kwargs + ): + """ + :keyword value: A list of available proxy artifacts. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + """ + super(ProxyArtifactVersionsOverviewListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyPublisherOverview(ProxyResource): + """The proxy publisher overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyPublisherOverview, self).__init__(**kwargs) + + +class ProxyPublisherOverviewListResult(msrest.serialization.Model): + """The proxy publisher list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of available proxy publishers. + :vartype value: list[~Microsoft.HybridNetwork.models.ProxyPublisherOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProxyPublisherOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProxyPublisherOverview"]] = None, + **kwargs + ): + """ + :keyword value: A list of available proxy publishers. + :paramtype value: list[~Microsoft.HybridNetwork.models.ProxyPublisherOverview] + """ + super(ProxyPublisherOverviewListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Publisher(TrackedResource): + """publisher resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the publisher resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted", + "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar scope: The publisher scope. Possible values include: "Unknown", "Public", "Private". + :vartype scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + scope: Optional[Union[str, "PublisherScope"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword scope: The publisher scope. Possible values include: "Unknown", "Public", "Private". + :paramtype scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + """ + super(Publisher, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.scope = scope + + +class PublisherListResult(msrest.serialization.Model): + """A list of publishers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of publishers. + :vartype value: list[~Microsoft.HybridNetwork.models.Publisher] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Publisher]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Publisher"]] = None, + **kwargs + ): + """ + :keyword value: A list of publishers. + :paramtype value: list[~Microsoft.HybridNetwork.models.Publisher] + """ + super(PublisherListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ReferencedResource(msrest.serialization.Model): + """Reference to another resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ReferencedResource, self).__init__(**kwargs) + self.id = id + + +class RequestMetadata(msrest.serialization.Model): + """Request metadata of execute request post call payload. + + All required parameters must be populated in order to send to Azure. + + :ivar relative_path: Required. The relative path of the request. + :vartype relative_path: str + :ivar http_method: Required. The http method of the request. Possible values include: + "Unknown", "Post", "Put", "Get", "Patch", "Delete". + :vartype http_method: str or ~Microsoft.HybridNetwork.models.HttpMethod + :ivar serialized_body: Required. The serialized body of the request. + :vartype serialized_body: str + :ivar api_version: The api version of the request. + :vartype api_version: str + """ + + _validation = { + 'relative_path': {'required': True}, + 'http_method': {'required': True}, + 'serialized_body': {'required': True}, + } + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + 'serialized_body': {'key': 'serializedBody', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + relative_path: str, + http_method: Union[str, "HttpMethod"], + serialized_body: str, + api_version: Optional[str] = None, + **kwargs + ): + """ + :keyword relative_path: Required. The relative path of the request. + :paramtype relative_path: str + :keyword http_method: Required. The http method of the request. Possible values include: + "Unknown", "Post", "Put", "Get", "Patch", "Delete". + :paramtype http_method: str or ~Microsoft.HybridNetwork.models.HttpMethod + :keyword serialized_body: Required. The serialized body of the request. + :paramtype serialized_body: str + :keyword api_version: The api version of the request. + :paramtype api_version: str + """ + super(RequestMetadata, self).__init__(**kwargs) + self.relative_path = relative_path + self.http_method = http_method + self.serialized_body = serialized_body + self.api_version = api_version + + +class Site(TrackedResource): + """Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The provisioning state of the site resource. **TODO**\ : Confirm if + this is needed. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", + "Failed", "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar nfvis: List of NFVIs. + :vartype nfvis: list[~Microsoft.HybridNetwork.models.NFVIs] + :ivar site_network_service_references: The list of site network services on the site. + :vartype site_network_service_references: + list[~Microsoft.HybridNetwork.models.ReferencedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'site_network_service_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'nfvis': {'key': 'properties.nfvis', 'type': '[NFVIs]'}, + 'site_network_service_references': {'key': 'properties.siteNetworkServiceReferences', 'type': '[ReferencedResource]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + nfvis: Optional[List["NFVIs"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword nfvis: List of NFVIs. + :paramtype nfvis: list[~Microsoft.HybridNetwork.models.NFVIs] + """ + super(Site, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.nfvis = nfvis + self.site_network_service_references = None + + +class SiteListResult(msrest.serialization.Model): + """Response for sites API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of sites in a resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.Site] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Site]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Site"]] = None, + **kwargs + ): + """ + :keyword value: A list of sites in a resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.Site] + """ + super(SiteListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SiteNetworkService(TrackedResource): + """Site network service resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~Microsoft.HybridNetwork.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: The managed identity of the Site network service, if configured. + :vartype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :ivar provisioning_state: The provisioning state of the site network service resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ManagedResourceGroupConfiguration + :ivar site_reference: The site details. + :vartype site_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :ivar publisher_name: The publisher name for the site network service. + :vartype publisher_name: str + :ivar publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :vartype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :ivar network_service_design_group_name: The network service design group name for the site + network service. + :vartype network_service_design_group_name: str + :ivar network_service_design_version_name: The network service design version for the site + network service. + :vartype network_service_design_version_name: str + :ivar network_service_design_version_offering_location: The location of the network service + design offering. + :vartype network_service_design_version_offering_location: str + :ivar desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :vartype desired_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + :ivar last_state_network_service_design_version_name: The network service design version for + the site network service. + :vartype last_state_network_service_design_version_name: str + :ivar last_state_configuration_group_value_references: The last state of the site network + service resource. + :vartype last_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'network_service_design_version_name': {'pattern': r'^[0-9]+\.[0-9]+\.[0-9]+$'}, + 'last_state_network_service_design_version_name': {'readonly': True, 'pattern': r'^[0-9]+\.[0-9]+\.[0-9]+$'}, + 'last_state_configuration_group_value_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ManagedResourceGroupConfiguration'}, + 'site_reference': {'key': 'properties.siteReference', 'type': 'ReferencedResource'}, + 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, + 'publisher_scope': {'key': 'properties.publisherScope', 'type': 'str'}, + 'network_service_design_group_name': {'key': 'properties.networkServiceDesignGroupName', 'type': 'str'}, + 'network_service_design_version_name': {'key': 'properties.networkServiceDesignVersionName', 'type': 'str'}, + 'network_service_design_version_offering_location': {'key': 'properties.networkServiceDesignVersionOfferingLocation', 'type': 'str'}, + 'desired_state_configuration_group_value_references': {'key': 'properties.desiredStateConfigurationGroupValueReferences', 'type': '{ReferencedResource}'}, + 'last_state_network_service_design_version_name': {'key': 'properties.lastStateNetworkServiceDesignVersionName', 'type': 'str'}, + 'last_state_configuration_group_value_references': {'key': 'properties.lastStateConfigurationGroupValueReferences', 'type': '{ReferencedResource}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + managed_resource_group_configuration: Optional["ManagedResourceGroupConfiguration"] = None, + site_reference: Optional["ReferencedResource"] = None, + publisher_name: Optional[str] = None, + publisher_scope: Optional[Union[str, "PublisherScope"]] = None, + network_service_design_group_name: Optional[str] = None, + network_service_design_version_name: Optional[str] = None, + network_service_design_version_offering_location: Optional[str] = None, + desired_state_configuration_group_value_references: Optional[Dict[str, "ReferencedResource"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The managed identity of the Site network service, if configured. + :paramtype identity: ~Microsoft.HybridNetwork.models.ManagedServiceIdentity + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~Microsoft.HybridNetwork.models.ManagedResourceGroupConfiguration + :keyword site_reference: The site details. + :paramtype site_reference: ~Microsoft.HybridNetwork.models.ReferencedResource + :keyword publisher_name: The publisher name for the site network service. + :paramtype publisher_name: str + :keyword publisher_scope: The scope of the publisher. Possible values include: "Unknown", + "Public", "Private". + :paramtype publisher_scope: str or ~Microsoft.HybridNetwork.models.PublisherScope + :keyword network_service_design_group_name: The network service design group name for the site + network service. + :paramtype network_service_design_group_name: str + :keyword network_service_design_version_name: The network service design version for the site + network service. + :paramtype network_service_design_version_name: str + :keyword network_service_design_version_offering_location: The location of the network service + design offering. + :paramtype network_service_design_version_offering_location: str + :keyword desired_state_configuration_group_value_references: The goal state of the site network + service resource. This has references to the configuration group value objects that describe + the desired state of the site network service. + :paramtype desired_state_configuration_group_value_references: dict[str, + ~Microsoft.HybridNetwork.models.ReferencedResource] + """ + super(SiteNetworkService, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.provisioning_state = None + self.managed_resource_group_configuration = managed_resource_group_configuration + self.site_reference = site_reference + self.publisher_name = publisher_name + self.publisher_scope = publisher_scope + self.network_service_design_group_name = network_service_design_group_name + self.network_service_design_version_name = network_service_design_version_name + self.network_service_design_version_offering_location = network_service_design_version_offering_location + self.desired_state_configuration_group_value_references = desired_state_configuration_group_value_references + self.last_state_network_service_design_version_name = None + self.last_state_configuration_group_value_references = None + + +class SiteNetworkServiceListResult(msrest.serialization.Model): + """Response for site network services API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of site network services in a resource group. + :vartype value: list[~Microsoft.HybridNetwork.models.SiteNetworkService] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SiteNetworkService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SiteNetworkService"]] = None, + **kwargs + ): + """ + :keyword value: A list of site network services in a resource group. + :paramtype value: list[~Microsoft.HybridNetwork.models.SiteNetworkService] + """ + super(SiteNetworkServiceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~Microsoft.HybridNetwork.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(TagsObject, self).__init__(**kwargs) + self.tags = tags + + +class UserAssignedIdentity(msrest.serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VhdImageArtifactProfile(msrest.serialization.Model): + """Vhd artifact profile. + + :ivar vhd_name: Vhd name. + :vartype vhd_name: str + :ivar vhd_version: Vhd version. + :vartype vhd_version: str + """ + + _attribute_map = { + 'vhd_name': {'key': 'vhdName', 'type': 'str'}, + 'vhd_version': {'key': 'vhdVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + vhd_name: Optional[str] = None, + vhd_version: Optional[str] = None, + **kwargs + ): + """ + :keyword vhd_name: Vhd name. + :paramtype vhd_name: str + :keyword vhd_version: Vhd version. + :paramtype vhd_version: str + """ + super(VhdImageArtifactProfile, self).__init__(**kwargs) + self.vhd_name = vhd_name + self.vhd_version = vhd_version + + +class VhdImageFileApplicationOverview(NetworkFunctionDefinitionApplicationOverview): + """Vhd image file Application overview. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application. + :vartype name: str + :ivar artifact_type: Required. The application overview artifact type.Constant filled by + server. Possible values include: "Unknown", "HelmPackage", "VhdImageFile", "ArmTemplate", + "ImageFile". + :vartype artifact_type: str or + ~Microsoft.HybridNetwork.models.NetworkFunctionPublisherArtifactType + :ivar deploy_parameters_mapping_rule_profile: The deployment parameters mapping rule profile. + :vartype deploy_parameters_mapping_rule_profile: + ~Microsoft.HybridNetwork.models.AzureCoreVhdImageDeployMappingRuleProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'artifact_type': {'required': True}, + 'deploy_parameters_mapping_rule_profile': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'deploy_parameters_mapping_rule_profile': {'key': 'deployParametersMappingRuleProfile', 'type': 'AzureCoreVhdImageDeployMappingRuleProfile'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VhdImageFileApplicationOverview, self).__init__(**kwargs) + self.artifact_type = 'VhdImageFile' # type: str + self.deploy_parameters_mapping_rule_profile = None + + +class VhdImageMappingRuleProfile(msrest.serialization.Model): + """Vhd mapping rule profile. + + :ivar user_configuration: List of values. + :vartype user_configuration: str + """ + + _attribute_map = { + 'user_configuration': {'key': 'userConfiguration', 'type': 'str'}, + } + + def __init__( + self, + *, + user_configuration: Optional[str] = None, + **kwargs + ): + """ + :keyword user_configuration: List of values. + :paramtype user_configuration: str + """ + super(VhdImageMappingRuleProfile, self).__init__(**kwargs) + self.user_configuration = user_configuration + + +class VirtualNetworkFunctionDefinitionVersion(NetworkFunctionDefinitionVersionPropertiesFormat): + """Virtual network function network function definition version properties . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the network function definition version + resource. Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", + "Canceled", "Deleted", "Converging". + :vartype provisioning_state: str or ~Microsoft.HybridNetwork.models.ProvisioningState + :ivar version_state: The network function definition version state. Possible values include: + "Unknown", "Preview", "Active", "Deprecated", "Validating", "ValidationFailed". + :vartype version_state: str or ~Microsoft.HybridNetwork.models.VersionState + :ivar description: The network function definition version description. + :vartype description: str + :ivar deploy_parameters: The deployment parameters of the network function definition version. + :vartype deploy_parameters: str + :ivar network_function_type: Required. The network function type.Constant filled by server. + Possible values include: "Unknown", "VirtualNetworkFunction", "ContainerizedNetworkFunction", + "DelegatedNetworkFunction". + :vartype network_function_type: str or ~Microsoft.HybridNetwork.models.NetworkFunctionType + :ivar network_function_template: Virtual network function template. + :vartype network_function_template: + ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionTemplate + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version_state': {'readonly': True}, + 'network_function_type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'version_state': {'key': 'versionState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'deploy_parameters': {'key': 'deployParameters', 'type': 'str'}, + 'network_function_type': {'key': 'networkFunctionType', 'type': 'str'}, + 'network_function_template': {'key': 'networkFunctionTemplate', 'type': 'VirtualNetworkFunctionTemplate'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + deploy_parameters: Optional[str] = None, + network_function_template: Optional["VirtualNetworkFunctionTemplate"] = None, + **kwargs + ): + """ + :keyword description: The network function definition version description. + :paramtype description: str + :keyword deploy_parameters: The deployment parameters of the network function definition + version. + :paramtype deploy_parameters: str + :keyword network_function_template: Virtual network function template. + :paramtype network_function_template: + ~Microsoft.HybridNetwork.models.VirtualNetworkFunctionTemplate + """ + super(VirtualNetworkFunctionDefinitionVersion, self).__init__(description=description, deploy_parameters=deploy_parameters, **kwargs) + self.network_function_type = 'VirtualNetworkFunction' # type: str + self.network_function_template = network_function_template diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/__init__.py b/src/aosm/azext_aosm/vendored_sdks/operations/__init__.py new file mode 100644 index 00000000000..6c86a395e1f --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/__init__.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._configuration_group_schemas_operations import ConfigurationGroupSchemasOperations +from ._configuration_group_values_operations import ConfigurationGroupValuesOperations +from ._network_functions_operations import NetworkFunctionsOperations +from ._components_operations import ComponentsOperations +from ._network_function_definition_groups_operations import NetworkFunctionDefinitionGroupsOperations +from ._preview_subscriptions_operations import PreviewSubscriptionsOperations +from ._network_function_definition_versions_operations import NetworkFunctionDefinitionVersionsOperations +from ._network_function_ready_k8_s_operations import NetworkFunctionReadyK8SOperations +from ._network_service_design_groups_operations import NetworkServiceDesignGroupsOperations +from ._network_service_design_versions_operations import NetworkServiceDesignVersionsOperations +from ._operations import Operations +from ._proxy_publisher_operations import ProxyPublisherOperations +from ._proxy_network_function_definition_groups_operations import ProxyNetworkFunctionDefinitionGroupsOperations +from ._proxy_network_function_definition_versions_operations import ProxyNetworkFunctionDefinitionVersionsOperations +from ._publishers_operations import PublishersOperations +from ._artifact_stores_operations import ArtifactStoresOperations +from ._artifact_manifests_operations import ArtifactManifestsOperations +from ._proxy_artifact_operations import ProxyArtifactOperations +from ._hybrid_network_management_client_operations import HybridNetworkManagementClientOperationsMixin +from ._sites_operations import SitesOperations +from ._site_network_services_operations import SiteNetworkServicesOperations + +__all__ = [ + 'ConfigurationGroupSchemasOperations', + 'ConfigurationGroupValuesOperations', + 'NetworkFunctionsOperations', + 'ComponentsOperations', + 'NetworkFunctionDefinitionGroupsOperations', + 'PreviewSubscriptionsOperations', + 'NetworkFunctionDefinitionVersionsOperations', + 'NetworkFunctionReadyK8SOperations', + 'NetworkServiceDesignGroupsOperations', + 'NetworkServiceDesignVersionsOperations', + 'Operations', + 'ProxyPublisherOperations', + 'ProxyNetworkFunctionDefinitionGroupsOperations', + 'ProxyNetworkFunctionDefinitionVersionsOperations', + 'PublishersOperations', + 'ArtifactStoresOperations', + 'ArtifactManifestsOperations', + 'ProxyArtifactOperations', + 'HybridNetworkManagementClientOperationsMixin', + 'SitesOperations', + 'SiteNetworkServicesOperations', +] diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_manifests_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_manifests_operations.py new file mode 100644 index 00000000000..3bbbfa5626c --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_manifests_operations.py @@ -0,0 +1,1050 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_artifact_store_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_credential_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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 + ) + + +def build_update_state_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactManifestName": _SERIALIZER.url("artifact_manifest_name", artifact_manifest_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ArtifactManifestsOperations(object): + """ArtifactManifestsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_artifact_store( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArtifactManifestListResult"] + """Gets information about the artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactManifestListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ArtifactManifestListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifestListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_artifact_store.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_artifact_store_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ArtifactManifestListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_artifact_store.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + parameters, # type: "_models.ArtifactManifest" + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactManifest" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactManifest') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + parameters, # type: "_models.ArtifactManifest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ArtifactManifest"] + """Creates or updates a artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactManifest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ArtifactManifest or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ArtifactManifest] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactManifest" + """Gets information about a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactManifest" + """Updates a artifact manifest resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to the create or update artifact manifest operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactManifest, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"} # type: ignore + + + @distributed_trace + def list_credential( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactAccessCredential" + """List credential for publishing artifacts defined in artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactAccessCredential, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactAccessCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactAccessCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_list_credential_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credential.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactAccessCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credential.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential"} # type: ignore + + + def _update_state_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + parameters, # type: "_models.ArtifactManifestUpdateState" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ArtifactManifestUpdateState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArtifactManifestUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactManifestUpdateState') + + request = build_update_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArtifactManifestUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState"} # type: ignore + + + @distributed_trace + def begin_update_state( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_manifest_name, # type: str + parameters, # type: "_models.ArtifactManifestUpdateState" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ArtifactManifestUpdateState"] + """Update state for artifact manifest. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_manifest_name: The name of the artifact manifest. + :type artifact_manifest_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactManifestUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ArtifactManifestUpdateState or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ArtifactManifestUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactManifestUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_manifest_name=artifact_manifest_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactManifestUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_stores_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_stores_operations.py new file mode 100644 index 00000000000..a70ff6449df --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_artifact_stores_operations.py @@ -0,0 +1,721 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_publisher_request( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ArtifactStoresOperations(object): + """ArtifactStoresOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArtifactStoreListResult"] + """Gets information of the ArtifactStores under publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArtifactStoreListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ArtifactStoreListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStoreListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ArtifactStoreListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + parameters, # type: "_models.ArtifactStore" + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactStore" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactStore') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + parameters, # type: "_models.ArtifactStore" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ArtifactStore"] + """Creates or updates a artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactStore + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ArtifactStore or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ArtifactStore] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ArtifactStore', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactStore" + """Gets information about the specified artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactStore, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactStore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactStore" + """Update artifact store resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param parameters: Parameters supplied to the create or update application group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactStore, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ArtifactStore + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactStore"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactStore', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_components_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_components_operations.py new file mode 100644 index 00000000000..dfc62a9c4b8 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_components_operations.py @@ -0,0 +1,277 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + network_function_name, # type: str + component_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_network_function_request( + resource_group_name, # type: str + subscription_id, # type: str + network_function_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ComponentsOperations(object): + """ComponentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name, # type: str + network_function_name, # type: str + component_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Component" + """Gets information about the specified application instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :param component_name: The name of the component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Component, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Component + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Component"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Component', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}"} # type: ignore + + + @distributed_trace + def list_by_network_function( + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ComponentListResult"] + """Lists all the component resources in a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ComponentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComponentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + network_function_name=network_function_name, + api_version=api_version, + template_url=self.list_by_network_function.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + network_function_name=network_function_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_network_function.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_schemas_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_schemas_operations.py new file mode 100644 index 00000000000..b4a05913f46 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_schemas_operations.py @@ -0,0 +1,900 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_publisher_request( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "configurationGroupSchemaName": _SERIALIZER.url("configuration_group_schema_name", configuration_group_schema_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "configurationGroupSchemaName": _SERIALIZER.url("configuration_group_schema_name", configuration_group_schema_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "configurationGroupSchemaName": _SERIALIZER.url("configuration_group_schema_name", configuration_group_schema_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "configurationGroupSchemaName": _SERIALIZER.url("configuration_group_schema_name", configuration_group_schema_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_state_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "configurationGroupSchemaName": _SERIALIZER.url("configuration_group_schema_name", configuration_group_schema_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ConfigurationGroupSchemasOperations(object): + """ConfigurationGroupSchemasOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConfigurationGroupSchemaListResult"] + """Gets information of the configuration group schemas under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupSchemaListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchemaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupSchemaListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + parameters, # type: "_models.ConfigurationGroupSchema" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupSchema" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupSchema') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + parameters, # type: "_models.ConfigurationGroupSchema" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigurationGroupSchema"] + """Creates or updates a configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update configuration group schema + resource. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationGroupSchema or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupSchema] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupSchema" + """Gets information about the specified configuration group schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupSchema" + """Updates a configuration group schema resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupSchema, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchema + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchema"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupSchema', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"} # type: ignore + + + def _update_state_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + parameters, # type: "_models.ConfigurationGroupSchemaVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ConfigurationGroupSchemaVersionUpdateState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConfigurationGroupSchemaVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupSchemaVersionUpdateState') + + request = build_update_state_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupSchemaVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState"} # type: ignore + + + @distributed_trace + def begin_update_state( + self, + resource_group_name, # type: str + publisher_name, # type: str + configuration_group_schema_name, # type: str + parameters, # type: "_models.ConfigurationGroupSchemaVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigurationGroupSchemaVersionUpdateState"] + """Update configuration group schema state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param configuration_group_schema_name: The name of the configuration group schema. + :type configuration_group_schema_name: str + :param parameters: Parameters supplied to update the state of configuration group schema. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + ConfigurationGroupSchemaVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupSchemaVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupSchemaVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + configuration_group_schema_name=configuration_group_schema_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupSchemaVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_values_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_values_operations.py new file mode 100644 index 00000000000..f575f04f744 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_configuration_group_values_operations.py @@ -0,0 +1,796 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "configurationGroupValueName": _SERIALIZER.url("configuration_group_value_name", configuration_group_value_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "configurationGroupValueName": _SERIALIZER.url("configuration_group_value_name", configuration_group_value_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "configurationGroupValueName": _SERIALIZER.url("configuration_group_value_name", configuration_group_value_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "configurationGroupValueName": _SERIALIZER.url("configuration_group_value_name", configuration_group_value_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ConfigurationGroupValuesOperations(object): + """ConfigurationGroupValuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupValue" + """Gets information about the specified hybrid configuration group values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + parameters, # type: "_models.ConfigurationGroupValue" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupValue" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConfigurationGroupValue') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + parameters, # type: "_models.ConfigurationGroupValue" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigurationGroupValue"] + """Creates or updates a hybrid configuration group value. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to the create or update configuration group value + resource. + :type parameters: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationGroupValue or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ConfigurationGroupValue] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + @distributed_trace + def update_tags( + self, + resource_group_name, # type: str + configuration_group_value_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationGroupValue" + """Updates a hybrid configuration group tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param configuration_group_value_name: The name of the configuration group value. + :type configuration_group_value_name: str + :param parameters: Parameters supplied to update configuration group values tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationGroupValue, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ConfigurationGroupValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + configuration_group_value_name=configuration_group_value_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationGroupValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConfigurationGroupValueListResult"] + """Lists all sites in the configuration group value in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValueListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupValueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConfigurationGroupValueListResult"] + """Lists all the hybrid network configurationGroupValues in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationGroupValueListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ConfigurationGroupValueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationGroupValueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationGroupValueListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_hybrid_network_management_client_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_hybrid_network_management_client_operations.py new file mode 100644 index 00000000000..67abfbe2c26 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_hybrid_network_management_client_operations.py @@ -0,0 +1,227 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_change_artifact_state_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + artifact_name = kwargs.pop('artifact_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactVersionName": _SERIALIZER.url("artifact_version_name", artifact_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['artifactName'] = _SERIALIZER.query("artifact_name", artifact_name, 'str', max_length=64, min_length=0) + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class HybridNetworkManagementClientOperationsMixin(object): + + def _change_artifact_state_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_name, # type: str + artifact_version_name, # type: str + parameters, # type: "_models.ArtifactChangeState" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ProxyArtifactVersionsListOverview"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProxyArtifactVersionsListOverview"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ArtifactChangeState') + + request = build_change_artifact_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_version_name=artifact_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + artifact_name=artifact_name, + json=_json, + template_url=self._change_artifact_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ProxyArtifactVersionsListOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _change_artifact_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}"} # type: ignore + + + @distributed_trace + def begin_change_artifact_state( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_name, # type: str + artifact_version_name, # type: str + parameters, # type: "_models.ArtifactChangeState" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ProxyArtifactVersionsListOverview"] + """Change artifact state defined in artifact store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. + :type artifact_name: str + :param artifact_version_name: The name of the artifact version. + :type artifact_version_name: str + :param parameters: Parameters supplied to update the state of artifact manifest. + :type parameters: ~Microsoft.HybridNetwork.models.ArtifactChangeState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProxyArtifactVersionsListOverview or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsListOverview] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactVersionsListOverview"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._change_artifact_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + artifact_name=artifact_name, + artifact_version_name=artifact_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ProxyArtifactVersionsListOverview', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_change_artifact_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName}"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_groups_operations.py new file mode 100644 index 00000000000..4761e907eb4 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_groups_operations.py @@ -0,0 +1,729 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_publisher_request( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkFunctionDefinitionGroupsOperations(object): + """NetworkFunctionDefinitionGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionDefinitionGroupListResult"] + """Gets information of the network function definition groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroupListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionGroup" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionGroup') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionGroup" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunctionDefinitionGroup"] + """Creates or updates a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFunctionDefinitionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionGroup" + """Gets information about the specified networkFunctionDefinition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionGroup" + """Updates a network function definition group resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param parameters: Parameters supplied to the create or update publisher network function + definition group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_versions_operations.py new file mode 100644 index 00000000000..2901c53336b --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_definition_versions_operations.py @@ -0,0 +1,962 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_network_function_definition_group_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_state_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkFunctionDefinitionVersionsOperations(object): + """NetworkFunctionDefinitionVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionVersion" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionVersion" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionVersion') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionVersion" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunctionDefinitionVersion"] + """Creates or updates a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFunctionDefinitionVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionVersion" + """Gets information about a network function definition version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionVersion" + """Updates a network function definition version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to the create or update network function definition + version operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + + + @distributed_trace + def list_by_network_function_definition_group( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionDefinitionVersionListResult"] + """Gets information about a list of network function definition versions under a network function + definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionVersionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions"} # type: ignore + + def _update_state_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NetworkFunctionDefinitionVersionUpdateState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkFunctionDefinitionVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionDefinitionVersionUpdateState') + + request = build_update_state_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionDefinitionVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState"} # type: ignore + + + @distributed_trace + def begin_update_state( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + parameters, # type: "_models.NetworkFunctionDefinitionVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunctionDefinitionVersionUpdateState"] + """Update network function definition version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :param parameters: Parameters supplied to update the state of network function definition + version. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + NetworkFunctionDefinitionVersionUpdateState or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionDefinitionVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_ready_k8_s_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_ready_k8_s_operations.py new file mode 100644 index 00000000000..0f1dacc47bb --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_function_ready_k8_s_operations.py @@ -0,0 +1,796 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionReadyK8sName": _SERIALIZER.url("network_function_ready_k8_s_name", network_function_ready_k8_s_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionReadyK8sName": _SERIALIZER.url("network_function_ready_k8_s_name", network_function_ready_k8_s_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionReadyK8sName": _SERIALIZER.url("network_function_ready_k8_s_name", network_function_ready_k8_s_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionReadyK8sName": _SERIALIZER.url("network_function_ready_k8_s_name", network_function_ready_k8_s_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkFunctionReadyK8SOperations(object): + """NetworkFunctionReadyK8SOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionReadyK8S" + """Gets information about the specified network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionReadyK8S, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + parameters, # type: "_models.NetworkFunctionReadyK8S" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionReadyK8S" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunctionReadyK8S') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + parameters, # type: "_models.NetworkFunctionReadyK8S" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunctionReadyK8S"] + """Creates or updates a network function ready K8s. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :param parameters: Parameters supplied to the create or update network function ready K8s + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFunctionReadyK8S or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + @distributed_trace + def update_tags( + self, + resource_group_name, # type: str + network_function_ready_k8_s_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionReadyK8S" + """Updates a network function ready K8s update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_ready_k8_s_name: The name of the network function ready K8s. + :type network_function_ready_k8_s_name: str + :param parameters: Parameters supplied to update network function ready K8s tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionReadyK8S, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8S + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8S"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + network_function_ready_k8_s_name=network_function_ready_k8_s_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionReadyK8S', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s/{networkFunctionReadyK8sName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionReadyK8SListResult"] + """Lists all network function ready K8s in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionReadyK8SListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8SListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8SListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionReadyK8SListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionReadyK8SListResult"] + """Lists all network function ready K8s in the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionReadyK8SListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionReadyK8SListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionReadyK8SListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionReadyK8SListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctionReadyK8s"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_functions_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_functions_operations.py new file mode 100644 index 00000000000..55ce90894c3 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_functions_operations.py @@ -0,0 +1,951 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + resource_group_name, # type: str + network_function_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + network_function_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + network_function_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_tags_request( + resource_group_name, # type: str + network_function_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_execute_request_request_initial( + resource_group_name, # type: str + network_function_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "networkFunctionName": _SERIALIZER.url("network_function_name", network_function_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkFunctionsOperations(object): + """NetworkFunctionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + """Gets information about the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.NetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkFunction') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.NetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunction"] + """Creates or updates a network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied in the body to the create or update network function + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFunction or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkFunction] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkFunction', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + @distributed_trace + def update_tags( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + """Updates the tags for the network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied to the update network function tags operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionListResult"] + """Lists all the network functions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionListResult"] + """Lists all the network function resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions"} # type: ignore + + def _execute_request_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.ExecuteRequestParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ExecuteRequestParameters') + + request = build_execute_request_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._execute_request_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _execute_request_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest"} # type: ignore + + + @distributed_trace + def begin_execute_request( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.ExecuteRequestParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Execute a request to services on a network function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :param parameters: Payload for execute request post call. + :type parameters: ~Microsoft.HybridNetwork.models.ExecuteRequestParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._execute_request_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_execute_request.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_groups_operations.py new file mode 100644 index 00000000000..699e58e52fd --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_groups_operations.py @@ -0,0 +1,725 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_publisher_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkServiceDesignGroupsOperations(object): + """NetworkServiceDesignGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkServiceDesignGroupListResult"] + """Gets information of the network service design groups under a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkServiceDesignGroupListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkServiceDesignGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + parameters, # type: "_models.NetworkServiceDesignGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignGroup" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignGroup') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + parameters, # type: "_models.NetworkServiceDesignGroup" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkServiceDesignGroup"] + """Creates or updates a network service design group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkServiceDesignGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignGroup" + """Gets information about the specified networkServiceDesign group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignGroup" + """Updates a network service design groups resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param parameters: Parameters supplied to the create or update publisher network service design + group operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignGroup, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_versions_operations.py new file mode 100644 index 00000000000..ee4decf9ff7 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_network_service_design_versions_operations.py @@ -0,0 +1,950 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignVersionName": _SERIALIZER.url("network_service_design_version_name", network_service_design_version_name, 'str', max_length=64, min_length=0), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignVersionName": _SERIALIZER.url("network_service_design_version_name", network_service_design_version_name, 'str', max_length=64, min_length=0), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignVersionName": _SERIALIZER.url("network_service_design_version_name", network_service_design_version_name, 'str', max_length=64, min_length=0), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignVersionName": _SERIALIZER.url("network_service_design_version_name", network_service_design_version_name, 'str', max_length=64, min_length=0), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_network_service_design_group_request( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_state_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignGroupName": _SERIALIZER.url("network_service_design_group_name", network_service_design_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkServiceDesignVersionName": _SERIALIZER.url("network_service_design_version_name", network_service_design_version_name, 'str', max_length=64, min_length=0), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class NetworkServiceDesignVersionsOperations(object): + """NetworkServiceDesignVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + parameters, # type: "_models.NetworkServiceDesignVersion" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignVersion" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + parameters, # type: "_models.NetworkServiceDesignVersion" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkServiceDesignVersion"] + """Creates or updates a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkServiceDesignVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignVersion" + """Gets information about a network service design version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkServiceDesignVersion" + """Updates a network service design version resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to the create or update network service design version + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkServiceDesignVersion, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkServiceDesignVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"} # type: ignore + + + @distributed_trace + def list_by_network_service_design_group( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkServiceDesignVersionListResult"] + """Gets information about a list of network service design versions under a network service design + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkServiceDesignVersionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_service_design_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=self.list_by_network_service_design_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_service_design_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkServiceDesignVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_network_service_design_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions"} # type: ignore + + def _update_state_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + parameters, # type: "_models.NetworkServiceDesignVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NetworkServiceDesignVersionUpdateState"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NetworkServiceDesignVersionUpdateState"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NetworkServiceDesignVersionUpdateState') + + request = build_update_state_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_state_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkServiceDesignVersionUpdateState', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState"} # type: ignore + + + @distributed_trace + def begin_update_state( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_service_design_group_name, # type: str + network_service_design_version_name, # type: str + parameters, # type: "_models.NetworkServiceDesignVersionUpdateState" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkServiceDesignVersionUpdateState"] + """Update network service design version state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_service_design_group_name: The name of the network service design group. + :type network_service_design_group_name: str + :param network_service_design_version_name: The name of the network service design version. The + name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + :type network_service_design_version_name: str + :param parameters: Parameters supplied to update the state of network service design version. + :type parameters: ~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionUpdateState + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkServiceDesignVersionUpdateState or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.NetworkServiceDesignVersionUpdateState] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkServiceDesignVersionUpdateState"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_state_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_service_design_group_name=network_service_design_group_name, + network_service_design_version_name=network_service_design_version_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('NetworkServiceDesignVersionUpdateState', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_operations.py new file mode 100644 index 00000000000..819603c5cff --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.HybridNetwork/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationList"] + """Gets a list of the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.HybridNetwork/operations"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_preview_subscriptions_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_preview_subscriptions_operations.py new file mode 100644 index 00000000000..3dcd75f1e26 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_preview_subscriptions_operations.py @@ -0,0 +1,763 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_network_function_definition_group_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "previewSubscription": _SERIALIZER.url("preview_subscription", preview_subscription, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class PreviewSubscriptionsOperations(object): + """PreviewSubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_network_function_definition_group( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PreviewSubscriptionsList"] + """Lists all the preview subscriptions of a network function definition group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PreviewSubscriptionsList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.PreviewSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PreviewSubscriptionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + parameters, # type: "_models.PreviewSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.PreviewSubscription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PreviewSubscription') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + parameters, # type: "_models.PreviewSubscription" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PreviewSubscription"] + """Creates or updates preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update publisher preview subscription + operation. + :type parameters: ~Microsoft.HybridNetwork.models.PreviewSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PreviewSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.PreviewSubscription] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PreviewSubscription" + """Gets the preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + network_function_definition_group_name, # type: str + preview_subscription, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.PreviewSubscription" + """Update a preview subscription resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update publisher preview subscription + operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + preview_subscription=preview_subscription, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/previewSubscriptions/{previewSubscription}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_artifact_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_artifact_operations.py new file mode 100644 index 00000000000..8c5a15b5a3d --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_artifact_operations.py @@ -0,0 +1,319 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + artifact_name = kwargs.pop('artifact_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "artifactStoreName": _SERIALIZER.url("artifact_store_name", artifact_store_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['artifactName'] = _SERIALIZER.query("artifact_name", artifact_name, 'str', max_length=64, min_length=0) + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ProxyArtifactOperations(object): + """ProxyArtifactOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProxyArtifactOverviewListResult"] + """Lists all the available artifacts in the parent Artifact Store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactOverviewListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ProxyArtifactOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyArtifactOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + artifact_store_name, # type: str + artifact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProxyArtifactVersionsOverviewListResult"] + """Get a Artifact overview information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param artifact_store_name: The name of the artifact store. + :type artifact_store_name: str + :param artifact_name: The name of the artifact. + :type artifact_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyArtifactVersionsOverviewListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ProxyArtifactVersionsOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyArtifactVersionsOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + artifact_name=artifact_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + artifact_store_name=artifact_store_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + artifact_name=artifact_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyArtifactVersionsOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_groups_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_groups_operations.py new file mode 100644 index 00000000000..5fa10463480 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_groups_operations.py @@ -0,0 +1,293 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_publisher_request( + proxy_publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups") # pylint: disable=line-too-long + path_format_arguments = { + "proxyPublisherName": _SERIALIZER.url("proxy_publisher_name", proxy_publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "proxyPublisherName": _SERIALIZER.url("proxy_publisher_name", proxy_publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ProxyNetworkFunctionDefinitionGroupsOperations(object): + """ProxyNetworkFunctionDefinitionGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_publisher( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + proxy_publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionDefinitionGroupOverviewListResult"] + """Lists all available network function definition group under a publisher. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionGroupOverviewListResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_publisher_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_publisher.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_publisher_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionGroupOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_publisher.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups"} # type: ignore + + @distributed_trace + def get( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionGroupOverview" + """Get information about network function definition overview. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionGroupOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionGroupOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionGroupOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionGroupOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_versions_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_versions_operations.py new file mode 100644 index 00000000000..7f0e01c882e --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_network_function_definition_versions_operations.py @@ -0,0 +1,309 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_network_function_definition_group_request( + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions") # pylint: disable=line-too-long + path_format_arguments = { + "proxyPublisherName": _SERIALIZER.url("proxy_publisher_name", proxy_publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "proxyPublisherName": _SERIALIZER.url("proxy_publisher_name", proxy_publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionGroupName": _SERIALIZER.url("network_function_definition_group_name", network_function_definition_group_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "networkFunctionDefinitionVersionName": _SERIALIZER.url("network_function_definition_version_name", network_function_definition_version_name, 'str', max_length=64, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ProxyNetworkFunctionDefinitionVersionsOperations(object): + """ProxyNetworkFunctionDefinitionVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_network_function_definition_group( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionDefinitionVersionOverviewListResult"] + """Lists available network function versions under a network function definition group. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionDefinitionVersionOverviewListResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_network_function_definition_group_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_network_function_definition_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_network_function_definition_group_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkFunctionDefinitionVersionOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_network_function_definition_group.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions"} # type: ignore + + @distributed_trace + def get( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + proxy_publisher_name, # type: str + network_function_definition_group_name, # type: str + network_function_definition_version_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunctionDefinitionVersionOverview" + """Get information about network function definition version overview. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :param network_function_definition_group_name: The name of the network function definition + group. + :type network_function_definition_group_name: str + :param network_function_definition_version_name: The name of the network function definition + version. The name should conform to the SemVer 2.0.0 specification: + https://semver.org/spec/v2.0.0.html. + :type network_function_definition_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunctionDefinitionVersionOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.NetworkFunctionDefinitionVersionOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionDefinitionVersionOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + network_function_definition_group_name=network_function_definition_group_name, + network_function_definition_version_name=network_function_definition_version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunctionDefinitionVersionOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_publisher_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_publisher_operations.py new file mode 100644 index 00000000000..e98e6431136 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_proxy_publisher_operations.py @@ -0,0 +1,279 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + proxy_publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + publisher_scope_name = kwargs.pop('publisher_scope_name') # type: str + publisher_location_name = kwargs.pop('publisher_location_name') # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}") # pylint: disable=line-too-long + path_format_arguments = { + "proxyPublisherName": _SERIALIZER.url("proxy_publisher_name", proxy_publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['publisherScopeName'] = _SERIALIZER.query("publisher_scope_name", publisher_scope_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['publisherLocationName'] = _SERIALIZER.query("publisher_location_name", publisher_location_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class ProxyPublisherOperations(object): + """ProxyPublisherOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProxyPublisherOverviewListResult"] + """Lists all the available network function definition and network service design publishers. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProxyPublisherOverviewListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.ProxyPublisherOverviewListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyPublisherOverviewListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProxyPublisherOverviewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers"} # type: ignore + + @distributed_trace + def get( + self, + publisher_scope_name, # type: str + publisher_location_name, # type: str + proxy_publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ProxyPublisherOverview" + """Get a publisher overview information. + + :param publisher_scope_name: The name of the publisher scope. + :type publisher_scope_name: str + :param publisher_location_name: The name of the publisher location. + :type publisher_location_name: str + :param proxy_publisher_name: The name of the proxy publisher. + :type proxy_publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProxyPublisherOverview, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.ProxyPublisherOverview + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProxyPublisherOverview"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + proxy_publisher_name=proxy_publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + publisher_scope_name=publisher_scope_name, + publisher_location_name=publisher_location_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProxyPublisherOverview', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/proxyPublishers/{proxyPublisherName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_publishers_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_publishers_operations.py new file mode 100644 index 00000000000..8475d51061e --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_publishers_operations.py @@ -0,0 +1,796 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_request( + resource_group_name, # type: str + publisher_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class PublishersOperations(object): + """PublishersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PublisherListResult"] + """Lists all the publishers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublisherListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.PublisherListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublisherListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PublisherListResult"] + """Lists all the publishers in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublisherListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.PublisherListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PublisherListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Publisher" + """Gets information about the specified publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Publisher + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + publisher_name, # type: str + parameters=None, # type: Optional["_models.Publisher"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Publisher" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'Publisher') + else: + _json = None + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Publisher', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + publisher_name, # type: str + parameters=None, # type: Optional["_models.Publisher"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Publisher"] + """Creates or updates a publisher. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. + :type parameters: ~Microsoft.HybridNetwork.models.Publisher + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Publisher or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.Publisher] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Publisher', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name, # type: str + publisher_name, # type: str + parameters=None, # type: Optional["_models.TagsObject"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Publisher" + """Update a publisher resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param publisher_name: The name of the publisher. + :type publisher_name: str + :param parameters: Parameters supplied to the create publisher operation. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Publisher + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Publisher"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'TagsObject') + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Publisher', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"} # type: ignore + diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_site_network_services_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_site_network_services_operations.py new file mode 100644 index 00000000000..41e06145a43 --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_site_network_services_operations.py @@ -0,0 +1,795 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteNetworkServiceName": _SERIALIZER.url("site_network_service_name", site_network_service_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteNetworkServiceName": _SERIALIZER.url("site_network_service_name", site_network_service_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteNetworkServiceName": _SERIALIZER.url("site_network_service_name", site_network_service_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteNetworkServiceName": _SERIALIZER.url("site_network_service_name", site_network_service_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class SiteNetworkServicesOperations(object): + """SiteNetworkServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + site_network_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SiteNetworkService" + """Gets information about the specified site network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteNetworkService, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.SiteNetworkService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + site_network_service_name, # type: str + parameters, # type: "_models.SiteNetworkService" + **kwargs # type: Any + ): + # type: (...) -> "_models.SiteNetworkService" + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SiteNetworkService') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + site_network_service_name, # type: str + parameters, # type: "_models.SiteNetworkService" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SiteNetworkService"] + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :param parameters: Parameters supplied to the create or update site network service operation. + :type parameters: ~Microsoft.HybridNetwork.models.SiteNetworkService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SiteNetworkService or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.SiteNetworkService] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + @distributed_trace + def update_tags( + self, + resource_group_name, # type: str + site_network_service_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.SiteNetworkService" + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_network_service_name: The name of the site network service. + :type site_network_service_name: str + :param parameters: Parameters supplied to update network site tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SiteNetworkService, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.SiteNetworkService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_network_service_name=site_network_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SiteNetworkService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SiteNetworkServiceListResult"] + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteNetworkServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.SiteNetworkServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SiteNetworkServiceListResult"] + """Lists all site network services. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteNetworkServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.SiteNetworkServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteNetworkServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SiteNetworkServiceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/operations/_sites_operations.py b/src/aosm/azext_aosm/vendored_sdks/operations/_sites_operations.py new file mode 100644 index 00000000000..ce2948d2a2c --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/operations/_sites_operations.py @@ -0,0 +1,790 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteName": _SERIALIZER.url("site_name", site_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteName": _SERIALIZER.url("site_name", site_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteName": _SERIALIZER.url("site_name", site_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_update_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "siteName": _SERIALIZER.url("site_name", site_name, 'str', max_length=64, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, '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 + ) + +# fmt: on +class SitesOperations(object): + """SitesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~Microsoft.HybridNetwork.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + site_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Site" + """Gets information about the specified network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + site_name, # type: str + parameters, # type: "_models.Site" + **kwargs # type: Any + ): + # type: (...) -> "_models.Site" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Site') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Site', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + site_name, # type: str + parameters, # type: "_models.Site" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Site"] + """Creates or updates a network site. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :param parameters: Parameters supplied to the create or update network site operation. + :type parameters: ~Microsoft.HybridNetwork.models.Site + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Site or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~Microsoft.HybridNetwork.models.Site] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + site_name=site_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Site', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + @distributed_trace + def update_tags( + self, + resource_group_name, # type: str + site_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.Site" + """Updates a site update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param site_name: The name of the network service site. + :type site_name: str + :param parameters: Parameters supplied to update network site tags. + :type parameters: ~Microsoft.HybridNetwork.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Site, or the result of cls(response) + :rtype: ~Microsoft.HybridNetwork.models.Site + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Site"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + site_name=site_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Site', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SiteListResult"] + """Lists all sites in the network service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.SiteListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SiteListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SiteListResult"] + """Lists all sites in the network service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SiteListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~Microsoft.HybridNetwork.models.SiteListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SiteListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SiteListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites"} # type: ignore diff --git a/src/aosm/azext_aosm/vendored_sdks/py.typed b/src/aosm/azext_aosm/vendored_sdks/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/aosm/azext_aosm/vendored_sdks/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/aosm/development.md b/src/aosm/development.md new file mode 100644 index 00000000000..28e681f3173 --- /dev/null +++ b/src/aosm/development.md @@ -0,0 +1,153 @@ +### Prerequisites + +1. `python 3.8+` + + +### Dev environment setup + +Follow [https://github.com/Azure/azure-cli-dev-tools](https://github.com/Azure/azure-cli-dev-tools) + +Clone both azure-cli and azure-cli-extensions + +Note for azure-cli-extensions we are currently on a fork : https://github.com/jddarby/azure-cli-extensions +```bash +# Go into your git clone of az-cli-extensions +cd azure-cli-extensions + +# Create a virtual environment to run in +python3.8 -m venv ~/.virtualenvs/az-cli-env +source ~/.virtualenvs/az-cli-env/bin/activate + +# Ensure you have pip +python -m pip install -U pip + +# Install azdev +pip install azdev + +git checkout add-aosm-extension + +# Install all the python dependencies you need +azdev setup --cli /home/developer/code/azure-cli --repo . + +# Install pyYAML types +python3 -m pip install types-PyYAML + +# Add the extension to your local CLI +azdev extension add aosm +``` +### Generating the AOSM Python SDK +TODO + +### VSCode environment setup. + +Make sure your VSCode is running in the same python virtual environment + +### Linting and Tests + +#### Style +```bash +azdev style aosm +``` + +Expected output: +``` +=============== +| Style Check | +=============== + +Extensions: aosm + +Running pylint on extensions... +Pylint: PASSED + +Running flake8 on extensions... +Flake8: PASSED +``` + +#### Linter +```bash +azdev linter --include-whl-extensions aosm +``` + +Current expected output: +``` + +============== +| CLI Linter | +============== + +Modules: aosm + +Initializing linter with command table and help files... + + Results +========= + +- pass: faulty_help_example_parameters_rule +- pass: faulty_help_example_rule +- pass: faulty_help_type_rule +- pass: unrecognized_help_entry_rule +- pass: unrecognized_help_parameter_rule +- pass: expired_command_group +- pass: missing_group_help +- pass: expired_command +- pass: missing_command_help +- pass: no_ids_for_list_commands +- pass: bad_short_option +- pass: expired_option +- pass: expired_parameter +- pass: missing_parameter_help +- pass: no_parameter_defaults_for_update_commands +- pass: no_positional_parameters +- pass: option_length_too_long +- pass: option_should_not_contain_under_score +``` + +#### Typing +```bash +cd src/aosm +mypy . --ignore-missing-imports --no-namespace-packages --exclude "azext_aosm/vendored_sdks/*" +``` + +Expected output: +``` +Success: no issues found in 33 source files +``` + +#### Auto-formatting +The standard Python tool, `black`, is useful for automatically formatting your code. + +You can use python-static-checks in your dev environment if you want, to help you: +```bash +pip3 install -U --index-url https://pkgs.dev.azure.com/msazuredev/AzureForOperators/_packaging/python/pypi/simple/ python-static-checks==4.0.0 +python-static-checks fmt +``` + +### Tests +The tests in this repository are split into unit tests and integration tests. Both tests live in the `tests/latest` folder and can be run using the `azdev test aosm` command (you can optionally use the `--live` flag with this command as some integration tests are run only in live mode, e.g. CNF tests). All tests are expected to pass. All unit tests and Integration tests are run as part of the pipeline. +### Unit tests +To get code coverage run: +```bash +pip install coverage +cd src/aosm +coverage erase +coverage run -m pytest . +coverage report --include="*/src/aosm/*" --omit="*/src/aosm/azext_aosm/vendored_sdks/*","*/src/aosm/azext_aosm/tests/*" -m +``` + +#### Integration tests +The integration tests are tests which run real azure CLI commands such as `az aosm nsd publish`. When running for the first time in a repository these tests will create a real resource group (with a randomly generated name starting with "cli_test_") in the subscription that is active on your account and deploy real AOSM resources. These resources will be cleaned up after the tests have run. After the first "live" run these tests will be automatically recorded in the `tests/latest/recordings` folder. These recordings record all communication between the CLI and Azure which mean that the next time the test is run it will no longer be run live but instead will be will be run against the recorded responses. This means that the tests will run much faster and will not create any real resources. The recording also does not rely on the knowledge of a subscription and the credentials will be removed from the recordings. + +If one of the publish tests fails, then it might be because you have made small tweaks and the recording is now out of date. +Delete the relevant file under tests/latest/recordings (the file names match the name of the tests), and re-run the test. +If that passes it will create a new recording for you. Running the tests using the `--live` flag will also run all tests +in "live" mode which will create a new recording for the integration tests. + +To find out more about integration tests see [here](https://github.com/Azure/azure-cli/blob/dev/doc/authoring_tests.md). + +### Pipelines +The pipelines for the Azure CLI run in ADO, not in github. +To trigger a pipeline you need to create a PR against main. +Until we do the initial merge to main we don't want to have a PR to main for every code review. +Instead we have a single PR for the `add-aosm-extension` branch: https://github.com/Azure/azure-cli-extensions/pull/6426 +Once you have merged your changes to `add-aosm-extension` then look at the Azure Pipelines under https://github.com/Azure/azure-cli-extensions/pull/6426/checks, click on the link that says ` errors / warnings`. diff --git a/src/aosm/pyproject.toml b/src/aosm/pyproject.toml new file mode 100644 index 00000000000..e4bbc5837c4 --- /dev/null +++ b/src/aosm/pyproject.toml @@ -0,0 +1,7 @@ +[tool.mypy] +ignore_missing_imports = true +no_namespace_packages = true + +[[tool.mypy.overrides]] +module = ["azext_aosm.vendored_sdks.*"] +ignore_errors = true diff --git a/src/aosm/setup.cfg b/src/aosm/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/src/aosm/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/aosm/setup.py b/src/aosm/setup.py new file mode 100644 index 00000000000..9215556829b --- /dev/null +++ b/src/aosm/setup.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +from codecs import open +from setuptools import find_packages, setup + +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + + logger.warn("Wheel is not available, disabling bdist_wheel hook") + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = "0.2.0" + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: MIT License", +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = ["oras~=0.1.19", "azure-storage-blob>=12.15.0", "jinja2>=3.1.2"] + +with open("README.md", "r", encoding="utf-8") as f: + README = f.read() +with open("HISTORY.rst", "r", encoding="utf-8") as f: + HISTORY = f.read() + +setup( + name="aosm", + version=VERSION, + description="Microsoft Azure Command-Line Tools Aosm Extension", + # TODO: Update author and email, if applicable + author="Microsoft Corporation", + author_email="azpycli@microsoft.com", + # TODO: change to your extension source code repo if the code will not be put in azure-cli-extensions repo + url="https://github.com/Azure/azure-cli-extensions/tree/master/src/aosm", + long_description=README + "\n\n" + HISTORY, + license="MIT", + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={ + "azext_aosm": [ + "azext_metadata.json", + "generate_nfd/templates/*", + "generate_nsd/templates/*", + ] + }, +)