diff --git a/src/operationsmanagement/HISTORY.rst b/src/operationsmanagement/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/operationsmanagement/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/operationsmanagement/README.md b/src/operationsmanagement/README.md new file mode 100644 index 00000000000..33908ecae2d --- /dev/null +++ b/src/operationsmanagement/README.md @@ -0,0 +1,75 @@ +# Azure CLI operationsmanagement Extension # +This is the extension for operationsmanagement + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name operationsmanagement +``` + +### Included Features ### +#### operationsmanagement solution #### +##### Create ##### +``` +az operationsmanagement solution create --location "East US" \ + --plan name="name1" product="product1" promotion-code="promocode1" publisher="publisher1" \ + --properties contained-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider1/resources/resource1" contained-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider2/resources/resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider1/resources/resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider2/resources/resource3" workspace-resource-id="/subscriptions/sub2/resourceGroups/rg2/providers/Microsoft.OperationalInsights/workspaces/ws1" \ + --resource-group "rg1" --name "solution1" +``` +##### Show ##### +``` +az operationsmanagement solution show --resource-group "rg1" --name "solution1" +``` +##### List ##### +``` +az operationsmanagement solution list --resource-group "rg1" +``` +##### Update ##### +``` +az operationsmanagement solution update --tags Dept="IT" Environment="Test" --resource-group "rg1" --name "solution1" +``` +##### Delete ##### +``` +az operationsmanagement solution delete --resource-group "rg1" --name "solution1" +``` +#### operationsmanagement management-association #### +##### Create ##### +``` +az operationsmanagement management-association create --name "managementAssociation1" --location "East US" \ + --application-id "/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.Appliance/Appliances/appliance1" \ + --provider-name "providerName" --resource-group "rg1" --resource-name "resourceName" \ + --resource-type "resourceType" +``` +##### Show ##### +``` +az operationsmanagement management-association show --name "managementAssociation1" --provider-name "providerName" \ + --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +``` +##### List ##### +``` +az operationsmanagement management-association list +``` +##### Delete ##### +``` +az operationsmanagement management-association delete --name "managementAssociationName" \ + --provider-name "providerName" --resource-group "rg1" --resource-name "resourceName" \ + --resource-type "resourceType" +``` +#### operationsmanagement management-configuration #### +##### Create ##### +``` +az operationsmanagement management-configuration create --name "managementConfiguration1" --location "East US" \ + --resource-group "rg1" +``` +##### Show ##### +``` +az operationsmanagement management-configuration show --name "managementConfigurationName" --resource-group "rg1" +``` +##### List ##### +``` +az operationsmanagement management-configuration list +``` +##### Delete ##### +``` +az operationsmanagement management-configuration delete --name "managementConfigurationName" --resource-group "rg1" +``` \ No newline at end of file diff --git a/src/operationsmanagement/azext_operationsmanagement/__init__.py b/src/operationsmanagement/azext_operationsmanagement/__init__.py new file mode 100644 index 00000000000..ec9dfaa23a8 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_operationsmanagement.generated._help import helps # pylint: disable=unused-import +try: + from azext_operationsmanagement.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class OperationsManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_operationsmanagement.generated._client_factory import cf_operationsmanagement_cl + operationsmanagement_custom = CliCommandType( + operations_tmpl='azext_operationsmanagement.custom#{}', + client_factory=cf_operationsmanagement_cl) + parent = super(OperationsManagementClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=operationsmanagement_custom) + + def load_command_table(self, args): + from azext_operationsmanagement.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_operationsmanagement.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_operationsmanagement.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_operationsmanagement.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = OperationsManagementClientCommandsLoader diff --git a/src/operationsmanagement/azext_operationsmanagement/action.py b/src/operationsmanagement/azext_operationsmanagement/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/action.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. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/operationsmanagement/azext_operationsmanagement/azext_metadata.json b/src/operationsmanagement/azext_operationsmanagement/azext_metadata.json new file mode 100644 index 00000000000..cfc30c747c7 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/operationsmanagement/azext_operationsmanagement/custom.py b/src/operationsmanagement/azext_operationsmanagement/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/custom.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. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/__init__.py b/src/operationsmanagement/azext_operationsmanagement/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/_client_factory.py b/src/operationsmanagement/azext_operationsmanagement/generated/_client_factory.py new file mode 100644 index 00000000000..fb94642ffa3 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/_client_factory.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def cf_operationsmanagement_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_operationsmanagement.vendored_sdks.operationsmanagement import OperationsManagementClient + return get_mgmt_service_client(cli_ctx, + OperationsManagementClient) + + +def cf_solution(cli_ctx, *_): + return cf_operationsmanagement_cl(cli_ctx).solutions + + +def cf_management_association(cli_ctx, *_): + return cf_operationsmanagement_cl(cli_ctx).management_associations + + +def cf_management_configuration(cli_ctx, *_): + return cf_operationsmanagement_cl(cli_ctx).management_configurations diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/_help.py b/src/operationsmanagement/azext_operationsmanagement/generated/_help.py new file mode 100644 index 00000000000..8c0f7fb343c --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/_help.py @@ -0,0 +1,231 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['operationsmanagement solution'] = """ + type: group + short-summary: Manage solution with operationsmanagement +""" + +helps['operationsmanagement solution list'] = """ + type: command + short-summary: "Retrieves the solution list. It will retrieve both first party and third party solutions And \ +Retrieves the solution list. It will retrieve both first party and third party solutions." + examples: + - name: SolutionList + text: |- + az operationsmanagement solution list --resource-group "rg1" + - name: SolutionList + text: |- + az operationsmanagement solution list +""" + +helps['operationsmanagement solution show'] = """ + type: command + short-summary: "Retrieves the user solution." + examples: + - name: SolutionGet + text: |- + az operationsmanagement solution show --resource-group "rg1" --name "solution1" +""" + +helps['operationsmanagement solution create'] = """ + type: command + short-summary: "Create the Solution." + parameters: + - name: --plan + short-summary: "Plan for solution object supported by the OperationsManagement resource provider." + long-summary: | + Usage: --plan name=XX publisher=XX promotion-code=XX product=XX + + name: name of the solution to be created. For Microsoft published solution it should be in the format of \ +solutionType(workspaceName). SolutionType part is case sensitive. For third party solution, it can be anything. + publisher: Publisher name. For gallery solution, it is Microsoft. + promotion-code: promotionCode, Not really used now, can you left as empty + product: name of the solution to enabled/add. For Microsoft published gallery solution it should be in the \ +format of OMSGallery/. This is case sensitive + - name: --properties + short-summary: "Properties for solution object supported by the OperationsManagement resource provider." + long-summary: | + Usage: --properties workspace-resource-id=XX contained-resources=XX referenced-resources=XX + + workspace-resource-id: Required. The azure resourceId for the workspace where the solution will be \ +deployed/enabled. + contained-resources: The azure resources that will be contained within the solutions. They will be locked \ +and gets deleted automatically when the solution is deleted. + referenced-resources: The resources that will be referenced from this solution. Deleting any of those \ +solution out of band will break the solution. + examples: + - name: SolutionCreate + text: |- + az operationsmanagement solution create --location "East US" --plan name="name1" product="product1" \ +promotion-code="promocode1" publisher="publisher1" --properties contained-resources="/subscriptions/sub2/resourceGroups\ +/rg2/providers/provider1/resources/resource1" contained-resources="/subscriptions/sub2/resourceGroups/rg2/providers/pro\ +vider2/resources/resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider1/resources/\ +resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider2/resources/resource3" \ +workspace-resource-id="/subscriptions/sub2/resourceGroups/rg2/providers/Microsoft.OperationalInsights/workspaces/ws1" \ +--resource-group "rg1" --name "solution1" +""" + +helps['operationsmanagement solution update'] = """ + type: command + short-summary: "Patch a Solution. Only updating tags supported." + examples: + - name: SolutionUpdate + text: |- + az operationsmanagement solution update --tags Dept="IT" Environment="Test" --resource-group "rg1" \ +--name "solution1" +""" + +helps['operationsmanagement solution delete'] = """ + type: command + short-summary: "Deletes the solution in the subscription." + examples: + - name: SolutionDelete + text: |- + az operationsmanagement solution delete --resource-group "rg1" --name "solution1" +""" + +helps['operationsmanagement solution wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the operationsmanagement solution is met. + examples: + - name: Pause executing next line of CLI script until the operationsmanagement solution is successfully created. + text: |- + az operationsmanagement solution wait --resource-group "rg1" --name "solution1" --created + - name: Pause executing next line of CLI script until the operationsmanagement solution is successfully updated. + text: |- + az operationsmanagement solution wait --resource-group "rg1" --name "solution1" --updated + - name: Pause executing next line of CLI script until the operationsmanagement solution is successfully deleted. + text: |- + az operationsmanagement solution wait --resource-group "rg1" --name "solution1" --deleted +""" + +helps['operationsmanagement management-association'] = """ + type: group + short-summary: Manage management association with operationsmanagement +""" + +helps['operationsmanagement management-association list'] = """ + type: command + short-summary: "Retrieves the ManagementAssociations list." + examples: + - name: SolutionList + text: |- + az operationsmanagement management-association list +""" + +helps['operationsmanagement management-association show'] = """ + type: command + short-summary: "Retrieves the user ManagementAssociation." + examples: + - name: SolutionGet + text: |- + az operationsmanagement management-association show --name "managementAssociation1" --provider-name \ +"providerName" --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +""" + +helps['operationsmanagement management-association create'] = """ + type: command + short-summary: "Create the ManagementAssociation." + examples: + - name: SolutionCreate + text: |- + az operationsmanagement management-association create --name "managementAssociation1" --location "East \ +US" --application-id "/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.Appliance/Appliances/appliance1" \ +--provider-name "providerName" --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +""" + +helps['operationsmanagement management-association update'] = """ + type: command + short-summary: "Update the ManagementAssociation." +""" + +helps['operationsmanagement management-association delete'] = """ + type: command + short-summary: "Deletes the ManagementAssociation in the subscription." + examples: + - name: SolutionDelete + text: |- + az operationsmanagement management-association delete --name "managementAssociationName" \ +--provider-name "providerName" --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +""" + +helps['operationsmanagement management-configuration'] = """ + type: group + short-summary: Manage management configuration with operationsmanagement +""" + +helps['operationsmanagement management-configuration list'] = """ + type: command + short-summary: "Retrieves the ManagementConfigurations list." + examples: + - name: SolutionList + text: |- + az operationsmanagement management-configuration list +""" + +helps['operationsmanagement management-configuration show'] = """ + type: command + short-summary: "Retrieves the user ManagementConfiguration." + examples: + - name: SolutionGet + text: |- + az operationsmanagement management-configuration show --name "managementConfigurationName" \ +--resource-group "rg1" +""" + +helps['operationsmanagement management-configuration create'] = """ + type: command + short-summary: "Create the ManagementConfiguration." + parameters: + - name: --properties-parameters + short-summary: "Parameters to run the ARM template" + long-summary: | + Usage: --properties-parameters name=XX value=XX + + name: name of the parameter. + value: value for the parameter. In Jtoken + + Multiple actions can be specified by using more than one --properties-parameters argument. + examples: + - name: ManagementConfigurationCreate + text: |- + az operationsmanagement management-configuration create --name "managementConfiguration1" --location \ +"East US" --resource-group "rg1" +""" + +helps['operationsmanagement management-configuration update'] = """ + type: command + short-summary: "Update the ManagementConfiguration." + parameters: + - name: --properties-parameters + short-summary: "Parameters to run the ARM template" + long-summary: | + Usage: --properties-parameters name=XX value=XX + + name: name of the parameter. + value: value for the parameter. In Jtoken + + Multiple actions can be specified by using more than one --properties-parameters argument. +""" + +helps['operationsmanagement management-configuration delete'] = """ + type: command + short-summary: "Deletes the ManagementConfiguration in the subscription." + examples: + - name: ManagementConfigurationDelete + text: |- + az operationsmanagement management-configuration delete --name "managementConfigurationName" \ +--resource-group "rg1" +""" diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/_params.py b/src/operationsmanagement/azext_operationsmanagement/generated/_params.py new file mode 100644 index 00000000000..de1adf32495 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/_params.py @@ -0,0 +1,140 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import ( + get_default_location_from_resource_group, + validate_file_or_dict +) +from azext_operationsmanagement.action import ( + AddPlan, + AddProperties, + AddPropertiesParameters +) + + +def load_arguments(self, _): + + with self.argument_context('operationsmanagement solution list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('operationsmanagement solution show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('solution_name', options_list=['--name', '-n', '--solution-name'], type=str, help='User Solution ' + 'Name.') + + with self.argument_context('operationsmanagement solution create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('solution_name', options_list=['--name', '-n', '--solution-name'], type=str, help='User Solution ' + 'Name.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('plan', action=AddPlan, nargs='+', help='Plan for solution object supported by the ' + 'OperationsManagement resource provider.') + c.argument('properties', action=AddProperties, nargs='+', help='Properties for solution object supported by ' + 'the OperationsManagement resource provider.') + + with self.argument_context('operationsmanagement solution update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('solution_name', options_list=['--name', '-n', '--solution-name'], type=str, help='User Solution ' + 'Name.') + c.argument('tags', tags_type) + + with self.argument_context('operationsmanagement solution delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('solution_name', options_list=['--name', '-n', '--solution-name'], type=str, help='User Solution ' + 'Name.') + + with self.argument_context('operationsmanagement solution wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('solution_name', options_list=['--name', '-n', '--solution-name'], type=str, help='User Solution ' + 'Name.') + + with self.argument_context('operationsmanagement management-association show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('provider_name', type=str, help='Provider name for the parent resource.') + c.argument('resource_type', type=str, help='Resource type for the parent resource') + c.argument('resource_name', type=str, help='Parent resource name.') + c.argument('management_association_name', options_list=['--name', '-n', '--management-association-name'], + type=str, help='User ManagementAssociation Name.') + + with self.argument_context('operationsmanagement management-association create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('provider_name', type=str, help='Provider name for the parent resource.') + c.argument('resource_type', type=str, help='Resource type for the parent resource') + c.argument('resource_name', type=str, help='Parent resource name.') + c.argument('management_association_name', options_list=['--name', '-n', '--management-association-name'], + type=str, help='User ManagementAssociation Name.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('application_id', type=str, help='The applicationId of the appliance for this association.') + + with self.argument_context('operationsmanagement management-association update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('provider_name', type=str, help='Provider name for the parent resource.') + c.argument('resource_type', type=str, help='Resource type for the parent resource') + c.argument('resource_name', type=str, help='Parent resource name.') + c.argument('management_association_name', options_list=['--name', '-n', '--management-association-name'], + type=str, help='User ManagementAssociation Name.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('application_id', type=str, help='The applicationId of the appliance for this association.') + c.ignore('parameters') + + with self.argument_context('operationsmanagement management-association delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('provider_name', type=str, help='Provider name for the parent resource.') + c.argument('resource_type', type=str, help='Resource type for the parent resource') + c.argument('resource_name', type=str, help='Parent resource name.') + c.argument('management_association_name', options_list=['--name', '-n', '--management-association-name'], + type=str, help='User ManagementAssociation Name.') + + with self.argument_context('operationsmanagement management-configuration show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('management_configuration_name', options_list=['--name', '-n', '--management-configuration-name'], + type=str, help='User Management Configuration Name.') + + with self.argument_context('operationsmanagement management-configuration create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('management_configuration_name', options_list=['--name', '-n', '--management-configuration-name'], + type=str, help='User Management Configuration Name.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('application_id', type=str, help='The applicationId of the appliance for this Management.') + c.argument('parent_resource_type', type=str, help='The type of the parent resource.') + c.argument('properties_parameters', action=AddPropertiesParameters, nargs='+', help='Parameters to run the ARM ' + 'template') + c.argument('template', type=validate_file_or_dict, help='The Json object containing the ARM template to deploy ' + 'Expected value: json-string/@json-file.') + + with self.argument_context('operationsmanagement management-configuration update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('management_configuration_name', options_list=['--name', '-n', '--management-configuration-name'], + type=str, help='User Management Configuration Name.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('application_id', type=str, help='The applicationId of the appliance for this Management.') + c.argument('parent_resource_type', type=str, help='The type of the parent resource.') + c.argument('properties_parameters', action=AddPropertiesParameters, nargs='+', help='Parameters to run the ARM ' + 'template') + c.argument('template', type=validate_file_or_dict, help='The Json object containing the ARM template to deploy ' + 'Expected value: json-string/@json-file.') + + with self.argument_context('operationsmanagement management-configuration delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('management_configuration_name', options_list=['--name', '-n', '--management-configuration-name'], + type=str, help='User Management Configuration Name.') diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/_validators.py b/src/operationsmanagement/azext_operationsmanagement/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/action.py b/src/operationsmanagement/azext_operationsmanagement/generated/action.py new file mode 100644 index 00000000000..06a6737642d --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/action.py @@ -0,0 +1,101 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from collections import defaultdict +from knack.util import CLIError + + +class AddPlan(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.plan = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'publisher': + d['publisher'] = v[0] + elif kl == 'promotion-code': + d['promotion_code'] = v[0] + elif kl == 'product': + d['product'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter plan. All possible keys are: name, ' + 'publisher, promotion-code, product'.format(k)) + return d + + +class AddProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'workspace-resource-id': + d['workspace_resource_id'] = v[0] + elif kl == 'contained-resources': + d['contained_resources'] = v + elif kl == 'referenced-resources': + d['referenced_resources'] = v + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'workspace-resource-id, contained-resources, referenced-resources'.format(k)) + return d + + +class AddPropertiesParameters(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddPropertiesParameters, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'value': + d['value'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties_parameters. All possible keys ' + 'are: name, value'.format(k)) + return d diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/commands.py b/src/operationsmanagement/azext_operationsmanagement/generated/commands.py new file mode 100644 index 00000000000..aef318806b3 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/commands.py @@ -0,0 +1,60 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_operationsmanagement.generated._client_factory import cf_solution + operationsmanagement_solution = CliCommandType( + operations_tmpl='azext_operationsmanagement.vendored_sdks.operationsmanagement.operations._solutions_operations' + '#SolutionsOperations.{}', + client_factory=cf_solution) + with self.command_group('operationsmanagement solution', operationsmanagement_solution, + client_factory=cf_solution) as g: + g.custom_command('list', 'operationsmanagement_solution_list') + g.custom_show_command('show', 'operationsmanagement_solution_show') + g.custom_command('create', 'operationsmanagement_solution_create', supports_no_wait=True) + g.custom_command('update', 'operationsmanagement_solution_update', supports_no_wait=True) + g.custom_command('delete', 'operationsmanagement_solution_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'operationsmanagement_solution_show') + + from azext_operationsmanagement.generated._client_factory import cf_management_association + operationsmanagement_management_association = CliCommandType( + operations_tmpl='azext_operationsmanagement.vendored_sdks.operationsmanagement.operations._management_associati' + 'ons_operations#ManagementAssociationsOperations.{}', + client_factory=cf_management_association) + with self.command_group('operationsmanagement management-association', operationsmanagement_management_association, + client_factory=cf_management_association) as g: + g.custom_command('list', 'operationsmanagement_management_association_list') + g.custom_show_command('show', 'operationsmanagement_management_association_show') + g.custom_command('create', 'operationsmanagement_management_association_create') + g.generic_update_command('update', custom_func_name='operationsmanagement_management_association_update') + g.custom_command('delete', 'operationsmanagement_management_association_delete', confirmation=True) + + from azext_operationsmanagement.generated._client_factory import cf_management_configuration + operationsmanagement_management_configuration = CliCommandType( + operations_tmpl='azext_operationsmanagement.vendored_sdks.operationsmanagement.operations._management_configura' + 'tions_operations#ManagementConfigurationsOperations.{}', + client_factory=cf_management_configuration) + with self.command_group('operationsmanagement management-configuration', + operationsmanagement_management_configuration, + client_factory=cf_management_configuration) as g: + g.custom_command('list', 'operationsmanagement_management_configuration_list') + g.custom_show_command('show', 'operationsmanagement_management_configuration_show') + g.custom_command('create', 'operationsmanagement_management_configuration_create') + g.custom_command('update', 'operationsmanagement_management_configuration_update') + g.custom_command('delete', 'operationsmanagement_management_configuration_delete', confirmation=True) + + with self.command_group('operationsmanagement', is_experimental=True): + pass diff --git a/src/operationsmanagement/azext_operationsmanagement/generated/custom.py b/src/operationsmanagement/azext_operationsmanagement/generated/custom.py new file mode 100644 index 00000000000..29bf66c6753 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/generated/custom.py @@ -0,0 +1,194 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=unused-argument + +from azure.cli.core.util import sdk_no_wait + + +def operationsmanagement_solution_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def operationsmanagement_solution_show(client, + resource_group_name, + solution_name): + return client.get(resource_group_name=resource_group_name, + solution_name=solution_name) + + +def operationsmanagement_solution_create(client, + resource_group_name, + solution_name, + location=None, + tags=None, + plan=None, + properties=None, + no_wait=False): + parameters = {} + parameters['location'] = location + parameters['tags'] = tags + parameters['plan'] = plan + parameters['properties'] = properties + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_group_name=resource_group_name, + solution_name=solution_name, + parameters=parameters) + + +def operationsmanagement_solution_update(client, + resource_group_name, + solution_name, + tags=None, + no_wait=False): + parameters = {} + parameters['tags'] = tags + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + solution_name=solution_name, + parameters=parameters) + + +def operationsmanagement_solution_delete(client, + resource_group_name, + solution_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + solution_name=solution_name) + + +def operationsmanagement_management_association_list(client): + return client.list_by_subscription() + + +def operationsmanagement_management_association_show(client, + resource_group_name, + provider_name, + resource_type, + resource_name, + management_association_name): + return client.get(resource_group_name=resource_group_name, + provider_name=provider_name, + resource_type=resource_type, + resource_name=resource_name, + management_association_name=management_association_name) + + +def operationsmanagement_management_association_create(client, + resource_group_name, + provider_name, + resource_type, + resource_name, + management_association_name, + location=None, + application_id=None): + parameters = {} + parameters['location'] = location + parameters['properties'] = {} + parameters['properties']['application_id'] = application_id + return client.create_or_update(resource_group_name=resource_group_name, + provider_name=provider_name, + resource_type=resource_type, + resource_name=resource_name, + management_association_name=management_association_name, + parameters=parameters) + + +def operationsmanagement_management_association_update(instance, + resource_group_name, + provider_name, + resource_type, + resource_name, + management_association_name, + location=None, + application_id=None): + if location is not None: + instance.location = location + if application_id is not None: + instance.properties.application_id = application_id + return instance + + +def operationsmanagement_management_association_delete(client, + resource_group_name, + provider_name, + resource_type, + resource_name, + management_association_name): + return client.delete(resource_group_name=resource_group_name, + provider_name=provider_name, + resource_type=resource_type, + resource_name=resource_name, + management_association_name=management_association_name) + + +def operationsmanagement_management_configuration_list(client): + return client.list_by_subscription() + + +def operationsmanagement_management_configuration_show(client, + resource_group_name, + management_configuration_name): + return client.get(resource_group_name=resource_group_name, + management_configuration_name=management_configuration_name) + + +def operationsmanagement_management_configuration_create(client, + resource_group_name, + management_configuration_name, + properties_parameters, + location=None, + application_id=None, + parent_resource_type=None, + template=None): + parameters = {} + parameters['location'] = location + parameters['properties'] = {} + parameters['properties']['application_id'] = application_id + parameters['properties']['parent_resource_type'] = parent_resource_type + parameters['properties']['parameters'] = properties_parameters + parameters['properties']['template'] = template + return client.create_or_update(resource_group_name=resource_group_name, + management_configuration_name=management_configuration_name, + parameters=parameters) + + +def operationsmanagement_management_configuration_update(client, + resource_group_name, + management_configuration_name, + properties_parameters, + location=None, + application_id=None, + parent_resource_type=None, + template=None): + parameters = {} + parameters['location'] = location + parameters['properties'] = {} + parameters['properties']['application_id'] = application_id + parameters['properties']['parent_resource_type'] = parent_resource_type + parameters['properties']['parameters'] = properties_parameters + parameters['properties']['template'] = template + return client.create_or_update(resource_group_name=resource_group_name, + management_configuration_name=management_configuration_name, + parameters=parameters) + + +def operationsmanagement_management_configuration_delete(client, + resource_group_name, + management_configuration_name): + return client.delete(resource_group_name=resource_group_name, + management_configuration_name=management_configuration_name) diff --git a/src/operationsmanagement/azext_operationsmanagement/manual/__init__.py b/src/operationsmanagement/azext_operationsmanagement/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/manual/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/operationsmanagement/azext_operationsmanagement/tests/__init__.py b/src/operationsmanagement/azext_operationsmanagement/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/tests/__init__.py @@ -0,0 +1,116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/operationsmanagement/azext_operationsmanagement/tests/latest/__init__.py b/src/operationsmanagement/azext_operationsmanagement/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/operationsmanagement/azext_operationsmanagement/tests/latest/example_steps.py b/src/operationsmanagement/azext_operationsmanagement/tests/latest/example_steps.py new file mode 100644 index 00000000000..440944de94b --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/tests/latest/example_steps.py @@ -0,0 +1,173 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /ManagementAssociations/put/SolutionCreate +@try_manual +def step_management_association_create(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-association create ' + '--name "{myManagementAssociation}" ' + '--location "East US" ' + '--application-id "/subscriptions/{subscription_id}/resourcegroups/{rg}/providers/Microsoft.Appliance/Appl' + 'iances/appliance1" ' + '--provider-name "providerName" ' + '--resource-group "{rg}" ' + '--resource-name "resourceName" ' + '--resource-type "resourceType"', + checks=checks) + + +# EXAMPLE: /ManagementAssociations/get/SolutionGet +@try_manual +def step_management_association_show(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-association show ' + '--name "{myManagementAssociation}" ' + '--provider-name "providerName" ' + '--resource-group "{rg}" ' + '--resource-name "resourceName" ' + '--resource-type "resourceType"', + checks=checks) + + +# EXAMPLE: /ManagementAssociations/get/SolutionList +@try_manual +def step_management_association_list(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-association list', + checks=checks) + + +# EXAMPLE: /ManagementAssociations/delete/SolutionDelete +@try_manual +def step_management_association_delete(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-association delete -y ' + '--name "{myManagementAssociation2}" ' + '--provider-name "providerName" ' + '--resource-group "{rg}" ' + '--resource-name "resourceName" ' + '--resource-type "resourceType"', + checks=checks) + + +# EXAMPLE: /ManagementConfigurations/put/ManagementConfigurationCreate +@try_manual +def step_management_configuration_create(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-configuration create ' + '--name "{myManagementConfiguration2}" ' + '--location "East US" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /ManagementConfigurations/get/SolutionGet +@try_manual +def step_management_configuration_show(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-configuration show ' + '--name "{myManagementConfiguration}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /ManagementConfigurations/get/SolutionList +@try_manual +def step_management_configuration_list(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-configuration list', + checks=checks) + + +# EXAMPLE: /ManagementConfigurations/delete/ManagementConfigurationDelete +@try_manual +def step_management_configuration_delete(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement management-configuration delete -y ' + '--name "{myManagementConfiguration}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Solutions/put/SolutionCreate +@try_manual +def step_solution_create(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement solution create ' + '--location "East US" ' + '--plan name="name1" product="product1" promotion-code="promocode1" publisher="publisher1" ' + '--properties contained-resources="/subscriptions/{subscription_id}/resourceGroups/{rg_2}/providers/provid' + 'er1/resources/resource1" contained-resources="/subscriptions/{subscription_id}/resourceGroups/{rg_2}/prov' + 'iders/provider2/resources/resource2" referenced-resources="/subscriptions/{subscription_id}/resourceGroup' + 's/{rg_2}/providers/provider1/resources/resource2" referenced-resources="/subscriptions/{subscription_id}/' + 'resourceGroups/{rg_2}/providers/provider2/resources/resource3" workspace-resource-id="/subscriptions/{sub' + 'scription_id}/resourceGroups/{rg_2}/providers/Microsoft.OperationalInsights/workspaces/ws1" ' + '--resource-group "{rg}" ' + '--name "{mySolution}"', + checks=checks) + + +# EXAMPLE: /Solutions/get/SolutionGet +@try_manual +def step_solution_show(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement solution show ' + '--resource-group "{rg}" ' + '--name "{mySolution}"', + checks=checks) + + +# EXAMPLE: /Solutions/get/SolutionList +@try_manual +def step_solution_list(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement solution list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Solutions/patch/SolutionUpdate +@try_manual +def step_solution_update(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement solution update ' + '--tags Dept="IT" Environment="Test" ' + '--resource-group "{rg}" ' + '--name "{mySolution}"', + checks=checks) + + +# EXAMPLE: /Solutions/delete/SolutionDelete +@try_manual +def step_solution_delete(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az operationsmanagement solution delete -y ' + '--resource-group "{rg}" ' + '--name "{mySolution}"', + checks=checks) + diff --git a/src/operationsmanagement/azext_operationsmanagement/tests/latest/test_operationsmanagement_scenario.py b/src/operationsmanagement/azext_operationsmanagement/tests/latest/test_operationsmanagement_scenario.py new file mode 100644 index 00000000000..200a89f7085 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/tests/latest/test_operationsmanagement_scenario.py @@ -0,0 +1,132 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_management_association_create +from .example_steps import step_management_association_show +from .example_steps import step_management_association_list +from .example_steps import step_management_association_delete +from .example_steps import step_management_configuration_create +from .example_steps import step_management_configuration_show +from .example_steps import step_management_configuration_list +from .example_steps import step_management_configuration_delete +from .example_steps import step_solution_create +from .example_steps import step_solution_show +from .example_steps import step_solution_list +from .example_steps import step_solution_update +from .example_steps import step_solution_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup_scenario +@try_manual +def setup_scenario(test, rg_2, rg): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg_2, rg): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg_2, rg): + setup_scenario(test, rg_2, rg) + step_management_association_create(test, rg_2, rg, checks=[ + test.check("name", "{myManagementAssociation}", case_sensitive=False), + test.check("location", "East US", case_sensitive=False), + test.check("applicationId", "/subscriptions/{subscription_id}/resourcegroups/{rg}/providers/Microsoft.Appliance" + "/Appliances/appliance1", case_sensitive=False), + ]) + step_management_association_show(test, rg_2, rg, checks=[ + test.check("name", "{myManagementAssociation}", case_sensitive=False), + test.check("location", "East US", case_sensitive=False), + test.check("applicationId", "/subscriptions/{subscription_id}/resourcegroups/{rg}/providers/Microsoft.Appliance" + "/Appliances/appliance1", case_sensitive=False), + ]) + step_management_association_list(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_management_association_delete(test, rg_2, rg, checks=[]) + step_management_configuration_create(test, rg_2, rg, checks=[ + test.check("name", "{myManagementConfiguration2}", case_sensitive=False), + test.check("location", "East US", case_sensitive=False), + ]) + step_management_configuration_show(test, rg_2, rg, checks=[]) + step_management_configuration_list(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_management_configuration_delete(test, rg_2, rg, checks=[]) + step_solution_create(test, rg_2, rg, checks=[]) + step_solution_show(test, rg_2, rg, checks=[ + test.check("location", "East US", case_sensitive=False), + test.check("plan.name", "name1", case_sensitive=False), + test.check("plan.product", "product1", case_sensitive=False), + test.check("plan.promotionCode", "promocode1", case_sensitive=False), + test.check("plan.publisher", "publisher1", case_sensitive=False), + test.check("name", "{mySolution}", case_sensitive=False), + ]) + step_solution_list(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_solution_list(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_solution_update(test, rg_2, rg, checks=[ + test.check("location", "East US", case_sensitive=False), + test.check("plan.name", "name1", case_sensitive=False), + test.check("plan.product", "product1", case_sensitive=False), + test.check("plan.promotionCode", "promocode1", case_sensitive=False), + test.check("plan.publisher", "publisher1", case_sensitive=False), + test.check("name", "{mySolution}", case_sensitive=False), + test.check("tags.Dept", "IT", case_sensitive=False), + test.check("tags.Environment", "Test", case_sensitive=False), + ]) + step_solution_delete(test, rg_2, rg, checks=[]) + cleanup_scenario(test, rg_2, rg) + + +# Test class for Scenario +@try_manual +class OperationsmanagementScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(OperationsmanagementScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'mySolution': 'solution1', + 'myManagementAssociation': 'managementAssociation1', + 'myManagementAssociation2': 'managementAssociationName', + 'myManagementConfiguration': 'managementConfigurationName', + 'myManagementConfiguration2': 'managementConfiguration1', + }) + + + @ResourceGroupPreparer(name_prefix='clitestoperationsmanagement_rg2'[:7], key='rg_2', parameter_name='rg_2') + @ResourceGroupPreparer(name_prefix='clitestoperationsmanagement_rg1'[:7], key='rg', parameter_name='rg') + def test_operationsmanagement_Scenario(self, rg_2, rg): + call_scenario(self, rg_2, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/__init__.py new file mode 100644 index 00000000000..3d7f726a5a4 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations_management_client import OperationsManagementClient +__all__ = ['OperationsManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_configuration.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_configuration.py new file mode 100644 index 00000000000..7fe6377001e --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_configuration.py @@ -0,0 +1,70 @@ +# 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 ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class OperationsManagementClientConfiguration(Configuration): + """Configuration for OperationsManagementClient. + + 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: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(OperationsManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'operationsmanagementclient/{}'.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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_operations_management_client.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_operations_management_client.py new file mode 100644 index 00000000000..df4c948012d --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/_operations_management_client.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import OperationsManagementClientConfiguration +from .operations import SolutionsOperations +from .operations import ManagementAssociationsOperations +from .operations import ManagementConfigurationsOperations +from .operations import Operations +from . import models + + +class OperationsManagementClient(object): + """Operations Management Client. + + :ivar solutions: SolutionsOperations operations + :vartype solutions: operations_management_client.operations.SolutionsOperations + :ivar management_associations: ManagementAssociationsOperations operations + :vartype management_associations: operations_management_client.operations.ManagementAssociationsOperations + :ivar management_configurations: ManagementConfigurationsOperations operations + :vartype management_configurations: operations_management_client.operations.ManagementConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: operations_management_client.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = OperationsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.solutions = SolutionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_associations = ManagementAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_configurations = ManagementConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> OperationsManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/__init__.py new file mode 100644 index 00000000000..43ba214d677 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations_management_client import OperationsManagementClient +__all__ = ['OperationsManagementClient'] diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_configuration.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_configuration.py new file mode 100644 index 00000000000..0471c4698f1 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class OperationsManagementClientConfiguration(Configuration): + """Configuration for OperationsManagementClient. + + 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: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(OperationsManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'operationsmanagementclient/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_operations_management_client.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_operations_management_client.py new file mode 100644 index 00000000000..d20abbd299a --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/_operations_management_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import OperationsManagementClientConfiguration +from .operations import SolutionsOperations +from .operations import ManagementAssociationsOperations +from .operations import ManagementConfigurationsOperations +from .operations import Operations +from .. import models + + +class OperationsManagementClient(object): + """Operations Management Client. + + :ivar solutions: SolutionsOperations operations + :vartype solutions: operations_management_client.aio.operations.SolutionsOperations + :ivar management_associations: ManagementAssociationsOperations operations + :vartype management_associations: operations_management_client.aio.operations.ManagementAssociationsOperations + :ivar management_configurations: ManagementConfigurationsOperations operations + :vartype management_configurations: operations_management_client.aio.operations.ManagementConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: operations_management_client.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = OperationsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.solutions = SolutionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_associations = ManagementAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.management_configurations = ManagementConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "OperationsManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/__init__.py new file mode 100644 index 00000000000..2782e69839b --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/__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 ._solutions_operations import SolutionsOperations +from ._management_associations_operations import ManagementAssociationsOperations +from ._management_configurations_operations import ManagementConfigurationsOperations +from ._operations import Operations + +__all__ = [ + 'SolutionsOperations', + 'ManagementAssociationsOperations', + 'ManagementConfigurationsOperations', + 'Operations', +] diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_associations_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_associations_operations.py new file mode 100644 index 00000000000..71f7b817b80 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_associations_operations.py @@ -0,0 +1,321 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementAssociationsOperations: + """ManagementAssociationsOperations 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: ~operations_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_subscription( + self, + **kwargs + ) -> "models.ManagementAssociationPropertiesList": + """Retrieves the ManagementAssociations list for the subscription. + + Retrieves the ManagementAssociations list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociationPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociationPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociationPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociationPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/ManagementAssociations'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + provider_name: str, + resource_type: str, + resource_name: str, + management_association_name: str, + parameters: "models.ManagementAssociation", + **kwargs + ) -> "models.ManagementAssociation": + """Create/Update ManagementAssociation. + + Creates or updates the ManagementAssociation. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :param parameters: The parameters required to create ManagementAssociation extension. + :type parameters: ~operations_management_client.models.ManagementAssociation + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociation, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementAssociation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + provider_name: str, + resource_type: str, + resource_name: str, + management_association_name: str, + **kwargs + ) -> None: + """Deletes the ManagementAssociation. + + Deletes the ManagementAssociation in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + provider_name: str, + resource_type: str, + resource_name: str, + management_association_name: str, + **kwargs + ) -> "models.ManagementAssociation": + """Retrieve ManagementAssociation. + + Retrieves the user ManagementAssociation. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociation, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_configurations_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_configurations_operations.py new file mode 100644 index 00000000000..26b68b21036 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_management_configurations_operations.py @@ -0,0 +1,285 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagementConfigurationsOperations: + """ManagementConfigurationsOperations 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: ~operations_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_subscription( + self, + **kwargs + ) -> "models.ManagementConfigurationPropertiesList": + """Retrieves the ManagementConfigurations list for the subscription. + + Retrieves the ManagementConfigurations list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfigurationPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfigurationPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfigurationPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfigurationPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/ManagementConfigurations'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + management_configuration_name: str, + parameters: "models.ManagementConfiguration", + **kwargs + ) -> "models.ManagementConfiguration": + """Create/Update ManagementConfiguration. + + Creates or updates the ManagementConfiguration. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :param parameters: The parameters required to create OMS Solution. + :type parameters: ~operations_management_client.models.ManagementConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfiguration, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + management_configuration_name: str, + **kwargs + ) -> None: + """Deletes the ManagementConfiguration. + + Deletes the ManagementConfiguration in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + management_configuration_name: str, + **kwargs + ) -> "models.ManagementConfiguration": + """Retrieve ManagementConfiguration. + + Retrieves the user ManagementConfiguration. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfiguration, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_operations.py new file mode 100644 index 00000000000..c146da84bc3 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class 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: ~operations_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available OperationsManagement Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~operations_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.OperationsManagement/operations'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_solutions_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_solutions_operations.py new file mode 100644 index 00000000000..e4181eada92 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/aio/operations/_solutions_operations.py @@ -0,0 +1,584 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SolutionsOperations: + """SolutionsOperations 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: ~operations_management_client.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 _create_or_update_initial( + self, + resource_group_name: str, + solution_name: str, + parameters: "models.Solution", + **kwargs + ) -> "models.Solution": + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Solution') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + solution_name: str, + parameters: "models.Solution", + **kwargs + ) -> AsyncLROPoller["models.Solution"]: + """Create/Update Solution. + + Creates or updates the Solution. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :param parameters: The parameters required to create OMS Solution. + :type parameters: ~operations_management_client.models.Solution + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Solution or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~operations_management_client.models.Solution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + 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, + solution_name=solution_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + solution_name: str, + parameters: "models.SolutionPatch", + **kwargs + ) -> "models.Solution": + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SolutionPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + solution_name: str, + parameters: "models.SolutionPatch", + **kwargs + ) -> AsyncLROPoller["models.Solution"]: + """Patch a Solution. + + Patch a Solution. Only updating tags supported. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :param parameters: The parameters required to patch a Solution. + :type parameters: ~operations_management_client.models.SolutionPatch + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Solution or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~operations_management_client.models.Solution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + 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_initial( + resource_group_name=resource_group_name, + solution_name=solution_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + solution_name: str, + **kwargs + ) -> 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 = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + solution_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the solution. + + Deletes the solution in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: 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: + """ + 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, + solution_name=solution_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + solution_name: str, + **kwargs + ) -> "models.Solution": + """Retrieve solution. + + Retrieves the user solution. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Solution, or the result of cls(response) + :rtype: ~operations_management_client.models.Solution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + async def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "models.SolutionPropertiesList": + """Retrieves the solution list for the subscription. + + Retrieves the solution list. It will retrieve both first party and third party solutions. + + :param resource_group_name: The name of the resource group to get. 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: SolutionPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.SolutionPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SolutionPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SolutionPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions'} # type: ignore + + async def list_by_subscription( + self, + **kwargs + ) -> "models.SolutionPropertiesList": + """Retrieves the solution list for the subscription. + + Retrieves the solution list. It will retrieve both first party and third party solutions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SolutionPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.SolutionPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SolutionPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SolutionPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/solutions'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/__init__.py new file mode 100644 index 00000000000..045f264fe88 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/__init__.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ArmTemplateParameter + from ._models_py3 import CodeMessageError + from ._models_py3 import Error + from ._models_py3 import ManagementAssociation + from ._models_py3 import ManagementAssociationProperties + from ._models_py3 import ManagementAssociationPropertiesList + from ._models_py3 import ManagementConfiguration + from ._models_py3 import ManagementConfigurationProperties + from ._models_py3 import ManagementConfigurationPropertiesList + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import Solution + from ._models_py3 import SolutionPatch + from ._models_py3 import SolutionPlan + from ._models_py3 import SolutionProperties + from ._models_py3 import SolutionPropertiesList +except (SyntaxError, ImportError): + from ._models import ArmTemplateParameter # type: ignore + from ._models import CodeMessageError # type: ignore + from ._models import Error # type: ignore + from ._models import ManagementAssociation # type: ignore + from ._models import ManagementAssociationProperties # type: ignore + from ._models import ManagementAssociationPropertiesList # type: ignore + from ._models import ManagementConfiguration # type: ignore + from ._models import ManagementConfigurationProperties # type: ignore + from ._models import ManagementConfigurationPropertiesList # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import Solution # type: ignore + from ._models import SolutionPatch # type: ignore + from ._models import SolutionPlan # type: ignore + from ._models import SolutionProperties # type: ignore + from ._models import SolutionPropertiesList # type: ignore + +__all__ = [ + 'ArmTemplateParameter', + 'CodeMessageError', + 'Error', + 'ManagementAssociation', + 'ManagementAssociationProperties', + 'ManagementAssociationPropertiesList', + 'ManagementConfiguration', + 'ManagementConfigurationProperties', + 'ManagementConfigurationPropertiesList', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Solution', + 'SolutionPatch', + 'SolutionPlan', + 'SolutionProperties', + 'SolutionPropertiesList', +] diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models.py new file mode 100644 index 00000000000..9e8eb7738ae --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models.py @@ -0,0 +1,509 @@ +# 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 ArmTemplateParameter(msrest.serialization.Model): + """Parameter to pass to ARM template. + + :param name: name of the parameter. + :type name: str + :param value: value for the parameter. In Jtoken. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmTemplateParameter, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class CodeMessageError(msrest.serialization.Model): + """The error body contract. + + :param error: The error details for a failed request. + :type error: ~operations_management_client.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(CodeMessageError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class Error(msrest.serialization.Model): + """The error details for a failed request. + + :param code: The error type. + :type code: str + :param message: The error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ManagementAssociation(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param properties: Properties for ManagementAssociation object supported by the + OperationsManagement resource provider. + :type properties: ~operations_management_client.models.ManagementAssociationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagementAssociationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementAssociation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class ManagementAssociationProperties(msrest.serialization.Model): + """ManagementAssociation properties supported by the OperationsManagement resource provider. + + All required parameters must be populated in order to send to Azure. + + :param application_id: Required. The applicationId of the appliance for this association. + :type application_id: str + """ + + _validation = { + 'application_id': {'required': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementAssociationProperties, self).__init__(**kwargs) + self.application_id = kwargs['application_id'] + + +class ManagementAssociationPropertiesList(msrest.serialization.Model): + """the list of ManagementAssociation response. + + :param value: List of Management Association properties within the subscription. + :type value: list[~operations_management_client.models.ManagementAssociation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementAssociation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementAssociationPropertiesList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ManagementConfiguration(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param properties: Properties for ManagementConfiguration object supported by the + OperationsManagement resource provider. + :type properties: ~operations_management_client.models.ManagementConfigurationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagementConfigurationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementConfiguration, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class ManagementConfigurationProperties(msrest.serialization.Model): + """ManagementConfiguration properties supported by the OperationsManagement resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param application_id: The applicationId of the appliance for this Management. + :type application_id: str + :param parent_resource_type: Required. The type of the parent resource. + :type parent_resource_type: str + :param parameters: Required. Parameters to run the ARM template. + :type parameters: list[~operations_management_client.models.ArmTemplateParameter] + :ivar provisioning_state: The provisioning state for the ManagementConfiguration. + :vartype provisioning_state: str + :param template: Required. The Json object containing the ARM template to deploy. + :type template: object + """ + + _validation = { + 'parent_resource_type': {'required': True}, + 'parameters': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'template': {'required': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'parent_resource_type': {'key': 'parentResourceType', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '[ArmTemplateParameter]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementConfigurationProperties, self).__init__(**kwargs) + self.application_id = kwargs.get('application_id', None) + self.parent_resource_type = kwargs['parent_resource_type'] + self.parameters = kwargs['parameters'] + self.provisioning_state = None + self.template = kwargs['template'] + + +class ManagementConfigurationPropertiesList(msrest.serialization.Model): + """the list of ManagementConfiguration response. + + :param value: List of Management Configuration properties within the subscription. + :type value: list[~operations_management_client.models.ManagementConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagementConfigurationPropertiesList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Operation(msrest.serialization.Model): + """Supported operation of OperationsManagement resource provider. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~operations_management_client.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft OperationsManagement. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list solution operations. + + :param value: List of solution operations supported by the OperationsManagement resource + provider. + :type value: list[~operations_management_client.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Solution(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Plan for solution object supported by the OperationsManagement resource provider. + :type plan: ~operations_management_client.models.SolutionPlan + :param properties: Properties for solution object supported by the OperationsManagement + resource provider. + :type properties: ~operations_management_client.models.SolutionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'SolutionPlan'}, + 'properties': {'key': 'properties', 'type': 'SolutionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Solution, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.plan = kwargs.get('plan', None) + self.properties = kwargs.get('properties', None) + + +class SolutionPatch(msrest.serialization.Model): + """The properties of a Solution that can be patched. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(SolutionPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class SolutionPlan(msrest.serialization.Model): + """Plan for solution object supported by the OperationsManagement resource provider. + + :param name: name of the solution to be created. For Microsoft published solution it should be + in the format of solutionType(workspaceName). SolutionType part is case sensitive. For third + party solution, it can be anything. + :type name: str + :param publisher: Publisher name. For gallery solution, it is Microsoft. + :type publisher: str + :param promotion_code: promotionCode, Not really used now, can you left as empty. + :type promotion_code: str + :param product: name of the solution to enabled/add. For Microsoft published gallery solution + it should be in the format of OMSGallery/:code:``. This is case sensitive. + :type product: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SolutionPlan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.promotion_code = kwargs.get('promotion_code', None) + self.product = kwargs.get('product', None) + + +class SolutionProperties(msrest.serialization.Model): + """Solution properties supported by the OperationsManagement resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param workspace_resource_id: Required. The azure resourceId for the workspace where the + solution will be deployed/enabled. + :type workspace_resource_id: str + :ivar provisioning_state: The provisioning state for the solution. + :vartype provisioning_state: str + :param contained_resources: The azure resources that will be contained within the solutions. + They will be locked and gets deleted automatically when the solution is deleted. + :type contained_resources: list[str] + :param referenced_resources: The resources that will be referenced from this solution. Deleting + any of those solution out of band will break the solution. + :type referenced_resources: list[str] + """ + + _validation = { + 'workspace_resource_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'contained_resources': {'key': 'containedResources', 'type': '[str]'}, + 'referenced_resources': {'key': 'referencedResources', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SolutionProperties, self).__init__(**kwargs) + self.workspace_resource_id = kwargs['workspace_resource_id'] + self.provisioning_state = None + self.contained_resources = kwargs.get('contained_resources', None) + self.referenced_resources = kwargs.get('referenced_resources', None) + + +class SolutionPropertiesList(msrest.serialization.Model): + """the list of solution response. + + :param value: List of solution properties within the subscription. + :type value: list[~operations_management_client.models.Solution] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Solution]'}, + } + + def __init__( + self, + **kwargs + ): + super(SolutionPropertiesList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models_py3.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models_py3.py new file mode 100644 index 00000000000..13b5fda2e1a --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/models/_models_py3.py @@ -0,0 +1,563 @@ +# 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 Dict, List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ArmTemplateParameter(msrest.serialization.Model): + """Parameter to pass to ARM template. + + :param name: name of the parameter. + :type name: str + :param value: value for the parameter. In Jtoken. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(ArmTemplateParameter, self).__init__(**kwargs) + self.name = name + self.value = value + + +class CodeMessageError(msrest.serialization.Model): + """The error body contract. + + :param error: The error details for a failed request. + :type error: ~operations_management_client.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + **kwargs + ): + super(CodeMessageError, self).__init__(**kwargs) + self.error = error + + +class Error(msrest.serialization.Model): + """The error details for a failed request. + + :param code: The error type. + :type code: str + :param message: The error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ManagementAssociation(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param properties: Properties for ManagementAssociation object supported by the + OperationsManagement resource provider. + :type properties: ~operations_management_client.models.ManagementAssociationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagementAssociationProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["ManagementAssociationProperties"] = None, + **kwargs + ): + super(ManagementAssociation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + + +class ManagementAssociationProperties(msrest.serialization.Model): + """ManagementAssociation properties supported by the OperationsManagement resource provider. + + All required parameters must be populated in order to send to Azure. + + :param application_id: Required. The applicationId of the appliance for this association. + :type application_id: str + """ + + _validation = { + 'application_id': {'required': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + } + + def __init__( + self, + *, + application_id: str, + **kwargs + ): + super(ManagementAssociationProperties, self).__init__(**kwargs) + self.application_id = application_id + + +class ManagementAssociationPropertiesList(msrest.serialization.Model): + """the list of ManagementAssociation response. + + :param value: List of Management Association properties within the subscription. + :type value: list[~operations_management_client.models.ManagementAssociation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementAssociation]'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagementAssociation"]] = None, + **kwargs + ): + super(ManagementAssociationPropertiesList, self).__init__(**kwargs) + self.value = value + + +class ManagementConfiguration(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param properties: Properties for ManagementConfiguration object supported by the + OperationsManagement resource provider. + :type properties: ~operations_management_client.models.ManagementConfigurationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagementConfigurationProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["ManagementConfigurationProperties"] = None, + **kwargs + ): + super(ManagementConfiguration, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + + +class ManagementConfigurationProperties(msrest.serialization.Model): + """ManagementConfiguration properties supported by the OperationsManagement resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param application_id: The applicationId of the appliance for this Management. + :type application_id: str + :param parent_resource_type: Required. The type of the parent resource. + :type parent_resource_type: str + :param parameters: Required. Parameters to run the ARM template. + :type parameters: list[~operations_management_client.models.ArmTemplateParameter] + :ivar provisioning_state: The provisioning state for the ManagementConfiguration. + :vartype provisioning_state: str + :param template: Required. The Json object containing the ARM template to deploy. + :type template: object + """ + + _validation = { + 'parent_resource_type': {'required': True}, + 'parameters': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'template': {'required': True}, + } + + _attribute_map = { + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'parent_resource_type': {'key': 'parentResourceType', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '[ArmTemplateParameter]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + *, + parent_resource_type: str, + parameters: List["ArmTemplateParameter"], + template: object, + application_id: Optional[str] = None, + **kwargs + ): + super(ManagementConfigurationProperties, self).__init__(**kwargs) + self.application_id = application_id + self.parent_resource_type = parent_resource_type + self.parameters = parameters + self.provisioning_state = None + self.template = template + + +class ManagementConfigurationPropertiesList(msrest.serialization.Model): + """the list of ManagementConfiguration response. + + :param value: List of Management Configuration properties within the subscription. + :type value: list[~operations_management_client.models.ManagementConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagementConfiguration]'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagementConfiguration"]] = None, + **kwargs + ): + super(ManagementConfigurationPropertiesList, self).__init__(**kwargs) + self.value = value + + +class Operation(msrest.serialization.Model): + """Supported operation of OperationsManagement resource provider. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~operations_management_client.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft OperationsManagement. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list solution operations. + + :param value: List of solution operations supported by the OperationsManagement resource + provider. + :type value: list[~operations_management_client.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + + +class Solution(msrest.serialization.Model): + """The container for solution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Plan for solution object supported by the OperationsManagement resource provider. + :type plan: ~operations_management_client.models.SolutionPlan + :param properties: Properties for solution object supported by the OperationsManagement + resource provider. + :type properties: ~operations_management_client.models.SolutionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'SolutionPlan'}, + 'properties': {'key': 'properties', 'type': 'SolutionProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["SolutionPlan"] = None, + properties: Optional["SolutionProperties"] = None, + **kwargs + ): + super(Solution, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.plan = plan + self.properties = properties + + +class SolutionPatch(msrest.serialization.Model): + """The properties of a Solution that can be patched. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(SolutionPatch, self).__init__(**kwargs) + self.tags = tags + + +class SolutionPlan(msrest.serialization.Model): + """Plan for solution object supported by the OperationsManagement resource provider. + + :param name: name of the solution to be created. For Microsoft published solution it should be + in the format of solutionType(workspaceName). SolutionType part is case sensitive. For third + party solution, it can be anything. + :type name: str + :param publisher: Publisher name. For gallery solution, it is Microsoft. + :type publisher: str + :param promotion_code: promotionCode, Not really used now, can you left as empty. + :type promotion_code: str + :param product: name of the solution to enabled/add. For Microsoft published gallery solution + it should be in the format of OMSGallery/:code:``. This is case sensitive. + :type product: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + promotion_code: Optional[str] = None, + product: Optional[str] = None, + **kwargs + ): + super(SolutionPlan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.promotion_code = promotion_code + self.product = product + + +class SolutionProperties(msrest.serialization.Model): + """Solution properties supported by the OperationsManagement resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param workspace_resource_id: Required. The azure resourceId for the workspace where the + solution will be deployed/enabled. + :type workspace_resource_id: str + :ivar provisioning_state: The provisioning state for the solution. + :vartype provisioning_state: str + :param contained_resources: The azure resources that will be contained within the solutions. + They will be locked and gets deleted automatically when the solution is deleted. + :type contained_resources: list[str] + :param referenced_resources: The resources that will be referenced from this solution. Deleting + any of those solution out of band will break the solution. + :type referenced_resources: list[str] + """ + + _validation = { + 'workspace_resource_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'contained_resources': {'key': 'containedResources', 'type': '[str]'}, + 'referenced_resources': {'key': 'referencedResources', 'type': '[str]'}, + } + + def __init__( + self, + *, + workspace_resource_id: str, + contained_resources: Optional[List[str]] = None, + referenced_resources: Optional[List[str]] = None, + **kwargs + ): + super(SolutionProperties, self).__init__(**kwargs) + self.workspace_resource_id = workspace_resource_id + self.provisioning_state = None + self.contained_resources = contained_resources + self.referenced_resources = referenced_resources + + +class SolutionPropertiesList(msrest.serialization.Model): + """the list of solution response. + + :param value: List of solution properties within the subscription. + :type value: list[~operations_management_client.models.Solution] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Solution]'}, + } + + def __init__( + self, + *, + value: Optional[List["Solution"]] = None, + **kwargs + ): + super(SolutionPropertiesList, self).__init__(**kwargs) + self.value = value diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/__init__.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/__init__.py new file mode 100644 index 00000000000..2782e69839b --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/__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 ._solutions_operations import SolutionsOperations +from ._management_associations_operations import ManagementAssociationsOperations +from ._management_configurations_operations import ManagementConfigurationsOperations +from ._operations import Operations + +__all__ = [ + 'SolutionsOperations', + 'ManagementAssociationsOperations', + 'ManagementConfigurationsOperations', + 'Operations', +] diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_associations_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_associations_operations.py new file mode 100644 index 00000000000..c15c6629d59 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_associations_operations.py @@ -0,0 +1,329 @@ +# 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 +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementAssociationsOperations(object): + """ManagementAssociationsOperations 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: ~operations_management_client.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 list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementAssociationPropertiesList" + """Retrieves the ManagementAssociations list for the subscription. + + Retrieves the ManagementAssociations list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociationPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociationPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociationPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociationPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/ManagementAssociations'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + provider_name, # type: str + resource_type, # type: str + resource_name, # type: str + management_association_name, # type: str + parameters, # type: "models.ManagementAssociation" + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementAssociation" + """Create/Update ManagementAssociation. + + Creates or updates the ManagementAssociation. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :param parameters: The parameters required to create ManagementAssociation extension. + :type parameters: ~operations_management_client.models.ManagementAssociation + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociation, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementAssociation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + provider_name, # type: str + resource_type, # type: str + resource_name, # type: str + management_association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the ManagementAssociation. + + Deletes the ManagementAssociation in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + provider_name, # type: str + resource_type, # type: str + resource_name, # type: str + management_association_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementAssociation" + """Retrieve ManagementAssociation. + + Retrieves the user ManagementAssociation. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param provider_name: Provider name for the parent resource. + :type provider_name: str + :param resource_type: Resource type for the parent resource. + :type resource_type: str + :param resource_name: Parent resource name. + :type resource_name: str + :param management_association_name: User ManagementAssociation Name. + :type management_association_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementAssociation, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementAssociation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementAssociation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'managementAssociationName': self._serialize.url("management_association_name", management_association_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementAssociation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.OperationsManagement/ManagementAssociations/{managementAssociationName}'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_configurations_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_configurations_operations.py new file mode 100644 index 00000000000..3a5d3e3bd60 --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_management_configurations_operations.py @@ -0,0 +1,293 @@ +# 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 +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagementConfigurationsOperations(object): + """ManagementConfigurationsOperations 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: ~operations_management_client.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 list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementConfigurationPropertiesList" + """Retrieves the ManagementConfigurations list for the subscription. + + Retrieves the ManagementConfigurations list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfigurationPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfigurationPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfigurationPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfigurationPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/ManagementConfigurations'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + management_configuration_name, # type: str + parameters, # type: "models.ManagementConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementConfiguration" + """Create/Update ManagementConfiguration. + + Creates or updates the ManagementConfiguration. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :param parameters: The parameters required to create OMS Solution. + :type parameters: ~operations_management_client.models.ManagementConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfiguration, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagementConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + management_configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the ManagementConfiguration. + + Deletes the ManagementConfiguration in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + management_configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ManagementConfiguration" + """Retrieve ManagementConfiguration. + + Retrieves the user ManagementConfiguration. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param management_configuration_name: User Management Configuration Name. + :type management_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagementConfiguration, or the result of cls(response) + :rtype: ~operations_management_client.models.ManagementConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'managementConfigurationName': self._serialize.url("management_configuration_name", management_configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagementConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/ManagementConfigurations/{managementConfigurationName}'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_operations.py new file mode 100644 index 00000000000..a243ae4905f --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 +import warnings + +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 HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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: ~operations_management_client.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 list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available OperationsManagement Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~operations_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.OperationsManagement/operations'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_solutions_operations.py b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_solutions_operations.py new file mode 100644 index 00000000000..2116618690b --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/operations/_solutions_operations.py @@ -0,0 +1,597 @@ +# 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 +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SolutionsOperations(object): + """SolutionsOperations 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: ~operations_management_client.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 _create_or_update_initial( + self, + resource_group_name, # type: str + solution_name, # type: str + parameters, # type: "models.Solution" + **kwargs # type: Any + ): + # type: (...) -> "models.Solution" + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Solution') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + solution_name, # type: str + parameters, # type: "models.Solution" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Solution"] + """Create/Update Solution. + + Creates or updates the Solution. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :param parameters: The parameters required to create OMS Solution. + :type parameters: ~operations_management_client.models.Solution + :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: True for ARMPolling, False for no polling, or a + polling object for 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 Solution or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~operations_management_client.models.Solution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + 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, + solution_name=solution_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + solution_name, # type: str + parameters, # type: "models.SolutionPatch" + **kwargs # type: Any + ): + # type: (...) -> "models.Solution" + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SolutionPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + solution_name, # type: str + parameters, # type: "models.SolutionPatch" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Solution"] + """Patch a Solution. + + Patch a Solution. Only updating tags supported. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :param parameters: The parameters required to patch a Solution. + :type parameters: ~operations_management_client.models.SolutionPatch + :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: True for ARMPolling, False for no polling, or a + polling object for 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 Solution or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~operations_management_client.models.Solution] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + 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_initial( + resource_group_name=resource_group_name, + solution_name=solution_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + solution_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 = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + solution_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the solution. + + Deletes the solution in the subscription. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + 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, + solution_name=solution_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + solution_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Solution" + """Retrieve solution. + + Retrieves the user solution. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :param solution_name: User Solution Name. + :type solution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Solution, or the result of cls(response) + :rtype: ~operations_management_client.models.Solution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Solution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'solutionName': self._serialize.url("solution_name", solution_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Solution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SolutionPropertiesList" + """Retrieves the solution list for the subscription. + + Retrieves the solution list. It will retrieve both first party and third party solutions. + + :param resource_group_name: The name of the resource group to get. 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: SolutionPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.SolutionPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SolutionPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SolutionPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.SolutionPropertiesList" + """Retrieves the solution list for the subscription. + + Retrieves the solution list. It will retrieve both first party and third party solutions. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SolutionPropertiesList, or the result of cls(response) + :rtype: ~operations_management_client.models.SolutionPropertiesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SolutionPropertiesList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.CodeMessageError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SolutionPropertiesList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.OperationsManagement/solutions'} # type: ignore diff --git a/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/py.typed b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/operationsmanagement/azext_operationsmanagement/vendored_sdks/operationsmanagement/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/operationsmanagement/report.md b/src/operationsmanagement/report.md new file mode 100644 index 00000000000..24280d4f34a --- /dev/null +++ b/src/operationsmanagement/report.md @@ -0,0 +1,265 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az operationsmanagement|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az operationsmanagement` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az operationsmanagement solution|Solutions|[commands](#CommandsInSolutions)| +|az operationsmanagement management-association|ManagementAssociations|[commands](#CommandsInManagementAssociations)| +|az operationsmanagement management-configuration|ManagementConfigurations|[commands](#CommandsInManagementConfigurations)| + +## COMMANDS +### Commands in `az operationsmanagement management-association` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az operationsmanagement management-association list](#ManagementAssociationsListBySubscription)|ListBySubscription|[Parameters](#ParametersManagementAssociationsListBySubscription)|[Example](#ExamplesManagementAssociationsListBySubscription)| +|[az operationsmanagement management-association show](#ManagementAssociationsGet)|Get|[Parameters](#ParametersManagementAssociationsGet)|[Example](#ExamplesManagementAssociationsGet)| +|[az operationsmanagement management-association create](#ManagementAssociationsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersManagementAssociationsCreateOrUpdate#Create)|[Example](#ExamplesManagementAssociationsCreateOrUpdate#Create)| +|[az operationsmanagement management-association update](#ManagementAssociationsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersManagementAssociationsCreateOrUpdate#Update)|Not Found| +|[az operationsmanagement management-association delete](#ManagementAssociationsDelete)|Delete|[Parameters](#ParametersManagementAssociationsDelete)|[Example](#ExamplesManagementAssociationsDelete)| + +### Commands in `az operationsmanagement management-configuration` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az operationsmanagement management-configuration list](#ManagementConfigurationsListBySubscription)|ListBySubscription|[Parameters](#ParametersManagementConfigurationsListBySubscription)|[Example](#ExamplesManagementConfigurationsListBySubscription)| +|[az operationsmanagement management-configuration show](#ManagementConfigurationsGet)|Get|[Parameters](#ParametersManagementConfigurationsGet)|[Example](#ExamplesManagementConfigurationsGet)| +|[az operationsmanagement management-configuration create](#ManagementConfigurationsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersManagementConfigurationsCreateOrUpdate#Create)|[Example](#ExamplesManagementConfigurationsCreateOrUpdate#Create)| +|[az operationsmanagement management-configuration update](#ManagementConfigurationsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersManagementConfigurationsCreateOrUpdate#Update)|Not Found| +|[az operationsmanagement management-configuration delete](#ManagementConfigurationsDelete)|Delete|[Parameters](#ParametersManagementConfigurationsDelete)|[Example](#ExamplesManagementConfigurationsDelete)| + +### Commands in `az operationsmanagement solution` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az operationsmanagement solution list](#SolutionsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersSolutionsListByResourceGroup)|[Example](#ExamplesSolutionsListByResourceGroup)| +|[az operationsmanagement solution list](#SolutionsListBySubscription)|ListBySubscription|[Parameters](#ParametersSolutionsListBySubscription)|[Example](#ExamplesSolutionsListBySubscription)| +|[az operationsmanagement solution show](#SolutionsGet)|Get|[Parameters](#ParametersSolutionsGet)|[Example](#ExamplesSolutionsGet)| +|[az operationsmanagement solution create](#SolutionsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersSolutionsCreateOrUpdate#Create)|[Example](#ExamplesSolutionsCreateOrUpdate#Create)| +|[az operationsmanagement solution update](#SolutionsUpdate)|Update|[Parameters](#ParametersSolutionsUpdate)|[Example](#ExamplesSolutionsUpdate)| +|[az operationsmanagement solution delete](#SolutionsDelete)|Delete|[Parameters](#ParametersSolutionsDelete)|[Example](#ExamplesSolutionsDelete)| + + +## COMMAND DETAILS + +### group `az operationsmanagement management-association` +#### Command `az operationsmanagement management-association list` + +##### Example +``` +az operationsmanagement management-association list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az operationsmanagement management-association show` + +##### Example +``` +az operationsmanagement management-association show --name "managementAssociation1" --provider-name "providerName" \ +--resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--provider-name**|string|Provider name for the parent resource.|provider_name|providerName| +|**--resource-type**|string|Resource type for the parent resource|resource_type|resourceType| +|**--resource-name**|string|Parent resource name.|resource_name|resourceName| +|**--management-association-name**|string|User ManagementAssociation Name.|management_association_name|managementAssociationName| + +#### Command `az operationsmanagement management-association create` + +##### Example +``` +az operationsmanagement management-association create --name "managementAssociation1" --location "East US" \ +--application-id "/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.Appliance/Appliances/appliance1" \ +--provider-name "providerName" --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--provider-name**|string|Provider name for the parent resource.|provider_name|providerName| +|**--resource-type**|string|Resource type for the parent resource|resource_type|resourceType| +|**--resource-name**|string|Parent resource name.|resource_name|resourceName| +|**--management-association-name**|string|User ManagementAssociation Name.|management_association_name|managementAssociationName| +|**--location**|string|Resource location|location|location| +|**--application-id**|string|The applicationId of the appliance for this association.|application_id|applicationId| + +#### Command `az operationsmanagement management-association update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--provider-name**|string|Provider name for the parent resource.|provider_name|providerName| +|**--resource-type**|string|Resource type for the parent resource|resource_type|resourceType| +|**--resource-name**|string|Parent resource name.|resource_name|resourceName| +|**--management-association-name**|string|User ManagementAssociation Name.|management_association_name|managementAssociationName| +|**--location**|string|Resource location|location|location| +|**--application-id**|string|The applicationId of the appliance for this association.|application_id|applicationId| + +#### Command `az operationsmanagement management-association delete` + +##### Example +``` +az operationsmanagement management-association delete --name "managementAssociationName" --provider-name \ +"providerName" --resource-group "rg1" --resource-name "resourceName" --resource-type "resourceType" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--provider-name**|string|Provider name for the parent resource.|provider_name|providerName| +|**--resource-type**|string|Resource type for the parent resource|resource_type|resourceType| +|**--resource-name**|string|Parent resource name.|resource_name|resourceName| +|**--management-association-name**|string|User ManagementAssociation Name.|management_association_name|managementAssociationName| + +### group `az operationsmanagement management-configuration` +#### Command `az operationsmanagement management-configuration list` + +##### Example +``` +az operationsmanagement management-configuration list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az operationsmanagement management-configuration show` + +##### Example +``` +az operationsmanagement management-configuration show --name "managementConfigurationName" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--management-configuration-name**|string|User Management Configuration Name.|management_configuration_name|managementConfigurationName| + +#### Command `az operationsmanagement management-configuration create` + +##### Example +``` +az operationsmanagement management-configuration create --name "managementConfiguration1" --location "East US" \ +--resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--management-configuration-name**|string|User Management Configuration Name.|management_configuration_name|managementConfigurationName| +|**--location**|string|Resource location|location|location| +|**--application-id**|string|The applicationId of the appliance for this Management.|application_id|applicationId| +|**--parent-resource-type**|string|The type of the parent resource.|parent_resource_type|parentResourceType| +|**--properties-parameters**|array|Parameters to run the ARM template|parameters|parameters| +|**--template**|any|The Json object containing the ARM template to deploy|template|template| + +#### Command `az operationsmanagement management-configuration update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--management-configuration-name**|string|User Management Configuration Name.|management_configuration_name|managementConfigurationName| +|**--location**|string|Resource location|location|location| +|**--application-id**|string|The applicationId of the appliance for this Management.|application_id|applicationId| +|**--parent-resource-type**|string|The type of the parent resource.|parent_resource_type|parentResourceType| +|**--properties-parameters**|array|Parameters to run the ARM template|parameters|parameters| +|**--template**|any|The Json object containing the ARM template to deploy|template|template| + +#### Command `az operationsmanagement management-configuration delete` + +##### Example +``` +az operationsmanagement management-configuration delete --name "managementConfigurationName" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--management-configuration-name**|string|User Management Configuration Name.|management_configuration_name|managementConfigurationName| + +### group `az operationsmanagement solution` +#### Command `az operationsmanagement solution list` + +##### Example +``` +az operationsmanagement solution list --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az operationsmanagement solution list` + +##### Example +``` +az operationsmanagement solution list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az operationsmanagement solution show` + +##### Example +``` +az operationsmanagement solution show --resource-group "rg1" --name "solution1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--solution-name**|string|User Solution Name.|solution_name|solutionName| + +#### Command `az operationsmanagement solution create` + +##### Example +``` +az operationsmanagement solution create --location "East US" --plan name="name1" product="product1" \ +promotion-code="promocode1" publisher="publisher1" --properties contained-resources="/subscriptions/sub2/resourceGroups\ +/rg2/providers/provider1/resources/resource1" contained-resources="/subscriptions/sub2/resourceGroups/rg2/providers/pro\ +vider2/resources/resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider1/resources/\ +resource2" referenced-resources="/subscriptions/sub2/resourceGroups/rg2/providers/provider2/resources/resource3" \ +workspace-resource-id="/subscriptions/sub2/resourceGroups/rg2/providers/Microsoft.OperationalInsights/workspaces/ws1" \ +--resource-group "rg1" --name "solution1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--solution-name**|string|User Solution Name.|solution_name|solutionName| +|**--location**|string|Resource location|location|location| +|**--tags**|dictionary|Resource tags|tags|tags| +|**--plan**|object|Plan for solution object supported by the OperationsManagement resource provider.|plan|plan| +|**--properties**|object|Properties for solution object supported by the OperationsManagement resource provider.|properties|properties| + +#### Command `az operationsmanagement solution update` + +##### Example +``` +az operationsmanagement solution update --tags Dept="IT" Environment="Test" --resource-group "rg1" --name "solution1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--solution-name**|string|User Solution Name.|solution_name|solutionName| +|**--tags**|dictionary|Resource tags|tags|tags| + +#### Command `az operationsmanagement solution delete` + +##### Example +``` +az operationsmanagement solution delete --resource-group "rg1" --name "solution1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to get. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--solution-name**|string|User Solution Name.|solution_name|solutionName| diff --git a/src/operationsmanagement/setup.cfg b/src/operationsmanagement/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/operationsmanagement/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/operationsmanagement/setup.py b/src/operationsmanagement/setup.py new file mode 100644 index 00000000000..81c9ba938c7 --- /dev/null +++ b/src/operationsmanagement/setup.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_operationsmanagement.manual.version import VERSION +except ImportError: + pass + +# 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', +] + +DEPENDENCIES = [] + +try: + from azext_operationsmanagement.manual.dependency import DEPENDENCIES +except ImportError: + pass + +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='operationsmanagement', + version=VERSION, + description='Microsoft Azure Command-Line Tools OperationsManagementClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/operationsmanagement', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_operationsmanagement': ['azext_metadata.json']}, +)