diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7692523bf11..c5d5d8f9d87 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -288,6 +288,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..e733b20bcec --- /dev/null +++ b/src/aosm/HISTORY.rst @@ -0,0 +1,31 @@ +.. :changelog: + +Release History +=============== + +unreleased +++++++++++ +* `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 + +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..d28dd58d2bd --- /dev/null +++ b/src/aosm/README.md @@ -0,0 +1,199 @@ +# 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` + +## 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. + +## 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. + +## 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 the `helm` package installed on the machine you are running the CLI from. 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 + +#### 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` + +# Development + +## Unit tests +To run unit tests run `azdev test aosm`. + +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 +``` + +## 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/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..221e972423b --- /dev/null +++ b/src/aosm/azext_aosm/_configuration.py @@ -0,0 +1,486 @@ +# -------------------------------------------------------------------------------------- +# 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 + +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_name_nsd": ( + "Name of the Publisher resource you want your design published to. " + "This should be the same as the publisher used for your NFDVs" + ), + "publisher_resource_group_name_nsd": "Resource group for the Publisher resource.", + "nf_name": "Name of NF definition", + "version": "Version of the NF definition", + "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." + ), + "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" + ), + "network_function_definition_group_name": ( + "Existing Network Function Definition Group Name. " + "This can be created using the 'az aosm nfd' commands." + ), + "network_function_definition_version_name": ( + "Existing Network Function Definition Version Name. " + "This can be created using the 'az aosm nfd' commands." + ), + "network_function_definition_offering_location": ( + "Offering location of the Network Function Definition" + ), + "network_function_type": ( + "Type of nf in the definition. Valid values are 'cnf' or 'vnf'" + ), + "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" + ), + "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. + file_path: Optional[str] = DESCRIPTION_MAP["file_path"] + blob_sas_url: Optional[str] = DESCRIPTION_MAP["blob_sas_url"] + version: 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_name(self) -> str: + """Base class method to ensure subclasses implement this function.""" + 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_name(self) -> str: + """Return the ACR manifest name from the NFD name.""" + sanitized_nf_name = self.nf_name.lower().replace("_", "-") + return f"{sanitized_nf_name}-acr-manifest-{self.version.replace('.', '-')}" + + +@dataclass +class NSConfiguration(Configuration): + # pylint: disable=too-many-instance-attributes + location: str = DESCRIPTION_MAP["location"] + publisher_name: str = DESCRIPTION_MAP["publisher_name_nsd"] + publisher_resource_group_name: str = DESCRIPTION_MAP[ + "publisher_resource_group_name_nsd" + ] + acr_artifact_store_name: str = DESCRIPTION_MAP["acr_artifact_store_name"] + network_function_definition_group_name: str = DESCRIPTION_MAP[ + "network_function_definition_group_name" + ] + network_function_definition_version_name: str = DESCRIPTION_MAP[ + "network_function_definition_version_name" + ] + network_function_definition_offering_location: str = DESCRIPTION_MAP[ + "network_function_definition_offering_location" + ] + network_function_type: str = DESCRIPTION_MAP["network_function_type"] + nsdg_name: str = DESCRIPTION_MAP["nsdg_name"] + nsd_version: str = DESCRIPTION_MAP["nsd_version"] + nsdv_description: str = DESCRIPTION_MAP["nsdv_description"] + + def validate(self): + """Validate that all of the configuration parameters are set.""" + + # Exemption for pylint as explicitly including the empty string makes the code clearer + # pylint: disable=simplifiable-condition + + if self.location == DESCRIPTION_MAP["location"] or "": + raise ValueError("Location must be set") + if self.publisher_name == DESCRIPTION_MAP["publisher_name_nsd"] or "": + raise ValueError("Publisher name must be set") + if ( + self.publisher_resource_group_name + == DESCRIPTION_MAP["publisher_resource_group_name_nsd"] + or "" + ): + raise ValueError("Publisher resource group name must be set") + if ( + self.acr_artifact_store_name == DESCRIPTION_MAP["acr_artifact_store_name"] + or "" + ): + raise ValueError("ACR Artifact Store name must be set") + if ( + self.network_function_definition_group_name + == DESCRIPTION_MAP["network_function_definition_group_name"] + or "" + ): + raise ValueError("Network Function Definition Group name must be set") + if ( + self.network_function_definition_version_name + == DESCRIPTION_MAP["network_function_definition_version_name"] + or "" + ): + raise ValueError("Network Function Definition Version name must be set") + if ( + self.network_function_definition_offering_location + == DESCRIPTION_MAP["network_function_definition_offering_location"] + or "" + ): + raise ValueError( + "Network Function Definition Offering Location must be set" + ) + if self.network_function_type not in [CNF, VNF]: + raise ValueError("Network Function Type must be cnf or vnf") + if self.nsdg_name == DESCRIPTION_MAP["nsdg_name"] or "": + raise ValueError("NSDG name must be set") + if self.nsd_version == DESCRIPTION_MAP["nsd_version"] or "": + 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(f"{current_working_directory}/{NSD_OUTPUT_BICEP_PREFIX}") + + @property + def resource_element_name(self) -> str: + """Return the name of the resource element.""" + return f"{self.nsdg_name.lower()}-resource-element" + + @property + def network_function_name(self) -> str: + """Return the name of the NFVI used for the NSDV.""" + return f"{self.nsdg_name}_NF" + + @property + def acr_manifest_name(self) -> str: + """Return the ACR manifest name from the NFD name.""" + sanitised_nf_name = self.network_function_name.lower().replace("_", "-") + return ( + f"{sanitised_nf_name}-nsd-acr-manifest-{self.nsd_version.replace('.', '-')}" + ) + + @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 arm_template(self) -> ArtifactConfig: + """Return the parameters of the ARM template to be uploaded as part of the NSDV.""" + artifact = ArtifactConfig() + artifact.version = self.nsd_version + artifact.file_path = os.path.join( + self.output_directory_for_build, NF_DEFINITION_JSON_FILENAME + ) + return artifact + + @property + def arm_template_artifact_name(self) -> str: + """Return the artifact name for the ARM template.""" + return f"{self.network_function_definition_group_name}-nfd-artifact" + + +@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): + 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." + ) + + +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..afb4b08f19d --- /dev/null +++ b/src/aosm/azext_aosm/_help.py @@ -0,0 +1,50 @@ +# 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 definition" +] = """ + type: group + short-summary: Manage AOSM publisher definitions. +""" + +helps[ + "aosm definition generate-config" +] = """ + type: command + short-summary: Generate configuration file for building an AOSM publisher definition. +""" + +helps[ + "aosm definition build" +] = """ + type: command + short-summary: Build an AOSM publisher definition. +""" + +helps[ + "aosm definition publish" +] = """ + type: command + short-summary: Publish a pre-built AOSM publisher definition. +""" + + +helps[ + "aosm definition delete" +] = """ + type: command + short-summary: Delete AOSM publisher definition. +""" diff --git a/src/aosm/azext_aosm/_params.py b/src/aosm/azext_aosm/_params.py new file mode 100644 index 00000000000..f0d5b1590f3 --- /dev/null +++ b/src/aosm/azext_aosm/_params.py @@ -0,0 +1,123 @@ +# -------------------------------------------------------------------------------------------- +# 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 + + +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]) + 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_parameters_json_file", + options_list=["--manifest-parameters-file", "-mp"], + 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=skip_steps, help="Optional skip steps") + + 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=skip_steps, help="Optional skip steps") 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..e3e6d225ece --- /dev/null +++ b/src/aosm/azext_aosm/custom.py @@ -0,0 +1,392 @@ +# -------------------------------------------------------------------------------------------- +# 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, NSD, 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, +): + """ + Build a definition. + + :param cmd: + :type cmd: _type_ + :param config_file: path to the file + :param definition_type: VNF, CNF + """ + + # 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, + ) + + +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 +): + """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: + 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_parameters_json_file: Optional[str] = None, + skip: Optional[str] = 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_parameters_json_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), + ) + + config = _get_config_from_file( + config_file=config_file, configuration_type=definition_type + ) + + if definition_type == VNF: + deployer = DeployerViaArm(api_clients, config=config) + deployer.deploy_vnfd_from_bicep( + bicep_path=definition_file, + parameters_json_file=parameters_json_file, + manifest_bicep_path=manifest_file, + manifest_parameters_json_file=manifest_parameters_json_file, + skip=skip, + ) + elif definition_type == CNF: + deployer = DeployerViaArm(api_clients, config=config) + deployer.deploy_cnfd_from_bicep( + cli_ctx=cmd.cli_ctx, + bicep_path=definition_file, + parameters_json_file=parameters_json_file, + manifest_bicep_path=manifest_file, + manifest_parameters_json_file=manifest_parameters_json_file, + skip=skip, + ) + else: + raise ValueError( + "Definition type must be either 'vnf' or 'cnf'. Definition type" + f" {definition_type} is not recognised." + ) + + +def delete_published_definition( + cmd, + client: HybridNetworkManagementClient, + definition_type, + config_file, + clean=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. + """ + 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) + if definition_type == VNF: + delly.delete_nfd(clean=clean) + elif definition_type == CNF: + delly.delete_nfd(clean=clean) + 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): + """ + Build a Network Service Design. + + :param cmd: + :type cmd: _type_ + :param client: + :type client: HybridNetworkManagementClient + :param config_file: path to the file + """ + + 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, + ) + + +def delete_published_design( + cmd, + client: HybridNetworkManagementClient, + config_file, +): + """ + 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. + """ + 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) + destroyer.delete_nsd() + + +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_parameters_json_file: Optional[str] = None, + skip: Optional[str] = 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_parameters_json_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, config=config) + + deployer.deploy_nsd_from_bicep( + bicep_path=design_file, + parameters_json_file=parameters_json_file, + manifest_bicep_path=manifest_file, + manifest_parameters_json_file=manifest_parameters_json_file, + skip=skip, + ) + + +def _generate_nsd(config: NSConfiguration, api_clients: ApiClients): + """Generate a Network Service Design for the given config.""" + if os.path.exists(config.output_directory_for_build): + 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 = NSDGenerator(api_clients, config) + 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..3580a5d7737 --- /dev/null +++ b/src/aosm/azext_aosm/delete/delete.py @@ -0,0 +1,314 @@ +# -------------------------------------------------------------------------------------- +# 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 knack.log import get_logger + +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, + ) -> 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 + + def delete_nfd(self, clean: bool = False): + """ + 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 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): + """ + Delete the NSDV and manifests. + + If they don't exist it still reports them as deleted. + """ + assert isinstance(self.config, NSConfiguration) + + print( + "Are you sure you want to delete the NSD Version" + f" {self.config.nsd_version}, the associated manifest" + f" {self.config.acr_manifest_name} and configuration group schema" + f" {self.config.cg_schema_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_nsdv() + self.delete_artifact_manifest("acr") + self.delete_config_group_schema() + + 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, + ) + poller.result() + 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, + ) + poller.result() + 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_name = self.config.sa_manifest_name + elif store_type == "acr": + store_name = self.config.acr_artifact_store_name + manifest_name = self.config.acr_manifest_name + else: + from azure.cli.core.azclierror import CLIInternalError + + raise CLIInternalError( + "Delete artifact manifest called for invalid store type. Valid types" + " are sa and acr." + ) + 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, + ) + poller.result() + 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, + ) + ) + poller.result() + 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, + ) + poller.result() + 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, + ) + poller.result() + 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, + ) + poller.result() + 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, + ) + ) + poller.result() + 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..eada313c6bb --- /dev/null +++ b/src/aosm/azext_aosm/deploy/artifact.py @@ -0,0 +1,219 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Highly Confidential Material + +# pylint: disable=unidiomatic-typecheck +"""A module to handle interacting with artifacts.""" +import os +import subprocess +from dataclasses import dataclass +from typing import List, 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 aritfact. + + :param artifact_config: configuration for the artifact being uploaded + """ + if type(self.artifact_client) == OrasClient: + if type(artifact_config) == HelmPackageConfig: + self._upload_helm_to_acr(artifact_config) + elif type(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 type(self.artifact_client) == OrasClient + + if artifact_config.file_path: + try: + # OrasClient 0.1.17 has a bug + # https://github.com/oras-project/oras-py/issues/90 which means on + # Windows we need a real blank file on disk, without a colon in the + # filepath (so tempfile can't be used and we just put it in the working + # directory), that can act as the manifest config file. So create one + # and then delete it after the upload. + with open("dummyManifestConfig.json", "w", encoding="utf-8") as f: + 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, + manifest_config=f.name, + ) + finally: + # Delete the dummy file + try: + os.remove("dummyManifestConfig.json") + except FileNotFoundError: + pass + 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", "") + + # az acr login --name "registry_name" + login_command = ["az", "acr", "login", "--name", registry_name] + subprocess.run(login_command, check=True) + + try: + logger.debug("Uploading %s to %s", chart_path, target_registry) + + # helm push "$chart_path" "$target_registry" + push_command = ["helm", "push", chart_path, target_registry] + subprocess.run(push_command, check=True) + finally: + # If we don't logout from the registry, future Artifact uploads to this ACR + # will fail with an UNAUTHORIZED error. There is no az acr logout command, + # but it is a wrapper around docker, so a call to docker logout will work. + logout_command = ["docker", "logout", registry] + subprocess.run(logout_command, check=True) + + 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 type(self.artifact_client) == BlobClient + assert type(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( + artifact, overwrite=True, blob_type=BlobType.PAGEBLOB + ) + 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..0d79fafcddd --- /dev/null +++ b/src/aosm/azext_aosm/deploy/deploy_with_arm.py @@ -0,0 +1,763 @@ +# -------------------------------------------------------------------------------------- +# 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.mgmt.resource.resources.models import DeploymentExtended +from knack.log import get_logger + +from azext_aosm._configuration import ( + CNFConfiguration, + Configuration, + 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, + NF_DEFINITION_BICEP_FILENAME, + NSD, + NSD_ARTIFACT_MANIFEST_BICEP_FILENAME, + NSD_BICEP_FILENAME, + 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: + """ + 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, config: Configuration) -> 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 + """ + logger.debug("Create ARM/Bicep Deployer") + self.api_clients = api_clients + self.config = config + self.pre_deployer = PreDeployerViaSDK(api_clients, self.config) + + @staticmethod + def read_parameters_from_file(parameters_json_file: str) -> Dict[str, Any]: + """ + Read parameters from a file. + + :param parameters_json_file: path to the parameters file + :return: parameters + """ + message = f"Use parameters from file {parameters_json_file}" + logger.info(message) + print(message) + with open(parameters_json_file, "r", encoding="utf-8") as f: + parameters_json = json.loads(f.read()) + parameters = parameters_json["parameters"] + + return parameters + + def deploy_vnfd_from_bicep( + self, + bicep_path: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_bicep_path: Optional[str] = None, + manifest_parameters_json_file: Optional[str] = None, + skip: Optional[str] = None, + ) -> None: + """ + Deploy the bicep template defining the VNFD. + + Also ensure that all required predeploy resources are deployed. + + :param bicep_template_path: The path to the bicep template of the nfdv :type + bicep_template_path: str :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 + :manifest_parameters_json_ + file: + :param bicep_template_path: The path to the bicep template of the nfdv + :type bicep_template_path: str + :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 + :manifest_parameters_json_file: path to an override file of set parameters for + the manifest + :param skip: options to skip, either publish bicep or upload artifacts + """ + assert isinstance(self.config, VNFConfiguration) + + if not skip == BICEP_PUBLISH: + if not 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 + bicep_path = os.path.join( + self.config.output_directory_for_build, + VNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + ) + + if parameters_json_file: + parameters = self.read_parameters_from_file(parameters_json_file) + + 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 NFDV template.") + parameters = self.construct_vnfd_parameters() + + logger.debug(parameters) + + # Create or check required resources + deploy_manifest_template = not self.nfd_predeploy(definition_type=VNF) + if deploy_manifest_template: + self.deploy_manifest_template( + manifest_parameters_json_file, manifest_bicep_path, VNF + ) + 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) + self.deploy_bicep_template(bicep_path, parameters) + print(f"Deployed NFD {self.config.nf_name} version {self.config.version}.") + else: + print("Skipping bicep publish") + + if skip == ARTIFACT_UPLOAD: + print("Skipping artifact upload") + print("Done") + return + + 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_name, + ) + + vhd_artifact = storage_account_manifest.artifacts[0] + arm_template_artifact = acr_manifest.artifacts[0] + + print("Uploading VHD artifact") + vhd_artifact.upload(self.config.vhd) + print("Uploading ARM template artifact") + arm_template_artifact.upload(self.config.arm_template) + print("Done") + + def nfd_predeploy(self, definition_type) -> 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 definition_type == VNF: + self.pre_deployer.ensure_sa_artifact_store_exists() + if definition_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() + + def construct_vnfd_parameters(self) -> Dict[str, Any]: + """ + Create the parmeters dictionary for vnfdefinitions.bicep. VNF specific. + + :param config: The contents of the configuration file. + """ + 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}, + } + + def construct_cnfd_parameters(self) -> Dict[str, Any]: + """ + Create the parmeters dictionary for cnfdefinition.bicep. + + CNF specific. + """ + 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}, + } + + def construct_manifest_parameters(self) -> Dict[str, Any]: + """Create the parmeters dictionary for VNF, CNF or NSD.""" + if 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_name}, + "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 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_name}, + } + if isinstance(self.config, NSConfiguration): + 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_name}, + "armTemplateName": {"value": self.config.arm_template_artifact_name}, + "armTemplateVersion": {"value": self.config.arm_template.version}, + } + raise ValueError("Unknown configuration type") + + def deploy_cnfd_from_bicep( + self, + cli_ctx, + bicep_path: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_bicep_path: Optional[str] = None, + manifest_parameters_json_file: Optional[str] = None, + skip: Optional[str] = None, + ) -> None: + """ + Deploy the bicep template defining the CNFD. + + Also ensure that all required predeploy resources are deployed. + + :param cli_ctx: The CLI context + :param management_client: The container registry management client + :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_parameters_json_file: path to an override file of set parameters for + the manifest + :param skip: options to skip, either publish bicep or upload artifacts + """ + assert isinstance(self.config, CNFConfiguration) + + if not skip == BICEP_PUBLISH: + if not 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 + bicep_path = os.path.join( + self.config.output_directory_for_build, + CNF_DEFINITION_BICEP_TEMPLATE_FILENAME, + ) + + if parameters_json_file: + parameters = self.read_parameters_from_file(parameters_json_file) + 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 NFDV template.") + parameters = self.construct_cnfd_parameters() + + logger.debug( + "Parameters used for CNF definition bicep deployment: %s", parameters + ) + + # Create or check required resources + deploy_manifest_template = not self.nfd_predeploy(definition_type=CNF) + if deploy_manifest_template: + self.deploy_manifest_template( + manifest_parameters_json_file, manifest_bicep_path, CNF + ) + 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) + self.deploy_bicep_template(bicep_path, parameters) + print(f"Deployed NFD {self.config.nf_name} version {self.config.version}.") + else: + print("Skipping bicep publish") + + if skip == ARTIFACT_UPLOAD: + print("Skipping artifact upload") + print("Done") + return + + 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_name, + ) + + 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. + for artifact in artifact_dictionary.values(): + assert isinstance(artifact, Artifact) + + print(f"Copying artifact: {artifact.artifact_name}") + artifact.copy_image( + cli_ctx=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}"], + ) + + print("Done") + + def deploy_nsd_from_bicep( + self, + bicep_path: Optional[str] = None, + parameters_json_file: Optional[str] = None, + manifest_bicep_path: Optional[str] = None, + manifest_parameters_json_file: Optional[str] = None, + skip: Optional[str] = None, + ) -> None: + """ + Deploy the bicep template defining the VNFD. + + Also ensure that all required predeploy resources are deployed. + + :param bicep_template_path: The path to the bicep template of the nfdv + :type bicep_template_path: str + :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_parameters_json_file: path to an override file of set parameters for the manifest + :param skip: options to skip, either publish bicep or upload artifacts + """ + assert isinstance(self.config, NSConfiguration) + if not skip == BICEP_PUBLISH: + if not 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, + ) + + if parameters_json_file: + parameters = self.read_parameters_from_file(parameters_json_file) + 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 + # NSDV using this CLI + logger.debug("Create parameters for default NSDV template.") + parameters = self.construct_nsd_parameters() + + logger.debug(parameters) + + # Create or check required resources + deploy_manifest_template = not self.nsd_predeploy() + + if deploy_manifest_template: + self.deploy_manifest_template( + manifest_parameters_json_file, manifest_bicep_path, NSD + ) + else: + print( + f"Artifact manifests {self.config.acr_manifest_name} already exists" + ) + + 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, parameters) + print( + f"Deployed NSD {self.config.nsdg_name} " + f"version {self.config.nsd_version}." + ) + if skip == ARTIFACT_UPLOAD: + print("Skipping artifact upload") + print("Done") + return + + acr_manifest = ArtifactManifestOperator( + self.config, + self.api_clients, + self.config.acr_artifact_store_name, + self.config.acr_manifest_name, + ) + + arm_template_artifact = acr_manifest.artifacts[0] + + # 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_DEFINITION_BICEP_FILENAME + ) + ) + + # appease mypy + assert ( + self.config.arm_template.file_path + ), "Config missing ARM template file path" + with open(self.config.arm_template.file_path, "w", encoding="utf-8") as file: + file.write(json.dumps(arm_template_artifact_json, indent=4)) + + print("Uploading ARM template artifact") + arm_template_artifact.upload(self.config.arm_template) + print("Done") + + def deploy_manifest_template( + self, manifest_parameters_json_file, manifest_bicep_path, configuration_type + ) -> None: + """ + Deploy the bicep template defining the manifest. + + :param manifest_parameters_json_file: path to an override file of set parameters for the manifest + :param manifest_bicep_path: The path to the bicep template of the manifest + :param configuration_type: The type of configuration to deploy + """ + print("Deploy bicep template for Artifact manifests") + logger.debug("Deploy manifest bicep") + + if not manifest_bicep_path: + file_name: str = "" + if configuration_type == NSD: + file_name = NSD_ARTIFACT_MANIFEST_BICEP_FILENAME + elif configuration_type == VNF: + file_name = VNF_MANIFEST_BICEP_TEMPLATE_FILENAME + elif configuration_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 manifest_parameters_json_file: + manifest_params = self.construct_manifest_parameters() + else: + logger.info("Use provided manifest parameters") + with open(manifest_parameters_json_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 construct_nsd_parameters(self) -> Dict[str, Any]: + """Create the parmeters dictionary for nsd_definition.bicep.""" + 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}, + "armTemplateVersion": {"value": self.config.arm_template.version}, + } + + 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) + 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_into_{resource_group}_{current_time}" + + 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 = validation.result() + 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 = poller.result() + 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 + :raise RuntimeError if az CLI is not installed. + :return: Output dictionary from the bicep template. + """ + if not shutil.which("az"): + logger.error( + "The Azure CLI is not installed - follow " + "https://github.com/Azure/bicep/blob/main/docs/installing.md#linux" + ) + raise RuntimeError( + "The Azure CLI is not installed - cannot render ARM templates." + ) + 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..ea5147fc44d --- /dev/null +++ b/src/aosm/azext_aosm/deploy/pre_deploy.py @@ -0,0 +1,467 @@ +# -------------------------------------------------------------------------------------- +# 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 azure.cli.core.azclierror import AzCLIError +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, + NSConfiguration, + 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, + ) -> 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 + """ + + self.api_clients = api_clients + self.config = config + + 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 + ): + if isinstance(self.config, NSConfiguration): + raise AzCLIError( + f"Resource Group {resource_group_name} does not exist. Please" + " create it before running this command." + ) + 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) + self.api_clients.resource_client.resource_groups.create_or_update( + resource_group_name, rg_params + ) + 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 as ex: + if isinstance(self.config, NSConfiguration): + raise AzCLIError( + f"Publisher {publisher_name} does not exist. Please create it" + " before running this command." + ) from ex + # 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}" + ) + pub = 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"), + ) + pub.result() + + 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, + ), + ) + ) + # Asking for result waits for provisioning state Succeeded before carrying + # on + arty: ArtifactStore = poller.result() + + 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 = poller.result() + + 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.""" + 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=self.config.acr_manifest_name, + ) + + 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 acr_manny_exists and sa_manny_exists: + return True + if acr_manny_exists or sa_manny_exists: + raise AzCLIError( + "Only one artifact manifest exists. Cannot proceed. Please delete" + " the NFDV using `az aosm nfd delete` and start the publish again" + " from scratch." + ) + 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 + """ + + logger.info( + "Creating network service design group %s if it does not exist", + nsdg_name, + ) + 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), + ) + + 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..dbf2bc7a314 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -0,0 +1,789 @@ +# -------------------------------------------------------------------------------------- +# 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] + valueMappingsPath: Path + + +@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." + "If you are happy with them, you should manually deploy your bicep " + "templates and upload your charts and images to your " + "artifact store." + ) + 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( + deployParametersPath=Path(SCHEMAS_DIR_NAME, DEPLOYMENT_PARAMETERS_FILENAME), + 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), + valueMappingsPath=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) -> Path: + """Yaml->JSON values mapping file, then return path to it.""" + 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 Path(CONFIG_MAPPINGS_DIR_NAME, 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..7c12e53c320 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/templates/cnfdefinition.bicep.j2 @@ -0,0 +1,76 @@ +// 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' + deployParameters: string(loadJsonContent('{{ deployParametersPath }}')) + 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('{{ configuration.valueMappingsPath }}')) + } + } + } + {%- endfor %} + ] + } + } +} \ No newline at end of file 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..0439097e8d0 --- /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..3aaa6ca25d6 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nfd/vnf_nfd_generator.py @@ -0,0 +1,323 @@ +# -------------------------------------------------------------------------------------- +# 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", +} + + +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, 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/nsd_generator.py b/src/aosm/azext_aosm/generate_nsd/nsd_generator.py new file mode 100644 index 00000000000..18c81f3731d --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/nsd_generator.py @@ -0,0 +1,348 @@ +# -------------------------------------------------------------------------------------- +# 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 copy +import os +import shutil +import tempfile +from functools import cached_property +from typing import Any, Dict, Optional + +from jinja2 import Template +from knack.log import get_logger + +from azext_aosm._configuration import NSConfiguration +from azext_aosm.util.constants import ( + CNF, + CONFIG_MAPPINGS_DIR_NAME, + NF_DEFINITION_BICEP_FILENAME, + NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE, + NSD_ARTIFACT_MANIFEST_BICEP_FILENAME, + NSD_ARTIFACT_MANIFEST_SOURCE_TEMPLATE_FILENAME, + NSD_CONFIG_MAPPING_FILENAME, + NSD_BICEP_FILENAME, + NSD_DEFINITION_JINJA2_SOURCE_TEMPLATE, + SCHEMAS_DIR_NAME, + TEMPLATES_DIR_NAME, + VNF, +) +from azext_aosm.util.management_clients import ApiClients +from azext_aosm.vendored_sdks.models import NetworkFunctionDefinitionVersion, NFVIType + +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: + """ + 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.nf_bicep_template_name = NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE + self.nsd_bicep_output_name = NSD_BICEP_FILENAME + self.nfdv_parameter_name = ( + f"{self.config.network_function_definition_group_name.replace('-', '_')}" + "_nfd_version" + ) + nfdv = self._get_nfdv(config, api_clients) + print("Finding the deploy parameters of the NFDV resource") + if not nfdv.deploy_parameters: + raise NotImplementedError( + "NFDV has no deploy parameters, cannot generate NSD." + ) + self.deploy_parameters: Optional[Dict[str, Any]] = json.loads( + nfdv.deploy_parameters + ) + + # pylint: disable=no-self-use + def _get_nfdv( + self, config: NSConfiguration, api_clients + ) -> NetworkFunctionDefinitionVersion: + """Get the existing NFDV resource object.""" + print( + "Reading existing NFDV resource object " + f"{config.network_function_definition_version_name} from group " + f"{config.network_function_definition_group_name}" + ) + nfdv_object = api_clients.aosm_client.network_function_definition_versions.get( + resource_group_name=config.publisher_resource_group_name, + publisher_name=config.publisher_name, + network_function_definition_group_name=config.network_function_definition_group_name, + network_function_definition_version_name=config.network_function_definition_version_name, + ) + return nfdv_object + + 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.tmp_folder_name = tmpdirname # pylint: disable=attribute-defined-outside-init + + self.create_config_group_schema_files() + self.write_nsd_manifest() + self.write_nf_bicep() + self.write_nsd_bicep() + + self.copy_to_output_folder() + 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. + + This function cannot be called before deployment parameters have been supplied. + """ + assert self.deploy_parameters + + # Take a copy of the deploy parameters. + cgs_dict = copy.deepcopy(self.deploy_parameters) + + # Re-title it. + cgs_dict["title"] = self.config.cg_schema_name + + # Add in the NFDV version as a parameter. + description_string = ( + f"The version of the {self.config.network_function_definition_group_name} " + "NFD to use. This version must be compatible with (have the same " + "parameters exposed as) " + f"{self.config.network_function_definition_version_name}." + ) + cgs_dict["properties"][self.nfdv_parameter_name] = { + "type": "string", + "description": description_string, + } + cgs_dict.setdefault("required", []).append(self.nfdv_parameter_name) + + 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." + ) + cgs_dict["properties"]["managedIdentity"] = { + "type": "string", + "description": managed_identity_description_string, + } + cgs_dict["required"].append("managedIdentity") + + if self.config.network_function_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}'" + ) + cgs_dict["properties"]["customLocationId"] = { + "type": "string", + "description": custom_location_description_string, + } + cgs_dict["required"].append("customLocationId") + + return cgs_dict + + def create_config_group_schema_files(self) -> None: + """Create the Schema and configMappings json files.""" + temp_schemas_folder_path = os.path.join(self.tmp_folder_name, SCHEMAS_DIR_NAME) + os.mkdir(temp_schemas_folder_path) + self.write_schema(temp_schemas_folder_path) + + temp_mappings_folder_path = os.path.join( + self.tmp_folder_name, CONFIG_MAPPINGS_DIR_NAME + ) + os.mkdir(temp_mappings_folder_path) + self.write_config_mappings(temp_mappings_folder_path) + + def write_schema(self, folder_path: str) -> None: + """ + Write out the NSD Config Group Schema JSON file. + + :param folder_path: The folder to put this file in. + """ + logger.debug("Create %s.json", self.config.cg_schema_name) + + schema_path = os.path.join(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_mappings(self, folder_path: str) -> None: + """ + Write out the NSD configMappings.json file. + + :param folder_path: The folder to put this file in. + """ + deploy_properties = self.config_group_schema_dict["properties"] + + logger.debug("Create configMappings.json") + config_mappings = { + key: f"{{configurationparameters('{self.config.cg_schema_name}').{key}}}" + for key in deploy_properties + } + + config_mappings_path = os.path.join(folder_path, NSD_CONFIG_MAPPING_FILENAME) + + with open(config_mappings_path, "w", encoding="utf-8") as _file: + _file.write(json.dumps(config_mappings, indent=4)) + + logger.debug("%s created", config_mappings_path) + + def write_nf_bicep(self) -> None: + """Write out the Network Function bicep file.""" + bicep_params = "" + + bicep_deploymentValues = "" + + if not self.deploy_parameters or not self.deploy_parameters.get("properties"): + raise ValueError( + f"NFDV in {self.config.network_function_definition_group_name} has " + "no properties within deployParameters" + ) + deploy_properties = self.deploy_parameters["properties"] + logger.debug("Deploy properties: %s", deploy_properties) + + for key, value in deploy_properties.items(): + # location is sometimes part of deploy_properties. + # We want to avoid having duplicate params in the bicep template + logger.debug( + "Adding deploy parameter key: %s, value: %s to nf template", key, value + ) + if key != "location": + bicep_type = ( + NFV_TO_BICEP_PARAM_TYPES.get(value["type"]) or value["type"] + ) + bicep_params += f"param {key} {bicep_type}\n" + bicep_deploymentValues += f"{key}: {key}\n " + + # pylint: disable=no-member + self.generate_bicep( + self.nf_bicep_template_name, + NF_DEFINITION_BICEP_FILENAME, + { + "bicep_params": bicep_params, + "deploymentValues": bicep_deploymentValues, + "network_function_name": self.config.network_function_name, + "publisher_name": self.config.publisher_name, + "network_function_definition_group_name": ( + self.config.network_function_definition_group_name + ), + "network_function_definition_version_parameter": ( + self.nfdv_parameter_name + ), + "network_function_definition_offering_location": ( + self.config.network_function_definition_offering_location + ), + "location": self.config.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] + if self.config.network_function_type == VNF + else NFVIType.AZURE_ARC_KUBERNETES.value # type: ignore[attr-defined] + ), + "CNF": self.config.network_function_type == CNF, + }, + ) + + def write_nsd_bicep(self) -> None: + """Write out the NSD bicep file.""" + params = { + "nfvi_site_name": self.config.nfvi_site_name, + "armTemplateName": self.config.arm_template_artifact_name, + "armTemplateVersion": self.config.arm_template.version, + "cg_schema_name": self.config.cg_schema_name, + "nsdv_description": self.config.nsdv_description, + "ResourceElementName": self.config.resource_element_name, + } + + self.generate_bicep( + self.nsd_bicep_template_name, self.nsd_bicep_output_name, params + ) + + def write_nsd_manifest(self) -> None: + """Write out the NSD manifest bicep file.""" + logger.debug("Create NSD manifest") + + self.generate_bicep( + NSD_ARTIFACT_MANIFEST_SOURCE_TEMPLATE_FILENAME, + NSD_ARTIFACT_MANIFEST_BICEP_FILENAME, + {}, + ) + + def generate_bicep( + self, 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) + + bicep_file_build_path = os.path.join(self.tmp_folder_name, output_file_name) + + with open(bicep_file_build_path, "w", encoding="utf-8") as file: + file.write(rendered_template) + + def copy_to_output_folder(self) -> 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( + self.tmp_folder_name, + 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..4dcdcf18114 --- /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 acrManifestName string +@description('The name under which to store the ARM template') +param armTemplateName 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 + +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 acrArtifactManifest 'Microsoft.Hybridnetwork/publishers/artifactStores/artifactManifests@2023-04-01-preview' = { + parent: acrArtifactStore + name: acrManifestName + location: location + properties: { + artifacts: [ + { + artifactName: armTemplateName + 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..8cf4a207a23 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/templates/nf_template.bicep.j2 @@ -0,0 +1,66 @@ +// 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 + +{{bicep_params}} + +var deploymentValues = { + {{deploymentValues}} +} + +var identityObject = (managedIdentity == '') ? { + type: 'SystemAssigned' +} : { + type: 'UserAssigned' + userAssignedIdentities: { + '${managedIdentity}': {} + } +} + +resource nf_resource 'Microsoft.HybridNetwork/networkFunctions@2023-04-01-preview' = { + name: '{{network_function_name}}' + 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(deploymentValues) + } +} 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..3570adf0247 --- /dev/null +++ b/src/aosm/azext_aosm/generate_nsd/templates/nsd_template.bicep.j2 @@ -0,0 +1,116 @@ +// 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}}' +@description('The version that you want to name the NF template artifact, in format A-B-C. e.g. 6-13-0. Suggestion that this matches as best possible the SIMPL released version. If testing for development, you can use any numbers you like.') +param armTemplateVersion string = '{{armTemplateVersion}}' +@description('Name of the NF template artifact') +var armTemplateName = '{{armTemplateName}}' + +// 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. +// You can either create one especially for SIMPL or share a manifest with other NSDs. In this example +// the artifact store is expected to be shared and should be created upfront. +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: [ + { + name: '{{ResourceElementName}}' + // 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: armTemplateName + artifactVersion: armTemplateVersion + } + templateType: 'ArmTemplate' + // The parameter values map values from the CG schema, to values required by the template + // deployed by this resource element. + // This NSD does not support the NF-Agent as it has no Configuration Resource Elements. + // If Configuration resource elements (SDFs, Perimeta config) are added, the configMapping + // must be edited to have these lines (instead of blank values. SNSSelf is null if there are no Configuration elements) + // "": "{configurationparameters('SNSSelf').nfAgentConfiguration.resourceNamespace}", + // "": "{configurationparameters('SNSSelf').nfAgentConfiguration.userAssignedIdentityResourceId}", + parameterValues: string(loadJsonContent('configMappings/configMappings.json')) + } + dependsOnProfile: { + installDependsOn: [] + uninstallDependsOn: [] + updateDependsOn: [] + } + } + ] + } +} 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/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..8cccdaebfa8 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_nsd/input.json @@ -0,0 +1,13 @@ +{ + "location": "eastus", + "publisher_name": "jamie-mobile-publisher", + "publisher_resource_group_name": "Jamie-publisher", + "acr_artifact_store_name": "ubuntu-acr", + "network_function_definition_group_name": "ubuntu-vm-nfdg", + "network_function_definition_version_name": "1.0.0", + "network_function_definition_offering_location": "eastus", + "network_function_type": "vnf", + "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.json b/src/aosm/azext_aosm/tests/latest/mock_vnf/input.json new file mode 100644 index 00000000000..b3a3b991a1d --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/mock_vnf/input.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/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/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_cnf.py b/src/aosm/azext_aosm/tests/latest/test_cnf.py new file mode 100644 index 00000000000..05f6ead7c5a --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_cnf.py @@ -0,0 +1,65 @@ +# -------------------------------------------------------------------------------------------- +# 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..0046b2aaf95 --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_nsd.py @@ -0,0 +1,90 @@ +# -------------------------------------------------------------------------------------------- +# 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 +import json +from pathlib import Path +from unittest.mock import patch +from tempfile import TemporaryDirectory +from typing import Any, Dict + +from azext_aosm.custom import generate_design_config, build_design + +mock_nsd_folder = ((Path(__file__).parent) / "mock_nsd").resolve() + + +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. + """ + # 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". + 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"}, + }, + } + + deploy_parameters_string = json.dumps(deploy_parameters) + + @dataclass + class NFDV: + deploy_parameters: Dict[str, Any] + + nfdv = NFDV(deploy_parameters_string) + + class NFDVs: + def get(self, **_): + return nfdv + + 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 + + cmd = FakeCmd() + + starting_directory = os.getcwd() + with TemporaryDirectory() as test_dir: + os.chdir(test_dir) + + try: + build_design( + cmd, + client=mock_client, + config_file=str(mock_nsd_folder / "input.json"), + ) + assert os.path.exists("nsd-bicep-templates") + 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..b44574ef6bb --- /dev/null +++ b/src/aosm/azext_aosm/tests/latest/test_vnf.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 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.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.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..d2f0f529f7c --- /dev/null +++ b/src/aosm/azext_aosm/util/constants.py @@ -0,0 +1,88 @@ +# -------------------------------------------------------------------------------------------- +# 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.""" + +# The types of definition that can be generated +VNF = "vnf" +CNF = "cnf" +NSD = "nsd" +SCHEMA = "schema" + +# Skip steps +BICEP_PUBLISH = "bicep-publish" +ARTIFACT_UPLOAD = "artifact-upload" + +# Names of files used in the repo + +NF_TEMPLATE_JINJA2_SOURCE_TEMPLATE = "nf_template.bicep.j2" +NF_DEFINITION_BICEP_FILENAME = "nf_definition.bicep" +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_JSON_FILENAME = "artifact_manifest.json" +NSD_CONFIG_MAPPING_FILENAME = "configMappings.json" +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/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.md b/src/aosm/setup.md new file mode 100644 index 00000000000..0c2a9659cbe --- /dev/null +++ b/src/aosm/setup.md @@ -0,0 +1,55 @@ +### 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 . + +# 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 +```bash +azdev style aosm +azdev linter --include-whl-extensions aosm +(Not written any tests yet) +azdev test aosm +``` +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 +``` diff --git a/src/aosm/setup.py b/src/aosm/setup.py new file mode 100644 index 00000000000..c3af671b370 --- /dev/null +++ b/src/aosm/setup.py @@ -0,0 +1,65 @@ +#!/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 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.6", + "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.18", "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/*", + ] + }, +)