diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4eec13c1189..3646ec8d5a9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -36,6 +36,8 @@ /src/log-analytics/ @alexeldeib +/src/logz/ @kairu-ms @necusjz + /src/mesh/ @linggengmsft @jeffj6123 /src/mixed-reality/ @xiangyul 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..c734aed8d83 --- /dev/null +++ b/src/logz/README.md @@ -0,0 +1,155 @@ +# 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-payload ##### +``` +az logz monitor list-payload --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List-resource ##### +``` +az logz monitor list-resource --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List-role ##### +``` +az logz monitor list-role --name "myMonitor" --resource-group "myResourceGroup" +``` +##### List-vm ##### +``` +az logz monitor list-vm --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Update-vm ##### +``` +az logz monitor update-vm --name "myMonitor" --state "Install" --resource-group "myResourceGroup" +``` +##### Delete ##### +``` +az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup" +``` +#### logz rule #### +##### Create ##### +``` +az logz 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 rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### List ##### +``` +az logz rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Delete ##### +``` +az logz rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +#### logz sso #### +##### Create ##### +``` +az logz sso 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 sso show --configuration-name "default" --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### List ##### +``` +az logz sso 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 --monitor-name "{myMonitor}" --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-payload ##### +``` +az logz sub-account list-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### List-resource ##### +``` +az logz sub-account list-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### List-vm ##### +``` +az logz sub-account list-vm --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "SubAccount1" +``` +##### Update-vm ##### +``` +az logz sub-account update-vm --monitor-name "myMonitor" --state "Install" --resource-group "myResourceGroup" \ + --name "SubAccount1" +``` +##### Delete ##### +``` +az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name "someName" +``` +#### logz sub-rule #### +##### Create ##### +``` +az logz sub-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-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" \ + --sub-account-name "SubAccount1" +``` +##### List ##### +``` +az logz sub-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" --sub-account-name "SubAccount1" +``` +##### Delete ##### +``` +az logz sub-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" \ + --sub-account-name "SubAccount1" +``` \ 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..72e9cc1d5e1 --- /dev/null +++ b/src/logz/azext_logz/__init__.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------- +# 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=unused-import + +import azext_logz._help +from azure.cli.core import AzCommandsLoader + + +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() + 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 as e: + if e.name.endswith('manual.commands'): + pass + else: + raise e + 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 as e: + if e.name.endswith('manual._params'): + pass + else: + raise e + + +COMMAND_LOADER_CLS = MicrosoftLogzCommandsLoader diff --git a/src/logz/azext_logz/_help.py b/src/logz/azext_logz/_help.py new file mode 100644 index 00000000000..9b93f87a6e9 --- /dev/null +++ b/src/logz/azext_logz/_help.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------- +# 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 +# pylint: disable=unused-import +from .generated._help import helps # pylint: disable=reimported +try: + from .manual._help import helps # pylint: disable=reimported +except ImportError as e: + if e.name.endswith('manual._help'): + pass + else: + raise e diff --git a/src/logz/azext_logz/action.py b/src/logz/azext_logz/action.py new file mode 100644 index 00000000000..9b3d0a8a78c --- /dev/null +++ b/src/logz/azext_logz/action.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------- +# 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 as e: + if e.name.endswith('manual.action'): + pass + else: + raise e diff --git a/src/logz/azext_logz/azext_metadata.json b/src/logz/azext_logz/azext_metadata.json new file mode 100644 index 00000000000..a78851d3d17 --- /dev/null +++ b/src/logz/azext_logz/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" +} diff --git a/src/logz/azext_logz/custom.py b/src/logz/azext_logz/custom.py new file mode 100644 index 00000000000..885447229d6 --- /dev/null +++ b/src/logz/azext_logz/custom.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------- +# 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 as e: + if e.name.endswith('manual.custom'): + pass + else: + raise e 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..c019e0012e6 --- /dev/null +++ b/src/logz/azext_logz/generated/_client_factory.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# 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 diff --git a/src/logz/azext_logz/generated/_help.py b/src/logz/azext_logz/generated/_help.py new file mode 100644 index 00000000000..ea738db1a48 --- /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'] = ''' + type: group + short-summary: Manage Microsoft Logz +''' + +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. This create operation can take upto 10 minutes to complete." + parameters: + - name: --org-properties + long-summary: | + Usage: --org-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. This delete operation can take upto 10 minutes to complete." + examples: + - name: Monitors_Delete + text: |- + az logz monitor delete --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-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 list-payload --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-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-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-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-role --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-vm'] = """ + 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 --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor update-vm'] = """ + 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 update-vm --name "myMonitor" --state "Install" --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 rule'] = """ + type: group + short-summary: Manage tag rule with logz +""" + +helps['logz rule list'] = """ + type: command + short-summary: "List the tag rules for a given monitor resource." + examples: + - name: TagRules_List + text: |- + az logz rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: TagRules_Get + text: |- + az logz rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz 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 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 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 rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz sso'] = """ + type: group + short-summary: Manage single sign on with logz +""" + +helps['logz sso list'] = """ + type: command + short-summary: "List the single sign-on configurations for a given monitor resource." + examples: + - name: SingleSignOnConfigurations_List + text: |- + az logz sso list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz sso show'] = """ + type: command + short-summary: "Gets the Logz single sign-on resource for the given Monitor." + examples: + - name: SingleSignOnConfigurations_Get + text: |- + az logz sso show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +""" + +helps['logz sso create'] = """ + type: command + short-summary: "Configures single-sign-on for this resource. This operation can take upto 10 minutes to complete." + 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 sso 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 sso update'] = """ + type: command + short-summary: "Configures single-sign-on for this resource. This operation can take upto 10 minutes to complete." + 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 sso wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the logz sso is met. + examples: + - name: Pause executing next line of CLI script until the logz sso is successfully created. + text: |- + az logz sso wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the logz sso is successfully updated. + text: |- + az logz sso 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. This create operation can take upto 10 minutes \ +to complete." + parameters: + - name: --org-properties + long-summary: | + Usage: --org-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. This delete operation can take upto 10 minutes to complete." + examples: + - name: SubAccount_Delete + text: |- + az logz sub-account delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"someName" +""" + +helps['logz sub-account list-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 list-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account list-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-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account list-vm'] = """ + 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 --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account update-vm'] = """ + 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 update-vm --monitor-name "myMonitor" --state "Install" --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-rule'] = """ + type: group + short-summary: Manage sub account tag rule with logz +""" + +helps['logz sub-rule list'] = """ + type: command + short-summary: "List the tag rules for a given sub account resource." + examples: + - name: SubAccountTagRules_List + text: |- + az logz sub-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" --sub-account-name \ +"SubAccount1" +""" + +helps['logz sub-rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: SubAccountTagRules_Get + text: |- + az logz sub-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +""" + +helps['logz sub-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-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-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-rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz sub-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +""" diff --git a/src/logz/azext_logz/generated/_params.py b/src/logz/azext_logz/generated/_params.py new file mode 100644 index 00000000000..08bdb228ac0 --- /dev/null +++ b/src/logz/azext_logz/generated/_params.py @@ -0,0 +1,314 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=line-too-long +# 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, + AddVmResourceIds, + AddFilteringTags, + AddProperties +) + + +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='Identity type.', 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', options_list=['--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', options_list=['--org-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-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') + + with self.argument_context('logz monitor list-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-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 list-vm') 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 update-vm') 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('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 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 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 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='Rule set name of monitor.', id_part='child_name_1') + + with self.argument_context('logz 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='Rule set name of monitor.') + 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 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='Rule set name of monitor.', 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 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='Rule set name of monitor.', id_part='child_name_1') + + with self.argument_context('logz sso 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 sso 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='Single sign-on configuration name.', id_part='child_name_1') + + with self.argument_context('logz sso 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='Single sign-on configuration name.') + c.argument('properties', action=AddProperties, nargs='+', help='') + + with self.argument_context('logz sso 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='Single sign-on configuration name.', id_part='child_name_1') + c.argument('properties', action=AddProperties, nargs='+', help='') + c.ignore('body') + + with self.argument_context('logz sso 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='Single sign-on configuration name.', 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='Identity type.', 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', options_list=['--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', options_list=['--org-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-payload') 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-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') 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 update-vm') 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('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 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-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-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='Rule set name of monitor.', id_part='child_name_2') + + with self.argument_context('logz sub-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='Rule set name of sub account.') + 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-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='Rule set name of sub account.', 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-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='Rule set name of monitor.', id_part='child_name_2') 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..6cfe7f7bd4a --- /dev/null +++ b/src/logz/azext_logz/generated/action.py @@ -0,0 +1,238 @@ +# -------------------------------------------------------------------------- +# 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 + +# pylint: disable=no-self-use + + +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): + 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): + 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): + 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 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): + 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 + + +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): + 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): + 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 diff --git a/src/logz/azext_logz/generated/commands.py b/src/logz/azext_logz/generated/commands.py new file mode 100644 index 00000000000..6a4678a0676 --- /dev/null +++ b/src/logz/azext_logz/generated/commands.py @@ -0,0 +1,112 @@ +# -------------------------------------------------------------------------- +# 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 +# pylint: disable=bad-continuation +# pylint: disable=line-too-long + +from azure.cli.core.commands import CliCommandType +from azext_logz.generated._client_factory import ( + cf_monitor, + cf_tag_rule, + cf_single_sign_on, + cf_sub_account, + cf_sub_account_tag_rule, +) + + +logz_monitor = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._monitors_operations#MonitorsOperations.{}', + client_factory=cf_monitor, +) + + +logz_tag_rule = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._tag_rules_operations#TagRulesOperations.{}', + client_factory=cf_tag_rule, +) + + +logz_single_sign_on = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._single_sign_on_operations#SingleSignOnOperations.{}', + client_factory=cf_single_sign_on, +) + + +logz_sub_account = CliCommandType( + operations_tmpl='azext_logz.vendored_sdks.logz.operations._sub_account_operations#SubAccountOperations.{}', + client_factory=cf_sub_account, +) + + +logz_sub_account_tag_rule = CliCommandType( + operations_tmpl=( + 'azext_logz.vendored_sdks.logz.operations._sub_account_tag_rules_operations#SubAccountTagRulesOperations.{}' + ), + client_factory=cf_sub_account_tag_rule, +) + + +def load_command_table(self, _): + + 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-payload', 'logz_monitor_list_payload') + g.custom_command('list-resource', 'logz_monitor_list_resource') + g.custom_command('list-role', 'logz_monitor_list_role') + g.custom_command('list-vm', 'logz_monitor_list_vm') + g.custom_command('update-vm', 'logz_monitor_update_vm') + g.custom_wait_command('wait', 'logz_monitor_show') + + with self.command_group('logz rule', logz_tag_rule, client_factory=cf_tag_rule) as g: + g.custom_command('list', 'logz_rule_list') + g.custom_show_command('show', 'logz_rule_show') + g.custom_command('create', 'logz_rule_create') + g.generic_update_command('update', custom_func_name='logz_rule_update', setter_arg_name='body') + g.custom_command('delete', 'logz_rule_delete', confirmation=True) + + with self.command_group('logz sso', logz_single_sign_on, client_factory=cf_single_sign_on) as g: + g.custom_command('list', 'logz_sso_list') + g.custom_show_command('show', 'logz_sso_show') + g.custom_command('create', 'logz_sso_create', supports_no_wait=True) + g.generic_update_command( + 'update', + supports_no_wait=True, + custom_func_name='logz_sso_update', + setter_arg_name='body', + setter_name='begin_create_or_update', + ) + g.custom_wait_command('wait', 'logz_sso_show') + + 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-payload', 'logz_sub_account_list_payload') + g.custom_command('list-resource', 'logz_sub_account_list_resource') + g.custom_command('list-vm', 'logz_sub_account_list_vm') + g.custom_command('update-vm', 'logz_sub_account_update_vm') + g.custom_wait_command('wait', 'logz_sub_account_show') + + with self.command_group('logz sub-rule', logz_sub_account_tag_rule, client_factory=cf_sub_account_tag_rule) as g: + g.custom_command('list', 'logz_sub_rule_list') + g.custom_show_command('show', 'logz_sub_rule_show') + g.custom_command('create', 'logz_sub_rule_create') + g.generic_update_command('update', custom_func_name='logz_sub_rule_update', setter_arg_name='body') + g.custom_command('delete', 'logz_sub_rule_delete', confirmation=True) + + 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..877e5714df4 --- /dev/null +++ b/src/logz/azext_logz/generated/custom.py @@ -0,0 +1,486 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# 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, + location, + tags=None, + type_=None, + monitoring_status=None, + marketplace_subscription_status=None, + logz_organization_properties=None, + user_info=None, + plan_data=None, + no_wait=False): + body = {} + if tags is not None: + body['tags'] = tags + body['location'] = location + body['identity'] = {} + if type_ is not None: + body['identity']['type'] = type_ + if len(body['identity']) == 0: + del body['identity'] + body['properties'] = {} + if monitoring_status is not None: + body['properties']['monitoring_status'] = monitoring_status + else: + body['properties']['monitoring_status'] = "Enabled" + if marketplace_subscription_status is not None: + body['properties']['marketplace_subscription_status'] = marketplace_subscription_status + else: + body['properties']['marketplace_subscription_status'] = "Active" + if logz_organization_properties is not None: + body['properties']['logz_organization_properties'] = logz_organization_properties + if user_info is not None: + body['properties']['user_info'] = user_info + if plan_data is not None: + body['properties']['plan_data'] = plan_data + if len(body['properties']) == 0: + del body['properties'] + 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 = {} + if tags is not None: + body['tags'] = tags + body['properties'] = {} + if monitoring_status is not None: + body['properties']['monitoring_status'] = monitoring_status + else: + body['properties']['monitoring_status'] = "Enabled" + if len(body['properties']) == 0: + del body['properties'] + 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_payload(client, + resource_group_name, + monitor_name): + return client.vm_host_payload(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_list_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_role(client, + resource_group_name, + monitor_name, + email_address=None): + body = {} + if email_address is not None: + body['email_address'] = email_address + return client.list_user_roles(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_monitor_list_vm(client, + resource_group_name, + monitor_name): + return client.list_vm_hosts(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_monitor_update_vm(client, + resource_group_name, + monitor_name, + vm_resource_ids=None, + state=None): + body = {} + if vm_resource_ids is not None: + body['vm_resource_ids'] = vm_resource_ids + if state is not None: + body['state'] = state + return client.list_vm_host_update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) + + +def logz_rule_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_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_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['properties'] = {} + body['properties']['log_rules'] = {} + if send_aad_logs is not None: + body['properties']['log_rules']['send_aad_logs'] = send_aad_logs + if send_subscription_logs is not None: + body['properties']['log_rules']['send_subscription_logs'] = send_subscription_logs + if send_activity_logs is not None: + body['properties']['log_rules']['send_activity_logs'] = send_activity_logs + if filtering_tags is not None: + body['properties']['log_rules']['filtering_tags'] = filtering_tags + if len(body['properties']['log_rules']) == 0: + del body['properties']['log_rules'] + 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_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.properties.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.properties.log_rules.send_subscription_logs = send_subscription_logs + if send_activity_logs is not None: + instance.properties.log_rules.send_activity_logs = send_activity_logs + if filtering_tags is not None: + instance.properties.log_rules.filtering_tags = filtering_tags + return instance + + +def logz_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_sso_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def logz_sso_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_sso_create(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + body = {} + if properties is not None: + 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_sso_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, + location, + tags=None, + type_=None, + monitoring_status=None, + marketplace_subscription_status=None, + logz_organization_properties=None, + user_info=None, + plan_data=None, + no_wait=False): + body = {} + if tags is not None: + body['tags'] = tags + body['location'] = location + body['identity'] = {} + if type_ is not None: + body['identity']['type'] = type_ + if len(body['identity']) == 0: + del body['identity'] + body['properties'] = {} + if monitoring_status is not None: + body['properties']['monitoring_status'] = monitoring_status + else: + body['properties']['monitoring_status'] = "Enabled" + if marketplace_subscription_status is not None: + body['properties']['marketplace_subscription_status'] = marketplace_subscription_status + else: + body['properties']['marketplace_subscription_status'] = "Active" + if logz_organization_properties is not None: + body['properties']['logz_organization_properties'] = logz_organization_properties + if user_info is not None: + body['properties']['user_info'] = user_info + if plan_data is not None: + body['properties']['plan_data'] = plan_data + if len(body['properties']) == 0: + del body['properties'] + 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 = {} + if tags is not None: + body['tags'] = tags + body['properties'] = {} + if monitoring_status is not None: + body['properties']['monitoring_status'] = monitoring_status + else: + body['properties']['monitoring_status'] = "Enabled" + if len(body['properties']) == 0: + del body['properties'] + 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_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_list_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(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_update_vm(client, + resource_group_name, + monitor_name, + sub_account_name, + vm_resource_ids=None, + state=None): + body = {} + if vm_resource_ids is not None: + body['vm_resource_ids'] = vm_resource_ids + if state is not None: + 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_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_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_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['properties'] = {} + body['properties']['log_rules'] = {} + if send_aad_logs is not None: + body['properties']['log_rules']['send_aad_logs'] = send_aad_logs + if send_subscription_logs is not None: + body['properties']['log_rules']['send_subscription_logs'] = send_subscription_logs + if send_activity_logs is not None: + body['properties']['log_rules']['send_activity_logs'] = send_activity_logs + if filtering_tags is not None: + body['properties']['log_rules']['filtering_tags'] = filtering_tags + if len(body['properties']['log_rules']) == 0: + del body['properties']['log_rules'] + 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_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.properties.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.properties.log_rules.send_subscription_logs = send_subscription_logs + if send_activity_logs is not None: + instance.properties.log_rules.send_activity_logs = send_activity_logs + if filtering_tags is not None: + instance.properties.log_rules.filtering_tags = filtering_tags + return instance + + +def logz_sub_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) 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/manual/_help.py b/src/logz/azext_logz/manual/_help.py new file mode 100644 index 00000000000..b67bc471140 --- /dev/null +++ b/src/logz/azext_logz/manual/_help.py @@ -0,0 +1,541 @@ +# -------------------------------------------------------------------------- +# 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'] = ''' + type: group + short-summary: Manage Microsoft Logz +''' + +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. This create operation can take Get to complete." + parameters: + - name: --org-properties + long-summary: | + Usage: --org-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-payload'] = """ + type: command + short-summary: "List 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 list-payload --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-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-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-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-role --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor list-vm'] = """ + 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 --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz monitor update-vm'] = """ + type: command + short-summary: "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 update-vm --name "myMonitor" --state "Install" --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 rule'] = """ + type: group + short-summary: Manage tag rule with logz +""" + +helps['logz rule list'] = """ + type: command + short-summary: "List the tag rules for a given monitor resource." + examples: + - name: TagRules_List + text: |- + az logz rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: TagRules_Get + text: |- + az logz rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz 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 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 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 rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['logz sso'] = """ + type: group + short-summary: Manage single sign on with logz +""" + +helps['logz sso list'] = """ + type: command + short-summary: "List the single sign-on configurations for a given monitor resource." + examples: + - name: SingleSignOnConfigurations_List + text: |- + az logz sso list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['logz sso show'] = """ + type: command + short-summary: "Get the Logz single sign-on resource for the given Monitor." + examples: + - name: SingleSignOnConfigurations_Get + text: |- + az logz sso show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +""" + +helps['logz sso create'] = """ + type: command + short-summary: "Create 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 sso 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 sso update'] = """ + type: command + short-summary: "Create 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 sso wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the logz sso is met. + examples: + - name: Pause executing next line of CLI script until the logz sso is successfully created. + text: |- + az logz sso wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the logz sso is successfully updated. + text: |- + az logz sso 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: --org-properties + long-summary: | + Usage: --org-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-payload'] = """ + type: command + short-summary: "List 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 list-payload --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account list-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-resource --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account list-vm'] = """ + 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 --monitor-name "myMonitor" --resource-group "myResourceGroup" --name \ +"SubAccount1" +""" + +helps['logz sub-account update-vm'] = """ + type: command + short-summary: "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 update-vm --monitor-name "myMonitor" --state "Install" --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-rule'] = """ + type: group + short-summary: Manage sub account tag rule with logz +""" + +helps['logz sub-rule list'] = """ + type: command + short-summary: "List the tag rules for a given sub account resource." + examples: + - name: SubAccountTagRules_List + text: |- + az logz sub-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" --sub-account-name \ +"SubAccount1" +""" + +helps['logz sub-rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: SubAccountTagRules_Get + text: |- + az logz sub-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +""" + +helps['logz sub-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-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-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-rule delete'] = """ + type: command + short-summary: "Delete a tag rule set for a given monitor resource." + examples: + - name: TagRules_Delete + text: |- + az logz sub-rule delete --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" --sub-account-name "SubAccount1" +""" 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/recordings/test_main_account_crud.yaml b/src/logz/azext_logz/tests/latest/recordings/test_main_account_crud.yaml new file mode 100644 index 00000000000..05e0388e5c8 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_main_account_crud.yaml @@ -0,0 +1,667 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:32 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:38.5840762Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:39:38.5840762Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '964' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:45 GMT + etag: + - '"5e008ff0-0000-0800-0000-6177a2af0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "name": "97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Accepted", "startTime": "2021-10-26T06:39:42.8627584Z"}' + headers: + cache-control: + - no-cache + content-length: + - '546' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:15 GMT + etag: + - '"570110d4-0000-0800-0000-6177a2ae0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "name": "97f6f7f3-6217-424b-b802-ee49f2c9ff26*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Succeeded", "startTime": "2021-10-26T06:39:42.8627584Z", "endTime": + "2021-10-26T06:40:22.6356283Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '617' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:45 GMT + etag: + - '"570134d4-0000-0800-0000-6177a2d60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:38.5840762Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:40:22.1677Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361015"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '905' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:45 GMT + etag: + - '"5e0004f1-0000-0800-0000-6177a2d60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:38.5840762Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:40:22.1677Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361015"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}]}' + headers: + cache-control: + - no-cache + content-length: + - '917' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - f7ad6db7-dd85-4930-8221-6f55728a3c5a + - bda69b3b-2e4f-4ea2-90df-70040b92a986 + - e0cc7e28-0845-4e10-bfce-8b2c91e1c079 + - 075710de-f11d-4acb-af44-0e96c5cc554f + status: + code: 200 + message: OK +- request: + body: '{"emailAddress": "ethanyang@microsoft.com"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor list-role + Connection: + - keep-alive + Content-Length: + - '43' + Content-Type: + - application/json + ParameterSetName: + - -n -g --email-address + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/listUserRoles?api-version=2020-10-01 + response: + body: + string: '{"value": [{"role": "Admin"}], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '44' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:51 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor list-resource + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/listMonitoredResources?api-version=2020-10-01 + response: + body: + string: '{"value": [], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '28' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:53 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Disabled"}, "tags": {"Environment": + "Dev"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor update + Connection: + - keep-alive + Content-Length: + - '80' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitoring-status --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:38.5840762Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:40:58.0418643Z"}, "properties": {"provisioningState": "Succeeded", + "monitoringStatus": "Disabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"id": "361015"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '889' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:00 GMT + etag: + - '"5e007cf1-0000-0800-0000-6177a2fa0000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor show + Connection: + - keep-alive + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:38.5840762Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:40:58.0418643Z"}, "properties": {"provisioningState": "Succeeded", + "monitoringStatus": "Disabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"id": "361015"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '889' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:03 GMT + etag: + - '"5e007cf1-0000-0800-0000-6177a2fa0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b5a7cc89-6f9f-4857-b48f-6efa16273c89*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:06 GMT + etag: + - '"5e0090f1-0000-0800-0000-6177a3020000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b5a7cc89-6f9f-4857-b48f-6efa16273c89*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor delete + Connection: + - keep-alive + ParameterSetName: + - -n -g --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b5a7cc89-6f9f-4857-b48f-6efa16273c89*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b5a7cc89-6f9f-4857-b48f-6efa16273c89*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "name": "b5a7cc89-6f9f-4857-b48f-6efa16273c89*E95E7B0A7199DB6089493C38598697011047FDB40BB368BD20B6E4C9DC969B68", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Succeeded", "startTime": "2021-10-26T06:41:05.4756024Z", "endTime": + "2021-10-26T06:41:08.6704865Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '617' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:36 GMT + etag: + - '"57016bd4-0000-0800-0000-6177a3040000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_main_account_rule.yaml b/src/logz/azext_logz/tests/latest/recordings/test_main_account_rule.yaml new file mode 100644 index 00000000000..6ef56510120 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_main_account_rule.yaml @@ -0,0 +1,613 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:33 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:40.3864021Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:39:40.3864021Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '964' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:48 GMT + etag: + - '"5e009cf0-0000-0800-0000-6177a2b20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F", + "name": "7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Accepted", "startTime": "2021-10-26T06:39:45.9628668Z"}' + headers: + cache-control: + - no-cache + content-length: + - '546' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:18 GMT + etag: + - '"570114d4-0000-0800-0000-6177a2b10000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F", + "name": "7ffa89f4-c7c0-47a2-be78-cbe56c7f8ac3*8DB042C46930F418902EB317FB1F211BDCD73D34E91C4E8AC88CF39AD4009F5F", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Succeeded", "startTime": "2021-10-26T06:39:45.9628668Z", "endTime": + "2021-10-26T06:40:23.2769087Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '617' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + etag: + - '"570136d4-0000-0800-0000-6177a2d70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:40.3864021Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:40:23.1284141Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361025"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '908' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + etag: + - '"5e0008f1-0000-0800-0000-6177a2d70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule create + Connection: + - keep-alive + Content-Length: + - '189' + Content-Type: + - application/json + ParameterSetName: + - --monitor-name -g --filtering-tag --send-aad-logs --send-activity-logs --send-subscription-logs + --rule-set-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:40:51.4024751Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:40:51.4024751Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '713' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:51 GMT + etag: + - '"d10229b9-0000-0800-0000-6177a2f40000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule list + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:40:51.4024751Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:40:51.4024751Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '725' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:53 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule update + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --rule-set-name --send-aad-logs + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:40:51.4024751Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:40:51.4024751Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '713' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:54 GMT + etag: + - '"d10229b9-0000-0800-0000-6177a2f40000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule update + Connection: + - keep-alive + Content-Length: + - '188' + Content-Type: + - application/json + ParameterSetName: + - --monitor-name -g --rule-set-name --send-aad-logs + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:40:51.4024751Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:40:51.4024751Z"}, + "properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": true, + "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '712' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:57 GMT + etag: + - '"d10250b9-0000-0800-0000-6177a2fa0000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule show + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --rule-set-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:40:51.4024751Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:40:51.4024751Z"}, + "properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": true, + "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '712' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:59 GMT + etag: + - '"d10250b9-0000-0800-0000-6177a2fa0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz rule delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --monitor-name -g --rule-set-name --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/tagRules/default?api-version=2020-10-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 26 Oct 2021 06:41:00 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_main_account_vm.yaml b/src/logz/azext_logz/tests/latest/recordings/test_main_account_vm.yaml new file mode 100644 index 00000000000..678506205fd --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_main_account_vm.yaml @@ -0,0 +1,1164 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:33 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:39.3618949Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:39:39.3618949Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '964' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:45 GMT + etag: + - '"5e0092f0-0000-0800-0000-6177a2b00000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D", + "name": "38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Accepted", "startTime": "2021-10-26T06:39:44.2173304Z"}' + headers: + cache-control: + - no-cache + content-length: + - '546' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:16 GMT + etag: + - '"570112d4-0000-0800-0000-6177a2b00000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D", + "name": "38f6c9c1-1e52-4a4c-8a5b-b84318a45e8f*DC69CE807D31FB7AAF3C69078B97DB27F027CDEC40F3E6405E72B5BBFADD631D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "status": "Succeeded", "startTime": "2021-10-26T06:39:44.2173304Z", "endTime": + "2021-10-26T06:40:23.4230591Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '617' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:46 GMT + etag: + - '"570137d4-0000-0800-0000-6177a2d70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor", + "name": "monitor", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:39.3618949Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:40:23.1927094Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361020"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '908' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:46 GMT + etag: + - '"5e000bf1-0000-0800-0000-6177a2d70000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.25.1 + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + response: + body: + string: '{"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [], "outputs": {"aliases": {"type": "object", "value": {"Linux": {"CentOS": + {"publisher": "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest"}, + "Debian": {"publisher": "Debian", "offer": "debian-10", "sku": "10", "version": + "latest"}, "Flatcar": {"publisher": "kinvolk", "offer": "flatcar-container-linux-free", + "sku": "stable", "version": "latest"}, "openSUSE-Leap": {"publisher": "SUSE", + "offer": "openSUSE-Leap", "sku": "42.3", "version": "latest"}, "RHEL": {"publisher": + "RedHat", "offer": "RHEL", "sku": "7-LVM", "version": "latest"}, "SLES": {"publisher": + "SUSE", "offer": "SLES", "sku": "15", "version": "latest"}, "UbuntuLTS": {"publisher": + "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": "latest"}}, + "Windows": {"Win2019Datacenter": {"publisher": "MicrosoftWindowsServer", "offer": + "WindowsServer", "sku": "2019-Datacenter", "version": "latest"}, "Win2016Datacenter": + {"publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter", + "version": "latest"}, "Win2012R2Datacenter": {"publisher": "MicrosoftWindowsServer", + "offer": "WindowsServer", "sku": "2012-R2-Datacenter", "version": "latest"}, + "Win2012Datacenter": {"publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", + "sku": "2012-Datacenter", "version": "latest"}, "Win2008R2SP1": {"publisher": + "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2008-R2-SP1", + "version": "latest"}}}}}}' + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '2525' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:49 GMT + etag: + - W/"54bceef15b892f2aa7f4c2145a49f1b5e33608722acdbb47933d7b6cbebbd7f4" + expires: + - Tue, 26 Oct 2021 06:45:49 GMT + source-age: + - '183' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding,Origin + via: + - 1.1 varnish + x-cache: + - HIT + x-cache-hits: + - '1' + x-content-type-options: + - nosniff + x-fastly-request-id: + - 6bbb4a5c1129b233be39e0080b6590d06b4badf8 + x-frame-options: + - deny + x-github-request-id: + - AB50:6143:39D648:507E5C:6175C9F2 + x-served-by: + - cache-qpg1237-QPG + x-timer: + - S1635230450.821708,VS0,VE0 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks?api-version=2018-01-01 + response: + body: + string: '{"value": []}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:50 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [{"name": "machineVNET", "type": "Microsoft.Network/virtualNetworks", "location": + "westus2", "apiVersion": "2015-06-15", "dependsOn": [], "tags": {}, "properties": + {"addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": + "machineSubnet", "properties": {"addressPrefix": "10.0.0.0/24"}}]}}, {"type": + "Microsoft.Network/networkSecurityGroups", "name": "machineNSG", "apiVersion": + "2015-06-15", "location": "westus2", "tags": {}, "dependsOn": [], "properties": + {"securityRules": [{"name": "default-allow-ssh", "properties": {"protocol": + "Tcp", "sourcePortRange": "*", "destinationPortRange": "22", "sourceAddressPrefix": + "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1000, "direction": + "Inbound"}}]}}, {"apiVersion": "2018-01-01", "type": "Microsoft.Network/publicIPAddresses", + "name": "machinePublicIP", "location": "westus2", "tags": {}, "dependsOn": [], + "properties": {"publicIPAllocationMethod": "Static"}, "sku": {"name": "Standard"}}, + {"apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", + "name": "machineVMNic", "location": "westus2", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/machineVNET", + "Microsoft.Network/networkSecurityGroups/machineNSG", "Microsoft.Network/publicIpAddresses/machinePublicIP"], + "properties": {"ipConfigurations": [{"name": "ipconfigmachine", "properties": + {"privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET/subnets/machineSubnet"}, + "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}}}], + "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}}}, + {"apiVersion": "2021-07-01", "type": "Microsoft.Compute/virtualMachines", "name": + "machine", "location": "westus2", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/machineVMNic"], + "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "properties": {"deleteOption": null}}]}, "storageProfile": {"osDisk": {"createOption": + "fromImage", "name": "os-disk", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + null}}, "imageReference": {"publisher": "OpenLogic", "offer": "CentOS", "sku": + "7.5", "version": "latest"}}, "osProfile": {"computerName": "machine", "adminUsername": + "ethanyang", "linuxConfiguration": {"disablePasswordAuthentication": true, "ssh": + {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n", "path": "/home/ethanyang/.ssh/authorized_keys"}]}}}}}], + "outputs": {}}, "parameters": {}, "mode": "incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '4004' + Content-Type: + - application/json + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_m0ryfKSHrA4hNLTjoB7pYlno0STiviiq", + "name": "vm_deploy_m0ryfKSHrA4hNLTjoB7pYlno0STiviiq", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "536440762476386008", "parameters": {}, "mode": + "Incremental", "provisioningState": "Accepted", "timestamp": "2021-10-26T06:40:56.5539972Z", + "duration": "PT2.4914143S", "correlationId": "2275cd66-c3f3-4214-b3c7-5659f19be989", + "providers": [{"namespace": "Microsoft.Network", "resourceTypes": [{"resourceType": + "virtualNetworks", "locations": ["westus2"]}, {"resourceType": "networkSecurityGroups", + "locations": ["westus2"]}, {"resourceType": "publicIPAddresses", "locations": + ["westus2"]}, {"resourceType": "networkInterfaces", "locations": ["westus2"]}]}, + {"namespace": "Microsoft.Compute", "resourceTypes": [{"resourceType": "virtualMachines", + "locations": ["westus2"]}]}], "dependencies": [{"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET", + "resourceType": "Microsoft.Network/virtualNetworks", "resourceName": "machineVNET"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG", + "resourceType": "Microsoft.Network/networkSecurityGroups", "resourceName": + "machineNSG"}, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "resourceType": "Microsoft.Network/publicIPAddresses", "resourceName": "machinePublicIP"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}, + {"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "resourceType": "Microsoft.Compute/virtualMachines", "resourceName": "machine"}]}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_m0ryfKSHrA4hNLTjoB7pYlno0STiviiq/operationStatuses/08585663764314150756?api-version=2021-04-01 + cache-control: + - no-cache + content-length: + - '2794' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663764314150756?api-version=2021-04-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663764314150756?api-version=2021-04-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663764314150756?api-version=2021-04-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_m0ryfKSHrA4hNLTjoB7pYlno0STiviiq", + "name": "vm_deploy_m0ryfKSHrA4hNLTjoB7pYlno0STiviiq", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "536440762476386008", "parameters": {}, "mode": + "Incremental", "provisioningState": "Succeeded", "timestamp": "2021-10-26T06:42:27.8271844Z", + "duration": "PT1M33.7646015S", "correlationId": "2275cd66-c3f3-4214-b3c7-5659f19be989", + "providers": [{"namespace": "Microsoft.Network", "resourceTypes": [{"resourceType": + "virtualNetworks", "locations": ["westus2"]}, {"resourceType": "networkSecurityGroups", + "locations": ["westus2"]}, {"resourceType": "publicIPAddresses", "locations": + ["westus2"]}, {"resourceType": "networkInterfaces", "locations": ["westus2"]}]}, + {"namespace": "Microsoft.Compute", "resourceTypes": [{"resourceType": "virtualMachines", + "locations": ["westus2"]}]}], "dependencies": [{"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET", + "resourceType": "Microsoft.Network/virtualNetworks", "resourceName": "machineVNET"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG", + "resourceType": "Microsoft.Network/networkSecurityGroups", "resourceName": + "machineNSG"}, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "resourceType": "Microsoft.Network/publicIPAddresses", "resourceName": "machinePublicIP"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}, + {"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "resourceType": "Microsoft.Compute/virtualMachines", "resourceName": "machine"}], + "outputs": {}, "outputResources": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '3881' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine?$expand=instanceView&api-version=2021-07-01 + response: + body: + string: '{"name": "machine", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "type": "Microsoft.Compute/virtualMachines", "location": "westus2", "tags": + {}, "properties": {"vmId": "8e3fb804-bc11-46d9-bc21-1bc7bb61682e", "hardwareProfile": + {"vmSize": "Standard_DS1_v2"}, "storageProfile": {"imageReference": {"publisher": + "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest", "exactVersion": + "7.5.201808150"}, "osDisk": {"osType": "Linux", "name": "os-disk", "createOption": + "FromImage", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + "Premium_LRS", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/disks/os-disk"}, + "deleteOption": "Detach", "diskSizeGB": 30}, "dataDisks": []}, "osProfile": + {"computerName": "machine", "adminUsername": "ethanyang", "linuxConfiguration": + {"disablePasswordAuthentication": true, "ssh": {"publicKeys": [{"path": "/home/ethanyang/.ssh/authorized_keys", + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n"}]}, "provisionVMAgent": true, "patchSettings": + {"patchMode": "ImageDefault", "assessmentMode": "ImageDefault"}}, "secrets": + [], "allowExtensionOperations": true, "requireGuestProvisionSignal": true}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}]}, + "provisioningState": "Succeeded", "instanceView": {"computerName": "machine", + "osName": "centos", "osVersion": "7.5.1804", "vmAgent": {"vmAgentVersion": + "2.5.0.2", "statuses": [{"code": "ProvisioningState/succeeded", "level": "Info", + "displayStatus": "Ready", "message": "Guest Agent is running", "time": "2021-10-26T06:42:28+00:00"}], + "extensionHandlers": []}, "disks": [{"name": "os-disk", "statuses": [{"code": + "ProvisioningState/succeeded", "level": "Info", "displayStatus": "Provisioning + succeeded", "time": "2021-10-26T06:41:19.9322772+00:00"}]}], "hyperVGeneration": + "V1", "statuses": [{"code": "ProvisioningState/succeeded", "level": "Info", + "displayStatus": "Provisioning succeeded", "time": "2021-10-26T06:42:24.5103358+00:00"}, + {"code": "PowerState/running", "level": "Info", "displayStatus": "VM running"}]}}}' + headers: + cache-control: + - no-cache + content-length: + - '4016' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:31 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3994,Microsoft.Compute/LowCostGet30Min;31955 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic?api-version=2018-01-01 + response: + body: + string: '{"name": "machineVMNic", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "etag": "W/\"8665ddd1-c3d6-4449-a8c2-1ba25522b9ba\"", "location": "westus2", + "tags": {}, "properties": {"provisioningState": "Succeeded", "resourceGuid": + "d1174781-2f6f-44e8-9334-d0a81a8f2893", "ipConfigurations": [{"name": "ipconfigmachine", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic/ipConfigurations/ipconfigmachine", + "etag": "W/\"8665ddd1-c3d6-4449-a8c2-1ba25522b9ba\"", "type": "Microsoft.Network/networkInterfaces/ipConfigurations", + "properties": {"provisioningState": "Succeeded", "privateIPAddress": "10.0.0.4", + "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}, + "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET/subnets/machineSubnet"}, + "primary": true, "privateIPAddressVersion": "IPv4"}}], "dnsSettings": {"dnsServers": + [], "appliedDnsServers": [], "internalDomainNameSuffix": "k4vga3svds3ehaibaygslbinue.xx.internal.cloudapp.net"}, + "macAddress": "00-22-48-7A-1B-DA", "enableAcceleratedNetworking": false, "enableIPForwarding": + false, "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}, + "primary": true, "virtualMachine": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine"}}, + "type": "Microsoft.Network/networkInterfaces"}' + headers: + cache-control: + - no-cache + content-length: + - '2609' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:32 GMT + etag: + - W/"8665ddd1-c3d6-4449-a8c2-1ba25522b9ba" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 0245b1a5-411f-4015-9d75-1fb1b8fb84c2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP?api-version=2018-01-01 + response: + body: + string: '{"name": "machinePublicIP", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "etag": "W/\"87efafd9-e80f-47ad-8fe0-5a98a6471e6e\"", "location": "westus2", + "tags": {}, "properties": {"provisioningState": "Succeeded", "resourceGuid": + "53842034-0b18-4f09-9c3d-47503513d0dc", "ipAddress": "52.148.164.204", "publicIPAddressVersion": + "IPv4", "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 4, "ipTags": + [], "ipConfiguration": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic/ipConfigurations/ipconfigmachine"}}, + "type": "Microsoft.Network/publicIPAddresses", "sku": {"name": "Standard"}}' + headers: + cache-control: + - no-cache + content-length: + - '1017' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:32 GMT + etag: + - W/"87efafd9-e80f-47ad-8fe0-5a98a6471e6e" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 70a77162-4db9-4c98-a24c-51047c7e0bdc + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm show + Connection: + - keep-alive + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine?api-version=2021-07-01 + response: + body: + string: '{"name": "machine", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "type": "Microsoft.Compute/virtualMachines", "location": "westus2", "tags": + {}, "properties": {"vmId": "8e3fb804-bc11-46d9-bc21-1bc7bb61682e", "hardwareProfile": + {"vmSize": "Standard_DS1_v2"}, "storageProfile": {"imageReference": {"publisher": + "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest", "exactVersion": + "7.5.201808150"}, "osDisk": {"osType": "Linux", "name": "os-disk", "createOption": + "FromImage", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + "Premium_LRS", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/disks/os-disk"}, + "deleteOption": "Detach", "diskSizeGB": 30}, "dataDisks": []}, "osProfile": + {"computerName": "machine", "adminUsername": "ethanyang", "linuxConfiguration": + {"disablePasswordAuthentication": true, "ssh": {"publicKeys": [{"path": "/home/ethanyang/.ssh/authorized_keys", + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n"}]}, "provisionVMAgent": true, "patchSettings": + {"patchMode": "ImageDefault", "assessmentMode": "ImageDefault"}}, "secrets": + [], "allowExtensionOperations": true, "requireGuestProvisionSignal": true}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}]}, + "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '2754' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:34 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3993,Microsoft.Compute/LowCostGet30Min;31954 + status: + code: 200 + message: OK +- request: + body: '{"vmResourceIds": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "agentVersion": "1.0.*"}], "state": "Install"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor update-vm + Connection: + - keep-alive + Content-Length: + - '270' + Content-Type: + - application/json + ParameterSetName: + - -n -g --state --vm-resource-ids + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/vmHostUpdate?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "agentVersion": "1.0.*"}], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '254' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:36 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor list-vm + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/listVMHosts?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/CLI_TEST_LOGZ_H6KNASYEDBAZAVXLYFQTJRAT37C2YDDECIXFA7XCHZWNZ2TRYPVUOUBXLRKD7/PROVIDERS/MICROSOFT.COMPUTE/VIRTUALMACHINES/MACHINE", + "agentVersion": "1.0.*"}], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '254' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:37 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor list-payload + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/vmHostPayload?api-version=2020-10-01 + response: + body: + string: '{"region": "westus2", "hidden": "hidden"}' + headers: + cache-control: + - no-cache + content-length: + - '64' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:40 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_single_sign_on.yaml b/src/logz/azext_logz/tests/latest/recordings/test_single_sign_on.yaml new file mode 100644 index 00000000000..a20cf063d25 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_single_sign_on.yaml @@ -0,0 +1,1637 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.28.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001","name":"cli_test_logz_000001","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"product":"azurecli","cause":"automation","date":"2021-10-13T09:19:09Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:19:13 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor","name":"monitor","type":"microsoft.logz/monitors","location":"westus2","tags":{"Environment":"Dev"},"systemData":{"createdBy":"ethanyang@microsoft.com","createdByType":"User","createdAt":"2021-10-13T09:19:17.6552077Z","lastModifiedBy":"ethanyang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-13T09:19:17.6552077Z"},"properties":{"provisioningState":"Accepted","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","logzOrganizationProperties":{"companyName":null,"id":null,"enterpriseAppId":null,"singleSignOnUrl":null},"userInfo":null,"planData":{"usageType":"Committed","billingCycle":"Monthly","planDetails":"100gb14days","effectiveDate":"2021-08-31T13:14:33Z"},"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '964' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:19:25 GMT + etag: + - '"1f009551-0000-0800-0000-6166a49c0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD","name":"36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor","status":"Accepted","startTime":"2021-10-13T09:19:23.2776497Z"}' + headers: + cache-control: + - no-cache + content-length: + - '546' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:19:55 GMT + etag: + - '"3f011615-0000-0800-0000-6166a49b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD","name":"36eb6d25-828c-45e2-b4d9-b060ee7d9bcb*EF343865B6CEF3051C26D7BAE1DE099D69781148EE95EB17EAC703A2A4A51ABD","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor","status":"Succeeded","startTime":"2021-10-13T09:19:23.2776497Z","endTime":"2021-10-13T09:20:13.9124719Z","error":{},"properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '617' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:20:25 GMT + etag: + - '"3f01a915-0000-0800-0000-6166a4cd0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor?api-version=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor","name":"monitor","type":"microsoft.logz/monitors","location":"westus2","tags":{"Environment":"Dev"},"systemData":{"createdBy":"ethanyang@microsoft.com","createdByType":"User","createdAt":"2021-10-13T09:19:17.6552077Z","lastModifiedBy":"a5472e16-e1d2-4bbe-81b3-ecdcd459b536","lastModifiedByType":"Application","lastModifiedAt":"2021-10-13T09:20:13.6205754Z"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","logzOrganizationProperties":{"id":"354595"},"planData":{"usageType":"Committed","billingCycle":"Monthly","planDetails":"100gb14days","effectiveDate":"2021-08-31T13:14:33Z"},"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' + headers: + cache-control: + - no-cache + content-length: + - '908' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:20:25 GMT + etag: + - '"1f003052-0000-0800-0000-6166a4cd0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"singleSignOnState": "Enable", "enterpriseAppId": "4c232741-efe7-4310-91cf-30c4c1adeb29"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + Content-Length: + - '106' + Content-Type: + - application/json + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default?api-version=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","name":"default","type":"microsoft.logz/monitors/singlesignonconfigurations","systemData":{"createdBy":"ethanyang@microsoft.com","createdByType":"User","createdAt":"2021-10-13T09:20:27.4152147Z","lastModifiedBy":"ethanyang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-13T09:20:27.4152147Z"},"properties":{"singleSignOnState":"Enable","enterpriseAppId":"4c232741-efe7-4310-91cf-30c4c1adeb29","singleSignOnUrl":null,"provisioningState":"Accepted"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '698' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:20:29 GMT + etag: + - '"bb00bd71-0000-0800-0000-6166a4dd0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:20:59 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:21:29 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:21:59 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:22:30 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:23:00 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:23:30 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:24:01 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:24:31 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:25:01 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:25:31 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:26:02 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:26:32 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:27:02 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:27:33 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:28:04 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:28:33 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:29:03 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:29:33 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:30:05 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:30:35 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:31:05 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:31:35 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:32:06 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:32:36 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:33:06 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:33:36 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:34:07 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Accepted","startTime":"2021-10-13T09:20:28.8568202Z"}' + headers: + cache-control: + - no-cache + content-length: + - '581' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:34:38 GMT + etag: + - '"3f01aa15-0000-0800-0000-6166a4dc0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sso create + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --properties --configuration-name + User-Agent: + - AZURECLI/2.28.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059?api-version=2020-10-01 + response: + body: + string: '{"id":"/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","name":"9cfc7f67-53d1-4b92-aada-e23e139982c4*87256D520F6CA726F667809745576FA0D439C9A141171F35C514248A4151E059","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor/singleSignOnConfigurations/default","status":"Failed","startTime":"2021-10-13T09:20:28.8568202Z","endTime":"2021-10-13T09:34:49.1711367Z","error":{"message":"Failed + to update SAML SSO for logz resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor. + Response Code: ''InternalServerError'', Error content: ''{\"code\":500,\"message\":\"500 + Internal Server Error\",\"requestId\":\"f892e65d-3195-41d7-a492-aabdc4b0a77e\"}''."}}' + headers: + cache-control: + - no-cache + content-length: + - '1040' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 09:35:08 GMT + etag: + - '"3f01001b-0000-0800-0000-6166a8390000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_sub_account_crud.yaml b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_crud.yaml new file mode 100644 index 00000000000..8c302fc54b4 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_crud.yaml @@ -0,0 +1,837 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:32 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:41.2396286Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:39:41.2396286Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '966' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:39:48 GMT + etag: + - '"5e009ef0-0000-0800-0000-6177a2b20000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501", + "name": "f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Accepted", "startTime": "2021-10-26T06:39:46.2597058Z"}' + headers: + cache-control: + - no-cache + content-length: + - '547' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:18 GMT + etag: + - '"570116d4-0000-0800-0000-6177a2b20000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501", + "name": "f7306448-96d5-4242-a808-6a75fc0974a3*340F4603A5EE689B315B0045179F269CC0ABA899C3A85CA7F4F1488876811501", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Succeeded", "startTime": "2021-10-26T06:39:46.2597058Z", "endTime": + "2021-10-26T06:40:22.7317091Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + etag: + - '"570135d4-0000-0800-0000-6177a2d60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:39:41.2396286Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:40:22.4834007Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361030"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '910' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:48 GMT + etag: + - '"5e0005f1-0000-0800-0000-6177a2d60000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:39:27Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:50 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:40:55.3516915Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:40:55.3516915Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": "monitor1", "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/749fb35e-24b3-44c9-8c85-065cbc0eb3d8*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '999' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:40:58 GMT + etag: + - '"c5038b5a-0000-0800-0000-6177a2f90000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/749fb35e-24b3-44c9-8c85-065cbc0eb3d8*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/749fb35e-24b3-44c9-8c85-065cbc0eb3d8*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/749fb35e-24b3-44c9-8c85-065cbc0eb3d8*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22", + "name": "749fb35e-24b3-44c9-8c85-065cbc0eb3d8*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "status": "Succeeded", "startTime": "2021-10-26T06:40:57.2301813Z", "endTime": + "2021-10-26T06:41:16.6009857Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '636' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:28 GMT + etag: + - '"570173d4-0000-0800-0000-6177a30c0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:40:55.3516915Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:41:16.1927602Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"companyName": "monitor1", "id": + "361035"}, "planData": {"usageType": "Committed", "billingCycle": "Monthly", + "planDetails": "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}' + headers: + cache-control: + - no-cache + content-length: + - '962' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:29 GMT + etag: + - '"c503ce5a-0000-0800-0000-6177a30c0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account list + Connection: + - keep-alive + ParameterSetName: + - -g --monitor-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:40:55.3516915Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:41:16.1927602Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"companyName": "monitor1", "id": + "361035"}, "planData": {"usageType": "Committed", "billingCycle": "Monthly", + "planDetails": "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}]}' + headers: + cache-control: + - no-cache + content-length: + - '974' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:31 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - a19b85ab-1161-4c4a-87f1-9db7e1423841 + - 4cad1ead-75dc-43e3-a158-e23e7a38e42a + - 05cb0fb0-8b6e-4622-b930-4494c59b7005 + - d77242e8-dac1-45b9-a475-d2518a0e418c + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account list-resource + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --monitor-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/listMonitoredResources?api-version=2020-10-01 + response: + body: + string: '{"value": [], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '28' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:33 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Disabled"}, "tags": {"Environment": + "Dev"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account update + Connection: + - keep-alive + Content-Length: + - '80' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitor-name --monitoring-status --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:40:55.3516915Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:41:36.4529213Z"}, "properties": {"provisioningState": "Succeeded", + "monitoringStatus": "Disabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": "monitor1", "id": "361035"}, + "planData": {"usageType": "Committed", "billingCycle": "Monthly", "planDetails": + "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}' + headers: + cache-control: + - no-cache + content-length: + - '943' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:38 GMT + etag: + - '"c503175b-0000-0800-0000-6177a3200000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account show + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:40:55.3516915Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:41:36.4529213Z"}, "properties": {"provisioningState": "Succeeded", + "monitoringStatus": "Disabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": "monitor1", "id": "361035"}, + "planData": {"usageType": "Committed", "billingCycle": "Monthly", "planDetails": + "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}' + headers: + cache-control: + - no-cache + content-length: + - '943' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:40 GMT + etag: + - '"c503175b-0000-0800-0000-6177a3200000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --monitor-name --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/682acee1-8f8c-4edd-acd2-7afaf90f0ed7*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:44 GMT + etag: + - '"c503455b-0000-0800-0000-6177a3280000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/682acee1-8f8c-4edd-acd2-7afaf90f0ed7*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account delete + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/682acee1-8f8c-4edd-acd2-7afaf90f0ed7*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/682acee1-8f8c-4edd-acd2-7afaf90f0ed7*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22", + "name": "682acee1-8f8c-4edd-acd2-7afaf90f0ed7*B68783FD54758B8967C2FE1678FBC29D869E2AE583B9C9DDD1AFFCD688695C22", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "status": "Succeeded", "startTime": "2021-10-26T06:41:43.8324915Z", "endTime": + "2021-10-26T06:41:59.4057764Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '636' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:14 GMT + etag: + - '"57019fd4-0000-0800-0000-6177a3370000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_sub_account_rule.yaml b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_rule.yaml new file mode 100644 index 00000000000..ea01c6c3e49 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_rule.yaml @@ -0,0 +1,935 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:41:42Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:46 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:41:53.2657619Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:41:53.2657619Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '966' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:59 GMT + etag: + - '"5e0022f2-0000-0800-0000-6177a3360000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "name": "b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Accepted", "startTime": "2021-10-26T06:41:57.6066436Z"}' + headers: + cache-control: + - no-cache + content-length: + - '547' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:29 GMT + etag: + - '"57019cd4-0000-0800-0000-6177a3350000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "name": "b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Accepted", "startTime": "2021-10-26T06:41:57.6066436Z"}' + headers: + cache-control: + - no-cache + content-length: + - '547' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:59 GMT + etag: + - '"57019cd4-0000-0800-0000-6177a3350000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "name": "b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Accepted", "startTime": "2021-10-26T06:41:57.6066436Z"}' + headers: + cache-control: + - no-cache + content-length: + - '547' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:30 GMT + etag: + - '"57019cd4-0000-0800-0000-6177a3350000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "name": "b67e1851-7a17-4996-a08e-d4d655bb5013*489C4648FA4E39C4D12183669CF03877595822EF83727406551B4C5911EE3D5D", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Succeeded", "startTime": "2021-10-26T06:41:57.6066436Z", "endTime": + "2021-10-26T06:43:40.5220054Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:00 GMT + etag: + - '"570101d5-0000-0800-0000-6177a39c0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:41:53.2657619Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:43:40.3459529Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361055"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '910' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:01 GMT + etag: + - '"5e0035f3-0000-0800-0000-6177a39c0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:41:42Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:44:07.7320248Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:44:07.7320248Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": "monitor1", "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/de8e2202-0b88-4a15-bdf5-52cdd94ce086*FC6AB7F969F2FFA1546D7D72D564EFA675C4FA52B63872729F88D238E14927DE?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '999' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:11 GMT + etag: + - '"c503c65d-0000-0800-0000-6177a3b90000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/de8e2202-0b88-4a15-bdf5-52cdd94ce086*FC6AB7F969F2FFA1546D7D72D564EFA675C4FA52B63872729F88D238E14927DE?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/de8e2202-0b88-4a15-bdf5-52cdd94ce086*FC6AB7F969F2FFA1546D7D72D564EFA675C4FA52B63872729F88D238E14927DE?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/de8e2202-0b88-4a15-bdf5-52cdd94ce086*FC6AB7F969F2FFA1546D7D72D564EFA675C4FA52B63872729F88D238E14927DE", + "name": "de8e2202-0b88-4a15-bdf5-52cdd94ce086*FC6AB7F969F2FFA1546D7D72D564EFA675C4FA52B63872729F88D238E14927DE", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "status": "Succeeded", "startTime": "2021-10-26T06:44:09.3710206Z", "endTime": + "2021-10-26T06:44:27.6585251Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '636' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:41 GMT + etag: + - '"57012cd5-0000-0800-0000-6177a3cb0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:44:07.7320248Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:44:27.4707006Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"companyName": "monitor1", "id": + "361060"}, "planData": {"usageType": "Committed", "billingCycle": "Monthly", + "planDetails": "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}' + headers: + cache-control: + - no-cache + content-length: + - '962' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:42 GMT + etag: + - '"c5032a5e-0000-0800-0000-6177a3cb0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule create + Connection: + - keep-alive + Content-Length: + - '189' + Content-Type: + - application/json + ParameterSetName: + - --monitor-name -g --sub-account-name --filtering-tag --send-aad-logs --send-activity-logs + --send-subscription-logs --rule-set-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/accounts/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:44:44.3418119Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:44:44.3418119Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '741' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:44 GMT + etag: + - '"db00f2d4-0000-0800-0000-6177a3dd0000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule list + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --sub-account-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/accounts/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:44:44.3418119Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:44:44.3418119Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '753' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:46 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule update + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --sub-account-name --rule-set-name --send-aad-logs + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/accounts/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:44:44.3418119Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:44:44.3418119Z"}, + "properties": {"logRules": {"sendAadLogs": false, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", + "value": "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '741' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:49 GMT + etag: + - '"db00f2d4-0000-0800-0000-6177a3dd0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": + true, "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule update + Connection: + - keep-alive + Content-Length: + - '188' + Content-Type: + - application/json + ParameterSetName: + - --monitor-name -g --sub-account-name --rule-set-name --send-aad-logs + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/accounts/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:44:44.3418119Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:44:44.3418119Z"}, + "properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": true, + "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '740' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:51 GMT + etag: + - '"db00f3d4-0000-0800-0000-6177a3e40000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1194' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule show + Connection: + - keep-alive + ParameterSetName: + - --monitor-name -g --sub-account-name --rule-set-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default", + "name": "default", "type": "microsoft.logz/monitors/accounts/tagrules", "systemData": + {"createdBy": "ethanyang@microsoft.com", "createdByType": "User", "createdAt": + "2021-10-26T06:44:44.3418119Z", "lastModifiedBy": "ethanyang@microsoft.com", + "lastModifiedByType": "User", "lastModifiedAt": "2021-10-26T06:44:44.3418119Z"}, + "properties": {"logRules": {"sendAadLogs": true, "sendSubscriptionLogs": true, + "sendActivityLogs": true, "filteringTags": [{"name": "Environment", "value": + "Dev", "action": "Exclude"}]}, "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '740' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:53 GMT + etag: + - '"db00f3d4-0000-0800-0000-6177a3e40000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-rule delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --monitor-name -g --sub-account-name --rule-set-name --yes + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/tagRules/default?api-version=2020-10-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 26 Oct 2021 06:44:55 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/recordings/test_sub_account_vm.yaml b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_vm.yaml new file mode 100644 index 00000000000..865f79d3929 --- /dev/null +++ b/src/logz/azext_logz/tests/latest/recordings/test_sub_account_vm.yaml @@ -0,0 +1,1430 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:41:06Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:10 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:41:15.9701978Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:41:15.9701978Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": null, "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '966' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:21 GMT + etag: + - '"5e00c1f1-0000-0800-0000-6177a3100000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4", + "name": "cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Accepted", "startTime": "2021-10-26T06:41:20.2263839Z"}' + headers: + cache-control: + - no-cache + content-length: + - '547' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:41:52 GMT + etag: + - '"570177d4-0000-0800-0000-6177a3100000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4", + "name": "cffffc15-1d7e-48bf-a42f-44c32b343532*BA1A881E3B7091A449B47FE314F71360E41E8FB88DA28117C29FD245DD7A07F4", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "status": "Succeeded", "startTime": "2021-10-26T06:41:20.2263839Z", "endTime": + "2021-10-26T06:42:02.6382119Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '618' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:22 GMT + etag: + - '"5701a3d4-0000-0800-0000-6177a33a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz monitor create + Connection: + - keep-alive + ParameterSetName: + - -n -g --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1", + "name": "monitor1", "type": "microsoft.logz/monitors", "location": "westus2", + "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:41:15.9701978Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:42:02.4096424Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"id": "361040"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + cache-control: + - no-cache + content-length: + - '910' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:22 GMT + etag: + - '"5e002df2-0000-0800-0000-6177a33a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:41:06Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:24 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "userInfo": {"firstName": "Ethan", "lastName": "Yang", "emailAddress": + "ethanyang@microsoft.com", "phoneNumber": "01234567"}, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33.000Z"}}, "tags": {"Environment": "Dev"}, "location": "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + Content-Length: + - '413' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:42:30.6264471Z", "lastModifiedBy": + "ethanyang@microsoft.com", "lastModifiedByType": "User", "lastModifiedAt": + "2021-10-26T06:42:30.6264471Z"}, "properties": {"provisioningState": "Accepted", + "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": "Active", + "logzOrganizationProperties": {"companyName": "monitor1", "id": null, "enterpriseAppId": + null, "singleSignOnUrl": null}, "userInfo": null, "planData": {"usageType": + "Committed", "billingCycle": "Monthly", "planDetails": "100gb14days", "effectiveDate": + "2021-08-31T13:14:33Z"}, "liftrResourceCategory": "MonitorLogs", "liftrResourcePreference": + 0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/4c5550e6-d367-41a9-9e82-8d6e56e5fda5*A7CBFDDCEFB7B9FAF335023209F4116BD6C3DB8F086F193359873E2D3639F0AF?api-version=2020-10-01 + cache-control: + - no-cache + content-length: + - '999' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:42:34 GMT + etag: + - '"c503195c-0000-0800-0000-6177a3590000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/4c5550e6-d367-41a9-9e82-8d6e56e5fda5*A7CBFDDCEFB7B9FAF335023209F4116BD6C3DB8F086F193359873E2D3639F0AF?api-version=2020-10-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/4c5550e6-d367-41a9-9e82-8d6e56e5fda5*A7CBFDDCEFB7B9FAF335023209F4116BD6C3DB8F086F193359873E2D3639F0AF?api-version=2020-10-01 + response: + body: + string: '{"id": "/providers/Microsoft.Logz/locations/WESTUS2/operationStatuses/4c5550e6-d367-41a9-9e82-8d6e56e5fda5*A7CBFDDCEFB7B9FAF335023209F4116BD6C3DB8F086F193359873E2D3639F0AF", + "name": "4c5550e6-d367-41a9-9e82-8d6e56e5fda5*A7CBFDDCEFB7B9FAF335023209F4116BD6C3DB8F086F193359873E2D3639F0AF", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "status": "Succeeded", "startTime": "2021-10-26T06:42:32.8683865Z", "endTime": + "2021-10-26T06:42:50.9753543Z", "error": {}, "properties": null}' + headers: + cache-control: + - no-cache + content-length: + - '636' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:04 GMT + etag: + - '"5701d5d4-0000-0800-0000-6177a36a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account create + Connection: + - keep-alive + ParameterSetName: + - -n -g --monitor-name --plan-data --user-info --tags + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2?api-version=2020-10-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2", + "name": "monitor2", "type": "microsoft.logz/monitors/accounts", "location": + "westus2", "tags": {"Environment": "Dev"}, "systemData": {"createdBy": "ethanyang@microsoft.com", + "createdByType": "User", "createdAt": "2021-10-26T06:42:30.6264471Z", "lastModifiedBy": + "a5472e16-e1d2-4bbe-81b3-ecdcd459b536", "lastModifiedByType": "Application", + "lastModifiedAt": "2021-10-26T06:42:50.7803254Z"}, "properties": {"provisioningState": + "Succeeded", "monitoringStatus": "Enabled", "marketplaceSubscriptionStatus": + "Active", "logzOrganizationProperties": {"companyName": "monitor1", "id": + "361045"}, "planData": {"usageType": "Committed", "billingCycle": "Monthly", + "planDetails": "100gb14days", "effectiveDate": "2021-08-31T13:14:33Z"}, "liftrResourceCategory": + "MonitorLogs", "liftrResourcePreference": 0}}' + headers: + cache-control: + - no-cache + content-length: + - '962' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:04 GMT + etag: + - '"c503795c-0000-0800-0000-6177a36a0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001", + "name": "cli_test_logz_000001", "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", "tags": {"product": "azurecli", "cause": "automation", + "date": "2021-10-26T06:41:06Z"}, "properties": {"provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:06 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.25.1 + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json + response: + body: + string: '{"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [], "outputs": {"aliases": {"type": "object", "value": {"Linux": {"CentOS": + {"publisher": "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest"}, + "Debian": {"publisher": "Debian", "offer": "debian-10", "sku": "10", "version": + "latest"}, "Flatcar": {"publisher": "kinvolk", "offer": "flatcar-container-linux-free", + "sku": "stable", "version": "latest"}, "openSUSE-Leap": {"publisher": "SUSE", + "offer": "openSUSE-Leap", "sku": "42.3", "version": "latest"}, "RHEL": {"publisher": + "RedHat", "offer": "RHEL", "sku": "7-LVM", "version": "latest"}, "SLES": {"publisher": + "SUSE", "offer": "SLES", "sku": "15", "version": "latest"}, "UbuntuLTS": {"publisher": + "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": "latest"}}, + "Windows": {"Win2019Datacenter": {"publisher": "MicrosoftWindowsServer", "offer": + "WindowsServer", "sku": "2019-Datacenter", "version": "latest"}, "Win2016Datacenter": + {"publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter", + "version": "latest"}, "Win2012R2Datacenter": {"publisher": "MicrosoftWindowsServer", + "offer": "WindowsServer", "sku": "2012-R2-Datacenter", "version": "latest"}, + "Win2012Datacenter": {"publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", + "sku": "2012-Datacenter", "version": "latest"}, "Win2008R2SP1": {"publisher": + "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2008-R2-SP1", + "version": "latest"}}}}}}' + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '2525' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:07 GMT + etag: + - W/"54bceef15b892f2aa7f4c2145a49f1b5e33608722acdbb47933d7b6cbebbd7f4" + expires: + - Tue, 26 Oct 2021 06:48:07 GMT + source-age: + - '20' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding,Origin + via: + - 1.1 varnish + x-cache: + - HIT + x-cache-hits: + - '1' + x-content-type-options: + - nosniff + x-fastly-request-id: + - 49c305d923174508f4cd454b308efe61e590724f + x-frame-options: + - deny + x-github-request-id: + - AB50:6143:39D648:507E5C:6175C9F2 + x-served-by: + - cache-qpg1238-QPG + x-timer: + - S1635230588.960916,VS0,VE1 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks?api-version=2018-01-01 + response: + body: + string: '{"value": []}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:08 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [{"name": "machineVNET", "type": "Microsoft.Network/virtualNetworks", "location": + "westus2", "apiVersion": "2015-06-15", "dependsOn": [], "tags": {}, "properties": + {"addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": + "machineSubnet", "properties": {"addressPrefix": "10.0.0.0/24"}}]}}, {"type": + "Microsoft.Network/networkSecurityGroups", "name": "machineNSG", "apiVersion": + "2015-06-15", "location": "westus2", "tags": {}, "dependsOn": [], "properties": + {"securityRules": [{"name": "default-allow-ssh", "properties": {"protocol": + "Tcp", "sourcePortRange": "*", "destinationPortRange": "22", "sourceAddressPrefix": + "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1000, "direction": + "Inbound"}}]}}, {"apiVersion": "2018-01-01", "type": "Microsoft.Network/publicIPAddresses", + "name": "machinePublicIP", "location": "westus2", "tags": {}, "dependsOn": [], + "properties": {"publicIPAllocationMethod": "Static"}, "sku": {"name": "Standard"}}, + {"apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", + "name": "machineVMNic", "location": "westus2", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/machineVNET", + "Microsoft.Network/networkSecurityGroups/machineNSG", "Microsoft.Network/publicIpAddresses/machinePublicIP"], + "properties": {"ipConfigurations": [{"name": "ipconfigmachine", "properties": + {"privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET/subnets/machineSubnet"}, + "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}}}], + "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}}}, + {"apiVersion": "2021-07-01", "type": "Microsoft.Compute/virtualMachines", "name": + "machine", "location": "westus2", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/machineVMNic"], + "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "properties": {"deleteOption": null}}]}, "storageProfile": {"osDisk": {"createOption": + "fromImage", "name": "os-disk", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + null}}, "imageReference": {"publisher": "OpenLogic", "offer": "CentOS", "sku": + "7.5", "version": "latest"}}, "osProfile": {"computerName": "machine", "adminUsername": + "ethanyang", "linuxConfiguration": {"disablePasswordAuthentication": true, "ssh": + {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n", "path": "/home/ethanyang/.ssh/authorized_keys"}]}}}}}], + "outputs": {}}, "parameters": {}, "mode": "incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '4004' + Content-Type: + - application/json + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_HuUsVipvwqvcHkG44Htngdy2NKrtwttr", + "name": "vm_deploy_HuUsVipvwqvcHkG44Htngdy2NKrtwttr", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "10412405892717040122", "parameters": {}, "mode": + "Incremental", "provisioningState": "Accepted", "timestamp": "2021-10-26T06:43:14.9512276Z", + "duration": "PT2.3666036S", "correlationId": "c53dd297-509c-49a1-bed9-5e76185de688", + "providers": [{"namespace": "Microsoft.Network", "resourceTypes": [{"resourceType": + "virtualNetworks", "locations": ["westus2"]}, {"resourceType": "networkSecurityGroups", + "locations": ["westus2"]}, {"resourceType": "publicIPAddresses", "locations": + ["westus2"]}, {"resourceType": "networkInterfaces", "locations": ["westus2"]}]}, + {"namespace": "Microsoft.Compute", "resourceTypes": [{"resourceType": "virtualMachines", + "locations": ["westus2"]}]}], "dependencies": [{"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET", + "resourceType": "Microsoft.Network/virtualNetworks", "resourceName": "machineVNET"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG", + "resourceType": "Microsoft.Network/networkSecurityGroups", "resourceName": + "machineNSG"}, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "resourceType": "Microsoft.Network/publicIPAddresses", "resourceName": "machinePublicIP"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}, + {"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "resourceType": "Microsoft.Compute/virtualMachines", "resourceName": "machine"}]}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_HuUsVipvwqvcHkG44Htngdy2NKrtwttr/operationStatuses/08585663762928930325?api-version=2021-04-01 + cache-control: + - no-cache + content-length: + - '2796' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:16 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1196' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663762928930325?api-version=2021-04-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:43:46 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663762928930325?api-version=2021-04-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:16 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663762928930325?api-version=2021-04-01 + response: + body: + string: '{"status": "Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:44:48 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585663762928930325?api-version=2021-04-01 + response: + body: + string: '{"status": "Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:18 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-resource/19.0.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Resources/deployments/vm_deploy_HuUsVipvwqvcHkG44Htngdy2NKrtwttr", + "name": "vm_deploy_HuUsVipvwqvcHkG44Htngdy2NKrtwttr", "type": "Microsoft.Resources/deployments", + "properties": {"templateHash": "10412405892717040122", "parameters": {}, "mode": + "Incremental", "provisioningState": "Succeeded", "timestamp": "2021-10-26T06:44:49.9047724Z", + "duration": "PT1M37.3201484S", "correlationId": "c53dd297-509c-49a1-bed9-5e76185de688", + "providers": [{"namespace": "Microsoft.Network", "resourceTypes": [{"resourceType": + "virtualNetworks", "locations": ["westus2"]}, {"resourceType": "networkSecurityGroups", + "locations": ["westus2"]}, {"resourceType": "publicIPAddresses", "locations": + ["westus2"]}, {"resourceType": "networkInterfaces", "locations": ["westus2"]}]}, + {"namespace": "Microsoft.Compute", "resourceTypes": [{"resourceType": "virtualMachines", + "locations": ["westus2"]}]}], "dependencies": [{"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET", + "resourceType": "Microsoft.Network/virtualNetworks", "resourceName": "machineVNET"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG", + "resourceType": "Microsoft.Network/networkSecurityGroups", "resourceName": + "machineNSG"}, {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "resourceType": "Microsoft.Network/publicIPAddresses", "resourceName": "machinePublicIP"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}, + {"dependsOn": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "resourceType": "Microsoft.Network/networkInterfaces", "resourceName": "machineVMNic"}], + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "resourceType": "Microsoft.Compute/virtualMachines", "resourceName": "machine"}], + "outputs": {}, "outputResources": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}, + {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '3883' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:18 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine?$expand=instanceView&api-version=2021-07-01 + response: + body: + string: '{"name": "machine", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "type": "Microsoft.Compute/virtualMachines", "location": "westus2", "tags": + {}, "properties": {"vmId": "3a514069-fa1e-4bf7-8d62-27235a346329", "hardwareProfile": + {"vmSize": "Standard_DS1_v2"}, "storageProfile": {"imageReference": {"publisher": + "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest", "exactVersion": + "7.5.201808150"}, "osDisk": {"osType": "Linux", "name": "os-disk", "createOption": + "FromImage", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + "Premium_LRS", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/disks/os-disk"}, + "deleteOption": "Detach", "diskSizeGB": 30}, "dataDisks": []}, "osProfile": + {"computerName": "machine", "adminUsername": "ethanyang", "linuxConfiguration": + {"disablePasswordAuthentication": true, "ssh": {"publicKeys": [{"path": "/home/ethanyang/.ssh/authorized_keys", + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n"}]}, "provisionVMAgent": true, "patchSettings": + {"patchMode": "ImageDefault", "assessmentMode": "ImageDefault"}}, "secrets": + [], "allowExtensionOperations": true, "requireGuestProvisionSignal": true}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}]}, + "provisioningState": "Succeeded", "instanceView": {"computerName": "machine", + "osName": "centos", "osVersion": "7.5.1804", "vmAgent": {"vmAgentVersion": + "2.5.0.2", "statuses": [{"code": "ProvisioningState/succeeded", "level": "Info", + "displayStatus": "Ready", "message": "Guest Agent is running", "time": "2021-10-26T06:44:46+00:00"}], + "extensionHandlers": []}, "disks": [{"name": "os-disk", "statuses": [{"code": + "ProvisioningState/succeeded", "level": "Info", "displayStatus": "Provisioning + succeeded", "time": "2021-10-26T06:43:45.0258584+00:00"}]}], "hyperVGeneration": + "V1", "statuses": [{"code": "ProvisioningState/succeeded", "level": "Info", + "displayStatus": "Provisioning succeeded", "time": "2021-10-26T06:44:45.5569996+00:00"}, + {"code": "PowerState/running", "level": "Info", "displayStatus": "VM running"}]}}}' + headers: + cache-control: + - no-cache + content-length: + - '4016' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:20 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3988,Microsoft.Compute/LowCostGet30Min;31953 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic?api-version=2018-01-01 + response: + body: + string: '{"name": "machineVMNic", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic", + "etag": "W/\"79a17e3d-586f-4464-9280-760935f5ea5d\"", "location": "westus2", + "tags": {}, "properties": {"provisioningState": "Succeeded", "resourceGuid": + "eaae0c13-798a-4906-8035-c2a523fbd044", "ipConfigurations": [{"name": "ipconfigmachine", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic/ipConfigurations/ipconfigmachine", + "etag": "W/\"79a17e3d-586f-4464-9280-760935f5ea5d\"", "type": "Microsoft.Network/networkInterfaces/ipConfigurations", + "properties": {"provisioningState": "Succeeded", "privateIPAddress": "10.0.0.4", + "privateIPAllocationMethod": "Dynamic", "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP"}, + "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/virtualNetworks/machineVNET/subnets/machineSubnet"}, + "primary": true, "privateIPAddressVersion": "IPv4"}}], "dnsSettings": {"dnsServers": + [], "appliedDnsServers": [], "internalDomainNameSuffix": "1guxfwixoi5udfj1eawkqk4xaa.xx.internal.cloudapp.net"}, + "macAddress": "00-0D-3A-FE-DA-BA", "enableAcceleratedNetworking": false, "enableIPForwarding": + false, "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkSecurityGroups/machineNSG"}, + "primary": true, "virtualMachine": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine"}}, + "type": "Microsoft.Network/networkInterfaces"}' + headers: + cache-control: + - no-cache + content-length: + - '2609' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:21 GMT + etag: + - W/"79a17e3d-586f-4464-9280-760935f5ea5d" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 659c191f-1c71-4fea-9574-5ad7653af222 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --os-disk-name --image --generate-ssh-keys --public-ip-sku + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-network/19.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP?api-version=2018-01-01 + response: + body: + string: '{"name": "machinePublicIP", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/publicIPAddresses/machinePublicIP", + "etag": "W/\"501ec9a3-d7f9-49e9-b30c-4317543d3abc\"", "location": "westus2", + "tags": {}, "properties": {"provisioningState": "Succeeded", "resourceGuid": + "0f9e2e69-1ca1-44fe-a5fb-701454c3f328", "ipAddress": "52.149.31.252", "publicIPAddressVersion": + "IPv4", "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 4, "ipTags": + [], "ipConfiguration": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic/ipConfigurations/ipconfigmachine"}}, + "type": "Microsoft.Network/publicIPAddresses", "sku": {"name": "Standard"}}' + headers: + cache-control: + - no-cache + content-length: + - '1016' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:21 GMT + etag: + - W/"501ec9a3-d7f9-49e9-b30c-4317543d3abc" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - a3f31cb6-09ff-4c0d-8920-310fbb68cfb5 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm show + Connection: + - keep-alive + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.29.1 azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine?api-version=2021-07-01 + response: + body: + string: '{"name": "machine", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "type": "Microsoft.Compute/virtualMachines", "location": "westus2", "tags": + {}, "properties": {"vmId": "3a514069-fa1e-4bf7-8d62-27235a346329", "hardwareProfile": + {"vmSize": "Standard_DS1_v2"}, "storageProfile": {"imageReference": {"publisher": + "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest", "exactVersion": + "7.5.201808150"}, "osDisk": {"osType": "Linux", "name": "os-disk", "createOption": + "FromImage", "caching": "ReadWrite", "managedDisk": {"storageAccountType": + "Premium_LRS", "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/disks/os-disk"}, + "deleteOption": "Detach", "diskSizeGB": 30}, "dataDisks": []}, "osProfile": + {"computerName": "machine", "adminUsername": "ethanyang", "linuxConfiguration": + {"disablePasswordAuthentication": true, "ssh": {"publicKeys": [{"path": "/home/ethanyang/.ssh/authorized_keys", + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDuxYC1cd81ocCYeOaHm+pa+8gVtszq8pf4Ur1cBxKprU/toLIjdBbQFqngK8s4LCAkLQO7pUqvOk9S7bDUQmd0iObPtaLHW6iKgBoQyvFG8dCO09QZZbABA2/j6gibVKQnVI6V1KamndZxLzdV/L/vaJAM25DmeIGol0xBEvjXLA0aVZXtQdLm3xhjX3bL0Gd/So/yzpRApWtC1Efn+u5ylo4R2Bx1NAxcDBgeduEAaVnPFmjLvG/xe5nEeil5CtK7P0nEtbUUZvb2QGxWclaYn7r+QK7S0oOLQZuK9MlSZ5pSdQeJP/64lT/huEbsxKB1uq6AskOjOigY/HmqIJnt6OmF4n9VYRzHAMoT4+STrgPGbEVFqSaZ4348PiAVIo+06kYha7P7jgMRGQb2RUTO8A4pH0RMj0IkESPFBkR/Ygv1UC3Z0jzchQKzB+fcSvHwdvj9f/76y4xzpV5fwJuYq7es93IoFjSxbXOurLFgU41HZPpViGOFBG7tX+qOyw8= + FAREAST+ethanyang@WIN-TA7OU6T7OG2\n"}]}, "provisionVMAgent": true, "patchSettings": + {"patchMode": "ImageDefault", "assessmentMode": "ImageDefault"}}, "secrets": + [], "allowExtensionOperations": true, "requireGuestProvisionSignal": true}, + "networkProfile": {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Network/networkInterfaces/machineVMNic"}]}, + "provisioningState": "Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '2754' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:22 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3987,Microsoft.Compute/LowCostGet30Min;31952 + status: + code: 200 + message: OK +- request: + body: '{"vmResourceIds": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "agentVersion": "1.0.*"}], "state": "Install"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account update-vm + Connection: + - keep-alive + Content-Length: + - '270' + Content-Type: + - application/json + ParameterSetName: + - -n -g --monitor-name --state --vm-resource-ids + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/vmHostUpdate?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Compute/virtualMachines/machine", + "agentVersion": "1.0.*"}], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '254' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:25 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account list-vm + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --monitor-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/listVMHosts?api-version=2020-10-01 + response: + body: + string: '{"value": [{"id": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/CLI_TEST_LOGZ_LY537TO437263MPDMPH3LCQQ4RCCRQXQYOFJMTTHSICHC5R7FY4WCSHVN7H5X/PROVIDERS/MICROSOFT.COMPUTE/VIRTUALMACHINES/MACHINE", + "agentVersion": "1.0.*"}], "nextLink": null}' + headers: + cache-control: + - no-cache + content-length: + - '254' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:27 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - logz sub-account list-payload + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --monitor-name + User-Agent: + - AZURECLI/2.29.1 azsdk-python-mgmt-logz/1.0.0b1 Python/3.8.10 (Windows-10-10.0.19043-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_logz_000001/providers/Microsoft.Logz/monitors/monitor1/accounts/monitor2/vmHostPayload?api-version=2020-10-01 + response: + body: + string: '{"region": "westus2", "hidden": "hidden"}' + headers: + cache-control: + - no-cache + content-length: + - '64' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Oct 2021 06:45:28 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:7ddc8157-0cfc-4630-87f5-4c20949f830d + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +version: 1 diff --git a/src/logz/azext_logz/tests/latest/test_logz_commands.py b/src/logz/azext_logz/tests/latest/test_logz_commands.py new file mode 100644 index 00000000000..985ecd01c2b --- /dev/null +++ b/src/logz/azext_logz/tests/latest/test_logz_commands.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. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines +from azure.cli.testsdk import ( + ResourceGroupPreparer, + ScenarioTest +) +from azure_devtools.scenario_tests import ( + RecordingProcessor, + live_only +) +from azure_devtools.scenario_tests.utilities import is_text_payload + + +class CredentialReplacer(RecordingProcessor): + def process_response(self, response): + import json + fake_data = "hidden" + sensitive_data = "apiKey" + if is_text_payload(response) and response["body"]["string"]: + try: + props = json.loads(response["body"]["string"]) + if sensitive_data in props: + del props[sensitive_data] + props[fake_data] = fake_data + response["body"]["string"] = json.dumps(props) + except TypeError: + pass + return response + + +class LogzClientTest(ScenarioTest): + def __init__(self, method_name): + super(LogzClientTest, self).__init__( + method_name, + recording_processors=[CredentialReplacer()] + ) + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_main_account_crud(self): + self.kwargs.update({ + "name": "monitor", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com" # set valid plan-data and user-info + }) + # create main account + self.cmd( + "logz monitor create -n {name} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # validate list-related commands + self.cmd( + "logz monitor list -g {rg}", + checks=[ + self.check("length(@)", 1) + ] + ) + role_obj = self.cmd( + "logz monitor list-role -n {name} -g {rg} --email-address={email}" + ).get_output_in_json()[0] + assert role_obj["role"] == "Admin" + resource_list = self.cmd( + "logz monitor list-resource -n {name} -g {rg}" + ).get_output_in_json() + assert len(resource_list) >= 0 + # validate main account update + self.cmd( + "logz monitor update -n {name} -g {rg} \ + --monitoring-status Disabled --tags Environment=Dev" + ) + self.cmd( + "logz monitor show -n {name} -g {rg}", + checks=[ + self.check("properties.monitoringStatus", "Disabled") + ] + ) + # delete main account + self.cmd("logz monitor delete -n {name} -g {rg} --yes") + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_main_account_vm(self): + self.kwargs.update({ + "name": "monitor", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com", # set valid plan-data and user-info + "vm": "machine", + "version": "1.0.*" + + }) + # create main account + self.cmd( + "logz monitor create -n {name} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create virtual machine + self.cmd( + "vm create -n {vm} -g {rg} \ + --os-disk-name os-disk --image centos \ + --generate-ssh-keys --public-ip-sku standard", + checks=[ + self.check("powerState", "VM running") + ] + ) + self.kwargs["id"] = self.cmd("vm show -n {vm} -g {rg}").get_output_in_json()["id"] + # validate update and retrieval + self.cmd( + "logz monitor update-vm -n {name} -g {rg} \ + --state install \ + --vm-resource-ids id={id} agent-version={version}" + ) + vm_obj = self.cmd("logz monitor list-vm -n {name} -g {rg}").get_output_in_json()[0] + assert vm_obj["id"].lower() == self.kwargs["id"].lower() + self.cmd( + "logz monitor list-payload -n {name} -g {rg}", + checks=[ + self.check("region", "westus2") + ] + ) + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_main_account_rule(self): + self.kwargs.update({ + "name": "monitor", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com", # set valid plan-data and user-info + "rule": "default" + }) + # create main account + self.cmd( + "logz monitor create -n {name} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create tag rule + self.cmd( + "logz rule create --monitor-name {name} -g {rg} \ + --filtering-tag name=Environment action=Exclude value=Dev \ + --send-aad-logs false --send-activity-logs true --send-subscription-logs true \ + --rule-set-name {rule}", + checks=[ + self.check("type", "microsoft.logz/monitors/tagrules") + ] + ) + # validate retrieval and update + self.cmd( + "logz rule list --monitor-name {name} -g {rg}", + checks=[ + self.check("length(@)", 1) + ] + ) + self.cmd( + "logz rule update --monitor-name {name} -g {rg} \ + --rule-set-name {rule} --send-aad-logs true" + ) + self.cmd( + "logz rule show --monitor-name {name} -g {rg} \ + --rule-set-name {rule}", + checks=[ + self.check("properties.logRules.sendAadLogs", True) + ] + ) + # delete tag rule + self.cmd( + "logz rule delete --monitor-name {name} -g {rg} \ + --rule-set-name {rule} --yes" + ) + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_sub_account_crud(self): + self.kwargs.update({ + "name1": "monitor1", + "name2": "monitor2", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com" # set valid plan-data and user-info + }) + # create main account + self.cmd( + "logz monitor create -n {name1} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create sub account + self.cmd( + "logz sub-account create -n {name2} -g {rg} --monitor-name {name1} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors/accounts") + ] + ) + # validate list-related commands + self.cmd( + "logz sub-account list -g {rg} --monitor-name {name1}", + checks=[ + self.check("length(@)", 1) + ] + ) + resource_list = self.cmd( + "logz sub-account list-resource -n {name2} -g {rg} --monitor-name {name1}" + ).get_output_in_json() + assert len(resource_list) >= 0 + # validate sub account update + self.cmd( + "logz sub-account update -n {name2} -g {rg} --monitor-name {name1} \ + --monitoring-status Disabled --tags Environment=Dev" + ) + self.cmd( + "logz sub-account show -n {name2} -g {rg} --monitor-name {name1}", + checks=[ + self.check("properties.monitoringStatus", "Disabled") + ] + ) + # delete sub account + self.cmd("logz sub-account delete -n {name2} -g {rg} --monitor-name {name1} --yes") + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_sub_account_vm(self): + self.kwargs.update({ + "name1": "monitor1", + "name2": "monitor2", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com", # set valid plan-data and user-info + "vm": "machine", + "version": "1.0.*" + }) + # create main account + self.cmd( + "logz monitor create -n {name1} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create sub account + self.cmd( + "logz sub-account create -n {name2} -g {rg} --monitor-name {name1} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors/accounts") + ] + ) + # create virtual machine + self.cmd( + "vm create -n {vm} -g {rg} \ + --os-disk-name os-disk --image centos \ + --generate-ssh-keys --public-ip-sku standard", + checks=[ + self.check("powerState", "VM running") + ] + ) + self.kwargs["id"] = self.cmd( + "vm show -n {vm} -g {rg}" + ).get_output_in_json()["id"] + # validate update and retrieval + self.cmd( + "logz sub-account update-vm -n {name2} -g {rg} --monitor-name {name1} \ + --state install \ + --vm-resource-ids id={id} agent-version={version}" + ) + vm_obj = self.cmd( + "logz sub-account list-vm -n {name2} -g {rg} --monitor-name {name1}" + ).get_output_in_json()[0] + assert vm_obj["id"].lower() == self.kwargs["id"].lower() + self.cmd( + "logz sub-account list-payload -n {name2} -g {rg} --monitor-name {name1}", + checks=[ + self.check("region", "westus2") + ] + ) + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_sub_account_rule(self): + self.kwargs.update({ + "name1": "monitor1", + "name2": "monitor2", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com", # set valid plan-data and user-info + "rule": "default" + }) + # create main account + self.cmd( + "logz monitor create -n {name1} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create sub account + self.cmd( + "logz sub-account create -n {name2} -g {rg} --monitor-name {name1} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors/accounts") + ] + ) + # create tag rule of sub account + self.cmd( + "logz sub-rule create --monitor-name {name1} -g {rg} --sub-account-name {name2} \ + --filtering-tag name=Environment action=Exclude value=Dev \ + --send-aad-logs false --send-activity-logs true --send-subscription-logs true \ + --rule-set-name {rule}", + checks=[ + self.check("type", "microsoft.logz/monitors/accounts/tagrules") + ] + ) + # validate retrieval and update + self.cmd( + "logz sub-rule list --monitor-name {name1} -g {rg} --sub-account-name {name2}", + checks=[ + self.check("length(@)", 1) + ] + ) + self.cmd( + "logz sub-rule update --monitor-name {name1} -g {rg} --sub-account-name {name2} \ + --rule-set-name {rule} --send-aad-logs true" + ) + self.cmd( + "logz sub-rule show --monitor-name {name1} -g {rg} --sub-account-name {name2} \ + --rule-set-name {rule}", + checks=[ + self.check("properties.logRules.sendAadLogs", True) + ] + ) + # delete tag rule of sub account + self.cmd( + "logz sub-rule delete --monitor-name {name1} -g {rg} --sub-account-name {name2} \ + --rule-set-name {rule} --yes" + ) + + @live_only() + @ResourceGroupPreparer(name_prefix="cli_test_logz_", location="westus2") + def test_single_sign_on(self): + self.kwargs.update({ + "name": "monitor", + "date": "2021-08-31T15:14:33+02:00", + "plan": "100gb14days", "email": "ethanyang@microsoft.com", # set valid plan-data and user-info + "id": "4c232741-efe7-4310-91cf-30c4c1adeb29", # set valid enterprise-app-id + "config": "default" + }) + # create main account + self.cmd( + "logz monitor create -n {name} -g {rg} \ + --plan-data billing-cycle=Monthly effective-date={date} plan-details={plan} usage-type=Committed \ + --user-info email-address={email} phone-number=01234567 first-name=Ethan last-name=Yang \ + --tags Environment=Dev", + checks=[ + self.check("type", "microsoft.logz/monitors") + ] + ) + # create single sign-on + self.cmd( + "logz sso create --monitor-name {name} -g {rg} \ + --properties enterprise-app-id={id} single-sign-on-state=Enable \ + --configuration-name {config}", + checks=[ + self.check("type", "microsoft.logz/monitors/singlesignonconfigurations") + ] + ) + # validate single sign-on retrieval + self.cmd( + "logz sso list --monitor-name {name} -g {rg}", + checks=[ + self.check("length(@)", 1) + ] + ) + self.cmd( + "logz sso show --monitor-name {name} -g {rg} --configuration-name {config}", + checks=[ + self.check("properties.singleSignOnState", "Existing") + ] + ) 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..b3d287f58cb --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._microsoft_logz import MicrosoftLogz +from ._version import VERSION + +__version__ = VERSION +__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..d2ad1bd702b --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/_configuration.py @@ -0,0 +1,71 @@ +# 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 + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +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" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-logz/{}'.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..229c8b095f8 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/_microsoft_logz.py @@ -0,0 +1,95 @@ +# 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 . 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 + :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._serialize.client_side_validation = False + 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) + + 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/_version.py b/src/logz/azext_logz/vendored_sdks/logz/_version.py new file mode 100644 index 00000000000..e5754a47ce6 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" 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..d8326f8e6e5 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +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" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-logz/{}'.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..9f902354dc5 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/_microsoft_logz.py @@ -0,0 +1,89 @@ +# 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 .. 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 + :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._serialize.client_side_validation = False + 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) + + 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..a6f001fe33d --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', + 'SubAccountOperations', + 'SubAccountTagRulesOperations', +] 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..7799e634cba --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_monitors_operations.py @@ -0,0 +1,974 @@ +# 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" + 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), + '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" + 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" + 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), + } + 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" + 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), + '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" + 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), + '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. This create operation can take upto 10 minutes to complete. + + Create a monitor resource. This create operation can take upto 10 minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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. This delete operation can take upto 10 minutes to complete. + + Delete a monitor resource. This delete operation can take upto 10 minutes to complete. + + :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), + '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 + + 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" + 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), + '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" + 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), + '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" + 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), + '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 + + 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" + 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), + '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..727cd4d4b95 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_single_sign_on_operations.py @@ -0,0 +1,328 @@ +# 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" + 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), + '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" + 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), + '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. This operation can take upto 10 minutes to complete. + + Configures single-sign-on for this resource. This operation can take upto 10 minutes to + complete. + + :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: Single sign-on 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), + '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: Single sign-on 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" + 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), + '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..67600cb451e --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/aio/operations/_sub_account_operations.py @@ -0,0 +1,852 @@ +# 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" + 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), + '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" + 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), + '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. This create operation can take upto 10 minutes to complete. + + Create sub account under a given monitor resource. This create operation can take upto 10 + minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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. This delete operation can take upto 10 minutes to complete. + + Delete a sub account resource. This delete operation can take upto 10 minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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" + 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), + '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" + 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), + '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" + 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), + '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..a5570775167 --- /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" + 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), + '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: Rule set name of sub account. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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..c7c33ccd44e --- /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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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..902c17e1594 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/models/_microsoft_logz_enums.py @@ -0,0 +1,108 @@ +# 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)): + """Identity type. + """ + + 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..126062d24e6 --- /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: Identity 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". Default value: "Enabled". + :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". Default value: "Active". + :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', "Enabled") + self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', "Active") + 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". Default value: "Enabled". + :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', "Enabled") + + +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..3758c83a3c2 --- /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: Identity 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". Default value: "Enabled". + :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". Default value: "Active". + :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"]] = "Enabled", + marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = "Active", + 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". Default value: "Enabled". + :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"]] = "Enabled", + **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..a6f001fe33d --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', + 'SubAccountOperations', + 'SubAccountTagRulesOperations', +] 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..d663736d72c --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_monitors_operations.py @@ -0,0 +1,991 @@ +# 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" + 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), + '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" + 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" + 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), + } + 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" + 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), + '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" + 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), + '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. This create operation can take upto 10 minutes to complete. + + Create a monitor resource. This create operation can take upto 10 minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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. This delete operation can take upto 10 minutes to complete. + + Delete a monitor resource. This delete operation can take upto 10 minutes to complete. + + :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), + '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 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" + 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), + '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" + 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), + '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" + 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), + '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 + + 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" + 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), + '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..1ec8677c171 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_single_sign_on_operations.py @@ -0,0 +1,336 @@ +# 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" + 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), + '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" + 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), + '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. This operation can take upto 10 minutes to complete. + + Configures single-sign-on for this resource. This operation can take upto 10 minutes to + complete. + + :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: Single sign-on 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), + '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: Single sign-on 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" + 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), + '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..5483c0d8634 --- /dev/null +++ b/src/logz/azext_logz/vendored_sdks/logz/operations/_sub_account_operations.py @@ -0,0 +1,867 @@ +# 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" + 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), + '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" + 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), + '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. This create operation can take upto 10 minutes to complete. + + Create sub account under a given monitor resource. This create operation can take upto 10 + minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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. This delete operation can take upto 10 minutes to complete. + + Delete a sub account resource. This delete operation can take upto 10 minutes to complete. + + :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), + '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" + 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), + '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" + 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), + '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" + 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), + '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" + 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), + '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" + 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), + '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..87c14c1cf78 --- /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" + 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), + '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: Rule set name of sub account. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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..73d73e7496f --- /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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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: Rule set name of monitor. + :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" + 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), + '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/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']}, +) diff --git a/src/service_name.json b/src/service_name.json index 4b8ec0e33a6..c367c342249 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -254,6 +254,11 @@ "AzureServiceName": "Azure Logic Apps", "URL": "https://docs.microsoft.com/azure/logic-apps/" }, + { + "Command": "az logz", + "AzureServiceName": "Azure Logz.io", + "URL": "https://docs.microsoft.com/en-us/azure/partner-solutions/logzio/overview" + }, { "Command": "az maintenance", "AzureServiceName": "Azure Virtual Machines",