diff --git a/src/logz/HISTORY.rst b/src/logz/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/logz/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/logz/README.md b/src/logz/README.md new file mode 100644 index 00000000000..8f585f05e4b --- /dev/null +++ b/src/logz/README.md @@ -0,0 +1,160 @@ +# Azure CLI logz Extension # +This is the extension for logz + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name logz +``` + +### Included Features ### +#### logz monitor #### +##### Create ##### +``` +az logz monitor create --name "myMonitor" --location "West US" \ + --plan-data billing-cycle="Monthly" effective-date="2019-08-30T15:14:33+02:00" plan-details="logzapitestplan" usage-type="Committed" \ + --user-info email-address="alice@microsoft.com" first-name="Alice" last-name="Bob" phone-number="123456" \ + --tags Environment="Dev" --resource-group "myResourceGroup" + +az logz monitor wait --created --name "{myMonitor}" --resource-group "{rg}" +``` +##### Show ##### +``` +az logz monitor show --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List ##### +``` +az logz monitor list --resource-group "myResourceGroup" +``` +##### Update ##### +``` +az logz monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ + --resource-group "myResourceGroup" +``` +##### List-monitored-resource ##### +``` +az logz monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List-user-role ##### +``` +az logz monitor list-user-role --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Delete ##### +``` +az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup" +``` +#### logz tag-rule #### +##### Create ##### +``` +az logz tag-rule create --monitor-name "myMonitor" --filtering-tags name="Environment" action="Include" value="Prod" \ + --filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false --send-activity-logs true \ + --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Show ##### +``` +az logz tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### List ##### +``` +az logz tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Delete ##### +``` +az logz tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +#### logz single-sign-on #### +##### Create ##### +``` +az logz single-sign-on create --configuration-name "default" --monitor-name "myMonitor" \ + --properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" single-sign-on-url=null \ + --resource-group "myResourceGroup" +``` +##### Show ##### +``` +az logz single-sign-on show --configuration-name "default" --monitor-name "myMonitor" \ + --resource-group "myResourceGroup" +``` +##### List ##### +``` +az logz single-sign-on list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +#### logz sub-account #### +##### Create ##### +``` +az logz sub-account create --monitor-name "myMonitor" --type "Microsoft.Logz/monitors" --location "West US" \ + --monitoring-status "Enabled" --tags Environment="Dev" --resource-group "myResourceGroup" --name "SubAccount1" + +az logz sub-account wait --created --resource-group "{rg}" --name "{mySubAccount}" +``` +##### Show ##### +``` +az logz sub-account show --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### List ##### +``` +az logz sub-account list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Update ##### +``` +az logz sub-account update --monitor-name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ + --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### List-monitored-resource ##### +``` +az logz sub-account list-monitored-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" \ + --name "SubAccount1" +``` +##### List-vm-host ##### +``` +az logz sub-account list-vm-host --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### List-vm-host-update ##### +``` +az logz sub-account list-vm-host-update --monitor-name "myMonitor" --state "Install" \ + --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Vm-host-payload ##### +``` +az logz sub-account vm-host-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Delete ##### +``` +az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "someName" +``` +#### logz sub-account-tag-rule #### +##### Create ##### +``` +az logz sub-account-tag-rule create --monitor-name "myMonitor" \ + --filtering-tags name="Environment" action="Include" value="Prod" \ + --filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false --send-activity-logs true \ + --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" \ + --sub-account-name "SubAccount1" +``` +##### Show ##### +``` +az logz sub-account-tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" \ + --rule-set-name "default" --sub-account-name "SubAccount1" +``` +##### List ##### +``` +az logz sub-account-tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" \ + --sub-account-name "SubAccount1" +``` +##### Delete ##### +``` +az logz sub-account-tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" \ + --rule-set-name "default" --sub-account-name "SubAccount1" +``` +#### logz monitor #### +##### List-vm-host ##### +``` +az logz monitor list-vm-host --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List-vm-host-update ##### +``` +az logz monitor list-vm-host-update --name "myMonitor" --state "Install" --resource-group "myResourceGroup" +``` +##### Vm-host-payload ##### +``` +az logz monitor vm-host-payload --name "myMonitor" --resource-group "myResourceGroup" +``` \ No newline at end of file diff --git a/src/logz/azext_logz/__init__.py b/src/logz/azext_logz/__init__.py new file mode 100644 index 00000000000..a4e63832470 --- /dev/null +++ b/src/logz/azext_logz/__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_logz.generated._help import helps # pylint: disable=unused-import +try: + from azext_logz.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class MicrosoftLogzCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_logz.generated._client_factory import cf_logz_cl + logz_custom = CliCommandType( + operations_tmpl='azext_logz.custom#{}', + client_factory=cf_logz_cl) + parent = super(MicrosoftLogzCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=logz_custom) + + def load_command_table(self, args): + from azext_logz.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_logz.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_logz.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_logz.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = MicrosoftLogzCommandsLoader diff --git a/src/logz/azext_logz/action.py b/src/logz/azext_logz/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/azext_metadata.json b/src/logz/azext_logz/azext_metadata.json new file mode 100644 index 00000000000..cfc30c747c7 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/custom.py b/src/logz/azext_logz/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/generated/__init__.py b/src/logz/azext_logz/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/generated/_client_factory.py b/src/logz/azext_logz/generated/_client_factory.py new file mode 100644 index 00000000000..8c2fd32498b --- /dev/null +++ b/src/logz/azext_logz/generated/_client_factory.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# 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_logz_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_logz.vendored_sdks.logz import MicrosoftLogz + return get_mgmt_service_client(cli_ctx, + MicrosoftLogz) + + +def cf_monitor(cli_ctx, *_): + return cf_logz_cl(cli_ctx).monitors + + +def cf_tag_rule(cli_ctx, *_): + return cf_logz_cl(cli_ctx).tag_rules + + +def cf_single_sign_on(cli_ctx, *_): + return cf_logz_cl(cli_ctx).single_sign_on + + +def cf_sub_account(cli_ctx, *_): + return cf_logz_cl(cli_ctx).sub_account + + +def cf_sub_account_tag_rule(cli_ctx, *_): + return cf_logz_cl(cli_ctx).sub_account_tag_rules + + +def cf_monitor(cli_ctx, *_): + return cf_logz_cl(cli_ctx).monitor diff --git a/src/logz/azext_logz/generated/_help.py b/src/logz/azext_logz/generated/_help.py new file mode 100644 index 00000000000..98da28e052d --- /dev/null +++ b/src/logz/azext_logz/generated/_help.py @@ -0,0 +1,542 @@ +# -------------------------------------------------------------------------- +# 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['logz monitor'] = """ + type: group + short-summary: Manage monitor with logz +""" + +helps['logz monitor list'] = """ + type: command + short-summary: "List all monitors under the specified resource group. And List all monitors under the specified \ +subscription." + examples: + - name: Monitors_ListByResourceGroup + text: |- + az logz monitor list --resource-group "myResourceGroup" + - name: Monitors_List + text: |- + az logz monitor list +""" + +helps['logz monitor show'] = """ + type: command + short-summary: "Get the properties of a specific monitor resource." + examples: + - name: Monitors_Get + text: |- + az logz monitor show --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor create'] = """ + type: command + short-summary: "Create a monitor resource." + parameters: + - name: --logz-organization-properties + long-summary: | + Usage: --logz-organization-properties company-name=XX enterprise-app-id=XX single-sign-on-url=XX + + company-name: Name of the Logz organization. + enterprise-app-id: The Id of the Enterprise App used for Single sign on. + single-sign-on-url: The login URL specific to this Logz Organization. + - name: --user-info + long-summary: | + Usage: --user-info first-name=XX last-name=XX email-address=XX phone-number=XX + + first-name: First Name of the user + last-name: Last Name of the user + email-address: Email of the user used by Logz for contacting them if needed + phone-number: Phone number of the user used by Logz for contacting them if needed + - name: --plan-data + long-summary: | + Usage: --plan-data usage-type=XX billing-cycle=XX plan-details=XX effective-date=XX + + usage-type: different usage type like PAYG/COMMITTED. this could be enum + billing-cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum + plan-details: plan id as published by Logz + effective-date: date when plan was applied + examples: + - name: Monitors_Create + text: |- + az logz monitor create --name "myMonitor" --location "West US" --plan-data billing-cycle="Monthly" \ +effective-date="2019-08-30T15:14:33+02:00" plan-details="logzapitestplan" usage-type="Committed" --user-info \ +email-address="alice@microsoft.com" first-name="Alice" last-name="Bob" phone-number="123456" --tags Environment="Dev" \ +--resource-group "myResourceGroup" +""" + +helps['logz monitor update'] = """ + type: command + short-summary: "Update a monitor resource." + examples: + - name: Monitors_Update + text: |- + az logz monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ +--resource-group "myResourceGroup" +""" + +helps['logz monitor delete'] = """ + type: command + short-summary: "Delete a monitor resource." + examples: + - name: Monitors_Delete + text: |- + az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-monitored-resource'] = """ + type: command + short-summary: "List the resources currently being monitored by the Logz monitor resource." + examples: + - name: MonitoredResources_List + text: |- + az logz monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-user-role'] = """ + type: command + short-summary: "List the user's roles configured on Logz.io side for the account corresponding to the monitor \ +resource." + examples: + - name: MainAccount_VMHosts_Update + text: |- + az logz monitor list-user-role --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the logz monitor is met. + examples: + - name: Pause executing next line of CLI script until the logz monitor is successfully created. + text: |- + az logz monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created + - name: Pause executing next line of CLI script until the logz monitor is successfully deleted. + text: |- + az logz monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted +""" + +helps['logz tag-rule'] = """ + type: group + short-summary: Manage tag rule with logz +""" + +helps['logz tag-rule list'] = """ + type: command + short-summary: "List the tag rules for a given monitor resource." + examples: + - name: TagRules_List + text: |- + az logz tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz tag-rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: TagRules_Get + text: |- + az logz tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz tag-rule create'] = """ + type: command + short-summary: "Create a tag rule set for a given monitor resource." + parameters: + - name: --filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --filtering-tags argument. + examples: + - name: TagRules_CreateOrUpdate + text: |- + az logz tag-rule create --monitor-name "myMonitor" --filtering-tags name="Environment" action="Include" \ +value="Prod" --filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false \ +--send-activity-logs true --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" +""" + +helps['logz tag-rule update'] = """ + type: command + short-summary: "Update a tag rule set for a given monitor resource." + parameters: + - name: --filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --filtering-tags argument. +""" + +helps['logz tag-rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz single-sign-on'] = """ + type: group + short-summary: Manage single sign on with logz +""" + +helps['logz single-sign-on list'] = """ + type: command + short-summary: "List the single sign-on configurations for a given monitor resource." + examples: + - name: SingleSignOnConfigurations_List + text: |- + az logz single-sign-on list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz single-sign-on show'] = """ + type: command + short-summary: "Gets the Logz single sign-on resource for the given Monitor." + examples: + - name: SingleSignOnConfigurations_Get + text: |- + az logz single-sign-on show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +""" + +helps['logz single-sign-on create'] = """ + type: command + short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. + single-sign-on-url: The login URL specific to this Logz Organization. + examples: + - name: SingleSignOnConfigurations_CreateOrUpdate + text: |- + az logz single-sign-on create --configuration-name "default" --monitor-name "myMonitor" --properties \ +enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" single-sign-on-url=null \ +--resource-group "myResourceGroup" +""" + +helps['logz single-sign-on update'] = """ + type: command + short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. + single-sign-on-url: The login URL specific to this Logz Organization. +""" + +helps['logz single-sign-on wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the logz single-sign-on is met. + examples: + - name: Pause executing next line of CLI script until the logz single-sign-on is successfully created. + text: |- + az logz single-sign-on wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the logz single-sign-on is successfully updated. + text: |- + az logz single-sign-on wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --updated +""" + +helps['logz sub-account'] = """ + type: group + short-summary: Manage sub account with logz +""" + +helps['logz sub-account list'] = """ + type: command + short-summary: "List the sub account under a given monitor resource." + examples: + - name: SubAccount_List + text: |- + az logz sub-account list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz sub-account show'] = """ + type: command + short-summary: "Get a sub account under a given monitor resource." + examples: + - name: SubAccount_Get + text: |- + az logz sub-account show --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account create'] = """ + type: command + short-summary: "Create sub account under a given monitor resource." + parameters: + - name: --logz-organization-properties + long-summary: | + Usage: --logz-organization-properties company-name=XX enterprise-app-id=XX single-sign-on-url=XX + + company-name: Name of the Logz organization. + enterprise-app-id: The Id of the Enterprise App used for Single sign on. + single-sign-on-url: The login URL specific to this Logz Organization. + - name: --user-info + long-summary: | + Usage: --user-info first-name=XX last-name=XX email-address=XX phone-number=XX + + first-name: First Name of the user + last-name: Last Name of the user + email-address: Email of the user used by Logz for contacting them if needed + phone-number: Phone number of the user used by Logz for contacting them if needed + - name: --plan-data + long-summary: | + Usage: --plan-data usage-type=XX billing-cycle=XX plan-details=XX effective-date=XX + + usage-type: different usage type like PAYG/COMMITTED. this could be enum + billing-cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum + plan-details: plan id as published by Logz + effective-date: date when plan was applied + examples: + - name: subAccount_Create + text: |- + az logz sub-account create --monitor-name "myMonitor" --type "Microsoft.Logz/monitors" --location "West \ +US" --monitoring-status "Enabled" --tags Environment="Dev" --resource-group "myResourceGroup" --name "SubAccount1" +""" + +helps['logz sub-account update'] = """ + type: command + short-summary: "Update a monitor resource." + examples: + - name: SubAccount_Update + text: |- + az logz sub-account update --monitor-name "myMonitor" --monitoring-status "Enabled" --tags \ +Environment="Dev" --resource-group "myResourceGroup" --name "SubAccount1" +""" + +helps['logz sub-account delete'] = """ + type: command + short-summary: "Delete a sub account resource." + examples: + - name: SubAccount_Delete + text: |- + az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"someName" +""" + +helps['logz sub-account list-monitored-resource'] = """ + type: command + short-summary: "List the resources currently being monitored by the Logz sub account resource." + examples: + - name: SubAccount_MonitoredResources_List + text: |- + az logz sub-account list-monitored-resource --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --name "SubAccount1" +""" + +helps['logz sub-account list-vm-host'] = """ + type: command + short-summary: "List the compute resources currently being monitored by the Logz sub account resource." + examples: + - name: SubAccount_VMHosts_List + text: |- + az logz sub-account list-vm-host --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account list-vm-host-update'] = """ + type: command + short-summary: "Sending request to update the collection when Logz.io agent has been installed on a VM for a given \ +monitor." + parameters: + - name: --vm-resource-ids + short-summary: "Request of a list vm host update operation." + long-summary: | + Usage: --vm-resource-ids id=XX agent-version=XX + + id: Request of a list vm host update operation. + agent-version: Version of the Logz agent installed on the VM. + + Multiple actions can be specified by using more than one --vm-resource-ids argument. + examples: + - name: SubAccount_VMHosts_Update + text: |- + az logz sub-account list-vm-host-update --monitor-name "myMonitor" --state "Install" --resource-group \ +"myResourceGroup" --name "SubAccount1" +""" + +helps['logz sub-account vm-host-payload'] = """ + type: command + short-summary: "Returns the payload that needs to be passed as a request for installing Logz.io agent on a VM." + examples: + - name: SubAccount_VMHosts_Payload + text: |- + az logz sub-account vm-host-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" \ +--name "SubAccount1" +""" + +helps['logz sub-account wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the logz sub-account is met. + examples: + - name: Pause executing next line of CLI script until the logz sub-account is successfully created. + text: |- + az logz sub-account wait --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" --created + - name: Pause executing next line of CLI script until the logz sub-account is successfully deleted. + text: |- + az logz sub-account wait --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" --deleted +""" + +helps['logz sub-account-tag-rule'] = """ + type: group + short-summary: Manage sub account tag rule with logz +""" + +helps['logz sub-account-tag-rule list'] = """ + type: command + short-summary: "List the tag rules for a given sub account resource." + examples: + - name: SubAccountTagRules_List + text: |- + az logz sub-account-tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" \ +--sub-account-name "SubAccount1" +""" + +helps['logz sub-account-tag-rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: SubAccountTagRules_Get + text: |- + az logz sub-account-tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" \ +--rule-set-name "default" --sub-account-name "SubAccount1" +""" + +helps['logz sub-account-tag-rule create'] = """ + type: command + short-summary: "Create a tag rule set for a given sub account resource." + parameters: + - name: --filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --filtering-tags argument. + examples: + - name: SubAccountTagRules_CreateOrUpdate + text: |- + az logz sub-account-tag-rule create --monitor-name "myMonitor" --filtering-tags name="Environment" \ +action="Include" value="Prod" --filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false \ +--send-activity-logs true --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" \ +--sub-account-name "SubAccount1" +""" + +helps['logz sub-account-tag-rule update'] = """ + type: command + short-summary: "Update a tag rule set for a given sub account resource." + parameters: + - name: --filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --filtering-tags argument. +""" + +helps['logz sub-account-tag-rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz sub-account-tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" \ +--rule-set-name "default" --sub-account-name "SubAccount1" +""" + +helps['logz monitor'] = """ + type: group + short-summary: Manage monitor with logz +""" + +helps['logz monitor list-vm-host'] = """ + type: command + short-summary: "List the compute resources currently being monitored by the Logz main account resource." + examples: + - name: MainAccount_VMHosts_List + text: |- + az logz monitor list-vm-host --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-vm-host-update'] = """ + type: command + short-summary: "Sending request to update the collection when Logz.io agent has been installed on a VM for a given \ +monitor." + parameters: + - name: --vm-resource-ids + short-summary: "Request of a list vm host update operation." + long-summary: | + Usage: --vm-resource-ids id=XX agent-version=XX + + id: Request of a list vm host update operation. + agent-version: Version of the Logz agent installed on the VM. + + Multiple actions can be specified by using more than one --vm-resource-ids argument. + examples: + - name: MainAccount_VMHosts_Update + text: |- + az logz monitor list-vm-host-update --name "myMonitor" --state "Install" --resource-group \ +"myResourceGroup" +""" + +helps['logz monitor vm-host-payload'] = """ + type: command + short-summary: "Returns the payload that needs to be passed in the request body for installing Logz.io agent on a \ +VM." + examples: + - name: MainAccount_VMHosts_Payload + text: |- + az logz monitor vm-host-payload --name "myMonitor" --resource-group "myResourceGroup" +""" diff --git a/src/logz/azext_logz/generated/_params.py b/src/logz/azext_logz/generated/_params.py new file mode 100644 index 00000000000..d7ed6134a49 --- /dev/null +++ b/src/logz/azext_logz/generated/_params.py @@ -0,0 +1,309 @@ +# -------------------------------------------------------------------------- +# 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, + get_three_state_flag, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_logz.action import ( + AddLogzOrganizationProperties, + AddUserInfo, + AddPlanData, + AddFilteringTags, + AddProperties, + AddVmResourceIds +) + + +def load_arguments(self, _): + + with self.argument_context('logz monitor list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('logz monitor show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('logz monitor create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), + help='', arg_group='Identity') + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + c.argument('marketplace_subscription_status', arg_type=get_enum_type(['Active', 'Suspended']), help='Flag ' + 'specifying the Marketplace Subscription Status of the resource. If payment is not made in time, ' + 'the resource will go in Suspended state.') + c.argument('logz_organization_properties', action=AddLogzOrganizationProperties, nargs='+', help='') + c.argument('user_info', action=AddUserInfo, nargs='+', help='') + c.argument('plan_data', action=AddPlanData, nargs='+', help='') + + with self.argument_context('logz monitor update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + c.argument('tags', tags_type) + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + + with self.argument_context('logz monitor delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('logz monitor list-monitored-resource') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('logz monitor list-user-role') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + c.argument('email_address', type=str, help='Email of the user used by Logz for contacting them if needed') + + with self.argument_context('logz monitor wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('logz tag-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('logz tag-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('rule_set_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('logz tag-rule create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('rule_set_name', type=str, help='') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if subscription ' + 'logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_activity_logs', arg_type=get_three_state_flag(), help='Flag specifying if activity logs from ' + 'Azure resources should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all ' + 'resources will be captured. If only Exclude action is specified, the rules will apply to the list ' + 'of all available resources. If Include actions are specified, the rules will only include ' + 'resources with the associated tags.', arg_group='Log Rules') + + with self.argument_context('logz tag-rule update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('rule_set_name', type=str, help='', id_part='child_name_1') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if subscription ' + 'logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_activity_logs', arg_type=get_three_state_flag(), help='Flag specifying if activity logs from ' + 'Azure resources should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all ' + 'resources will be captured. If only Exclude action is specified, the rules will apply to the list ' + 'of all available resources. If Include actions are specified, the rules will only include ' + 'resources with the associated tags.', arg_group='Log Rules') + c.ignore('body') + + with self.argument_context('logz tag-rule delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('rule_set_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('logz single-sign-on list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('logz single-sign-on show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('logz single-sign-on create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('configuration_name', type=str, help='') + c.argument('properties', action=AddProperties, nargs='+', help='') + + with self.argument_context('logz single-sign-on update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') + c.argument('properties', action=AddProperties, nargs='+', help='') + c.ignore('body') + + with self.argument_context('logz single-sign-on wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('logz sub-account list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('logz sub-account show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name', id_part='child_name_1') + + with self.argument_context('logz sub-account create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), + help='', arg_group='Identity') + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + c.argument('marketplace_subscription_status', arg_type=get_enum_type(['Active', 'Suspended']), help='Flag ' + 'specifying the Marketplace Subscription Status of the resource. If payment is not made in time, ' + 'the resource will go in Suspended state.') + c.argument('logz_organization_properties', action=AddLogzOrganizationProperties, nargs='+', help='') + c.argument('user_info', action=AddUserInfo, nargs='+', help='') + c.argument('plan_data', action=AddPlanData, nargs='+', help='') + + with self.argument_context('logz sub-account update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name', id_part='child_name_1') + c.argument('tags', tags_type) + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + + with self.argument_context('logz sub-account delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name', id_part='child_name_1') + + with self.argument_context('logz sub-account list-monitored-resource') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name') + + with self.argument_context('logz sub-account list-vm-host') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name') + + with self.argument_context('logz sub-account list-vm-host-update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name') + c.argument('vm_resource_ids', action=AddVmResourceIds, nargs='+', help='Request of a list vm host update ' + 'operation.') + c.argument('state', arg_type=get_enum_type(['Install', 'Delete']), help='Specifies the state of the operation ' + '- install/ delete.') + + with self.argument_context('logz sub-account vm-host-payload') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name', id_part='child_name_1') + + with self.argument_context('logz sub-account wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', options_list=['--name', '-n', '--sub-account-name'], type=str, help='Sub ' + 'Account resource name', id_part='child_name_1') + + with self.argument_context('logz sub-account-tag-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', type=str, help='Sub Account resource name') + + with self.argument_context('logz sub-account-tag-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', type=str, help='Sub Account resource name', id_part='child_name_1') + c.argument('rule_set_name', type=str, help='', id_part='child_name_2') + + with self.argument_context('logz sub-account-tag-rule create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('sub_account_name', type=str, help='Sub Account resource name') + c.argument('rule_set_name', type=str, help='') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if subscription ' + 'logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_activity_logs', arg_type=get_three_state_flag(), help='Flag specifying if activity logs from ' + 'Azure resources should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all ' + 'resources will be captured. If only Exclude action is specified, the rules will apply to the list ' + 'of all available resources. If Include actions are specified, the rules will only include ' + 'resources with the associated tags.', arg_group='Log Rules') + + with self.argument_context('logz sub-account-tag-rule update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', type=str, help='Sub Account resource name', id_part='child_name_1') + c.argument('rule_set_name', type=str, help='', id_part='child_name_2') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if subscription ' + 'logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_activity_logs', arg_type=get_three_state_flag(), help='Flag specifying if activity logs from ' + 'Azure resources should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all ' + 'resources will be captured. If only Exclude action is specified, the rules will apply to the list ' + 'of all available resources. If Include actions are specified, the rules will only include ' + 'resources with the associated tags.', arg_group='Log Rules') + c.ignore('body') + + with self.argument_context('logz sub-account-tag-rule delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('sub_account_name', type=str, help='Sub Account resource name', id_part='child_name_1') + c.argument('rule_set_name', type=str, help='', id_part='child_name_2') + + with self.argument_context('logz monitor list-vm-host') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('logz monitor list-vm-host-update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + c.argument('vm_resource_ids', action=AddVmResourceIds, nargs='+', help='Request of a list vm host update ' + 'operation.') + c.argument('state', arg_type=get_enum_type(['Install', 'Delete']), help='Specifies the state of the operation ' + '- install/ delete.') + + with self.argument_context('logz monitor vm-host-payload') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') diff --git a/src/logz/azext_logz/generated/_validators.py b/src/logz/azext_logz/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/generated/action.py b/src/logz/azext_logz/generated/action.py new file mode 100644 index 00000000000..c5d07036d2c --- /dev/null +++ b/src/logz/azext_logz/generated/action.py @@ -0,0 +1,190 @@ +# -------------------------------------------------------------------------- +# 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 AddLogzOrganizationProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.logz_organization_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 == 'company-name': + d['company_name'] = v[0] + elif kl == 'enterprise-app-id': + d['enterprise_app_id'] = v[0] + elif kl == 'single-sign-on-url': + d['single_sign_on_url'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter logz_organization_properties. All ' + 'possible keys are: company-name, enterprise-app-id, single-sign-on-url'.format(k)) + return d + + +class AddUserInfo(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.user_info = 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 == 'first-name': + d['first_name'] = v[0] + elif kl == 'last-name': + d['last_name'] = v[0] + elif kl == 'email-address': + d['email_address'] = v[0] + elif kl == 'phone-number': + d['phone_number'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter user_info. All possible keys are: ' + 'first-name, last-name, email-address, phone-number'.format(k)) + return d + + +class AddPlanData(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.plan_data = 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 == 'usage-type': + d['usage_type'] = v[0] + elif kl == 'billing-cycle': + d['billing_cycle'] = v[0] + elif kl == 'plan-details': + d['plan_details'] = v[0] + elif kl == 'effective-date': + d['effective_date'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter plan_data. All possible keys are: ' + 'usage-type, billing-cycle, plan-details, effective-date'.format(k)) + return d + + +class AddFilteringTags(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddFilteringTags, 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] + elif kl == 'action': + d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter filtering_tags. All possible keys are: ' + 'name, value, action'.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 == 'single-sign-on-state': + d['single_sign_on_state'] = v[0] + elif kl == 'enterprise-app-id': + d['enterprise_app_id'] = v[0] + elif kl == 'single-sign-on-url': + d['single_sign_on_url'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'single-sign-on-state, enterprise-app-id, single-sign-on-url'.format(k)) + return d + + +class AddVmResourceIds(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddVmResourceIds, 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 == 'id': + d['id'] = v[0] + elif kl == 'agent-version': + d['agent_version'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter vm_resource_ids. All possible keys are: ' + 'id, agent-version'.format(k)) + return d diff --git a/src/logz/azext_logz/generated/commands.py b/src/logz/azext_logz/generated/commands.py new file mode 100644 index 00000000000..046a7b3f713 --- /dev/null +++ b/src/logz/azext_logz/generated/commands.py @@ -0,0 +1,95 @@ +# -------------------------------------------------------------------------- +# 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_logz.generated._client_factory import cf_monitor + logz_monitor = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._monitors_operations#MonitorsOperations.{}', + client_factory=cf_monitor) + with self.command_group('logz monitor', logz_monitor, client_factory=cf_monitor) as g: + g.custom_command('list', 'logz_monitor_list') + g.custom_show_command('show', 'logz_monitor_show') + g.custom_command('create', 'logz_monitor_create', supports_no_wait=True) + g.custom_command('update', 'logz_monitor_update') + g.custom_command('delete', 'logz_monitor_delete', supports_no_wait=True, confirmation=True) + g.custom_command('list-monitored-resource', 'logz_monitor_list_monitored_resource') + g.custom_command('list-user-role', 'logz_monitor_list_user_role') + g.custom_wait_command('wait', 'logz_monitor_show') + + from azext_logz.generated._client_factory import cf_tag_rule + logz_tag_rule = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._tag_rules_operations#TagRulesOperations.{}', + client_factory=cf_tag_rule) + with self.command_group('logz tag-rule', logz_tag_rule, client_factory=cf_tag_rule) as g: + g.custom_command('list', 'logz_tag_rule_list') + g.custom_show_command('show', 'logz_tag_rule_show') + g.custom_command('create', 'logz_tag_rule_create') + g.generic_update_command('update', setter_arg_name='body', custom_func_name='logz_tag_rule_update') + g.custom_command('delete', 'logz_tag_rule_delete', confirmation=True) + + from azext_logz.generated._client_factory import cf_single_sign_on + logz_single_sign_on = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._single_sign_on_operations#SingleSignOnOperations.{}', + client_factory=cf_single_sign_on) + with self.command_group('logz single-sign-on', logz_single_sign_on, client_factory=cf_single_sign_on) as g: + g.custom_command('list', 'logz_single_sign_on_list') + g.custom_show_command('show', 'logz_single_sign_on_show') + g.custom_command('create', 'logz_single_sign_on_create', supports_no_wait=True) + g.generic_update_command('update', setter_arg_name='body', setter_name='begin_create_or_update', + custom_func_name='logz_single_sign_on_update', supports_no_wait=True) + g.custom_wait_command('wait', 'logz_single_sign_on_show') + + from azext_logz.generated._client_factory import cf_sub_account + logz_sub_account = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._sub_account_operations#SubAccountOperations.{}', + client_factory=cf_sub_account) + with self.command_group('logz sub-account', logz_sub_account, client_factory=cf_sub_account) as g: + g.custom_command('list', 'logz_sub_account_list') + g.custom_show_command('show', 'logz_sub_account_show') + g.custom_command('create', 'logz_sub_account_create', supports_no_wait=True) + g.custom_command('update', 'logz_sub_account_update') + g.custom_command('delete', 'logz_sub_account_delete', supports_no_wait=True, confirmation=True) + g.custom_command('list-monitored-resource', 'logz_sub_account_list_monitored_resource') + g.custom_command('list-vm-host', 'logz_sub_account_list_vm_host') + g.custom_command('list-vm-host-update', 'logz_sub_account_list_vm_host_update') + g.custom_command('vm-host-payload', 'logz_sub_account_vm_host_payload') + g.custom_wait_command('wait', 'logz_sub_account_show') + + from azext_logz.generated._client_factory import cf_sub_account_tag_rule + logz_sub_account_tag_rule = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._sub_account_tag_rules_operations#SubAccountTagRulesO' + 'perations.{}', + client_factory=cf_sub_account_tag_rule) + with self.command_group('logz sub-account-tag-rule', logz_sub_account_tag_rule, + client_factory=cf_sub_account_tag_rule) as g: + g.custom_command('list', 'logz_sub_account_tag_rule_list') + g.custom_show_command('show', 'logz_sub_account_tag_rule_show') + g.custom_command('create', 'logz_sub_account_tag_rule_create') + g.generic_update_command('update', setter_arg_name='body', + custom_func_name='logz_sub_account_tag_rule_update') + g.custom_command('delete', 'logz_sub_account_tag_rule_delete', confirmation=True) + + from azext_logz.generated._client_factory import cf_monitor + logz_monitor = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._monitor_operations#MonitorOperations.{}', + client_factory=cf_monitor) + with self.command_group('logz monitor', logz_monitor, client_factory=cf_monitor) as g: + g.custom_command('list-vm-host', 'logz_monitor_list_vm_host') + g.custom_command('list-vm-host-update', 'logz_monitor_list_vm_host_update') + g.custom_command('vm-host-payload', 'logz_monitor_vm_host_payload') + + with self.command_group('logz', is_experimental=True): + pass diff --git a/src/logz/azext_logz/generated/custom.py b/src/logz/azext_logz/generated/custom.py new file mode 100644 index 00000000000..95f85132633 --- /dev/null +++ b/src/logz/azext_logz/generated/custom.py @@ -0,0 +1,424 @@ +# -------------------------------------------------------------------------- +# 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 logz_monitor_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 logz_monitor_show(client, + resource_group_name, + monitor_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_create(client, + resource_group_name, + monitor_name, + tags=None, + location=None, + type_=None, + monitoring_status=None, + marketplace_subscription_status=None, + logz_organization_properties=None, + user_info=None, + plan_data=None, + no_wait=False): + body = {} + body['tags'] = tags + body['location'] = location + body['identity'] = {} + body['identity']['type'] = type_ + body['properties'] = {} + body['properties']['monitoring_status'] = monitoring_status + body['properties']['marketplace_subscription_status'] = marketplace_subscription_status + body['properties']['logz_organization_properties'] = logz_organization_properties + body['properties']['user_info'] = user_info + body['properties']['plan_data'] = plan_data + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_monitor_update(client, + resource_group_name, + monitor_name, + tags=None, + monitoring_status=None): + body = {} + body['tags'] = tags + body['properties'] = {} + body['properties']['monitoring_status'] = monitoring_status + return client.update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_monitor_delete(client, + resource_group_name, + monitor_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_list_monitored_resource(client, + resource_group_name, + monitor_name): + return client.list_monitored_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_list_user_role(client, + resource_group_name, + monitor_name, + email_address=None): + body = {} + body['email_address'] = email_address + return client.list_user_roles(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_tag_rule_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_tag_rule_show(client, + resource_group_name, + monitor_name, + rule_set_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name) + + +def logz_tag_rule_create(client, + resource_group_name, + monitor_name, + rule_set_name, + send_aad_logs=None, + send_subscription_logs=None, + send_activity_logs=None, + filtering_tags=None): + body = {} + body['log_rules'] = {} + body['log_rules']['send_aad_logs'] = send_aad_logs + body['log_rules']['send_subscription_logs'] = send_subscription_logs + body['log_rules']['send_activity_logs'] = send_activity_logs + body['log_rules']['filtering_tags'] = filtering_tags + return client.create_or_update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + body=body) + + +def logz_tag_rule_update(instance, + resource_group_name, + monitor_name, + rule_set_name, + send_aad_logs=None, + send_subscription_logs=None, + send_activity_logs=None, + filtering_tags=None): + if send_aad_logs is not None: + instance.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.log_rules.send_subscription_logs = send_subscription_logs + if send_activity_logs is not None: + instance.log_rules.send_activity_logs = send_activity_logs + if filtering_tags is not None: + instance.log_rules.filtering_tags = filtering_tags + return instance + + +def logz_tag_rule_delete(client, + resource_group_name, + monitor_name, + rule_set_name): + return client.delete(resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name) + + +def logz_single_sign_on_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_single_sign_on_show(client, + resource_group_name, + monitor_name, + configuration_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name) + + +def logz_single_sign_on_create(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + body = {} + body['properties'] = properties + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body) + + +def logz_single_sign_on_update(instance, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + if properties is not None: + instance.properties = properties + return instance + + +def logz_sub_account_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_sub_account_show(client, + resource_group_name, + monitor_name, + sub_account_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_create(client, + resource_group_name, + monitor_name, + sub_account_name, + tags=None, + location=None, + type_=None, + monitoring_status=None, + marketplace_subscription_status=None, + logz_organization_properties=None, + user_info=None, + plan_data=None, + no_wait=False): + body = {} + body['tags'] = tags + body['location'] = location + body['identity'] = {} + body['identity']['type'] = type_ + body['properties'] = {} + body['properties']['monitoring_status'] = monitoring_status + body['properties']['marketplace_subscription_status'] = marketplace_subscription_status + body['properties']['logz_organization_properties'] = logz_organization_properties + body['properties']['user_info'] = user_info + body['properties']['plan_data'] = plan_data + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + body=body) + + +def logz_sub_account_update(client, + resource_group_name, + monitor_name, + sub_account_name, + tags=None, + monitoring_status=None): + body = {} + body['tags'] = tags + body['properties'] = {} + body['properties']['monitoring_status'] = monitoring_status + return client.update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + body=body) + + +def logz_sub_account_delete(client, + resource_group_name, + monitor_name, + sub_account_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_list_monitored_resource(client, + resource_group_name, + monitor_name, + sub_account_name): + return client.list_monitored_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_list_vm_host(client, + resource_group_name, + monitor_name, + sub_account_name): + return client.list_vm_hosts(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_list_vm_host_update(client, + resource_group_name, + monitor_name, + sub_account_name, + vm_resource_ids=None, + state=None): + body = {} + body['vm_resource_ids'] = vm_resource_ids + body['state'] = state + return client.list_vm_host_update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + body=body) + + +def logz_sub_account_vm_host_payload(client, + resource_group_name, + monitor_name, + sub_account_name): + return client.vm_host_payload(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_tag_rule_list(client, + resource_group_name, + monitor_name, + sub_account_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name) + + +def logz_sub_account_tag_rule_show(client, + resource_group_name, + monitor_name, + sub_account_name, + rule_set_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + rule_set_name=rule_set_name) + + +def logz_sub_account_tag_rule_create(client, + resource_group_name, + monitor_name, + sub_account_name, + rule_set_name, + send_aad_logs=None, + send_subscription_logs=None, + send_activity_logs=None, + filtering_tags=None): + body = {} + body['log_rules'] = {} + body['log_rules']['send_aad_logs'] = send_aad_logs + body['log_rules']['send_subscription_logs'] = send_subscription_logs + body['log_rules']['send_activity_logs'] = send_activity_logs + body['log_rules']['filtering_tags'] = filtering_tags + return client.create_or_update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + rule_set_name=rule_set_name, + body=body) + + +def logz_sub_account_tag_rule_update(instance, + resource_group_name, + monitor_name, + sub_account_name, + rule_set_name, + send_aad_logs=None, + send_subscription_logs=None, + send_activity_logs=None, + filtering_tags=None): + if send_aad_logs is not None: + instance.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.log_rules.send_subscription_logs = send_subscription_logs + if send_activity_logs is not None: + instance.log_rules.send_activity_logs = send_activity_logs + if filtering_tags is not None: + instance.log_rules.filtering_tags = filtering_tags + return instance + + +def logz_sub_account_tag_rule_delete(client, + resource_group_name, + monitor_name, + sub_account_name, + rule_set_name): + return client.delete(resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + rule_set_name=rule_set_name) + + +def logz_monitor_list_vm_host(client, + resource_group_name, + monitor_name): + return client.list_vm_hosts(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_list_vm_host_update(client, + resource_group_name, + monitor_name, + vm_resource_ids=None, + state=None): + body = {} + body['vm_resource_ids'] = vm_resource_ids + body['state'] = state + return client.list_vm_host_update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_monitor_vm_host_payload(client, + resource_group_name, + monitor_name): + return client.vm_host_payload(resource_group_name=resource_group_name, + monitor_name=monitor_name) diff --git a/src/logz/azext_logz/manual/__init__.py b/src/logz/azext_logz/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/tests/__init__.py b/src/logz/azext_logz/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/tests/latest/__init__.py b/src/logz/azext_logz/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/tests/latest/example_steps.py b/src/logz/azext_logz/tests/latest/example_steps.py new file mode 100644 index 00000000000..8681aaf5229 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/example_steps.py @@ -0,0 +1,408 @@ +# -------------------------------------------------------------------------- +# 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: /Monitors/put/Monitors_Create +@try_manual +def step_monitor_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor create ' + '--name "{myMonitor}" ' + '--location "West US" ' + '--plan-data billing-cycle="Monthly" effective-date="2019-08-30T15:14:33+02:00" ' + 'plan-details="logzapitestplan" usage-type="Committed" ' + '--user-info email-address="alice@microsoft.com" first-name="Alice" last-name="Bob" phone-number="123456" ' + '' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az logz monitor wait --created ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_Get +@try_manual +def step_monitor_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor show ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_List +@try_manual +def step_monitor_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_ListByResourceGroup +@try_manual +def step_monitor_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/patch/Monitors_Update +@try_manual +def step_monitor_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor update ' + '--name "{myMonitor}" ' + '--monitoring-status "Enabled" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/MainAccount_VMHosts_Update +@try_manual +def step_monitor_list_user_role(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list-user-role ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/MonitoredResources_List +@try_manual +def step_monitor_list_monitored_resource(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list-monitored-resource ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitor/post/MainAccount_VMHosts_List +@try_manual +def step_monitor_list_vm_host(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list-vm-host ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitor/post/MainAccount_VMHosts_Payload +@try_manual +def step_monitor_vm_host_payload(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor vm-host-payload ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitor/post/MainAccount_VMHosts_Update +@try_manual +def step_monitor_list_vm_host_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor list-vm-host-update ' + '--name "{myMonitor}" ' + '--state "Install" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOn/put/SingleSignOnConfigurations_CreateOrUpdate +@try_manual +def step_single_sign_on_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz single-sign-on create ' + '--configuration-name "default" ' + '--monitor-name "{myMonitor}" ' + '--properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" ' + 'single-sign-on-url=null ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOn/get/SingleSignOnConfigurations_Get +@try_manual +def step_single_sign_on_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz single-sign-on show ' + '--configuration-name "default" ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOn/get/SingleSignOnConfigurations_List +@try_manual +def step_single_sign_on_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz single-sign-on list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SubAccount/put/subAccount_Create +@try_manual +def step_sub_account_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account create ' + '--monitor-name "{myMonitor}" ' + '--type "Microsoft.Logz/monitors" ' + '--location "West US" ' + '--monitoring-status "Enabled" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=[]) + test.cmd('az logz sub-account wait --created ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/get/SubAccount_Get +@try_manual +def step_sub_account_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account show ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/get/SubAccount_List +@try_manual +def step_sub_account_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SubAccount/patch/SubAccount_Update +@try_manual +def step_sub_account_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account update ' + '--monitor-name "{myMonitor}" ' + '--monitoring-status "Enabled" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/post/SubAccount_MonitoredResources_List +@try_manual +def step_sub_account_list_monitored_resource(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account list-monitored-resource ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/post/SubAccount_VMHosts_List +@try_manual +def step_sub_account_list_vm_host(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account list-vm-host ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/post/SubAccount_VMHosts_Payload +@try_manual +def step_sub_account_vm_host_payload(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account vm-host-payload ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/post/SubAccount_VMHosts_Update +@try_manual +def step_sub_account_list_vm_host_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account list-vm-host-update ' + '--monitor-name "{myMonitor}" ' + '--state "Install" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccountTagRules/put/SubAccountTagRules_CreateOrUpdate +@try_manual +def step_sub_account_tag_rule_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account-tag-rule create ' + '--monitor-name "{myMonitor}" ' + '--filtering-tags name="Environment" action="Include" value="Prod" ' + '--filtering-tags name="Environment" action="Exclude" value="Dev" ' + '--send-aad-logs false ' + '--send-activity-logs true ' + '--send-subscription-logs true ' + '--resource-group "{rg}" ' + '--rule-set-name "default" ' + '--sub-account-name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccountTagRules/get/SubAccountTagRules_Get +@try_manual +def step_sub_account_tag_rule_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account-tag-rule show ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--rule-set-name "default" ' + '--sub-account-name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccountTagRules/get/SubAccountTagRules_List +@try_manual +def step_sub_account_tag_rule_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account-tag-rule list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--sub-account-name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccountTagRules/delete/TagRules_Delete +@try_manual +def step_sub_account_tag_rule_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account-tag-rule delete -y ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--rule-set-name "default" ' + '--sub-account-name "{mySubAccount}"', + checks=checks) + + +# EXAMPLE: /SubAccount/delete/SubAccount_Delete +@try_manual +def step_sub_account_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz sub-account delete -y ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--name "{mySubAccount2}"', + checks=checks) + + +# EXAMPLE: /TagRules/put/TagRules_CreateOrUpdate +@try_manual +def step_tag_rule_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz tag-rule create ' + '--monitor-name "{myMonitor}" ' + '--filtering-tags name="Environment" action="Include" value="Prod" ' + '--filtering-tags name="Environment" action="Exclude" value="Dev" ' + '--send-aad-logs false ' + '--send-activity-logs true ' + '--send-subscription-logs true ' + '--resource-group "{rg}" ' + '--rule-set-name "default"', + checks=checks) + + +# EXAMPLE: /TagRules/get/TagRules_Get +@try_manual +def step_tag_rule_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz tag-rule show ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--rule-set-name "default"', + checks=checks) + + +# EXAMPLE: /TagRules/get/TagRules_List +@try_manual +def step_tag_rule_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz tag-rule list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /TagRules/delete/TagRules_Delete +@try_manual +def step_tag_rule_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz tag-rule delete -y ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--rule-set-name "default"', + checks=checks) + + +# EXAMPLE: /Monitors/delete/Monitors_Delete +@try_manual +def step_monitor_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az logz monitor delete -y ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + diff --git a/src/logz/azext_logz/tests/latest/test_logz_scenario.py b/src/logz/azext_logz/tests/latest/test_logz_scenario.py new file mode 100644 index 00000000000..297aac67897 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/test_logz_scenario.py @@ -0,0 +1,165 @@ +# -------------------------------------------------------------------------- +# 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_monitor_create +from .example_steps import step_monitor_show +from .example_steps import step_monitor_list +from .example_steps import step_monitor_list2 +from .example_steps import step_monitor_update +from .example_steps import step_monitor_list_user_role +from .example_steps import step_monitor_list_monitored_resource +from .example_steps import step_monitor_list_vm_host +from .example_steps import step_monitor_vm_host_payload +from .example_steps import step_monitor_list_vm_host_update +from .example_steps import step_single_sign_on_create +from .example_steps import step_single_sign_on_show +from .example_steps import step_single_sign_on_list +from .example_steps import step_sub_account_create +from .example_steps import step_sub_account_show +from .example_steps import step_sub_account_list +from .example_steps import step_sub_account_update +from .example_steps import step_sub_account_list_monitored_resource +from .example_steps import step_sub_account_list_vm_host +from .example_steps import step_sub_account_vm_host_payload +from .example_steps import step_sub_account_list_vm_host_update +from .example_steps import step_sub_account_tag_rule_create +from .example_steps import step_sub_account_tag_rule_show +from .example_steps import step_sub_account_tag_rule_list +from .example_steps import step_sub_account_tag_rule_delete +from .example_steps import step_sub_account_delete +from .example_steps import step_tag_rule_create +from .example_steps import step_tag_rule_show +from .example_steps import step_tag_rule_list +from .example_steps import step_tag_rule_delete +from .example_steps import step_monitor_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): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg): + setup_scenario(test, rg) + step_monitor_create(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_monitor_show(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("planData.billingCycle", "Monthly", case_sensitive=False), + test.check("planData.effectiveDate", "2019-08-30T15:14:33+02:00", case_sensitive=False), + test.check("planData.planDetails", "logzapitestplan", case_sensitive=False), + test.check("planData.usageType", "Committed", case_sensitive=False), + test.check("userInfo.emailAddress", "alice@microsoft.com", case_sensitive=False), + test.check("userInfo.firstName", "Alice", case_sensitive=False), + test.check("userInfo.lastName", "Bob", case_sensitive=False), + test.check("userInfo.phoneNumber", "123456", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_monitor_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_monitor_list2(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_monitor_update(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + test.check("monitoringStatus", "Enabled", case_sensitive=False), + ]) + step_monitor_list_user_role(test, rg, checks=[]) + step_monitor_list_monitored_resource(test, rg, checks=[]) + step_monitor_list_vm_host(test, rg, checks=[]) + step_monitor_vm_host_payload(test, rg, checks=[]) + step_monitor_list_vm_host_update(test, rg, checks=[]) + step_single_sign_on_create(test, rg, checks=[]) + step_single_sign_on_show(test, rg, checks=[]) + step_single_sign_on_list(test, rg, checks=[]) + step_sub_account_create(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("type", "Microsoft.Logz/monitors", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_sub_account_show(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("type", "Microsoft.Logz/monitors", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("monitoringStatus", "Enabled", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_sub_account_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_sub_account_update(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("type", "Microsoft.Logz/monitors", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("monitoringStatus", "Enabled", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_sub_account_list_monitored_resource(test, rg, checks=[]) + step_sub_account_list_vm_host(test, rg, checks=[]) + step_sub_account_vm_host_payload(test, rg, checks=[]) + step_sub_account_list_vm_host_update(test, rg, checks=[]) + step_sub_account_tag_rule_create(test, rg, checks=[]) + step_sub_account_tag_rule_show(test, rg, checks=[]) + step_sub_account_tag_rule_list(test, rg, checks=[]) + step_sub_account_tag_rule_delete(test, rg, checks=[]) + step_sub_account_delete(test, rg, checks=[]) + step_tag_rule_create(test, rg, checks=[]) + step_tag_rule_show(test, rg, checks=[]) + step_tag_rule_list(test, rg, checks=[]) + step_tag_rule_delete(test, rg, checks=[]) + step_monitor_delete(test, rg, checks=[]) + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class LogzScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(LogzScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'myMonitor': 'myMonitor', + 'mySubAccount': 'SubAccount1', + 'mySubAccount2': 'someName', + }) + + + @ResourceGroupPreparer(name_prefix='clitestlogz_myResourceGroup'[:7], key='rg', parameter_name='rg') + def test_logz_Scenario(self, rg): + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/logz/azext_logz/vendored_sdks/__init__.py b/src/logz/azext_logz/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/logz/azext_logz/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/logz/azext_logz/vendored_sdks/logz/__init__.py b/src/logz/azext_logz/vendored_sdks/logz/__init__.py new file mode 100644 index 00000000000..7f1a4e3e578 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/__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 ._microsoft_logz import MicrosoftLogz +__all__ = ['MicrosoftLogz'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/logz/azext_logz/vendored_sdks/logz/_configuration.py b/src/logz/azext_logz/vendored_sdks/logz/_configuration.py new file mode 100644 index 00000000000..63ac6792871 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/_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 MicrosoftLogzConfiguration(Configuration): + """Configuration for MicrosoftLogz. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + 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(MicrosoftLogzConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftlogz/{}'.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/logz/azext_logz/vendored_sdks/logz/_microsoft_logz.py b/src/logz/azext_logz/vendored_sdks/logz/_microsoft_logz.py new file mode 100644 index 00000000000..947f1cc08a1 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/_microsoft_logz.py @@ -0,0 +1,99 @@ +# 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 MicrosoftLogzConfiguration +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnOperations +from .operations import SubAccountOperations +from .operations import SubAccountTagRulesOperations +from .operations import MonitorOperations +from . import models + + +class MicrosoftLogz(object): + """MicrosoftLogz. + + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_logz.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_logz.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_logz.operations.TagRulesOperations + :ivar single_sign_on: SingleSignOnOperations operations + :vartype single_sign_on: microsoft_logz.operations.SingleSignOnOperations + :ivar sub_account: SubAccountOperations operations + :vartype sub_account: microsoft_logz.operations.SubAccountOperations + :ivar sub_account_tag_rules: SubAccountTagRulesOperations operations + :vartype sub_account_tag_rules: microsoft_logz.operations.SubAccountTagRulesOperations + :ivar monitor: MonitorOperations operations + :vartype monitor: microsoft_logz.operations.MonitorOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param 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 = MicrosoftLogzConfiguration(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.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.single_sign_on = SingleSignOnOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sub_account = SubAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sub_account_tag_rules = SubAccountTagRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitor = MonitorOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MicrosoftLogz + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/__init__.py b/src/logz/azext_logz/vendored_sdks/logz/aio/__init__.py new file mode 100644 index 00000000000..dca956cbd29 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/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 ._microsoft_logz import MicrosoftLogz +__all__ = ['MicrosoftLogz'] diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/_configuration.py b/src/logz/azext_logz/vendored_sdks/logz/aio/_configuration.py new file mode 100644 index 00000000000..8bb5415255e --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/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 MicrosoftLogzConfiguration(Configuration): + """Configuration for MicrosoftLogz. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + 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(MicrosoftLogzConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftlogz/{}'.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/logz/azext_logz/vendored_sdks/logz/aio/_microsoft_logz.py b/src/logz/azext_logz/vendored_sdks/logz/aio/_microsoft_logz.py new file mode 100644 index 00000000000..41517eb01ee --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/_microsoft_logz.py @@ -0,0 +1,93 @@ +# 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 MicrosoftLogzConfiguration +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnOperations +from .operations import SubAccountOperations +from .operations import SubAccountTagRulesOperations +from .operations import MonitorOperations +from .. import models + + +class MicrosoftLogz(object): + """MicrosoftLogz. + + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_logz.aio.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_logz.aio.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_logz.aio.operations.TagRulesOperations + :ivar single_sign_on: SingleSignOnOperations operations + :vartype single_sign_on: microsoft_logz.aio.operations.SingleSignOnOperations + :ivar sub_account: SubAccountOperations operations + :vartype sub_account: microsoft_logz.aio.operations.SubAccountOperations + :ivar sub_account_tag_rules: SubAccountTagRulesOperations operations + :vartype sub_account_tag_rules: microsoft_logz.aio.operations.SubAccountTagRulesOperations + :ivar monitor: MonitorOperations operations + :vartype monitor: microsoft_logz.aio.operations.MonitorOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param 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 = MicrosoftLogzConfiguration(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.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.single_sign_on = SingleSignOnOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sub_account = SubAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sub_account_tag_rules = SubAccountTagRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitor = MonitorOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MicrosoftLogz": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/__init__.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/__init__.py new file mode 100644 index 00000000000..9c8560a389d --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_operations import SingleSignOnOperations +from ._sub_account_operations import SubAccountOperations +from ._sub_account_tag_rules_operations import SubAccountTagRulesOperations +from ._monitor_operations import MonitorOperations + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', + 'SubAccountOperations', + 'SubAccountTagRulesOperations', + 'MonitorOperations', +] diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitor_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitor_operations.py new file mode 100644 index 00000000000..360db77770c --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitor_operations.py @@ -0,0 +1,276 @@ +# 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 MonitorOperations: + """MonitorOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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 vm_host_payload( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.VmExtensionPayload": + """Returns the payload that needs to be passed in the request body for installing Logz.io agent on a VM. + + Returns the payload that needs to be passed in the request body for installing Logz.io agent on + a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmExtensionPayload, or the result of cls(response) + :rtype: ~microsoft_logz.models.VmExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.vm_host_payload.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VmExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + vm_host_payload.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/vmHostPayload'} # type: ignore + + def list_vm_host_update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.VmHostUpdateRequest"] = None, + **kwargs + ) -> AsyncIterable["models.VmResourcesListResponse"]: + """Sending request to update the collection when Logz.io agent has been installed on a VM for a given monitor. + + Sending request to update the collection when Logz.io agent has been installed on a VM for a + given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: Request body to update the collection for agent installed in the given monitor. + :type body: ~microsoft_logz.models.VmHostUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_vm_host_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_vm_host_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/vmHostUpdate'} # type: ignore + + def list_vm_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.VmResourcesListResponse"]: + """List the compute resources currently being monitored by the Logz main account resource. + + List the compute resources currently being monitored by the Logz main account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_vm_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + request = self._client.post(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('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_vm_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listVMHosts'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitors_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitors_operations.py new file mode 100644 index 00000000000..d7712519493 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitors_operations.py @@ -0,0 +1,740 @@ +# 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, Union +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.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 MonitorsOperations: + """MonitorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Logz monitor resource. + + List the resources currently being monitored by the Logz monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + request = self._client.post(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('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.LogzMonitorResourceListResponse"]: + """List all monitors under the specified subscription. + + List all monitors under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Logz/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.LogzMonitorResourceListResponse"]: + """List all monitors under the specified resource group. + + List all monitors under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + '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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.LogzMonitorResource": + """Get the properties of a specific monitor resource. + + Get the properties of a specific monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.LogzMonitorResource"] = None, + **kwargs + ) -> "models.LogzMonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.LogzMonitorResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.LogzMonitorResource"]: + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResource + :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 LogzMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_logz.models.LogzMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + 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_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body, + 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('LogzMonitorResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.LogzMonitorResourceUpdateParameters"] = None, + **kwargs + ) -> "models.LogzMonitorResource": + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResourceUpdateParameters') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + monitor_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_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, + monitor_name=monitor_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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.Logz/monitors/{monitorName}'} # type: ignore + + def list_user_roles( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.UserRoleRequest"] = None, + **kwargs + ) -> AsyncIterable["models.UserRoleListResponse"]: + """List the user's roles configured on Logz.io side for the account corresponding to the monitor resource. + + List the user's roles configured on Logz.io side for the account corresponding to the monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.UserRoleRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserRoleListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.UserRoleListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserRoleListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_user_roles.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'UserRoleRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'UserRoleRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UserRoleListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_user_roles.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listUserRoles'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_operations.py new file mode 100644 index 00000000000..5945cbae078 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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: ~microsoft_logz.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"]: + """List all operations provided by Microsoft.Logz. + + List all operations provided by Microsoft.Logz. + + :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[~microsoft_logz.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', {})) + 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] + + 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 deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Logz/operations'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_single_sign_on_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_single_sign_on_operations.py new file mode 100644 index 00000000000..800be2b8e4f --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_single_sign_on_operations.py @@ -0,0 +1,327 @@ +# 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, Union +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.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 SingleSignOnOperations: + """SingleSignOnOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.LogzSingleSignOnResourceListResponse"]: + """List the single sign-on configurations for a given monitor resource. + + List the single sign-on configurations for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzSingleSignOnResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.LogzSingleSignOnResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('LogzSingleSignOnResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional["models.LogzSingleSignOnResource"] = None, + **kwargs + ) -> "models.LogzSingleSignOnResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", 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] + if body is not None: + body_content = self._serialize.body(body, 'LogzSingleSignOnResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional["models.LogzSingleSignOnResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.LogzSingleSignOnResource"]: + """Configures single-sign-on for this resource. + + Configures single-sign-on for this resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: + :type configuration_name: str + :param body: + :type body: ~microsoft_logz.models.LogzSingleSignOnResource + :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 LogzSingleSignOnResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_logz.models.LogzSingleSignOnResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + 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, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + 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('LogzSingleSignOnResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs + ) -> "models.LogzSingleSignOnResource": + """Gets the Logz single sign-on resource for the given Monitor. + + Gets the Logz single sign-on resource for the given Monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzSingleSignOnResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzSingleSignOnResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_operations.py new file mode 100644 index 00000000000..583cb0a1098 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_operations.py @@ -0,0 +1,851 @@ +# 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, Union +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.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 SubAccountOperations: + """SubAccountOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.LogzMonitorResourceListResponse"]: + """List the sub account under a given monitor resource. + + List the sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + body: Optional["models.LogzMonitorResource"] = None, + **kwargs + ) -> "models.LogzMonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + body: Optional["models.LogzMonitorResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.LogzMonitorResource"]: + """Create sub account under a given monitor resource. + + Create sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResource + :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 LogzMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_logz.models.LogzMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + 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_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + body=body, + 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('LogzMonitorResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> "models.LogzMonitorResource": + """Get a sub account under a given monitor resource. + + Get a sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + sub_account_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a sub account resource. + + Delete a sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_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, + monitor_name=monitor_name, + sub_account_name=sub_account_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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + body: Optional["models.LogzMonitorResourceUpdateParameters"] = None, + **kwargs + ) -> "models.LogzMonitorResource": + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResourceUpdateParameters') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Logz sub account resource. + + List the resources currently being monitored by the Logz sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + request = self._client.post(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('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/listMonitoredResources'} # type: ignore + + async def vm_host_payload( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> "models.VmExtensionPayload": + """Returns the payload that needs to be passed as a request for installing Logz.io agent on a VM. + + Returns the payload that needs to be passed as a request for installing Logz.io agent on a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmExtensionPayload, or the result of cls(response) + :rtype: ~microsoft_logz.models.VmExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.vm_host_payload.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VmExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + vm_host_payload.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostPayload'} # type: ignore + + def list_vm_host_update( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + body: Optional["models.VmHostUpdateRequest"] = None, + **kwargs + ) -> AsyncIterable["models.VmResourcesListResponse"]: + """Sending request to update the collection when Logz.io agent has been installed on a VM for a given monitor. + + Sending request to update the collection when Logz.io agent has been installed on a VM for a + given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: Request body to update the collection for agent installed in the given monitor. + :type body: ~microsoft_logz.models.VmHostUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_vm_host_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_vm_host_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostUpdate'} # type: ignore + + def list_vm_hosts( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> AsyncIterable["models.VmResourcesListResponse"]: + """List the compute resources currently being monitored by the Logz sub account resource. + + List the compute resources currently being monitored by the Logz sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_vm_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + request = self._client.post(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('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_vm_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/listVMHosts'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_tag_rules_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_tag_rules_operations.py new file mode 100644 index 00000000000..f2b45428317 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_tag_rules_operations.py @@ -0,0 +1,342 @@ +# 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 SubAccountTagRulesOperations: + """SubAccountTagRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoringTagRulesListResponse"]: + """List the tag rules for a given sub account resource. + + List the tag rules for a given sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.MonitoringTagRulesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + 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('MonitoringTagRulesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + rule_set_name: str, + body: Optional["models.MonitoringTagRules"] = None, + **kwargs + ) -> "models.MonitoringTagRules": + """Create or update a tag rule set for a given sub account resource. + + Create or update a tag rule set for a given sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_name: str + :param body: + :type body: ~microsoft_logz.models.MonitoringTagRules + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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] + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + rule_set_name: str, + **kwargs + ) -> "models.MonitoringTagRules": + """Get a tag rule set for a given monitor resource. + + Get a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + monitor_name: str, + sub_account_name: str, + rule_set_name: str, + **kwargs + ) -> None: + """Delete a tag rule set for a given monitor resource. + + Delete a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_tag_rules_operations.py b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_tag_rules_operations.py new file mode 100644 index 00000000000..398ce859589 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_tag_rules_operations.py @@ -0,0 +1,326 @@ +# 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 TagRulesOperations: + """TagRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoringTagRulesListResponse"]: + """List the tag rules for a given monitor resource. + + List the tag rules for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_logz.models.MonitoringTagRulesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('MonitoringTagRulesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional["models.MonitoringTagRules"] = None, + **kwargs + ) -> "models.MonitoringTagRules": + """Create or update a tag rule set for a given monitor resource. + + Create or update a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_name: str + :param body: + :type body: ~microsoft_logz.models.MonitoringTagRules + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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] + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs + ) -> "models.MonitoringTagRules": + """Get a tag rule set for a given monitor resource. + + Get a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs + ) -> None: + """Delete a tag rule set for a given monitor resource. + + Delete a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/models/__init__.py b/src/logz/azext_logz/vendored_sdks/logz/models/__init__.py new file mode 100644 index 00000000000..f4eb466af52 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/models/__init__.py @@ -0,0 +1,135 @@ +# 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 ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import FilteringTag + from ._models_py3 import IdentityProperties + from ._models_py3 import LogRules + from ._models_py3 import LogzMonitorResource + from ._models_py3 import LogzMonitorResourceListResponse + from ._models_py3 import LogzMonitorResourceUpdateParameters + from ._models_py3 import LogzOrganizationProperties + from ._models_py3 import LogzSingleSignOnProperties + from ._models_py3 import LogzSingleSignOnResource + from ._models_py3 import LogzSingleSignOnResourceListResponse + from ._models_py3 import MonitorProperties + from ._models_py3 import MonitorUpdateProperties + from ._models_py3 import MonitoredResource + from ._models_py3 import MonitoredResourceListResponse + from ._models_py3 import MonitoringTagRules + from ._models_py3 import MonitoringTagRulesListResponse + from ._models_py3 import MonitoringTagRulesProperties + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import OperationResult + from ._models_py3 import PlanData + from ._models_py3 import SystemData + from ._models_py3 import UserInfo + from ._models_py3 import UserRoleListResponse + from ._models_py3 import UserRoleRequest + from ._models_py3 import UserRoleResponse + from ._models_py3 import VmExtensionPayload + from ._models_py3 import VmHostUpdateRequest + from ._models_py3 import VmResources + from ._models_py3 import VmResourcesListResponse +except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import FilteringTag # type: ignore + from ._models import IdentityProperties # type: ignore + from ._models import LogRules # type: ignore + from ._models import LogzMonitorResource # type: ignore + from ._models import LogzMonitorResourceListResponse # type: ignore + from ._models import LogzMonitorResourceUpdateParameters # type: ignore + from ._models import LogzOrganizationProperties # type: ignore + from ._models import LogzSingleSignOnProperties # type: ignore + from ._models import LogzSingleSignOnResource # type: ignore + from ._models import LogzSingleSignOnResourceListResponse # type: ignore + from ._models import MonitorProperties # type: ignore + from ._models import MonitorUpdateProperties # type: ignore + from ._models import MonitoredResource # type: ignore + from ._models import MonitoredResourceListResponse # type: ignore + from ._models import MonitoringTagRules # type: ignore + from ._models import MonitoringTagRulesListResponse # type: ignore + from ._models import MonitoringTagRulesProperties # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationResult # type: ignore + from ._models import PlanData # type: ignore + from ._models import SystemData # type: ignore + from ._models import UserInfo # type: ignore + from ._models import UserRoleListResponse # type: ignore + from ._models import UserRoleRequest # type: ignore + from ._models import UserRoleResponse # type: ignore + from ._models import VmExtensionPayload # type: ignore + from ._models import VmHostUpdateRequest # type: ignore + from ._models import VmResources # type: ignore + from ._models import VmResourcesListResponse # type: ignore + +from ._microsoft_logz_enums import ( + CreatedByType, + LiftrResourceCategories, + ManagedIdentityTypes, + MarketplaceSubscriptionStatus, + MonitoringStatus, + ProvisioningState, + SingleSignOnStates, + TagAction, + UserRole, + VmHostUpdateStates, +) + +__all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'FilteringTag', + 'IdentityProperties', + 'LogRules', + 'LogzMonitorResource', + 'LogzMonitorResourceListResponse', + 'LogzMonitorResourceUpdateParameters', + 'LogzOrganizationProperties', + 'LogzSingleSignOnProperties', + 'LogzSingleSignOnResource', + 'LogzSingleSignOnResourceListResponse', + 'MonitorProperties', + 'MonitorUpdateProperties', + 'MonitoredResource', + 'MonitoredResourceListResponse', + 'MonitoringTagRules', + 'MonitoringTagRulesListResponse', + 'MonitoringTagRulesProperties', + 'OperationDisplay', + 'OperationListResult', + 'OperationResult', + 'PlanData', + 'SystemData', + 'UserInfo', + 'UserRoleListResponse', + 'UserRoleRequest', + 'UserRoleResponse', + 'VmExtensionPayload', + 'VmHostUpdateRequest', + 'VmResources', + 'VmResourcesListResponse', + 'CreatedByType', + 'LiftrResourceCategories', + 'ManagedIdentityTypes', + 'MarketplaceSubscriptionStatus', + 'MonitoringStatus', + 'ProvisioningState', + 'SingleSignOnStates', + 'TagAction', + 'UserRole', + 'VmHostUpdateStates', +] diff --git a/src/logz/azext_logz/vendored_sdks/logz/models/_microsoft_logz_enums.py b/src/logz/azext_logz/vendored_sdks/logz/models/_microsoft_logz_enums.py new file mode 100644 index 00000000000..039610c1bc9 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/models/_microsoft_logz_enums.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class LiftrResourceCategories(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + UNKNOWN = "Unknown" + MONITOR_LOGS = "MonitorLogs" + +class ManagedIdentityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + +class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in + time, the resource will go in Suspended state. + """ + + ACTIVE = "Active" + SUSPENDED = "Suspended" + +class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag specifying if the resource monitoring is enabled or disabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Flag specifying if the resource provisioning state as tracked by ARM. + """ + + ACCEPTED = "Accepted" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETED = "Deleted" + NOT_SPECIFIED = "NotSpecified" + +class SingleSignOnStates(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Various states of the SSO resource + """ + + INITIAL = "Initial" + ENABLE = "Enable" + DISABLE = "Disable" + EXISTING = "Existing" + +class TagAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Valid actions for a filtering tag. Exclusion takes priority over inclusion. + """ + + INCLUDE = "Include" + EXCLUDE = "Exclude" + +class UserRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """User roles on configured in Logz.io account. + """ + + NONE = "None" + USER = "User" + ADMIN = "Admin" + +class VmHostUpdateStates(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Various states of the updating vm extension on resource + """ + + INSTALL = "Install" + DELETE = "Delete" diff --git a/src/logz/azext_logz/vendored_sdks/logz/models/_models.py b/src/logz/azext_logz/vendored_sdks/logz/models/_models.py new file mode 100644 index 00000000000..e6f6cbad29e --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/models/_models.py @@ -0,0 +1,1066 @@ +# 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 ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft_logz.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_logz.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~microsoft_logz.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class FilteringTag(msrest.serialization.Model): + """The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. + + :param name: The name (also known as the key) of the tag. + :type name: str + :param value: The value of the tag. + :type value: str + :param action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :type action: str or ~microsoft_logz.models.TagAction + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FilteringTag, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + self.action = kwargs.get('action', None) + + +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_logz.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. + :type send_subscription_logs: bool + :param send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + for the Monitor resource. + :type send_activity_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_logz.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_activity_logs': {'key': 'sendActivityLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = kwargs.get('send_aad_logs', None) + self.send_subscription_logs = kwargs.get('send_subscription_logs', None) + self.send_activity_logs = kwargs.get('send_activity_logs', None) + self.filtering_tags = kwargs.get('filtering_tags', None) + + +class LogzMonitorResource(msrest.serialization.Model): + """LogzMonitorResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ARM id of the monitor resource. + :vartype id: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :ivar name: Name of the monitor resource. + :vartype name: str + :ivar type: The type of the monitor resource. + :vartype type: str + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_logz.models.MonitorProperties + :param identity: + :type identity: ~microsoft_logz.models.IdentityProperties + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + :param location: Required. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'system_data': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzMonitorResource, self).__init__(**kwargs) + self.id = None + self.system_data = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + self.identity = kwargs.get('identity', None) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class LogzMonitorResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.LogzMonitorResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LogzMonitorResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzMonitorResourceListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class LogzMonitorResourceUpdateParameters(msrest.serialization.Model): + """The parameters for a PATCH request to a monitor resource. + + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_logz.models.MonitorUpdateProperties + :param tags: A set of tags. The new tags of the monitor resource. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.tags = kwargs.get('tags', None) + + +class LogzOrganizationProperties(msrest.serialization.Model): + """LogzOrganizationProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param company_name: Name of the Logz organization. + :type company_name: str + :ivar id: Id of the Logz organization. + :vartype id: str + :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :type enterprise_app_id: str + :param single_sign_on_url: The login URL specific to this Logz Organization. + :type single_sign_on_url: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'company_name': {'key': 'companyName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzOrganizationProperties, self).__init__(**kwargs) + self.company_name = kwargs.get('company_name', None) + self.id = None + self.enterprise_app_id = kwargs.get('enterprise_app_id', None) + self.single_sign_on_url = kwargs.get('single_sign_on_url', None) + + +class LogzSingleSignOnProperties(msrest.serialization.Model): + """LogzSingleSignOnProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param single_sign_on_state: Various states of the SSO resource. Possible values include: + "Initial", "Enable", "Disable", "Existing". + :type single_sign_on_state: str or ~microsoft_logz.models.SingleSignOnStates + :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :type enterprise_app_id: str + :param single_sign_on_url: The login URL specific to this Logz Organization. + :type single_sign_on_url: str + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, + 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzSingleSignOnProperties, self).__init__(**kwargs) + self.single_sign_on_state = kwargs.get('single_sign_on_state', None) + self.enterprise_app_id = kwargs.get('enterprise_app_id', None) + self.single_sign_on_url = kwargs.get('single_sign_on_url', None) + self.provisioning_state = None + + +class LogzSingleSignOnResource(msrest.serialization.Model): + """LogzSingleSignOnResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the configuration. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param properties: + :type properties: ~microsoft_logz.models.LogzSingleSignOnProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'LogzSingleSignOnProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzSingleSignOnResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.properties = kwargs.get('properties', None) + + +class LogzSingleSignOnResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.LogzSingleSignOnResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LogzSingleSignOnResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogzSingleSignOnResourceListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class MonitoredResource(msrest.serialization.Model): + """The properties of a resource currently being monitored by the Logz monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: The ARM id of the resource. + :type id: str + :param sending_metrics: Flag indicating if resource is sending metrics to Logz. + :type sending_metrics: bool + :param reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is + not sending). + :type reason_for_metrics_status: str + :param sending_logs: Flag indicating if resource is sending logs to Logz. + :type sending_logs: bool + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :type reason_for_logs_status: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sending_metrics': {'key': 'sendingMetrics', 'type': 'bool'}, + 'reason_for_metrics_status': {'key': 'reasonForMetricsStatus', 'type': 'str'}, + 'sending_logs': {'key': 'sendingLogs', 'type': 'bool'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'reason_for_logs_status': {'key': 'reasonForLogsStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoredResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.sending_metrics = kwargs.get('sending_metrics', None) + self.reason_for_metrics_status = kwargs.get('reason_for_metrics_status', None) + self.sending_logs = kwargs.get('sending_logs', None) + self.system_data = None + self.reason_for_logs_status = kwargs.get('reason_for_logs_status', None) + + +class MonitoredResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.MonitoredResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitoredResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoredResourceListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class MonitoringTagRules(msrest.serialization.Model): + """Capture logs and metrics of Azure resources based on ARM tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the rule set. + :vartype name: str + :ivar id: The id of the rule set. + :vartype id: str + :ivar type: The type of the rule set. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_logz.models.MonitoringTagRulesProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRules, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.properties = kwargs.get('properties', None) + + +class MonitoringTagRulesListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.MonitoringTagRules] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitoringTagRules]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRulesListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_logz.models.LogRules + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.log_rules = kwargs.get('log_rules', None) + self.system_data = None + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :type monitoring_status: str or ~microsoft_logz.models.MonitoringStatus + :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Active", "Suspended". + :type marketplace_subscription_status: str or + ~microsoft_logz.models.MarketplaceSubscriptionStatus + :param logz_organization_properties: + :type logz_organization_properties: ~microsoft_logz.models.LogzOrganizationProperties + :param user_info: + :type user_info: ~microsoft_logz.models.UserInfo + :param plan_data: + :type plan_data: ~microsoft_logz.models.PlanData + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or ~microsoft_logz.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'logz_organization_properties': {'key': 'logzOrganizationProperties', 'type': 'LogzOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'plan_data': {'key': 'planData', 'type': 'PlanData'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.monitoring_status = kwargs.get('monitoring_status', None) + self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', None) + self.logz_organization_properties = kwargs.get('logz_organization_properties', None) + self.user_info = kwargs.get('user_info', None) + self.plan_data = kwargs.get('plan_data', None) + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :type monitoring_status: str or ~microsoft_logz.models.MonitoringStatus + """ + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = kwargs.get('monitoring_status', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider, i.e., Microsoft.Logz. + :type provider: str + :param resource: Type on which the operation is performed, e.g., 'monitors'. + :type resource: str + :param operation: Operation type, e.g., read, write, delete, etc. + :type operation: str + :param description: Description of the operation, e.g., 'Write monitors'. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of GET request to list the Microsoft.Logz operations. + + :param value: List of operations supported by the Microsoft.Logz provider. + :type value: list[~microsoft_logz.models.OperationResult] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationResult(msrest.serialization.Model): + """A Microsoft.Logz REST API operation. + + :param name: Operation name, i.e., {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: The object that represents the operation. + :type display: ~microsoft_logz.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class PlanData(msrest.serialization.Model): + """PlanData. + + :param usage_type: different usage type like PAYG/COMMITTED. this could be enum. + :type usage_type: str + :param billing_cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum. + :type billing_cycle: str + :param plan_details: plan id as published by Logz. + :type plan_details: str + :param effective_date: date when plan was applied. + :type effective_date: ~datetime.datetime + """ + + _validation = { + 'usage_type': {'max_length': 50, 'min_length': 0}, + 'billing_cycle': {'max_length': 50, 'min_length': 0}, + 'plan_details': {'max_length': 50, 'min_length': 0}, + } + + _attribute_map = { + 'usage_type': {'key': 'usageType', 'type': 'str'}, + 'billing_cycle': {'key': 'billingCycle', 'type': 'str'}, + 'plan_details': {'key': 'planDetails', 'type': 'str'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(PlanData, self).__init__(**kwargs) + self.usage_type = kwargs.get('usage_type', None) + self.billing_cycle = kwargs.get('billing_cycle', None) + self.plan_details = kwargs.get('plan_details', None) + self.effective_date = kwargs.get('effective_date', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~microsoft_logz.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~microsoft_logz.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class UserInfo(msrest.serialization.Model): + """UserInfo. + + :param first_name: First Name of the user. + :type first_name: str + :param last_name: Last Name of the user. + :type last_name: str + :param email_address: Email of the user used by Logz for contacting them if needed. + :type email_address: str + :param phone_number: Phone number of the user used by Logz for contacting them if needed. + :type phone_number: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$'}, + 'phone_number': {'max_length': 40, 'min_length': 0}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserInfo, self).__init__(**kwargs) + self.first_name = kwargs.get('first_name', None) + self.last_name = kwargs.get('last_name', None) + self.email_address = kwargs.get('email_address', None) + self.phone_number = kwargs.get('phone_number', None) + + +class UserRoleListResponse(msrest.serialization.Model): + """Response for list of user's role for Logz.io account. + + :param value: List of user roles for Logz.io account. + :type value: list[~microsoft_logz.models.UserRoleResponse] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserRoleResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserRoleListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class UserRoleRequest(msrest.serialization.Model): + """Request for checking user's role for Logz.io account. + + :param email_address: Email of the user used by Logz for contacting them if needed. + :type email_address: str + """ + + _validation = { + 'email_address': {'pattern': r'^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$'}, + } + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserRoleRequest, self).__init__(**kwargs) + self.email_address = kwargs.get('email_address', None) + + +class UserRoleResponse(msrest.serialization.Model): + """Response for checking user's role for Logz.io account. + + :param role: User roles on configured in Logz.io account. Possible values include: "None", + "User", "Admin". + :type role: str or ~microsoft_logz.models.UserRole + """ + + _attribute_map = { + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserRoleResponse, self).__init__(**kwargs) + self.role = kwargs.get('role', None) + + +class VmExtensionPayload(msrest.serialization.Model): + """Response of payload to be passed while installing VM agent. + + :param api_key: API Key corresponding to the resource. + :type api_key: str + :param region: Logz.io region where the resource has been created. + :type region: str + """ + + _attribute_map = { + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VmExtensionPayload, self).__init__(**kwargs) + self.api_key = kwargs.get('api_key', None) + self.region = kwargs.get('region', None) + + +class VmHostUpdateRequest(msrest.serialization.Model): + """Request of a list VM Host Update Operation. + + :param vm_resource_ids: Request of a list vm host update operation. + :type vm_resource_ids: list[~microsoft_logz.models.VmResources] + :param state: Specifies the state of the operation - install/ delete. Possible values include: + "Install", "Delete". + :type state: str or ~microsoft_logz.models.VmHostUpdateStates + """ + + _attribute_map = { + 'vm_resource_ids': {'key': 'vmResourceIds', 'type': '[VmResources]'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VmHostUpdateRequest, self).__init__(**kwargs) + self.vm_resource_ids = kwargs.get('vm_resource_ids', None) + self.state = kwargs.get('state', None) + + +class VmResources(msrest.serialization.Model): + """VM Resource Ids. + + :param id: Request of a list vm host update operation. + :type id: str + :param agent_version: Version of the Logz agent installed on the VM. + :type agent_version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'agent_version': {'key': 'agentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VmResources, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.agent_version = kwargs.get('agent_version', None) + + +class VmResourcesListResponse(msrest.serialization.Model): + """Response of a list VM Host Update Operation. + + :param value: Response of a list vm host update operation. + :type value: list[~microsoft_logz.models.VmResources] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VmResources]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VmResourcesListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) diff --git a/src/logz/azext_logz/vendored_sdks/logz/models/_models_py3.py b/src/logz/azext_logz/vendored_sdks/logz/models/_models_py3.py new file mode 100644 index 00000000000..241443281ff --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/models/_models_py3.py @@ -0,0 +1,1181 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._microsoft_logz_enums import * + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft_logz.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_logz.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~microsoft_logz.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class FilteringTag(msrest.serialization.Model): + """The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. + + :param name: The name (also known as the key) of the tag. + :type name: str + :param value: The value of the tag. + :type value: str + :param action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :type action: str or ~microsoft_logz.models.TagAction + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + action: Optional[Union[str, "TagAction"]] = None, + **kwargs + ): + super(FilteringTag, self).__init__(**kwargs) + self.name = name + self.value = value + self.action = action + + +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_logz.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityTypes"]] = None, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. + :type send_subscription_logs: bool + :param send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + for the Monitor resource. + :type send_activity_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_logz.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_activity_logs': {'key': 'sendActivityLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + send_aad_logs: Optional[bool] = None, + send_subscription_logs: Optional[bool] = None, + send_activity_logs: Optional[bool] = None, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = send_aad_logs + self.send_subscription_logs = send_subscription_logs + self.send_activity_logs = send_activity_logs + self.filtering_tags = filtering_tags + + +class LogzMonitorResource(msrest.serialization.Model): + """LogzMonitorResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ARM id of the monitor resource. + :vartype id: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :ivar name: Name of the monitor resource. + :vartype name: str + :ivar type: The type of the monitor resource. + :vartype type: str + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_logz.models.MonitorProperties + :param identity: + :type identity: ~microsoft_logz.models.IdentityProperties + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + :param location: Required. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'system_data': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + properties: Optional["MonitorProperties"] = None, + identity: Optional["IdentityProperties"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(LogzMonitorResource, self).__init__(**kwargs) + self.id = None + self.system_data = None + self.name = None + self.type = None + self.properties = properties + self.identity = identity + self.tags = tags + self.location = location + + +class LogzMonitorResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.LogzMonitorResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LogzMonitorResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["LogzMonitorResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(LogzMonitorResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LogzMonitorResourceUpdateParameters(msrest.serialization.Model): + """The parameters for a PATCH request to a monitor resource. + + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_logz.models.MonitorUpdateProperties + :param tags: A set of tags. The new tags of the monitor resource. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional["MonitorUpdateProperties"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(LogzMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = properties + self.tags = tags + + +class LogzOrganizationProperties(msrest.serialization.Model): + """LogzOrganizationProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param company_name: Name of the Logz organization. + :type company_name: str + :ivar id: Id of the Logz organization. + :vartype id: str + :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :type enterprise_app_id: str + :param single_sign_on_url: The login URL specific to this Logz Organization. + :type single_sign_on_url: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'company_name': {'key': 'companyName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + company_name: Optional[str] = None, + enterprise_app_id: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + **kwargs + ): + super(LogzOrganizationProperties, self).__init__(**kwargs) + self.company_name = company_name + self.id = None + self.enterprise_app_id = enterprise_app_id + self.single_sign_on_url = single_sign_on_url + + +class LogzSingleSignOnProperties(msrest.serialization.Model): + """LogzSingleSignOnProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param single_sign_on_state: Various states of the SSO resource. Possible values include: + "Initial", "Enable", "Disable", "Existing". + :type single_sign_on_state: str or ~microsoft_logz.models.SingleSignOnStates + :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :type enterprise_app_id: str + :param single_sign_on_url: The login URL specific to this Logz Organization. + :type single_sign_on_url: str + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, + 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, + enterprise_app_id: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + **kwargs + ): + super(LogzSingleSignOnProperties, self).__init__(**kwargs) + self.single_sign_on_state = single_sign_on_state + self.enterprise_app_id = enterprise_app_id + self.single_sign_on_url = single_sign_on_url + self.provisioning_state = None + + +class LogzSingleSignOnResource(msrest.serialization.Model): + """LogzSingleSignOnResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the configuration. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param properties: + :type properties: ~microsoft_logz.models.LogzSingleSignOnProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'LogzSingleSignOnProperties'}, + } + + def __init__( + self, + *, + properties: Optional["LogzSingleSignOnProperties"] = None, + **kwargs + ): + super(LogzSingleSignOnResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.properties = properties + + +class LogzSingleSignOnResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.LogzSingleSignOnResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LogzSingleSignOnResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["LogzSingleSignOnResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(LogzSingleSignOnResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MonitoredResource(msrest.serialization.Model): + """The properties of a resource currently being monitored by the Logz monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: The ARM id of the resource. + :type id: str + :param sending_metrics: Flag indicating if resource is sending metrics to Logz. + :type sending_metrics: bool + :param reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is + not sending). + :type reason_for_metrics_status: str + :param sending_logs: Flag indicating if resource is sending logs to Logz. + :type sending_logs: bool + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :type reason_for_logs_status: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sending_metrics': {'key': 'sendingMetrics', 'type': 'bool'}, + 'reason_for_metrics_status': {'key': 'reasonForMetricsStatus', 'type': 'str'}, + 'sending_logs': {'key': 'sendingLogs', 'type': 'bool'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'reason_for_logs_status': {'key': 'reasonForLogsStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + sending_metrics: Optional[bool] = None, + reason_for_metrics_status: Optional[str] = None, + sending_logs: Optional[bool] = None, + reason_for_logs_status: Optional[str] = None, + **kwargs + ): + super(MonitoredResource, self).__init__(**kwargs) + self.id = id + self.sending_metrics = sending_metrics + self.reason_for_metrics_status = reason_for_metrics_status + self.sending_logs = sending_logs + self.system_data = None + self.reason_for_logs_status = reason_for_logs_status + + +class MonitoredResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.MonitoredResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitoredResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MonitoredResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(MonitoredResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MonitoringTagRules(msrest.serialization.Model): + """Capture logs and metrics of Azure resources based on ARM tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the rule set. + :vartype name: str + :ivar id: The id of the rule set. + :vartype id: str + :ivar type: The type of the rule set. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~microsoft_logz.models.SystemData + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_logz.models.MonitoringTagRulesProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + } + + def __init__( + self, + *, + properties: Optional["MonitoringTagRulesProperties"] = None, + **kwargs + ): + super(MonitoringTagRules, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.properties = properties + + +class MonitoringTagRulesListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_logz.models.MonitoringTagRules] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitoringTagRules]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MonitoringTagRules"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(MonitoringTagRulesListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_logz.models.LogRules + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_logz.models.SystemData + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + log_rules: Optional["LogRules"] = None, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.log_rules = log_rules + self.system_data = None + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Flag specifying if the resource provisioning state as tracked by ARM. + Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled", "Deleted", "NotSpecified". + :vartype provisioning_state: str or ~microsoft_logz.models.ProvisioningState + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :type monitoring_status: str or ~microsoft_logz.models.MonitoringStatus + :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Active", "Suspended". + :type marketplace_subscription_status: str or + ~microsoft_logz.models.MarketplaceSubscriptionStatus + :param logz_organization_properties: + :type logz_organization_properties: ~microsoft_logz.models.LogzOrganizationProperties + :param user_info: + :type user_info: ~microsoft_logz.models.UserInfo + :param plan_data: + :type plan_data: ~microsoft_logz.models.PlanData + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or ~microsoft_logz.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'logz_organization_properties': {'key': 'logzOrganizationProperties', 'type': 'LogzOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'plan_data': {'key': 'planData', 'type': 'PlanData'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + *, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, + marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, + logz_organization_properties: Optional["LogzOrganizationProperties"] = None, + user_info: Optional["UserInfo"] = None, + plan_data: Optional["PlanData"] = None, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.monitoring_status = monitoring_status + self.marketplace_subscription_status = marketplace_subscription_status + self.logz_organization_properties = logz_organization_properties + self.user_info = user_info + self.plan_data = plan_data + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :type monitoring_status: str or ~microsoft_logz.models.MonitoringStatus + """ + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = monitoring_status + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider, i.e., Microsoft.Logz. + :type provider: str + :param resource: Type on which the operation is performed, e.g., 'monitors'. + :type resource: str + :param operation: Operation type, e.g., read, write, delete, etc. + :type operation: str + :param description: Description of the operation, e.g., 'Write monitors'. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of GET request to list the Microsoft.Logz operations. + + :param value: List of operations supported by the Microsoft.Logz provider. + :type value: list[~microsoft_logz.models.OperationResult] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationResult"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationResult(msrest.serialization.Model): + """A Microsoft.Logz REST API operation. + + :param name: Operation name, i.e., {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: The object that represents the operation. + :type display: ~microsoft_logz.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + **kwargs + ): + super(OperationResult, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + + +class PlanData(msrest.serialization.Model): + """PlanData. + + :param usage_type: different usage type like PAYG/COMMITTED. this could be enum. + :type usage_type: str + :param billing_cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum. + :type billing_cycle: str + :param plan_details: plan id as published by Logz. + :type plan_details: str + :param effective_date: date when plan was applied. + :type effective_date: ~datetime.datetime + """ + + _validation = { + 'usage_type': {'max_length': 50, 'min_length': 0}, + 'billing_cycle': {'max_length': 50, 'min_length': 0}, + 'plan_details': {'max_length': 50, 'min_length': 0}, + } + + _attribute_map = { + 'usage_type': {'key': 'usageType', 'type': 'str'}, + 'billing_cycle': {'key': 'billingCycle', 'type': 'str'}, + 'plan_details': {'key': 'planDetails', 'type': 'str'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + usage_type: Optional[str] = None, + billing_cycle: Optional[str] = None, + plan_details: Optional[str] = None, + effective_date: Optional[datetime.datetime] = None, + **kwargs + ): + super(PlanData, self).__init__(**kwargs) + self.usage_type = usage_type + self.billing_cycle = billing_cycle + self.plan_details = plan_details + self.effective_date = effective_date + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~microsoft_logz.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~microsoft_logz.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserInfo(msrest.serialization.Model): + """UserInfo. + + :param first_name: First Name of the user. + :type first_name: str + :param last_name: Last Name of the user. + :type last_name: str + :param email_address: Email of the user used by Logz for contacting them if needed. + :type email_address: str + :param phone_number: Phone number of the user used by Logz for contacting them if needed. + :type phone_number: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$'}, + 'phone_number': {'max_length': 40, 'min_length': 0}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone_number: Optional[str] = None, + **kwargs + ): + super(UserInfo, self).__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + self.phone_number = phone_number + + +class UserRoleListResponse(msrest.serialization.Model): + """Response for list of user's role for Logz.io account. + + :param value: List of user roles for Logz.io account. + :type value: list[~microsoft_logz.models.UserRoleResponse] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserRoleResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserRoleResponse"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(UserRoleListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UserRoleRequest(msrest.serialization.Model): + """Request for checking user's role for Logz.io account. + + :param email_address: Email of the user used by Logz for contacting them if needed. + :type email_address: str + """ + + _validation = { + 'email_address': {'pattern': r'^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$'}, + } + + _attribute_map = { + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + email_address: Optional[str] = None, + **kwargs + ): + super(UserRoleRequest, self).__init__(**kwargs) + self.email_address = email_address + + +class UserRoleResponse(msrest.serialization.Model): + """Response for checking user's role for Logz.io account. + + :param role: User roles on configured in Logz.io account. Possible values include: "None", + "User", "Admin". + :type role: str or ~microsoft_logz.models.UserRole + """ + + _attribute_map = { + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + role: Optional[Union[str, "UserRole"]] = None, + **kwargs + ): + super(UserRoleResponse, self).__init__(**kwargs) + self.role = role + + +class VmExtensionPayload(msrest.serialization.Model): + """Response of payload to be passed while installing VM agent. + + :param api_key: API Key corresponding to the resource. + :type api_key: str + :param region: Logz.io region where the resource has been created. + :type region: str + """ + + _attribute_map = { + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + *, + api_key: Optional[str] = None, + region: Optional[str] = None, + **kwargs + ): + super(VmExtensionPayload, self).__init__(**kwargs) + self.api_key = api_key + self.region = region + + +class VmHostUpdateRequest(msrest.serialization.Model): + """Request of a list VM Host Update Operation. + + :param vm_resource_ids: Request of a list vm host update operation. + :type vm_resource_ids: list[~microsoft_logz.models.VmResources] + :param state: Specifies the state of the operation - install/ delete. Possible values include: + "Install", "Delete". + :type state: str or ~microsoft_logz.models.VmHostUpdateStates + """ + + _attribute_map = { + 'vm_resource_ids': {'key': 'vmResourceIds', 'type': '[VmResources]'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_resource_ids: Optional[List["VmResources"]] = None, + state: Optional[Union[str, "VmHostUpdateStates"]] = None, + **kwargs + ): + super(VmHostUpdateRequest, self).__init__(**kwargs) + self.vm_resource_ids = vm_resource_ids + self.state = state + + +class VmResources(msrest.serialization.Model): + """VM Resource Ids. + + :param id: Request of a list vm host update operation. + :type id: str + :param agent_version: Version of the Logz agent installed on the VM. + :type agent_version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'agent_version': {'key': 'agentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + agent_version: Optional[str] = None, + **kwargs + ): + super(VmResources, self).__init__(**kwargs) + self.id = id + self.agent_version = agent_version + + +class VmResourcesListResponse(msrest.serialization.Model): + """Response of a list VM Host Update Operation. + + :param value: Response of a list vm host update operation. + :type value: list[~microsoft_logz.models.VmResources] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VmResources]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["VmResources"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(VmResourcesListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/__init__.py b/src/logz/azext_logz/vendored_sdks/logz/operations/__init__.py new file mode 100644 index 00000000000..9c8560a389d --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_operations import SingleSignOnOperations +from ._sub_account_operations import SubAccountOperations +from ._sub_account_tag_rules_operations import SubAccountTagRulesOperations +from ._monitor_operations import MonitorOperations + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', + 'SubAccountOperations', + 'SubAccountTagRulesOperations', + 'MonitorOperations', +] diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_monitor_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_monitor_operations.py new file mode 100644 index 00000000000..c50e94d85bb --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_monitor_operations.py @@ -0,0 +1,283 @@ +# 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 MonitorOperations(object): + """MonitorOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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 vm_host_payload( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VmExtensionPayload" + """Returns the payload that needs to be passed in the request body for installing Logz.io agent on a VM. + + Returns the payload that needs to be passed in the request body for installing Logz.io agent on + a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmExtensionPayload, or the result of cls(response) + :rtype: ~microsoft_logz.models.VmExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.vm_host_payload.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VmExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + vm_host_payload.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/vmHostPayload'} # type: ignore + + def list_vm_host_update( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.VmHostUpdateRequest"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.VmResourcesListResponse"] + """Sending request to update the collection when Logz.io agent has been installed on a VM for a given monitor. + + Sending request to update the collection when Logz.io agent has been installed on a VM for a + given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: Request body to update the collection for agent installed in the given monitor. + :type body: ~microsoft_logz.models.VmHostUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_vm_host_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_vm_host_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/vmHostUpdate'} # type: ignore + + def list_vm_hosts( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.VmResourcesListResponse"] + """List the compute resources currently being monitored by the Logz main account resource. + + List the compute resources currently being monitored by the Logz main account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_vm_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + request = self._client.post(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('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_vm_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listVMHosts'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_monitors_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_monitors_operations.py new file mode 100644 index 00000000000..71def303f80 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_monitors_operations.py @@ -0,0 +1,754 @@ +# 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.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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MonitorsOperations(object): + """MonitorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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_monitored_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.MonitoredResourceListResponse"] + """List the resources currently being monitored by the Logz monitor resource. + + List the resources currently being monitored by the Logz monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + request = self._client.post(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('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LogzMonitorResourceListResponse"] + """List all monitors under the specified subscription. + + List all monitors under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Logz/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LogzMonitorResourceListResponse"] + """List all monitors under the specified resource group. + + List all monitors under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + '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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + """Get the properties of a specific monitor resource. + + Get the properties of a specific monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.LogzMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.LogzMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.LogzMonitorResource"] + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResource + :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 LogzMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_logz.models.LogzMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + 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_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body, + 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('LogzMonitorResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.LogzMonitorResourceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResourceUpdateParameters') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + monitor_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_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, + monitor_name=monitor_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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.Logz/monitors/{monitorName}'} # type: ignore + + def list_user_roles( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.UserRoleRequest"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.UserRoleListResponse"] + """List the user's roles configured on Logz.io side for the account corresponding to the monitor resource. + + List the user's roles configured on Logz.io side for the account corresponding to the monitor + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_logz.models.UserRoleRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserRoleListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.UserRoleListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserRoleListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_user_roles.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'UserRoleRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'UserRoleRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UserRoleListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_user_roles.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listUserRoles'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_operations.py new file mode 100644 index 00000000000..36c2fa72b0a --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_operations.py @@ -0,0 +1,110 @@ +# 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: ~microsoft_logz.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"] + """List all operations provided by Microsoft.Logz. + + List all operations provided by Microsoft.Logz. + + :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[~microsoft_logz.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', {})) + 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] + + 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 deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Logz/operations'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_single_sign_on_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_single_sign_on_operations.py new file mode 100644 index 00000000000..3ca8a39ae1c --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_single_sign_on_operations.py @@ -0,0 +1,335 @@ +# 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.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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SingleSignOnOperations(object): + """SingleSignOnOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LogzSingleSignOnResourceListResponse"] + """List the single sign-on configurations for a given monitor resource. + + List the single sign-on configurations for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzSingleSignOnResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.LogzSingleSignOnResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('LogzSingleSignOnResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + configuration_name, # type: str + body=None, # type: Optional["models.LogzSingleSignOnResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.LogzSingleSignOnResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", 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] + if body is not None: + body_content = self._serialize.body(body, 'LogzSingleSignOnResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + monitor_name, # type: str + configuration_name, # type: str + body=None, # type: Optional["models.LogzSingleSignOnResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.LogzSingleSignOnResource"] + """Configures single-sign-on for this resource. + + Configures single-sign-on for this resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: + :type configuration_name: str + :param body: + :type body: ~microsoft_logz.models.LogzSingleSignOnResource + :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 LogzSingleSignOnResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_logz.models.LogzSingleSignOnResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + 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, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + 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('LogzSingleSignOnResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.LogzSingleSignOnResource" + """Gets the Logz single sign-on resource for the given Monitor. + + Gets the Logz single sign-on resource for the given Monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzSingleSignOnResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzSingleSignOnResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_operations.py new file mode 100644 index 00000000000..a28b3d8ad09 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_operations.py @@ -0,0 +1,866 @@ +# 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.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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubAccountOperations(object): + """SubAccountOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LogzMonitorResourceListResponse"] + """List the sub account under a given monitor resource. + + List the sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogzMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.LogzMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('LogzMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + body=None, # type: Optional["models.LogzMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResource') + else: + body_content = None + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + body=None, # type: Optional["models.LogzMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.LogzMonitorResource"] + """Create sub account under a given monitor resource. + + Create sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResource + :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 LogzMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_logz.models.LogzMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + 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_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + sub_account_name=sub_account_name, + body=body, + 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('LogzMonitorResource', 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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + """Get a sub account under a given monitor resource. + + Get a sub account under a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a sub account resource. + + Delete a sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_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, + monitor_name=monitor_name, + sub_account_name=sub_account_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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + body=None, # type: Optional["models.LogzMonitorResourceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> "models.LogzMonitorResource" + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: + :type body: ~microsoft_logz.models.LogzMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogzMonitorResource, or the result of cls(response) + :rtype: ~microsoft_logz.models.LogzMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LogzMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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] + if body is not None: + body_content = self._serialize.body(body, 'LogzMonitorResourceUpdateParameters') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LogzMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.MonitoredResourceListResponse"] + """List the resources currently being monitored by the Logz sub account resource. + + List the resources currently being monitored by the Logz sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + request = self._client.post(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('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/listMonitoredResources'} # type: ignore + + def vm_host_payload( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.VmExtensionPayload" + """Returns the payload that needs to be passed as a request for installing Logz.io agent on a VM. + + Returns the payload that needs to be passed as a request for installing Logz.io agent on a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmExtensionPayload, or the result of cls(response) + :rtype: ~microsoft_logz.models.VmExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.vm_host_payload.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VmExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + vm_host_payload.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostPayload'} # type: ignore + + def list_vm_host_update( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + body=None, # type: Optional["models.VmHostUpdateRequest"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.VmResourcesListResponse"] + """Sending request to update the collection when Logz.io agent has been installed on a VM for a given monitor. + + Sending request to update the collection when Logz.io agent has been installed on a VM for a + given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param body: Request body to update the collection for agent installed in the given monitor. + :type body: ~microsoft_logz.models.VmHostUpdateRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # 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') + + if not next_link: + # Construct URL + url = self.list_vm_host_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'VmHostUpdateRequest') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_vm_host_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostUpdate'} # type: ignore + + def list_vm_hosts( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.VmResourcesListResponse"] + """List the compute resources currently being monitored by the Logz sub account resource. + + List the compute resources currently being monitored by the Logz sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmResourcesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.VmResourcesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VmResourcesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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_vm_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + request = self._client.post(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('VmResourcesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_vm_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/listVMHosts'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_tag_rules_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_tag_rules_operations.py new file mode 100644 index 00000000000..3ba1a073ba4 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_tag_rules_operations.py @@ -0,0 +1,350 @@ +# 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 SubAccountTagRulesOperations(object): + """SubAccountTagRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.MonitoringTagRulesListResponse"] + """List the tag rules for a given sub account resource. + + List the tag rules for a given sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.MonitoringTagRulesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_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') + + 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('MonitoringTagRulesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + rule_set_name, # type: str + body=None, # type: Optional["models.MonitoringTagRules"] + **kwargs # type: Any + ): + # type: (...) -> "models.MonitoringTagRules" + """Create or update a tag rule set for a given sub account resource. + + Create or update a tag rule set for a given sub account resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_name: str + :param body: + :type body: ~microsoft_logz.models.MonitoringTagRules + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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] + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MonitoringTagRules" + """Get a tag rule set for a given monitor resource. + + Get a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + sub_account_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a tag rule set for a given monitor resource. + + Delete a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param sub_account_name: Sub Account resource name. + :type sub_account_name: str + :param rule_set_name: + :type rule_set_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'subAccountName': self._serialize.url("sub_account_name", sub_account_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/operations/_tag_rules_operations.py b/src/logz/azext_logz/vendored_sdks/logz/operations/_tag_rules_operations.py new file mode 100644 index 00000000000..dd37a6c4fc7 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_tag_rules_operations.py @@ -0,0 +1,334 @@ +# 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 TagRulesOperations(object): + """TagRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_logz.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, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.MonitoringTagRulesListResponse"] + """List the tag rules for a given monitor resource. + + List the tag rules for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_logz.models.MonitoringTagRulesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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 + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_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') + + 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('MonitoringTagRulesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + monitor_name, # type: str + rule_set_name, # type: str + body=None, # type: Optional["models.MonitoringTagRules"] + **kwargs # type: Any + ): + # type: (...) -> "models.MonitoringTagRules" + """Create or update a tag rule set for a given monitor resource. + + Create or update a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_name: str + :param body: + :type body: ~microsoft_logz.models.MonitoringTagRules + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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] + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') + else: + body_content = None + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.MonitoringTagRules" + """Get a tag rule set for a given monitor resource. + + Get a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringTagRules, or the result of cls(response) + :rtype: ~microsoft_logz.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a tag rule set for a given monitor resource. + + Delete a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: + :type rule_set_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 = "2020-10-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', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/src/logz/azext_logz/vendored_sdks/logz/py.typed b/src/logz/azext_logz/vendored_sdks/logz/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/logz/report.md b/src/logz/report.md new file mode 100644 index 00000000000..039fd8056c2 --- /dev/null +++ b/src/logz/report.md @@ -0,0 +1,563 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az logz|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az logz` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az logz monitor|Monitors|[commands](#CommandsInMonitors)| +|az logz tag-rule|TagRules|[commands](#CommandsInTagRules)| +|az logz single-sign-on|SingleSignOn|[commands](#CommandsInSingleSignOn)| +|az logz sub-account|SubAccount|[commands](#CommandsInSubAccount)| +|az logz sub-account-tag-rule|SubAccountTagRules|[commands](#CommandsInSubAccountTagRules)| +|az logz monitor|Monitor|[commands](#CommandsInMonitor)| + +## COMMANDS +### Commands in `az logz monitor` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz monitor list](#MonitorsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersMonitorsListByResourceGroup)|[Example](#ExamplesMonitorsListByResourceGroup)| +|[az logz monitor list](#MonitorsListBySubscription)|ListBySubscription|[Parameters](#ParametersMonitorsListBySubscription)|[Example](#ExamplesMonitorsListBySubscription)| +|[az logz monitor show](#MonitorsGet)|Get|[Parameters](#ParametersMonitorsGet)|[Example](#ExamplesMonitorsGet)| +|[az logz monitor create](#MonitorsCreate)|Create|[Parameters](#ParametersMonitorsCreate)|[Example](#ExamplesMonitorsCreate)| +|[az logz monitor update](#MonitorsUpdate)|Update|[Parameters](#ParametersMonitorsUpdate)|[Example](#ExamplesMonitorsUpdate)| +|[az logz monitor delete](#MonitorsDelete)|Delete|[Parameters](#ParametersMonitorsDelete)|[Example](#ExamplesMonitorsDelete)| +|[az logz monitor list-monitored-resource](#MonitorsListMonitoredResources)|ListMonitoredResources|[Parameters](#ParametersMonitorsListMonitoredResources)|[Example](#ExamplesMonitorsListMonitoredResources)| +|[az logz monitor list-user-role](#MonitorsListUserRoles)|ListUserRoles|[Parameters](#ParametersMonitorsListUserRoles)|[Example](#ExamplesMonitorsListUserRoles)| + +### Commands in `az logz monitor` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz monitor list-vm-host](#MonitorListVMHosts)|ListVMHosts|[Parameters](#ParametersMonitorListVMHosts)|[Example](#ExamplesMonitorListVMHosts)| +|[az logz monitor list-vm-host-update](#MonitorListVmHostUpdate)|ListVmHostUpdate|[Parameters](#ParametersMonitorListVmHostUpdate)|[Example](#ExamplesMonitorListVmHostUpdate)| +|[az logz monitor vm-host-payload](#MonitorVMHostPayload)|VMHostPayload|[Parameters](#ParametersMonitorVMHostPayload)|[Example](#ExamplesMonitorVMHostPayload)| + +### Commands in `az logz single-sign-on` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz single-sign-on list](#SingleSignOnList)|List|[Parameters](#ParametersSingleSignOnList)|[Example](#ExamplesSingleSignOnList)| +|[az logz single-sign-on show](#SingleSignOnGet)|Get|[Parameters](#ParametersSingleSignOnGet)|[Example](#ExamplesSingleSignOnGet)| +|[az logz single-sign-on create](#SingleSignOnCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersSingleSignOnCreateOrUpdate#Create)|[Example](#ExamplesSingleSignOnCreateOrUpdate#Create)| +|[az logz single-sign-on update](#SingleSignOnCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersSingleSignOnCreateOrUpdate#Update)|Not Found| + +### Commands in `az logz sub-account` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz sub-account list](#SubAccountList)|List|[Parameters](#ParametersSubAccountList)|[Example](#ExamplesSubAccountList)| +|[az logz sub-account show](#SubAccountGet)|Get|[Parameters](#ParametersSubAccountGet)|[Example](#ExamplesSubAccountGet)| +|[az logz sub-account create](#SubAccountCreate)|Create|[Parameters](#ParametersSubAccountCreate)|[Example](#ExamplesSubAccountCreate)| +|[az logz sub-account update](#SubAccountUpdate)|Update|[Parameters](#ParametersSubAccountUpdate)|[Example](#ExamplesSubAccountUpdate)| +|[az logz sub-account delete](#SubAccountDelete)|Delete|[Parameters](#ParametersSubAccountDelete)|[Example](#ExamplesSubAccountDelete)| +|[az logz sub-account list-monitored-resource](#SubAccountListMonitoredResources)|ListMonitoredResources|[Parameters](#ParametersSubAccountListMonitoredResources)|[Example](#ExamplesSubAccountListMonitoredResources)| +|[az logz sub-account list-vm-host](#SubAccountListVMHosts)|ListVMHosts|[Parameters](#ParametersSubAccountListVMHosts)|[Example](#ExamplesSubAccountListVMHosts)| +|[az logz sub-account list-vm-host-update](#SubAccountListVmHostUpdate)|ListVmHostUpdate|[Parameters](#ParametersSubAccountListVmHostUpdate)|[Example](#ExamplesSubAccountListVmHostUpdate)| +|[az logz sub-account vm-host-payload](#SubAccountVMHostPayload)|VMHostPayload|[Parameters](#ParametersSubAccountVMHostPayload)|[Example](#ExamplesSubAccountVMHostPayload)| + +### Commands in `az logz sub-account-tag-rule` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz sub-account-tag-rule list](#SubAccountTagRulesList)|List|[Parameters](#ParametersSubAccountTagRulesList)|[Example](#ExamplesSubAccountTagRulesList)| +|[az logz sub-account-tag-rule show](#SubAccountTagRulesGet)|Get|[Parameters](#ParametersSubAccountTagRulesGet)|[Example](#ExamplesSubAccountTagRulesGet)| +|[az logz sub-account-tag-rule create](#SubAccountTagRulesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersSubAccountTagRulesCreateOrUpdate#Create)|[Example](#ExamplesSubAccountTagRulesCreateOrUpdate#Create)| +|[az logz sub-account-tag-rule update](#SubAccountTagRulesCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersSubAccountTagRulesCreateOrUpdate#Update)|Not Found| +|[az logz sub-account-tag-rule delete](#SubAccountTagRulesDelete)|Delete|[Parameters](#ParametersSubAccountTagRulesDelete)|[Example](#ExamplesSubAccountTagRulesDelete)| + +### Commands in `az logz tag-rule` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az logz tag-rule list](#TagRulesList)|List|[Parameters](#ParametersTagRulesList)|[Example](#ExamplesTagRulesList)| +|[az logz tag-rule show](#TagRulesGet)|Get|[Parameters](#ParametersTagRulesGet)|[Example](#ExamplesTagRulesGet)| +|[az logz tag-rule create](#TagRulesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersTagRulesCreateOrUpdate#Create)|[Example](#ExamplesTagRulesCreateOrUpdate#Create)| +|[az logz tag-rule update](#TagRulesCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersTagRulesCreateOrUpdate#Update)|Not Found| +|[az logz tag-rule delete](#TagRulesDelete)|Delete|[Parameters](#ParametersTagRulesDelete)|[Example](#ExamplesTagRulesDelete)| + + +## COMMAND DETAILS + +### group `az logz monitor` +#### Command `az logz monitor list` + +##### Example +``` +az logz monitor list --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az logz monitor list` + +##### Example +``` +az logz monitor list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az logz monitor show` + +##### Example +``` +az logz monitor show --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz monitor create` + +##### Example +``` +az logz monitor create --name "myMonitor" --location "West US" --plan-data billing-cycle="Monthly" \ +effective-date="2019-08-30T15:14:33+02:00" plan-details="logzapitestplan" usage-type="Committed" --user-info \ +email-address="alice@microsoft.com" first-name="Alice" last-name="Bob" phone-number="123456" --tags Environment="Dev" \ +--resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--tags**|dictionary|Dictionary of |tags|tags| +|**--location**|string||location|location| +|**--type**|choice||type|type| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| +|**--marketplace-subscription-status**|choice|Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state.|marketplace_subscription_status|marketplaceSubscriptionStatus| +|**--logz-organization-properties**|object||logz_organization_properties|logzOrganizationProperties| +|**--user-info**|object||user_info|userInfo| +|**--plan-data**|object||plan_data|planData| + +#### Command `az logz monitor update` + +##### Example +``` +az logz monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" --resource-group \ +"myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--tags**|dictionary|The new tags of the monitor resource.|tags|tags| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| + +#### Command `az logz monitor delete` + +##### Example +``` +az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz monitor list-monitored-resource` + +##### Example +``` +az logz monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz monitor list-user-role` + +##### Example +``` +az logz monitor list-user-role --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--email-address**|string|Email of the user used by Logz for contacting them if needed|email_address|emailAddress| + +### group `az logz monitor` +#### Command `az logz monitor list-vm-host` + +##### Example +``` +az logz monitor list-vm-host --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz monitor list-vm-host-update` + +##### Example +``` +az logz monitor list-vm-host-update --name "myMonitor" --state "Install" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--vm-resource-ids**|array|Request of a list vm host update operation.|vm_resource_ids|vmResourceIds| +|**--state**|choice|Specifies the state of the operation - install/ delete.|state|state| + +#### Command `az logz monitor vm-host-payload` + +##### Example +``` +az logz monitor vm-host-payload --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az logz single-sign-on` +#### Command `az logz single-sign-on list` + +##### Example +``` +az logz single-sign-on list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz single-sign-on show` + +##### Example +``` +az logz single-sign-on show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string||configuration_name|configurationName| + +#### Command `az logz single-sign-on create` + +##### Example +``` +az logz single-sign-on create --configuration-name "default" --monitor-name "myMonitor" --properties \ +enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" single-sign-on-url=null \ +--resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string||configuration_name|configurationName| +|**--properties**|object||properties|properties| + +#### Command `az logz single-sign-on update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string||configuration_name|configurationName| +|**--properties**|object||properties|properties| + +### group `az logz sub-account` +#### Command `az logz sub-account list` + +##### Example +``` +az logz sub-account list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz sub-account show` + +##### Example +``` +az logz sub-account show --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +#### Command `az logz sub-account create` + +##### Example +``` +az logz sub-account create --monitor-name "myMonitor" --type "Microsoft.Logz/monitors" --location "West US" \ +--monitoring-status "Enabled" --tags Environment="Dev" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--tags**|dictionary|Dictionary of |tags|tags| +|**--location**|string||location|location| +|**--type**|choice||type|type| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| +|**--marketplace-subscription-status**|choice|Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state.|marketplace_subscription_status|marketplaceSubscriptionStatus| +|**--logz-organization-properties**|object||logz_organization_properties|logzOrganizationProperties| +|**--user-info**|object||user_info|userInfo| +|**--plan-data**|object||plan_data|planData| + +#### Command `az logz sub-account update` + +##### Example +``` +az logz sub-account update --monitor-name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ +--resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--tags**|dictionary|The new tags of the monitor resource.|tags|tags| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| + +#### Command `az logz sub-account delete` + +##### Example +``` +az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "someName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +#### Command `az logz sub-account list-monitored-resource` + +##### Example +``` +az logz sub-account list-monitored-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +#### Command `az logz sub-account list-vm-host` + +##### Example +``` +az logz sub-account list-vm-host --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +#### Command `az logz sub-account list-vm-host-update` + +##### Example +``` +az logz sub-account list-vm-host-update --monitor-name "myMonitor" --state "Install" --resource-group \ +"myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--vm-resource-ids**|array|Request of a list vm host update operation.|vm_resource_ids|vmResourceIds| +|**--state**|choice|Specifies the state of the operation - install/ delete.|state|state| + +#### Command `az logz sub-account vm-host-payload` + +##### Example +``` +az logz sub-account vm-host-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +### group `az logz sub-account-tag-rule` +#### Command `az logz sub-account-tag-rule list` + +##### Example +``` +az logz sub-account-tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" --sub-account-name \ +"SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| + +#### Command `az logz sub-account-tag-rule show` + +##### Example +``` +az logz sub-account-tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| + +#### Command `az logz sub-account-tag-rule create` + +##### Example +``` +az logz sub-account-tag-rule create --monitor-name "myMonitor" --filtering-tags name="Environment" action="Include" \ +value="Prod" --filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false \ +--send-activity-logs true --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" \ +--sub-account-name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-activity-logs**|boolean|Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.|send_activity_logs|sendActivityLogs| +|**--filtering-tags**|array|List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| + +#### Command `az logz sub-account-tag-rule update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-activity-logs**|boolean|Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.|send_activity_logs|sendActivityLogs| +|**--filtering-tags**|array|List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| + +#### Command `az logz sub-account-tag-rule delete` + +##### Example +``` +az logz sub-account-tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--sub-account-name**|string|Sub Account resource name|sub_account_name|subAccountName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| + +### group `az logz tag-rule` +#### Command `az logz tag-rule list` + +##### Example +``` +az logz tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az logz tag-rule show` + +##### Example +``` +az logz tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| + +#### Command `az logz tag-rule create` + +##### Example +``` +az logz tag-rule create --monitor-name "myMonitor" --filtering-tags name="Environment" action="Include" value="Prod" \ +--filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false --send-activity-logs true \ +--send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-activity-logs**|boolean|Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.|send_activity_logs|sendActivityLogs| +|**--filtering-tags**|array|List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| + +#### Command `az logz tag-rule update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-activity-logs**|boolean|Flag specifying if activity logs from Azure resources should be sent for the Monitor resource.|send_activity_logs|sendActivityLogs| +|**--filtering-tags**|array|List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| + +#### Command `az logz tag-rule delete` + +##### Example +``` +az logz tag-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string||rule_set_name|ruleSetName| diff --git a/src/logz/setup.cfg b/src/logz/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/logz/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/logz/setup.py b/src/logz/setup.py new file mode 100644 index 00000000000..11767b6d597 --- /dev/null +++ b/src/logz/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_logz.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_logz.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='logz', + version=VERSION, + description='Microsoft Azure Command-Line Tools MicrosoftLogz Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/logz', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_logz': ['azext_metadata.json']}, +)