From 4747a1d3f80248e95280e3dd87db882c98ddd8a5 Mon Sep 17 00:00:00 2001 From: Limin Gu Date: Fri, 26 Mar 2021 14:19:00 -0700 Subject: [PATCH 1/3] [Datadog] Release new CLI with stable api version --- linter_exclusions.yml | 25 +- .../generated/_client_factory.py | 32 +- src/datadog/azext_datadog/generated/_help.py | 242 ++-- .../azext_datadog/generated/_params.py | 156 +-- src/datadog/azext_datadog/generated/action.py | 74 +- .../azext_datadog/generated/commands.py | 85 +- src/datadog/azext_datadog/generated/custom.py | 265 ++-- src/datadog/azext_datadog/manual/_help.py | 16 - src/datadog/azext_datadog/manual/commands.py | 10 - src/datadog/azext_datadog/manual/custom.py | 24 - src/datadog/azext_datadog/tests/__init__.py | 8 +- .../tests/latest/recordings/test_datadog.yaml | 455 ++++++- .../tests/latest/test_datadog_scenario.py | 78 +- .../vendored_sdks/datadog/_configuration.py | 7 +- .../datadog/_microsoft_datadog_client.py | 59 +- .../vendored_sdks/datadog/aio/__init__.py | 2 +- ...nfiguration_async.py => _configuration.py} | 7 +- .../datadog/aio/_microsoft_datadog_client.py | 83 ++ .../aio/_microsoft_datadog_client_async.py | 103 -- .../datadog/aio/operations/__init__.py | 21 + .../_marketplace_agreements_operations.py | 175 +++ .../aio/operations/_monitors_operations.py | 1063 ++++++++++++++++ .../_operations.py} | 21 +- ...ngle_sign_on_configurations_operations.py} | 90 +- .../_tag_rules_operations.py} | 100 +- .../datadog/aio/operations_async/__init__.py | 29 - .../_api_key_operations_async.py | 254 ---- .../_host_operations_async.py | 117 -- .../_linked_resource_operations_async.py | 117 -- .../_monitor_operations_async.py | 588 --------- .../_monitored_resource_operations_async.py | 117 -- .../_refresh_set_password_operations_async.py | 100 -- .../vendored_sdks/datadog/models/__init__.py | 44 +- .../models/_microsoft_datadog_client_enums.py | 13 + .../vendored_sdks/datadog/models/_models.py | 519 ++++++-- .../datadog/models/_models_py3.py | 576 ++++++--- .../datadog/operations/__init__.py | 27 +- .../datadog/operations/_api_key_operations.py | 261 ---- .../datadog/operations/_host_operations.py | 122 -- .../operations/_linked_resource_operations.py | 122 -- .../_marketplace_agreements_operations.py | 26 +- .../datadog/operations/_monitor_operations.py | 600 --------- .../_monitored_resource_operations.py | 122 -- .../operations/_monitors_operations.py | 1082 +++++++++++++++++ ...operation_operations.py => _operations.py} | 21 +- .../_refresh_set_password_operations.py | 105 -- ...ngle_sign_on_configurations_operations.py} | 90 +- ...operations.py => _tag_rules_operations.py} | 100 +- src/datadog/setup.py | 3 +- 49 files changed, 4500 insertions(+), 3856 deletions(-) delete mode 100644 src/datadog/azext_datadog/manual/_help.py delete mode 100644 src/datadog/azext_datadog/manual/commands.py delete mode 100644 src/datadog/azext_datadog/manual/custom.py rename src/datadog/azext_datadog/vendored_sdks/datadog/aio/{_configuration_async.py => _configuration.py} (91%) create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py rename src/datadog/azext_datadog/vendored_sdks/datadog/aio/{operations_async/_operation_operations_async.py => operations/_operations.py} (87%) rename src/datadog/azext_datadog/vendored_sdks/datadog/aio/{operations_async/_single_sign_on_configuration_operations_async.py => operations/_single_sign_on_configurations_operations.py} (82%) rename src/datadog/azext_datadog/vendored_sdks/datadog/aio/{operations_async/_tag_rule_operations_async.py => operations/_tag_rules_operations.py} (74%) delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py rename src/datadog/azext_datadog/vendored_sdks/datadog/operations/{_operation_operations.py => _operations.py} (87%) delete mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py rename src/datadog/azext_datadog/vendored_sdks/datadog/operations/{_single_sign_on_configuration_operations.py => _single_sign_on_configurations_operations.py} (81%) rename src/datadog/azext_datadog/vendored_sdks/datadog/operations/{_tag_rule_operations.py => _tag_rules_operations.py} (73%) diff --git a/linter_exclusions.yml b/linter_exclusions.yml index 37cb53d6390..8716a09ee42 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -290,24 +290,12 @@ datadog monitor create: datadog_organization_properties: rule_exclusions: - option_length_too_long - marketplace_subscription_status: - rule_exclusions: - - option_length_too_long datadog tag-rule create: parameters: log_rules_filtering_tags: rule_exclusions: - option_length_too_long - log_rules_send_aad_logs: - rule_exclusions: - - option_length_too_long - log_rules_send_resource_logs: - rule_exclusions: - - option_length_too_long - log_rules_send_subscription_logs: - rule_exclusions: - - option_length_too_long - metric_rules_filtering_tags: + send_subscription_logs: rule_exclusions: - option_length_too_long datadog tag-rule update: @@ -315,16 +303,7 @@ datadog tag-rule update: log_rules_filtering_tags: rule_exclusions: - option_length_too_long - log_rules_send_aad_logs: - rule_exclusions: - - option_length_too_long - log_rules_send_resource_logs: - rule_exclusions: - - option_length_too_long - log_rules_send_subscription_logs: - rule_exclusions: - - option_length_too_long - metric_rules_filtering_tags: + send_subscription_logs: rule_exclusions: - option_length_too_long datafactory factory configure-factory-repo: diff --git a/src/datadog/azext_datadog/generated/_client_factory.py b/src/datadog/azext_datadog/generated/_client_factory.py index 7e71886718f..920835d7499 100644 --- a/src/datadog/azext_datadog/generated/_client_factory.py +++ b/src/datadog/azext_datadog/generated/_client_factory.py @@ -11,42 +11,22 @@ def cf_datadog_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client - from ..vendored_sdks.datadog import MicrosoftDatadogClient + from azext_datadog.vendored_sdks.datadog import MicrosoftDatadogClient return get_mgmt_service_client(cli_ctx, MicrosoftDatadogClient) -def cf_api_key(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).api_key - - -def cf_host(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).host - - -def cf_linked_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).linked_resource - - -def cf_monitored_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitored_resource +def cf_marketplace_agreement(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).marketplace_agreements def cf_monitor(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitor - - -def cf_refresh_set_password(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).refresh_set_password + return cf_datadog_cl(cli_ctx).monitors def cf_tag_rule(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).tag_rule + return cf_datadog_cl(cli_ctx).tag_rules def cf_single_sign_on_configuration(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).single_sign_on_configuration - - -def cf_marketplace_agreement(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).marketplace_agreements + return cf_datadog_cl(cli_ctx).single_sign_on_configurations diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py index 3b96a8176e4..6ebd1b47e17 100644 --- a/src/datadog/azext_datadog/generated/_help.py +++ b/src/datadog/azext_datadog/generated/_help.py @@ -26,93 +26,22 @@ az datadog terms list """ -helps['datadog api-key'] = """ - type: group - short-summary: datadog api-key -""" - -helps['datadog api-key list'] = """ - type: command - short-summary: "List the api keys for a given monitor resource." - examples: - - name: ApiKeys_List - text: |- - az datadog api-key list --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - -helps['datadog api-key get-default-key'] = """ - type: command - short-summary: "Get the default api key." - examples: - - name: ApiKeys_GetDefaultKey - text: |- - az datadog api-key get-default-key --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - -helps['datadog api-key set-default-key'] = """ - type: command - short-summary: "Set the default api key." - examples: - - name: ApiKeys_SetDefaultKey - text: |- - az datadog api-key set-default-key --monitor-name "myMonitor" --key "1111111111111111aaaaaaaaaaaaaaaa" \ ---resource-group "myResourceGroup" -""" - -helps['datadog host'] = """ - type: group - short-summary: datadog host -""" - -helps['datadog host list'] = """ - type: command - short-summary: "List the hosts for a given monitor resource." - examples: - - name: Hosts_List - text: |- - az datadog host list --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - -helps['datadog linked-resource'] = """ - type: group - short-summary: datadog linked-resource -""" - -helps['datadog linked-resource list'] = """ - type: command - short-summary: "List all Azure resources associated to the same Datadog organization as the target resource." - examples: - - name: LinkedResources_List - text: |- - az datadog linked-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - -helps['datadog monitored-resource'] = """ - type: group - short-summary: datadog monitored-resource -""" - -helps['datadog monitored-resource list'] = """ - type: command - short-summary: "List the resources currently being monitored by the Datadog monitor resource." - examples: - - name: MonitoredResources_List - text: |- - az datadog monitored-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - helps['datadog monitor'] = """ type: group - short-summary: datadog monitor + short-summary: Manage monitor with datadog """ helps['datadog monitor list'] = """ type: command - short-summary: "List all monitors under the specified subscription." + short-summary: "List all monitors under the specified resource group. And List all monitors under the specified \ +subscription." examples: - name: Monitors_ListByResourceGroup text: |- az datadog monitor list --resource-group "myResourceGroup" + - name: Monitors_List + text: |- + az datadog monitor list """ helps['datadog monitor show'] = """ @@ -129,13 +58,19 @@ short-summary: "Create a monitor resource." parameters: - name: --datadog-organization-properties + short-summary: "Datadog organization properties" long-summary: | - Usage: --datadog-organization-properties linking-auth-code=XX linking-client-id=XX enterprise-app-id=XX + Usage: --datadog-organization-properties linking-auth-code=XX linking-client-id=XX redirect-uri=XX \ +api-key=XX application-key=XX enterprise-app-id=XX linking-auth-code: The auth code used to linking to an existing datadog organization. linking-client-id: The client_id from an existing in exchange for an auth token to link organization. + redirect-uri: The redirect uri for linking. + api-key: Api key associated to the Datadog organization. + application-key: Application key associated to the Datadog organization. enterprise-app-id: The Id of the Enterprise App used for Single sign on. - name: --user-info + short-summary: "User info" long-summary: | Usage: --user-info name=XX email-address=XX phone-number=XX @@ -145,11 +80,14 @@ examples: - name: Monitors_Create text: |- - az datadog monitor create --name "myMonitor" --location "West US 2" \ ---datadog-organization-properties name="myOrg" enterprise-app-id="00000000-0000-0000-0000-000000000000" \ -linking-auth-code="someAuthCode" linking-client-id="00000000-0000-0000-0000-000000000000" subscription="pro" \ ---monitoring-status "Enabled" --user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" \ ---sku-name "drawdown_testing_20200904_Monthly" --tags Environment="Dev" --resource-group "myResourceGroup" + az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" \ +--tags Environment="Dev" --user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" \ +--type "SystemAssigned" --sku-name "payg_v2_Monthly" + - name: Monitors creation with linking to Datadogo organization. + text: |- + az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" \ +--datadog-organization-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" \ +email-address="alice@microsoft.com" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "Linked" """ helps['datadog monitor update'] = """ @@ -158,8 +96,8 @@ examples: - name: Monitors_Update text: |- - az datadog monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ ---resource-group "myResourceGroup" + az datadog monitor update --name "myMonitor" --tags Environment="Dev" --resource-group \ +"myResourceGroup" """ helps['datadog monitor delete'] = """ @@ -171,35 +109,85 @@ az datadog monitor delete --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog monitor wait'] = """ +helps['datadog monitor get-default-key'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the datadog monitor is met. + short-summary: "Get the default api key." examples: - - name: Pause executing next line of CLI script until the datadog monitor is successfully created. + - name: Monitors_GetDefaultKey text: |- - az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the datadog monitor is successfully deleted. + az datadog monitor get-default-key --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor list-api-key'] = """ + type: command + short-summary: "List the api keys for a given monitor resource." + examples: + - name: Monitors_ListApiKeys text: |- - az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted + az datadog monitor list-api-key --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog set-password-link'] = """ - type: group - short-summary: datadog set-password-link +helps['datadog monitor list-host'] = """ + type: command + short-summary: "List the hosts for a given monitor resource." + examples: + - name: Monitors_ListHosts + text: |- + az datadog monitor list-host --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog set-password-link get'] = """ +helps['datadog monitor list-linked-resource'] = """ + type: command + short-summary: "List all Azure resources associated to the same Datadog organization as the target resource." + examples: + - name: Monitors_ListLinkedResources + text: |- + az datadog monitor list-linked-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor list-monitored-resource'] = """ + type: command + short-summary: "List the resources currently being monitored by the Datadog monitor resource." + examples: + - name: Monitors_ListMonitoredResources + text: |- + az datadog monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor refresh-set-password-link'] = """ type: command short-summary: "Refresh the set password link and return a latest one." examples: - - name: RefreshSetPassword_Get + - name: Monitors_RefreshSetPasswordLink + text: |- + az datadog monitor refresh-set-password-link --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor set-default-key'] = """ + type: command + short-summary: "Set the default api key." + examples: + - name: Monitors_SetDefaultKey + text: |- + az datadog monitor set-default-key --monitor-name "myMonitor" --key "1111111111111111aaaaaaaaaaaaaaaa" \ +--resource-group "myResourceGroup" +""" + +helps['datadog monitor wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the datadog monitor is met. + examples: + - name: Pause executing next line of CLI script until the datadog monitor is successfully created. + text: |- + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog monitor is successfully deleted. text: |- - az datadog set-password-link get --monitor-name "myMonitor" --resource-group "myResourceGroup" + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted """ helps['datadog tag-rule'] = """ type: group - short-summary: datadog tag-rule + short-summary: Manage tag rule with datadog """ helps['datadog tag-rule list'] = """ @@ -225,18 +213,18 @@ type: command short-summary: "Create a tag rule set for a given monitor resource." parameters: - - name: --metric-rules-filtering-tags + - name: --filtering-tags short-summary: "List of filtering tags to be used for capturing metrics. 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: --metric-rules-filtering-tags name=XX value=XX action=XX + 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 --metric-rules-filtering-tags argument. + Multiple actions can be specified by using more than one --filtering-tags argument. - name: --log-rules-filtering-tags short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ @@ -255,26 +243,26 @@ text: |- az datadog tag-rule create --monitor-name "myMonitor" --log-rules-filtering-tags name="Environment" \ action="Include" value="Prod" --log-rules-filtering-tags name="Environment" action="Exclude" value="Dev" \ ---log-rules-send-aad-logs false --log-rules-send-resource-logs true --log-rules-send-subscription-logs true \ ---resource-group "myResourceGroup" --rule-set-name "default" +--send-aad-logs false --send-resource-logs true --send-subscription-logs true --resource-group "myResourceGroup" \ +--rule-set-name "default" """ helps['datadog tag-rule update'] = """ type: command short-summary: "Update a tag rule set for a given monitor resource." parameters: - - name: --metric-rules-filtering-tags + - name: --filtering-tags short-summary: "List of filtering tags to be used for capturing metrics. 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: --metric-rules-filtering-tags name=XX value=XX action=XX + 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 --metric-rules-filtering-tags argument. + Multiple actions can be specified by using more than one --filtering-tags argument. - name: --log-rules-filtering-tags short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ @@ -292,7 +280,7 @@ helps['datadog sso-config'] = """ type: group - short-summary: datadog sso-config + short-summary: Manage sso config with datadog """ helps['datadog sso-config list'] = """ @@ -301,8 +289,7 @@ examples: - name: SingleSignOnConfigurations_List text: |- - az datadog sso-config list --monitor-name "myMonitor" --resource-group \ -"myResourceGroup" + az datadog sso-config list --monitor-name "myMonitor" --resource-group "myResourceGroup" """ helps['datadog sso-config show'] = """ @@ -311,8 +298,8 @@ examples: - name: SingleSignOnConfigurations_Get text: |- - az datadog sso-config show --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" + az datadog sso-config show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" """ helps['datadog sso-config create'] = """ @@ -321,37 +308,40 @@ parameters: - name: --properties long-summary: | - Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + Usage: --properties provisioning-state=XX single-sign-on-state=XX enterprise-app-id=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 Datadog Organization. examples: - name: SingleSignOnConfigurations_CreateOrUpdate text: |- - az datadog sso-config create --configuration-name "default" --monitor-name \ -"myMonitor" --properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" \ ---resource-group "myResourceGroup" + az datadog sso-config create --configuration-name "default" --monitor-name "myMonitor" --properties \ +enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" --resource-group \ +"myResourceGroup" """ helps['datadog sso-config update'] = """ type: command short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties provisioning-state=XX single-sign-on-state=XX enterprise-app-id=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. """ helps['datadog sso-config wait'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is \ -met. + short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is met. examples: - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -created. + - name: Pause executing next line of CLI script until the datadog sso-config is successfully created. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -updated. + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog sso-config is successfully updated. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --updated + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --updated """ diff --git a/src/datadog/azext_datadog/generated/_params.py b/src/datadog/azext_datadog/generated/_params.py index 6aa9c602fa6..0a271f71169 100644 --- a/src/datadog/azext_datadog/generated/_params.py +++ b/src/datadog/azext_datadog/generated/_params.py @@ -19,43 +19,24 @@ ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from azext_datadog.action import ( + AddMarketplaceagreementsProperties, AddDatadogOrganizationProperties, AddUserInfo, - AddMetricRulesFilteringTags, + AddFilteringTags, AddLogRulesFilteringTags, - AddProperties + AddSinglesignonconfigurationsProperties ) def load_arguments(self, _): - with self.argument_context('datadog api-key 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('datadog api-key get-default-key') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') - - with self.argument_context('datadog api-key set-default-key') 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('created_by', type=str, help='The user that created the API key.') - c.argument('name', type=str, help='The name of the API key.') - c.argument('key', type=str, help='The value of the API key.') - c.argument('created', type=str, help='The time of creation of the API key.') - - with self.argument_context('datadog host 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('datadog marketplace-agreement create') as c: + c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' + 'of the resource.') - with self.argument_context('datadog linked-resource 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('datadog monitored-resource 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('datadog marketplace-agreement update') as c: + c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' + 'of the resource.') with self.argument_context('datadog monitor list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -70,43 +51,68 @@ def load_arguments(self, _): 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), + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('identity_type', arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), help='Identity type') - c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Failed', 'Canceled', 'Deleted', - 'NotSpecified']), help='Provisioning state') - c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' - 'resource monitoring is enabled or disabled.') - c.argument('marketplace_subscription_status', arg_type=get_enum_type(['Active', 'Suspended']), help='Flag ' - 'specifying the Marketplace Subscription Status of the resource. If payment is not made in time, ' - 'the resource will go in Suspended state.') - c.argument('datadog_organization_properties', action=AddDatadogOrganizationProperties, nargs='*', + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), + help='Identity type', arg_group='Identity') + c.argument('datadog_organization_properties', action=AddDatadogOrganizationProperties, nargs='+', help='Datadog organization properties') - c.argument('user_info', action=AddUserInfo, nargs='*', help='User info') - c.argument('sku_name', type=str, help='Name of the SKU.') + c.argument('user_info', action=AddUserInfo, nargs='+', help='User info') + c.argument('sku_name', type=str, help='Name of the SKU.', arg_group='Sku') with self.argument_context('datadog 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('datadog 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('datadog monitor wait') as c: + with self.argument_context('datadog monitor get-default-key') 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('datadog set-password-link get') as c: + with self.argument_context('datadog monitor list-api-key') 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('datadog monitor list-host') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor list-linked-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('datadog monitor list-monitored-resource') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor refresh-set-password-link') 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('datadog monitor set-default-key') 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('created_by', type=str, help='The user that created the API key.') + c.argument('name', type=str, help='The name of the API key.') + c.argument('key', type=str, help='The value of the API key.') + c.argument('created', type=str, help='The time of creation of the API key.') + + with self.argument_context('datadog 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('datadog tag-rule list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -121,41 +127,48 @@ def load_arguments(self, _): 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') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. 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.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'NotSpecified']), help='Provisioning state') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing metrics. 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='Metric Rules') + 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 Azure ' + 'subscription logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure resource logs ' + 'should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='+', help='List of filtering ' 'tags to be used for capturing logs. This only takes effect if SendResourceLogs 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.') + 'include resources with the associated tags.', arg_group='Log Rules') with self.argument_context('datadog tag-rule update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') c.argument('rule_set_name', type=str, help='Rule set name', id_part='child_name_1') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. 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.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'NotSpecified']), help='Provisioning state') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing metrics. 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='Metric Rules') + 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 Azure ' + 'subscription logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure resource logs ' + 'should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='+', help='List of filtering ' 'tags to be used for capturing logs. This only takes effect if SendResourceLogs 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.') + 'include resources with the associated tags.', arg_group='Log Rules') + c.ignore('body') with self.argument_context('datadog sso-config list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -170,13 +183,14 @@ def load_arguments(self, _): 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='Configuration name') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') with self.argument_context('datadog sso-config 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='Configuration name', id_part='child_name_1') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') + c.ignore('body') with self.argument_context('datadog sso-config wait') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/datadog/azext_datadog/generated/action.py b/src/datadog/azext_datadog/generated/action.py index 27649270eec..2d81235bad9 100644 --- a/src/datadog/azext_datadog/generated/action.py +++ b/src/datadog/azext_datadog/generated/action.py @@ -14,6 +14,46 @@ from knack.util import CLIError +class AddMarketplaceagreementsProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'publisher': + d['publisher'] = v[0] + elif kl == 'product': + d['product'] = v[0] + elif kl == 'plan': + d['plan'] = v[0] + elif kl == 'license-text-link': + d['license_text_link'] = v[0] + elif kl == 'privacy-policy-link': + d['privacy_policy_link'] = v[0] + elif kl == 'retrieve-datetime': + d['retrieve_datetime'] = v[0] + elif kl == 'signature': + d['signature'] = v[0] + elif kl == 'accepted': + d['accepted'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'publisher, product, plan, license-text-link, privacy-policy-link, retrieve-datetime, ' + 'signature, accepted'.format(k)) + return d + + class AddDatadogOrganizationProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) @@ -35,8 +75,18 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['linking_auth_code'] = v[0] elif kl == 'linking-client-id': d['linking_client_id'] = v[0] + elif kl == 'redirect-uri': + d['redirect_uri'] = v[0] + elif kl == 'api-key': + d['api_key'] = v[0] + elif kl == 'application-key': + d['application_key'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter datadog_organization_properties. All ' + 'possible keys are: linking-auth-code, linking-client-id, redirect-uri, api-key, ' + 'application-key, enterprise-app-id'.format(k)) return d @@ -63,13 +113,16 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use 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: name, ' + 'email-address, phone-number'.format(k)) return d -class AddMetricRulesFilteringTags(argparse._AppendAction): +class AddFilteringTags(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - super(AddMetricRulesFilteringTags, self).__call__(parser, namespace, action, option_string) + super(AddFilteringTags, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -89,6 +142,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use 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 @@ -115,10 +171,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['value'] = v[0] elif kl == 'action': d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter log_rules_filtering_tags. All possible ' + 'keys are: name, value, action'.format(k)) return d -class AddProperties(argparse.Action): +class AddSinglesignonconfigurationsProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) namespace.properties = action @@ -135,10 +194,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'single-sign-on-state': + if kl == 'provisioning-state': + d['provisioning_state'] = v[0] + elif 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: ' + 'provisioning-state, single-sign-on-state, enterprise-app-id'.format(k)) return d diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py index a35c103807c..2e10c20b231 100644 --- a/src/datadog/azext_datadog/generated/commands.py +++ b/src/datadog/azext_datadog/generated/commands.py @@ -22,85 +22,50 @@ def load_command_table(self, _): client_factory=cf_marketplace_agreement) with self.command_group('datadog terms', datadog_marketplace_agreement, client_factory=cf_marketplace_agreement, is_experimental=True) as g: - g.custom_command('list', 'datadog_terms_list') - - from azext_datadog.generated._client_factory import cf_api_key - datadog_api_key = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._api_key_operations#ApiKeyOperations.{}', - client_factory=cf_api_key) - with self.command_group('datadog api-key', datadog_api_key, client_factory=cf_api_key, is_experimental=True) as g: - g.custom_command('list', 'datadog_api_key_list') - g.custom_command('get-default-key', 'datadog_api_key_get_default_key') - g.custom_command('set-default-key', 'datadog_api_key_set_default_key') - - from azext_datadog.generated._client_factory import cf_host - datadog_host = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._host_operations#HostOperations.{}', - client_factory=cf_host) - with self.command_group('datadog host', datadog_host, client_factory=cf_host, is_experimental=True) as g: - g.custom_command('list', 'datadog_host_list') - - from azext_datadog.generated._client_factory import cf_linked_resource - datadog_linked_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._linked_resource_operations#LinkedResourceOpera' - 'tions.{}', - client_factory=cf_linked_resource) - with self.command_group('datadog linked-resource', datadog_linked_resource, client_factory=cf_linked_resource, - is_experimental=True) as g: - g.custom_command('list', 'datadog_linked_resource_list') - - from azext_datadog.generated._client_factory import cf_monitored_resource - datadog_monitored_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitored_resource_operations#MonitoredResourc' - 'eOperations.{}', - client_factory=cf_monitored_resource) - with self.command_group('datadog monitored-resource', datadog_monitored_resource, - client_factory=cf_monitored_resource, is_experimental=True) as g: - g.custom_command('list', 'datadog_monitored_resource_list') + g.custom_command('list', 'datadog_marketplace_agreement_list') from azext_datadog.generated._client_factory import cf_monitor datadog_monitor = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitor_operations#MonitorOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitors_operations#MonitorsOperations.{}', client_factory=cf_monitor) - with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor, is_experimental=True) as g: + with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor) as g: g.custom_command('list', 'datadog_monitor_list') g.custom_show_command('show', 'datadog_monitor_show') g.custom_command('create', 'datadog_monitor_create', supports_no_wait=True) g.custom_command('update', 'datadog_monitor_update') g.custom_command('delete', 'datadog_monitor_delete', supports_no_wait=True, confirmation=True) + g.custom_command('get-default-key', 'datadog_monitor_get_default_key') + g.custom_command('list-api-key', 'datadog_monitor_list_api_key') + g.custom_command('list-host', 'datadog_monitor_list_host') + g.custom_command('list-linked-resource', 'datadog_monitor_list_linked_resource') + g.custom_command('list-monitored-resource', 'datadog_monitor_list_monitored_resource') + g.custom_command('refresh-set-password-link', 'datadog_monitor_refresh_set_password_link') + g.custom_command('set-default-key', 'datadog_monitor_set_default_key') g.custom_wait_command('wait', 'datadog_monitor_show') - from azext_datadog.generated._client_factory import cf_refresh_set_password - datadog_refresh_set_password = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._refresh_set_password_operations#RefreshSetPass' - 'wordOperations.{}', - client_factory=cf_refresh_set_password) - with self.command_group('datadog set-password-link', datadog_refresh_set_password, - client_factory=cf_refresh_set_password, is_experimental=True) as g: - g.custom_command('get', 'datadog_refresh_set_password_get') - from azext_datadog.generated._client_factory import cf_tag_rule datadog_tag_rule = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rule_operations#TagRuleOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rules_operations#TagRulesOperations.{}', client_factory=cf_tag_rule) - with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule, - is_experimental=True) as g: + with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule) as g: g.custom_command('list', 'datadog_tag_rule_list') g.custom_show_command('show', 'datadog_tag_rule_show') g.custom_command('create', 'datadog_tag_rule_create') - g.custom_command('update', 'datadog_tag_rule_update') + g.generic_update_command('update', setter_arg_name='body', custom_func_name='datadog_tag_rule_update') from azext_datadog.generated._client_factory import cf_single_sign_on_configuration datadog_single_sign_on_configuration = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configuration_operations#Single' - 'SignOnConfigurationOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configurations_operations#Singl' + 'eSignOnConfigurationsOperations.{}', client_factory=cf_single_sign_on_configuration) with self.command_group('datadog sso-config', datadog_single_sign_on_configuration, - client_factory=cf_single_sign_on_configuration, is_experimental=True) as g: - g.custom_command('list', 'datadog_single_sign_on_configuration_list') - g.custom_show_command('show', 'datadog_single_sign_on_configuration_show') - g.custom_command('create', 'datadog_single_sign_on_configuration_create', supports_no_wait=True) - g.generic_update_command('update', setter_arg_name='properties', setter_name='begin_create_or_update', - custom_func_name='datadog_single_sign_on_configuration_update', - supports_no_wait=True) - g.custom_wait_command('wait', 'datadog_single_sign_on_configuration_show') + client_factory=cf_single_sign_on_configuration) as g: + g.custom_command('list', 'datadog_sso_config_list') + g.custom_show_command('show', 'datadog_sso_config_show') + g.custom_command('create', 'datadog_sso_config_create', supports_no_wait=True) + g.generic_update_command('update', setter_arg_name='body', setter_name='begin_create_or_update', + custom_func_name='datadog_sso_config_update', supports_no_wait=True) + g.custom_wait_command('wait', 'datadog_sso_config_show') + + with self.command_group('datadog', is_experimental=True): + pass diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py index a4d66c84e0b..009270c26e0 100644 --- a/src/datadog/azext_datadog/generated/custom.py +++ b/src/datadog/azext_datadog/generated/custom.py @@ -14,58 +14,22 @@ from azure.cli.core.util import sdk_no_wait -def datadog_terms_list(client): +def datadog_marketplace_agreement_list(client): return client.list() -def datadog_api_key_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) +def datadog_marketplace_agreement_create(client, + properties=None): + body = {} + body['properties'] = properties + return client.create_or_update(body=body) -def datadog_api_key_get_default_key(client, - resource_group_name, - monitor_name): - return client.get_default_key(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_api_key_set_default_key(client, - resource_group_name, - monitor_name, - key, - created_by=None, - name=None, - created=None): - return client.set_default_key(resource_group_name=resource_group_name, - monitor_name=monitor_name, - created_by=created_by, - name=name, - key=key, - created=created) - - -def datadog_host_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_linked_resource_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_monitored_resource_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) +def datadog_marketplace_agreement_update(client, + properties=None): + body = {} + body['properties'] = properties + return client.create_or_update(body=body) def datadog_monitor_list(client, @@ -86,33 +50,34 @@ def datadog_monitor_create(cmd, client, resource_group_name, monitor_name, - location, tags=None, - identity_type=None, - provisioning_state=None, - monitoring_status=None, - marketplace_subscription_status=None, + location=None, + type_=None, datadog_organization_properties=None, user_info=None, sku_name=None, no_wait=False): + body = {} + body['tags'] = tags + body['location'] = location + body['identity'] = {} + body['identity']['type'] = type_ + body['properties'] = {} + body['properties']['monitoring_status'] = "Enabled" + body['properties']['datadog_organization_properties'] = datadog_organization_properties + body['properties']['user_info'] = user_info + body['sku'] = {} + body['sku']['name'] = sku_name poller = sdk_no_wait(no_wait, client.begin_create, resource_group_name=resource_group_name, monitor_name=monitor_name, - tags=tags, - location=location, - type=identity_type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=sku_name) + body=body) result = poller.result() - if result and result.principal_id: + if result and result.identity and result.identity.principal_id: scrope = '/subscriptions/' + result.id.split('/')[2] - create_role_assignment(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05', assignee_object_id=result.principal_id, + create_role_assignment(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05', + assignee_object_id=result.identity.principal_id, scope=scrope, assignee_principal_type='ServicePrincipal') return poller @@ -120,12 +85,14 @@ def datadog_monitor_create(cmd, def datadog_monitor_update(client, resource_group_name, monitor_name, - tags=None, - monitoring_status=None): + tags=None): + body = {} + body['tags'] = tags + body['properties'] = {} + body['properties']['monitoring_status'] = "Enabled" return client.update(resource_group_name=resource_group_name, monitor_name=monitor_name, - tags=tags, - monitoring_status=monitoring_status) + body=body) def datadog_monitor_delete(cmd, @@ -144,17 +111,69 @@ def datadog_monitor_delete(cmd, scrope = '/subscriptions/' + monitor.id.split('/')[2] role_assignments = list_role_assignments(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05', scope=scrope) for i in role_assignments: - if i.get('principalId') == monitor.principal_id: + if i.get('principalId') == monitor.identity.principal_id: delete_role_assignments(cmd, ids=[i.get('id')]) break return poller -def datadog_refresh_set_password_get(client, - resource_group_name, - monitor_name): - return client.get(resource_group_name=resource_group_name, - monitor_name=monitor_name) +def datadog_monitor_get_default_key(client, + resource_group_name, + monitor_name): + return client.get_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_api_key(client, + resource_group_name, + monitor_name): + return client.list_api_keys(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_host(client, + resource_group_name, + monitor_name): + return client.list_hosts(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_linked_resource(client, + resource_group_name, + monitor_name): + return client.list_linked_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_monitored_resource(client, + resource_group_name, + monitor_name): + return client.list_monitored_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_refresh_set_password_link(client, + resource_group_name, + monitor_name): + return client.refresh_set_password_link(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_set_default_key(client, + resource_group_name, + monitor_name, + created_by=None, + name=None, + key=None, + created=None): + body = {} + body['created_by'] = created_by + body['name'] = name + body['key'] = key + body['created'] = created + return client.set_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) def datadog_tag_rule_list(client, @@ -177,73 +196,91 @@ def datadog_tag_rule_create(client, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + provisioning_state=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): + body = {} + body['properties'] = {} + body['properties']['provisioning_state'] = provisioning_state + body['properties']['metric_rules'] = {} + body['properties']['metric_rules']['filtering_tags'] = filtering_tags + body['properties']['log_rules'] = {} + body['properties']['log_rules']['send_aad_logs'] = send_aad_logs + body['properties']['log_rules']['send_subs_logs'] = send_subscription_logs + body['properties']['log_rules']['send_resource_logs'] = send_resource_logs + body['properties']['log_rules']['filtering_tags'] = log_rules_filtering_tags return client.create_or_update(resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + body=body) -def datadog_tag_rule_update(client, +def datadog_tag_rule_update(instance, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + provisioning_state=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): - return client.create_or_update(resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + if provisioning_state is not None: + instance.properties.provisioning_state = provisioning_state + if filtering_tags is not None: + instance.properties.metric_rules.filtering_tags = filtering_tags + 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_resource_logs is not None: + instance.properties.log_rules.send_resource_logs = send_resource_logs + if log_rules_filtering_tags is not None: + instance.properties.log_rules.filtering_tags = log_rules_filtering_tags + return instance -def datadog_single_sign_on_configuration_list(client, - resource_group_name, - monitor_name): +def datadog_sso_config_list(client, + resource_group_name, + monitor_name): return client.list(resource_group_name=resource_group_name, monitor_name=monitor_name) -def datadog_single_sign_on_configuration_show(client, - resource_group_name, - monitor_name, - configuration_name): +def datadog_sso_config_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 datadog_single_sign_on_configuration_create(client, - resource_group_name, - monitor_name, - configuration_name, - properties=None, - no_wait=False): +def datadog_sso_config_create(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + body = {} + body['properties'] = properties return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties) + body=body) -def datadog_single_sign_on_configuration_update(instance, - resource_group_name, - monitor_name, - configuration_name, - no_wait=False): +def datadog_sso_config_update(instance, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + if properties is not None: + instance.properties = properties return instance diff --git a/src/datadog/azext_datadog/manual/_help.py b/src/datadog/azext_datadog/manual/_help.py deleted file mode 100644 index aec86544978..00000000000 --- a/src/datadog/azext_datadog/manual/_help.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from knack.help_files import helps - -helps['datadog link'] = """ - type: group - short-summary: Link Datadog existing organization. -""" - -helps['datadog link create'] = """ - type: command - short-summary: The operation to link Datadog existing organization. -""" diff --git a/src/datadog/azext_datadog/manual/commands.py b/src/datadog/azext_datadog/manual/commands.py deleted file mode 100644 index 761f97d37ab..00000000000 --- a/src/datadog/azext_datadog/manual/commands.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def load_command_table(self, _): - - with self.command_group('datadog link', is_experimental=True) as g: - g.custom_command('create', 'datadog_link_create') diff --git a/src/datadog/azext_datadog/manual/custom.py b/src/datadog/azext_datadog/manual/custom.py deleted file mode 100644 index d50a300c681..00000000000 --- a/src/datadog/azext_datadog/manual/custom.py +++ /dev/null @@ -1,24 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core.util import open_page_in_browser, can_launch_browser, in_cloud_console - - -def datadog_link_create(): - - url = 'https://us3.datadoghq.com/api/v1/liftr/oauth/start' - if can_launch_browser() and not in_cloud_console(): - open_page_in_browser(url) - else: - print("There isn't an available browser to create an issue draft. You can copy and paste the url" - " below in a browser to submit.\n\n{}\n\n".format(url)) - - print("After login and authorize the linking, copy the code and client_id from the broswer address bar.\n" - "Use code as linking-auth-code and client_id as linking-client-id in monitor create command.\n" - "example:\n" - " az datadog monitor create --name \"myMonitor\" --location \"West US 2\" --identity-type" - " \"SystemAssigned\" --sku-name \"Linked\" --datadog-organization-properties" - " linking-auth-code=\"copyFromCode\" linking-client-id=\"00000000-0000-0000-0000-000000000000\"" - " --user-info name=\"Alice\" email-address=\"alice@microsoft.com\" phone-number=\"123-456-789\"") diff --git a/src/datadog/azext_datadog/tests/__init__.py b/src/datadog/azext_datadog/tests/__init__.py index 50e0627daff..70488e93851 100644 --- a/src/datadog/azext_datadog/tests/__init__.py +++ b/src/datadog/azext_datadog/tests/__init__.py @@ -31,8 +31,8 @@ def try_manual(func): def import_manual_function(origin_func): from importlib import import_module - decorated_path = inspect.getfile(origin_func) - module_path = __path__[0] + 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( @@ -46,7 +46,6 @@ def import_manual_function(origin_func): def get_func_to_call(): func_to_call = func try: - func_to_call = import_manual_function(func) func_to_call = import_manual_function(func) logger.info("Found manual override for %s(...)", func.__name__) except (ImportError, AttributeError): @@ -66,6 +65,9 @@ def wrapper(*args, **kwargs): 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] diff --git a/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml b/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml index a0c6e8d01e9..bb63bedb0e4 100644 --- a/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml +++ b/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml @@ -147,13 +147,13 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Accepted","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":null,"linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' headers: azure-asyncoperation: - - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2020-02-01-preview + - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2021-03-01 cache-control: - no-cache content-length: @@ -197,7 +197,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2020-02-01-preview + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2021-03-01 response: body: string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea","name":"6def0190-d70c-4af9-984e-6130d52a00ea","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","status":"Accepted","startTime":"2020-10-17T21:08:21.3672152Z"}' @@ -247,7 +247,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2020-02-01-preview + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2021-03-01 response: body: string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea","name":"6def0190-d70c-4af9-984e-6130d52a00ea","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","status":"Accepted","startTime":"2020-10-17T21:08:21.3672152Z"}' @@ -297,7 +297,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2020-02-01-preview + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea?api-version=2021-03-01 response: body: string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/6def0190-d70c-4af9-984e-6130d52a00ea","name":"6def0190-d70c-4af9-984e-6130d52a00ea","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","status":"Succeeded","startTime":"2020-10-17T21:08:21.3672152Z","error":{},"properties":null}' @@ -347,7 +347,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -502,7 +502,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -551,7 +551,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -600,7 +600,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/monitors?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/monitors?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}]}' @@ -647,7 +647,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}]}' @@ -698,7 +698,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev2"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -751,7 +751,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listHosts?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listHosts?api-version=2021-03-01 response: body: string: '{"value":[],"nextLink":null}' @@ -800,7 +800,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listLinkedResources?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listLinkedResources?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/CLITESTXNSTEX6BTRQAXL5WXPLPDRWJGS3KHBD75DKEM6MZRXW3MDPWWNWCIKJ47J76SUYHW2PQ/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MYMONITOR"}],"nextLink":null}' @@ -849,7 +849,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listMonitoredResources?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listMonitoredResources?api-version=2021-03-01 response: body: string: '{"value":[],"nextLink":null}' @@ -898,7 +898,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/refreshSetPasswordLink?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/refreshSetPasswordLink?api-version=2021-03-01 response: body: string: '{"setPasswordLink":null}' @@ -951,13 +951,13 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default","name":"default","type":"Microsoft.Datadog/monitors/singleSignOnConfigurations","properties":{"singleSignOnState":"Enable","enterpriseAppId":"ac754169-3489-42ae-bd06-8be89db12e58","singleSignOnUrl":null}}' headers: azure-asyncoperation: - - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b61a2387-27d6-4d54-bcc9-4a52442f8c24?api-version=2020-02-01-preview + - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b61a2387-27d6-4d54-bcc9-4a52442f8c24?api-version=2021-03-01 cache-control: - no-cache content-length: @@ -1000,7 +1000,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b61a2387-27d6-4d54-bcc9-4a52442f8c24?api-version=2020-02-01-preview + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b61a2387-27d6-4d54-bcc9-4a52442f8c24?api-version=2021-03-01 response: body: string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b61a2387-27d6-4d54-bcc9-4a52442f8c24","name":"b61a2387-27d6-4d54-bcc9-4a52442f8c24","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default","status":"Succeeded","startTime":"2020-10-17T21:10:04.6216693Z","error":{},"properties":null}' @@ -1049,7 +1049,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default","name":"default","type":"Microsoft.Datadog/monitors/singleSignOnConfigurations","properties":{"singleSignOnState":"Enable","enterpriseAppId":"ac754169-3489-42ae-bd06-8be89db12e58","singleSignOnUrl":"https://app.datadoghq.com/account/login/id/ki0vqopr9ouvv7t2"}}' @@ -1098,7 +1098,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default","name":"default","type":"Microsoft.Datadog/monitors/singleSignOnConfigurations","properties":{"singleSignOnState":"Enable","enterpriseAppId":"ac754169-3489-42ae-bd06-8be89db12e58","singleSignOnUrl":"https://app.datadoghq.com/account/login/id/ki0vqopr9ouvv7t2"}}' @@ -1147,7 +1147,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/singleSignOnConfigurations/default","name":"default","type":"Microsoft.Datadog/monitors/singleSignOnConfigurations","properties":{"singleSignOnState":"Enable","enterpriseAppId":"ac754169-3489-42ae-bd06-8be89db12e58","singleSignOnUrl":"https://app.datadoghq.com/account/login/id/ki0vqopr9ouvv7t2"}}]}' @@ -1203,7 +1203,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default","name":"default","type":"Microsoft.Datadog/monitors/tagRules","properties":{"logRules":{"sendAadLogs":false,"sendSubscriptionLogs":true,"sendResourceLogs":true,"filteringTags":[{"name":"Environment","value":"Prod","action":"Include"},{"name":"Environment","value":"Dev","action":"Exclude"}]},"metricRules":{"filteringTags":[]}}}' @@ -1254,7 +1254,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default","name":"default","type":"Microsoft.Datadog/monitors/tagRules","properties":{"logRules":{"sendAadLogs":false,"sendSubscriptionLogs":true,"sendResourceLogs":true,"filteringTags":[{"name":"Environment","value":"Prod","action":"Include"},{"name":"Environment","value":"Dev","action":"Exclude"}]},"metricRules":{"filteringTags":[]}}}' @@ -1303,7 +1303,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/tagRules/default","name":"default","type":"Microsoft.Datadog/monitors/tagRules","properties":{"logRules":{"sendAadLogs":false,"sendSubscriptionLogs":true,"sendResourceLogs":true,"filteringTags":[{"name":"Environment","value":"Prod","action":"Include"},{"name":"Environment","value":"Dev","action":"Exclude"}]},"metricRules":{"filteringTags":[]}}}]}' @@ -1352,7 +1352,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listApiKeys?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/listApiKeys?api-version=2021-03-01 response: body: string: '{"value":[{"createdBy":"alice@microsoft.com","name":"Azure Admin User @@ -1406,7 +1406,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/setDefaultKey?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/setDefaultKey?api-version=2021-03-01 response: body: string: 'null' @@ -1457,7 +1457,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/getDefaultKey?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor/getDefaultKey?api-version=2021-03-01 response: body: string: '{"createdBy":null,"name":null,"key":"1111111111111111aaaaaaaaaaaaaaaa","created":null}' @@ -1507,7 +1507,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"Environment":"Dev"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -1558,7 +1558,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"Microsoft.Datadog/monitors","sku":{"name":"drawdown_testing_20200904_Monthly"},"location":"eastus2euap","tags":{"environment":"Dev2"},"systemData":{"createdBy":"alice@microsoft.com","createdByType":"User","createdAt":"2020-10-17T21:08:18.7403557Z","lastModifiedBy":"ae11f5fb-c627-4eec-b4a0-f7b5969426e5","lastModifiedByType":"Application","lastModifiedAt":"2020-10-17T21:10:42.1874411Z"},"identity":{"principalId":"396616d4-f232-4f78-b79f-8094954bc32b","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Deleting","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"myMonitor","id":"ki0vqopr9ouvv7t2","linkingAuthCode":null,"linkingClientId":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' @@ -1576,7 +1576,7 @@ interactions: expires: - '-1' location: - - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b0320776-fb4c-4bf3-936c-9711b18b5009?api-version=2020-02-01-preview + - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b0320776-fb4c-4bf3-936c-9711b18b5009?api-version=2021-03-01 pragma: - no-cache server: @@ -1607,7 +1607,7 @@ interactions: - AZURECLI/2.13.0 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b0320776-fb4c-4bf3-936c-9711b18b5009?api-version=2020-02-01-preview + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b0320776-fb4c-4bf3-936c-9711b18b5009?api-version=2021-03-01 response: body: string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/b0320776-fb4c-4bf3-936c-9711b18b5009","name":"b0320776-fb4c-4bf3-936c-9711b18b5009","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","status":"Succeeded","startTime":"2020-10-17T21:10:46.439404Z","error":{},"properties":null}' @@ -1653,7 +1653,7 @@ interactions: User-Agent: - AZURECLI/2.17.1 azsdk-python-microsoftdatadogclient/unknown Python/3.6.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements/marketplace","name":"marketplace","type":"Microsoft.Datadog/agreements","properties":{"publisher":"Microsoft","product":"Marketplace","plan":"Marketplace","licenseTextLink":"https://azure.microsoft.com/en-us/support/legal/marketplace-terms/","privacyPolicyLink":"http://www.microsoft.com/privacy","retrieveDatetime":null,"signature":"","accepted":true}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements/datadog","name":"datadog","type":"Microsoft.Datadog/agreements","properties":{"publisher":"Datadog","product":"Datadog","plan":"Datadog","licenseTextLink":"https://www.datadoghq.com/pdf/Datadog_AzureMarketplace.pdf","privacyPolicyLink":"https://www.datadoghq.com/legal/privacy/","retrieveDatetime":null,"signature":"","accepted":true}}]}' @@ -2534,7 +2534,7 @@ interactions: User-Agent: - AZURECLI/2.17.1 azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements?api-version=2020-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements?api-version=2021-03-01 response: body: string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements/marketplace","name":"marketplace","type":"Microsoft.Datadog/agreements","properties":{"publisher":"Microsoft","product":"Marketplace","plan":"Marketplace","licenseTextLink":"https://azure.microsoft.com/en-us/support/legal/marketplace-terms/","privacyPolicyLink":"http://www.microsoft.com/privacy","retrieveDatetime":null,"signature":"","accepted":false}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Datadog/agreements/datadog","name":"datadog","type":"Microsoft.Datadog/agreements","properties":{"publisher":"Datadog","product":"Datadog","plan":"Datadog","licenseTextLink":"https://www.datadoghq.com/pdf/Datadog_AzureMarketplace.pdf","privacyPolicyLink":"https://www.datadoghq.com/legal/privacy/","retrieveDatetime":null,"signature":"","accepted":false}}]}' @@ -2564,4 +2564,393 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - unknown + Connection: + - keep-alive + User-Agent: + - python/3.7.8 (Windows-10-10.0.19041-SP0) msrest/0.6.19 msrest_azure/0.6.4 + azure-mgmt-resource/10.3.0 Azure-SDK-For-Python AZURECLI/2.17.1 (MSI) + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/locations?api-version=2019-11-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus","name":"eastus","displayName":"East + US","regionalDisplayName":"(US) East US","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-79.8164","latitude":"37.3719","physicalLocation":"Virginia","pairedRegion":[{"name":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2","name":"eastus2","displayName":"East + US 2","regionalDisplayName":"(US) East US 2","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-78.3889","latitude":"36.6681","physicalLocation":"Virginia","pairedRegion":[{"name":"centralus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralus","name":"southcentralus","displayName":"South + Central US","regionalDisplayName":"(US) South Central US","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-98.5","latitude":"29.4167","physicalLocation":"Texas","pairedRegion":[{"name":"northcentralus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2","name":"westus2","displayName":"West + US 2","regionalDisplayName":"(US) West US 2","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-119.852","latitude":"47.233","physicalLocation":"Washington","pairedRegion":[{"name":"westcentralus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westcentralus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiaeast","name":"australiaeast","displayName":"Australia + East","regionalDisplayName":"(Asia Pacific) Australia East","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"151.2094","latitude":"-33.86","physicalLocation":"New + South Wales","pairedRegion":[{"name":"australiasoutheast","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiasoutheast"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia","name":"southeastasia","displayName":"Southeast + Asia","regionalDisplayName":"(Asia Pacific) Southeast Asia","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"103.833","latitude":"1.283","physicalLocation":"Singapore","pairedRegion":[{"name":"eastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northeurope","name":"northeurope","displayName":"North + Europe","regionalDisplayName":"(Europe) North Europe","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"-6.2597","latitude":"53.3478","physicalLocation":"Ireland","pairedRegion":[{"name":"westeurope","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westeurope"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uksouth","name":"uksouth","displayName":"UK + South","regionalDisplayName":"(Europe) UK South","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"-0.799","latitude":"50.941","physicalLocation":"London","pairedRegion":[{"name":"ukwest","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/ukwest"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westeurope","name":"westeurope","displayName":"West + Europe","regionalDisplayName":"(Europe) West Europe","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"4.9","latitude":"52.3667","physicalLocation":"Netherlands","pairedRegion":[{"name":"northeurope","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northeurope"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus","name":"centralus","displayName":"Central + US","regionalDisplayName":"(US) Central US","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-93.6208","latitude":"41.5908","physicalLocation":"Iowa","pairedRegion":[{"name":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralus","name":"northcentralus","displayName":"North + Central US","regionalDisplayName":"(US) North Central US","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-87.6278","latitude":"41.8819","physicalLocation":"Illinois","pairedRegion":[{"name":"southcentralus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus","name":"westus","displayName":"West + US","regionalDisplayName":"(US) West US","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"US","longitude":"-122.417","latitude":"37.783","physicalLocation":"California","pairedRegion":[{"name":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricanorth","name":"southafricanorth","displayName":"South + Africa North","regionalDisplayName":"(Africa) South Africa North","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Africa","longitude":"28.218370","latitude":"-25.731340","physicalLocation":"Johannesburg","pairedRegion":[{"name":"southafricawest","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricawest"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralindia","name":"centralindia","displayName":"Central + India","regionalDisplayName":"(Asia Pacific) Central India","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"73.9197","latitude":"18.5822","physicalLocation":"Pune","pairedRegion":[{"name":"southindia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southindia"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East + Asia","regionalDisplayName":"(Asia Pacific) East Asia","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"114.188","latitude":"22.267","physicalLocation":"Hong + Kong","pairedRegion":[{"name":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japaneast","name":"japaneast","displayName":"Japan + East","regionalDisplayName":"(Asia Pacific) Japan East","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"139.77","latitude":"35.68","physicalLocation":"Tokyo, + Saitama","pairedRegion":[{"name":"japanwest","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japanwest"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/jioindiawest","name":"jioindiawest","displayName":"JIO + India West","regionalDisplayName":"(Asia Pacific) JIO India West","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"70.05773","latitude":"22.470701","physicalLocation":"Jamnagar","pairedRegion":[{"name":"jioindiacentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/jioindiacentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreacentral","name":"koreacentral","displayName":"Korea + Central","regionalDisplayName":"(Asia Pacific) Korea Central","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Asia + Pacific","longitude":"126.9780","latitude":"37.5665","physicalLocation":"Seoul","pairedRegion":[{"name":"koreasouth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadacentral","name":"canadacentral","displayName":"Canada + Central","regionalDisplayName":"(Canada) Canada Central","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Canada","longitude":"-79.383","latitude":"43.653","physicalLocation":"Toronto","pairedRegion":[{"name":"canadaeast","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadaeast"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francecentral","name":"francecentral","displayName":"France + Central","regionalDisplayName":"(Europe) France Central","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"2.3730","latitude":"46.3772","physicalLocation":"Paris","pairedRegion":[{"name":"francesouth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francesouth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanywestcentral","name":"germanywestcentral","displayName":"Germany + West Central","regionalDisplayName":"(Europe) Germany West Central","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"8.682127","latitude":"50.110924","physicalLocation":"Frankfurt","pairedRegion":[{"name":"germanynorth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanynorth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwayeast","name":"norwayeast","displayName":"Norway + East","regionalDisplayName":"(Europe) Norway East","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"10.752245","latitude":"59.913868","physicalLocation":"Norway","pairedRegion":[{"name":"norwaywest","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwaywest"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandnorth","name":"switzerlandnorth","displayName":"Switzerland + North","regionalDisplayName":"(Europe) Switzerland North","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Europe","longitude":"8.564572","latitude":"47.451542","physicalLocation":"Zurich","pairedRegion":[{"name":"switzerlandwest","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandwest"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaenorth","name":"uaenorth","displayName":"UAE + North","regionalDisplayName":"(Middle East) UAE North","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"Middle + East","longitude":"55.316666","latitude":"25.266666","physicalLocation":"Dubai","pairedRegion":[{"name":"uaecentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaecentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilsouth","name":"brazilsouth","displayName":"Brazil + South","regionalDisplayName":"(South America) Brazil South","metadata":{"regionType":"Physical","regionCategory":"Recommended","geographyGroup":"South + America","longitude":"-46.633","latitude":"-23.55","physicalLocation":"Sao + Paulo State","pairedRegion":[{"name":"southcentralus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralusstage","name":"centralusstage","displayName":"Central + US (Stage)","regionalDisplayName":"(US) Central US (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastusstage","name":"eastusstage","displayName":"East + US (Stage)","regionalDisplayName":"(US) East US (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2stage","name":"eastus2stage","displayName":"East + US 2 (Stage)","regionalDisplayName":"(US) East US 2 (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralusstage","name":"northcentralusstage","displayName":"North + Central US (Stage)","regionalDisplayName":"(US) North Central US (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralusstage","name":"southcentralusstage","displayName":"South + Central US (Stage)","regionalDisplayName":"(US) South Central US (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westusstage","name":"westusstage","displayName":"West + US (Stage)","regionalDisplayName":"(US) West US (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2stage","name":"westus2stage","displayName":"West + US 2 (Stage)","regionalDisplayName":"(US) West US 2 (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"US"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/asia","name":"asia","displayName":"Asia","regionalDisplayName":"Asia","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/asiapacific","name":"asiapacific","displayName":"Asia + Pacific","regionalDisplayName":"Asia Pacific","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australia","name":"australia","displayName":"Australia","regionalDisplayName":"Australia","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazil","name":"brazil","displayName":"Brazil","regionalDisplayName":"Brazil","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canada","name":"canada","displayName":"Canada","regionalDisplayName":"Canada","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/europe","name":"europe","displayName":"Europe","regionalDisplayName":"Europe","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/global","name":"global","displayName":"Global","regionalDisplayName":"Global","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/india","name":"india","displayName":"India","regionalDisplayName":"India","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japan","name":"japan","displayName":"Japan","regionalDisplayName":"Japan","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uk","name":"uk","displayName":"United + Kingdom","regionalDisplayName":"United Kingdom","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/unitedstates","name":"unitedstates","displayName":"United + States","regionalDisplayName":"United States","metadata":{"regionType":"Logical","regionCategory":"Other"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasiastage","name":"eastasiastage","displayName":"East + Asia (Stage)","regionalDisplayName":"(Asia Pacific) East Asia (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"Asia + Pacific"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasiastage","name":"southeastasiastage","displayName":"Southeast + Asia (Stage)","regionalDisplayName":"(Asia Pacific) Southeast Asia (Stage)","metadata":{"regionType":"Logical","regionCategory":"Other","geographyGroup":"Asia + Pacific"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centraluseuap","name":"centraluseuap","displayName":"Central + US EUAP","regionalDisplayName":"(US) Central US EUAP","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"US","longitude":"-93.6208","latitude":"41.5908","pairedRegion":[{"name":"eastus2euap","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2euap"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2euap","name":"eastus2euap","displayName":"East + US 2 EUAP","regionalDisplayName":"(US) East US 2 EUAP","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"US","longitude":"-78.3889","latitude":"36.6681","pairedRegion":[{"name":"centraluseuap","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centraluseuap"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westcentralus","name":"westcentralus","displayName":"West + Central US","regionalDisplayName":"(US) West Central US","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"US","longitude":"-110.234","latitude":"40.890","physicalLocation":"Wyoming","pairedRegion":[{"name":"westus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus3","name":"westus3","displayName":"West + US 3","regionalDisplayName":"(US) West US 3","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"US","longitude":"-112.074036","latitude":"33.448376","physicalLocation":"Phoenix","pairedRegion":[{"name":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricawest","name":"southafricawest","displayName":"South + Africa West","regionalDisplayName":"(Africa) South Africa West","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Africa","longitude":"18.843266","latitude":"-34.075691","physicalLocation":"Cape + Town","pairedRegion":[{"name":"southafricanorth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricanorth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral","name":"australiacentral","displayName":"Australia + Central","regionalDisplayName":"(Asia Pacific) Australia Central","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"149.1244","latitude":"-35.3075","physicalLocation":"Canberra","pairedRegion":[{"name":"australiacentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral2","name":"australiacentral2","displayName":"Australia + Central 2","regionalDisplayName":"(Asia Pacific) Australia Central 2","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"149.1244","latitude":"-35.3075","physicalLocation":"Canberra","pairedRegion":[{"name":"australiacentral2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral2"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiasoutheast","name":"australiasoutheast","displayName":"Australia + Southeast","regionalDisplayName":"(Asia Pacific) Australia Southeast","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"144.9631","latitude":"-37.8136","physicalLocation":"Victoria","pairedRegion":[{"name":"australiaeast","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiaeast"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japanwest","name":"japanwest","displayName":"Japan + West","regionalDisplayName":"(Asia Pacific) Japan West","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"135.5022","latitude":"34.6939","physicalLocation":"Osaka","pairedRegion":[{"name":"japaneast","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japaneast"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth","name":"koreasouth","displayName":"Korea + South","regionalDisplayName":"(Asia Pacific) Korea South","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"129.0756","latitude":"35.1796","physicalLocation":"Busan","pairedRegion":[{"name":"koreacentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreacentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southindia","name":"southindia","displayName":"South + India","regionalDisplayName":"(Asia Pacific) South India","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"80.1636","latitude":"12.9822","physicalLocation":"Chennai","pairedRegion":[{"name":"centralindia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralindia"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westindia","name":"westindia","displayName":"West + India","regionalDisplayName":"(Asia Pacific) West India","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Asia + Pacific","longitude":"72.868","latitude":"19.088","physicalLocation":"Mumbai","pairedRegion":[{"name":"southindia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southindia"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadaeast","name":"canadaeast","displayName":"Canada + East","regionalDisplayName":"(Canada) Canada East","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Canada","longitude":"-71.217","latitude":"46.817","physicalLocation":"Quebec","pairedRegion":[{"name":"canadacentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadacentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francesouth","name":"francesouth","displayName":"France + South","regionalDisplayName":"(Europe) France South","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Europe","longitude":"2.1972","latitude":"43.8345","physicalLocation":"Marseille","pairedRegion":[{"name":"francecentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francecentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanynorth","name":"germanynorth","displayName":"Germany + North","regionalDisplayName":"(Europe) Germany North","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Europe","longitude":"8.806422","latitude":"53.073635","physicalLocation":"Berlin","pairedRegion":[{"name":"germanywestcentral","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanywestcentral"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwaywest","name":"norwaywest","displayName":"Norway + West","regionalDisplayName":"(Europe) Norway West","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Europe","longitude":"5.733107","latitude":"58.969975","physicalLocation":"Norway","pairedRegion":[{"name":"norwayeast","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwayeast"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandwest","name":"switzerlandwest","displayName":"Switzerland + West","regionalDisplayName":"(Europe) Switzerland West","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Europe","longitude":"6.143158","latitude":"46.204391","physicalLocation":"Geneva","pairedRegion":[{"name":"switzerlandnorth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandnorth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/ukwest","name":"ukwest","displayName":"UK + West","regionalDisplayName":"(Europe) UK West","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Europe","longitude":"-3.084","latitude":"53.427","physicalLocation":"Cardiff","pairedRegion":[{"name":"uksouth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uksouth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaecentral","name":"uaecentral","displayName":"UAE + Central","regionalDisplayName":"(Middle East) UAE Central","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"Middle + East","longitude":"54.366669","latitude":"24.466667","physicalLocation":"Abu + Dhabi","pairedRegion":[{"name":"uaenorth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaenorth"}]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilsoutheast","name":"brazilsoutheast","displayName":"Brazil + Southeast","regionalDisplayName":"(South America) Brazil Southeast","metadata":{"regionType":"Physical","regionCategory":"Other","geographyGroup":"South + America","longitude":"-43.2075","latitude":"-22.90278","physicalLocation":"Rio","pairedRegion":[{"name":"brazilsouth","id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilsouth"}]}}]}' + headers: + cache-control: + - no-cache + content-length: + - '26028' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:45:45 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: '{"sku": {"name": "Linked"}, "properties": {"monitoringStatus": "Enabled", + "datadogOrganizationProperties": {"apiKey": "000000", + "applicationKey": "00000000"}, "userInfo": {"name": + "Alice", "emailAddress": "alice@microsoft.com", "phoneNumber": "123-456-7890"}}, + "identity": {"type": "SystemAssigned"}, "tags": {"Environment": "Dev"}, "location": + "eastus2euap"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - datadog monitor create + Connection: + - keep-alive + Content-Length: + - '417' + Content-Type: + - application/json + ParameterSetName: + - --name --sku-name --datadog-organization-properties --location --type --user-info + --tags --resource-group + User-Agent: + - AZURECLI/2.17.1 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 + (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"microsoft.datadog/monitors","sku":{"name":"Linked"},"location":"eastus2euap","tags":{"Environment":"Dev"},"systemData":{"createdBy":"limgu@microsoft.com","createdByType":"User","createdAt":"2021-03-27T00:45:46.8072643Z","lastModifiedBy":"limgu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-03-27T00:45:46.8072643Z"},"identity":{"principalId":"1c358b6b-d136-4835-8cb2-ba3245c00a5e","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Accepted","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Provisioning","datadogOrganizationProperties":{"name":"myMonitor","id":null,"linkingAuthCode":null,"linkingClientId":null,"redirectUri":null,"apiKey":null,"applicationKey":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/c94d288c-892f-48d2-9f30-b38ae92caee2?api-version=2021-03-01 + cache-control: + - no-cache + content-length: + - '1092' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:45:49 GMT + etag: + - '"00008997-0000-3400-0000-605e803d0000"' + expires: + - '-1' + location: + - https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/c94d288c-892f-48d2-9f30-b38ae92caee2?api-version=2021-03-01 + pragma: + - no-cache + request-context: + - appId=cid-v1:0b211baa-00db-496b-b625-0e3961b2c5bd + 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: + - datadog monitor create + Connection: + - keep-alive + ParameterSetName: + - --name --sku-name --datadog-organization-properties --location --type --user-info + --tags --resource-group + User-Agent: + - AZURECLI/2.17.1 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/c94d288c-892f-48d2-9f30-b38ae92caee2?api-version=2021-03-01 + response: + body: + string: '{"id":"/providers/Microsoft.Datadog/locations/EASTUS2EUAP/operationStatuses/c94d288c-892f-48d2-9f30-b38ae92caee2","name":"c94d288c-892f-48d2-9f30-b38ae92caee2","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","status":"Succeeded","startTime":"2021-03-27T00:45:48.4319132Z","endTime":"2021-03-27T00:46:00.8010035Z","error":{},"properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '499' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:46:19 GMT + etag: + - '"02003ee3-0000-3400-0000-605e80480000"' + 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: + - datadog monitor create + Connection: + - keep-alive + ParameterSetName: + - --name --sku-name --datadog-organization-properties --location --type --user-info + --tags --resource-group + User-Agent: + - AZURECLI/2.17.1 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"microsoft.datadog/monitors","sku":{"name":"Linked"},"location":"eastus2euap","tags":{"Environment":"Dev"},"systemData":{"createdBy":"limgu@microsoft.com","createdByType":"User","createdAt":"2021-03-27T00:45:46.8072643Z","lastModifiedBy":"ae11f5fb-c627-4eec-b4a0-f7b5969426e5","lastModifiedByType":"Application","lastModifiedAt":"2021-03-27T00:45:59.5597746Z"},"identity":{"principalId":"1c358b6b-d136-4835-8cb2-ba3245c00a5e","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"test325212","id":"ndvplqultx44t044","linkingAuthCode":null,"linkingClientId":null,"redirectUri":null,"apiKey":null,"applicationKey":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' + headers: + cache-control: + - no-cache + content-length: + - '1126' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:46:19 GMT + etag: + - '"00008c97-0000-3400-0000-605e80480000"' + 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": {"roleDefinitionId": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/43d0d8ad-25c7-4714-9337-8ba259a9fe05", + "principalId": "1c358b6b-d136-4835-8cb2-ba3245c00a5e", "principalType": "ServicePrincipal"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - datadog monitor create + Connection: + - keep-alive + Content-Length: + - '270' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --name --sku-name --datadog-organization-properties --location --type --user-info + --tags --resource-group + User-Agent: + - python/3.7.8 (Windows-10-10.0.19041-SP0) msrest/0.6.19 msrest_azure/0.6.4 + azure-mgmt-authorization/0.61.0 Azure-SDK-For-Python AZURECLI/2.17.1 (MSI) + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleAssignments/88888888-0000-0000-0000-000000000002?api-version=2020-04-01-preview + response: + body: + string: '{"properties":{"roleDefinitionId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/43d0d8ad-25c7-4714-9337-8ba259a9fe05","principalId":"1c358b6b-d136-4835-8cb2-ba3245c00a5e","principalType":"ServicePrincipal","scope":"/subscriptions/00000000-0000-0000-0000-000000000000","condition":null,"conditionVersion":null,"createdOn":"2021-03-27T00:46:20.6463323Z","updatedOn":"2021-03-27T00:46:20.9063332Z","createdBy":null,"updatedBy":"4290ae1b-4f92-4dc9-81fe-fab805a38536","delegatedManagedIdentityResourceId":null,"description":null},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleAssignments/88888888-0000-0000-0000-000000000001","type":"Microsoft.Authorization/roleAssignments","name":"88888888-0000-0000-0000-000000000001"}' + headers: + cache-control: + - no-cache + content-length: + - '823' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:46:21 GMT + expires: + - '-1' + pragma: + - no-cache + set-cookie: + - x-ms-gateway-slice=Production; path=/; secure; samesite=none; httponly + 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: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - datadog monitor wait + Connection: + - keep-alive + ParameterSetName: + - --created --name --resource-group + User-Agent: + - AZURECLI/2.17.1 (MSI) azsdk-python-microsoftdatadogclient/unknown Python/3.7.8 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor?api-version=2021-03-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Datadog/monitors/myMonitor","name":"myMonitor","type":"microsoft.datadog/monitors","sku":{"name":"Linked"},"location":"eastus2euap","tags":{"Environment":"Dev"},"systemData":{"createdBy":"limgu@microsoft.com","createdByType":"User","createdAt":"2021-03-27T00:45:46.8072643Z","lastModifiedBy":"ae11f5fb-c627-4eec-b4a0-f7b5969426e5","lastModifiedByType":"Application","lastModifiedAt":"2021-03-27T00:45:59.5597746Z"},"identity":{"principalId":"1c358b6b-d136-4835-8cb2-ba3245c00a5e","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","monitoringStatus":"Enabled","marketplaceSubscriptionStatus":"Active","datadogOrganizationProperties":{"name":"test325212","id":"ndvplqultx44t044","linkingAuthCode":null,"linkingClientId":null,"redirectUri":null,"apiKey":null,"applicationKey":null,"enterpriseAppId":null},"userInfo":null,"liftrResourceCategory":"MonitorLogs","liftrResourcePreference":0}}' + headers: + cache-control: + - no-cache + content-length: + - '1126' + content-type: + - application/json; charset=utf-8 + date: + - Sat, 27 Mar 2021 00:46:22 GMT + etag: + - '"00008c97-0000-3400-0000-605e80480000"' + 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 version: 1 diff --git a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py index d92b9dea80f..071d01d3893 100644 --- a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -32,18 +32,17 @@ def step__monitors_put_monitors_create(test, rg): '--name "{myMonitor}" ' '--sku-name "drawdown_testing_20200904_Monthly" ' '--location "East US 2 EUAP" ' - '--identity-type "SystemAssigned" ' - '--monitoring-status "Enabled" ' + '--type "SystemAssigned" ' '--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" ' '--tags Environment="Dev" ' '--resource-group "{rg}"', checks=[ test.check("name", "{myMonitor}", case_sensitive=False), - test.check("nameSkuName", "drawdown_testing_20200904_Monthly", case_sensitive=False), + test.check("sku.name", "drawdown_testing_20200904_Monthly", case_sensitive=False), test.check("location", "eastus2euap", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), - test.check("monitoringStatus", "Enabled", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.monitoringStatus", "Enabled", case_sensitive=False), + test.check("properties.provisioningState", "Succeeded", case_sensitive=False), test.check("tags.Environment", "Dev", case_sensitive=False), ]) test.cmd('az datadog monitor wait --created ' @@ -60,11 +59,11 @@ def step__monitors_get_monitors_get(test, rg): '--resource-group "{rg}"', checks=[ test.check("name", "{myMonitor}", case_sensitive=False), - test.check("nameSkuName", "drawdown_testing_20200904_Monthly", case_sensitive=False), + test.check("sku.name", "drawdown_testing_20200904_Monthly", case_sensitive=False), test.check("location", "eastus2euap", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), - test.check("monitoringStatus", "Enabled", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.monitoringStatus", "Enabled", case_sensitive=False), + test.check("properties.provisioningState", "Succeeded", case_sensitive=False), test.check("tags.Environment", "Dev", case_sensitive=False), ]) @@ -94,16 +93,15 @@ def step__monitors_get_monitors_listbyresourcegroup(test, rg): def step__monitors_patch_monitors_update(test, rg): test.cmd('az datadog monitor update ' '--name "{myMonitor}" ' - '--monitoring-status "Enabled" ' '--tags Environment="Dev2" ' '--resource-group "{rg}"', checks=[ test.check("name", "{myMonitor}", case_sensitive=False), - test.check("nameSkuName", "drawdown_testing_20200904_Monthly", case_sensitive=False), + test.check("sku.name", "drawdown_testing_20200904_Monthly", case_sensitive=False), test.check("location", "eastus2euap", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), - test.check("monitoringStatus", "Enabled", case_sensitive=False), - test.check("marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.monitoringStatus", "Enabled", case_sensitive=False), + test.check("properties.provisioningState", "Succeeded", case_sensitive=False), test.check("tags.Environment", "Dev2", case_sensitive=False), ]) @@ -111,7 +109,7 @@ def step__monitors_patch_monitors_update(test, rg): # EXAMPLE: /ApiKeys/post/ApiKeys_GetDefaultKey @try_manual def step__apikeys_post_apikeys_getdefaultkey(test, rg): - test.cmd('az datadog api-key get-default-key ' + test.cmd('az datadog monitor get-default-key ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[ @@ -122,7 +120,7 @@ def step__apikeys_post_apikeys_getdefaultkey(test, rg): # EXAMPLE: /ApiKeys/post/ApiKeys_List @try_manual def step__apikeys_post_apikeys_list(test, rg): - test.cmd('az datadog api-key list ' + test.cmd('az datadog monitor list-api-key ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[ @@ -133,7 +131,7 @@ def step__apikeys_post_apikeys_list(test, rg): # EXAMPLE: /ApiKeys/post/ApiKeys_SetDefaultKey @try_manual def step__apikeys_post_apikeys_setdefaultkey(test, rg): - test.cmd('az datadog api-key set-default-key ' + test.cmd('az datadog monitor set-default-key ' '--monitor-name "{myMonitor}" ' '--key "1111111111111111aaaaaaaaaaaaaaaa" ' '--resource-group "{rg}"', @@ -143,7 +141,7 @@ def step__apikeys_post_apikeys_setdefaultkey(test, rg): # EXAMPLE: /Hosts/post/Hosts_List @try_manual def step__hosts_post_hosts_list(test, rg): - test.cmd('az datadog host list ' + test.cmd('az datadog monitor list-host ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[]) @@ -152,7 +150,7 @@ def step__hosts_post_hosts_list(test, rg): # EXAMPLE: /LinkedResources/post/LinkedResources_List @try_manual def step__linkedresources_post_linkedresources_list(test, rg): - test.cmd('az datadog linked-resource list ' + test.cmd('az datadog monitor list-linked-resource ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[ @@ -163,7 +161,7 @@ def step__linkedresources_post_linkedresources_list(test, rg): # EXAMPLE: /MonitoredResources/post/MonitoredResources_List @try_manual def step__monitoredresources_post(test, rg): - test.cmd('az datadog monitored-resource list ' + test.cmd('az datadog monitor list-monitored-resource ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[]) @@ -172,7 +170,7 @@ def step__monitoredresources_post(test, rg): # EXAMPLE: /RefreshSetPassword/post/RefreshSetPassword_Get @try_manual def step__refreshsetpassword_post(test, rg): - test.cmd('az datadog set-password-link get ' + test.cmd('az datadog monitor refresh-set-password-link ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', checks=[ @@ -222,9 +220,9 @@ def step__tagrules_put_tagrules_createorupdate(test, rg): '--monitor-name "{myMonitor}" ' '--log-rules-filtering-tags name="Environment" action="Include" value="Prod" ' '--log-rules-filtering-tags name="Environment" action="Exclude" value="Dev" ' - '--log-rules-send-aad-logs false ' - '--log-rules-send-resource-logs true ' - '--log-rules-send-subscription-logs true ' + '--send-aad-logs false ' + '--send-resource-logs true ' + '--send-subscription-logs true ' '--resource-group "{rg}" ' '--rule-set-name "default"', checks=[ @@ -274,6 +272,35 @@ def step__terms_list(test, rg): ]) +@try_manual +def step__monitors_put_monitors_create_link(test, rg): + with mock.patch('azure.cli.command_modules.role.custom._gen_guid', side_effect=test.create_guid): + test.cmd('az datadog monitor create ' + '--name "{myMonitor}" ' + '--sku-name "Linked" ' + '--datadog-organization-properties ' + 'api-key=000000 ' + 'application-key=00000000 ' + '--location "East US 2 EUAP" ' + '--type "SystemAssigned" ' + '--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("sku.name", "Linked", case_sensitive=False), + test.check("location", "eastus2euap", case_sensitive=False), + test.check("properties.marketplaceSubscriptionStatus", "Active", case_sensitive=False), + test.check("properties.monitoringStatus", "Enabled", case_sensitive=False), + test.check("properties.provisioningState", "Succeeded", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + test.cmd('az datadog monitor wait --created ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + @try_manual def cleanup(test, rg): pass @@ -302,6 +329,7 @@ def call_scenario(test, rg): step__apikeys_post_apikeys_getdefaultkey(test, rg) step__monitors_delete_monitors_delete(test, rg) step__terms_list(test, rg) + step__monitors_put_monitors_create_link(test, rg) cleanup(test, rg) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py b/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py index 456fc5ca871..3b844c5adca 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py @@ -28,7 +28,7 @@ class MicrosoftDatadogClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -47,9 +47,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-02-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'microsoftdatadogclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py b/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py index 72160660d16..d557b59868e 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py @@ -19,15 +19,10 @@ from ._configuration import MicrosoftDatadogClientConfiguration from .operations import MarketplaceAgreementsOperations -from .operations import ApiKeyOperations -from .operations import HostOperations -from .operations import LinkedResourceOperations -from .operations import MonitoredResourceOperations -from .operations import OperationOperations -from .operations import MonitorOperations -from .operations import RefreshSetPasswordOperations -from .operations import TagRuleOperations -from .operations import SingleSignOnConfigurationOperations +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations from . import models @@ -36,27 +31,17 @@ class MicrosoftDatadogClient(object): :ivar marketplace_agreements: MarketplaceAgreementsOperations operations :vartype marketplace_agreements: microsoft_datadog_client.operations.MarketplaceAgreementsOperations - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.operations.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.operations.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.operations.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.operations.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.operations.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.operations.MonitorOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.operations.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.operations.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.operations.SingleSignOnConfigurationOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :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. @@ -81,23 +66,13 @@ def __init__( self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize) - self.api_key = ApiKeyOperations( + self.monitors = MonitorsOperations( self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( + self.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rule = TagRuleOperations( - self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( + self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py index 3b629c26f27..b43d36247a5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_datadog_client_async import MicrosoftDatadogClient +from ._microsoft_datadog_client import MicrosoftDatadogClient __all__ = ['MicrosoftDatadogClient'] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py index e2d16a4bf3e..f4e5b7f1f0d 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py @@ -26,7 +26,7 @@ class MicrosoftDatadogClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -44,9 +44,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-02-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'microsoftdatadogclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py new file mode 100644 index 00000000000..c378a32e2f2 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py @@ -0,0 +1,83 @@ +# 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 MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations +from .. import models + + +class MicrosoftDatadogClient(object): + """MicrosoftDatadogClient. + + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.aio.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.aio.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.aio.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.aio.operations.SingleSignOnConfigurationsOperations + :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 = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.marketplace_agreements = MarketplaceAgreementsOperations( + self._client, self._config, self._serialize, self._deserialize) + 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_configurations = SingleSignOnConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MicrosoftDatadogClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py deleted file mode 100644 index 7b6366c0e29..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py +++ /dev/null @@ -1,103 +0,0 @@ -# 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_async import MicrosoftDatadogClientConfiguration -from .operations_async import ApiKeyOperations -from .operations_async import HostOperations -from .operations_async import LinkedResourceOperations -from .operations_async import MonitoredResourceOperations -from .operations_async import OperationOperations -from .operations_async import MonitorOperations -from .operations_async import RefreshSetPasswordOperations -from .operations_async import TagRuleOperations -from .operations_async import SingleSignOnConfigurationOperations -from .. import models - - -class MicrosoftDatadogClient(object): - """MicrosoftDatadogClient. - - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.aio.operations_async.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.aio.operations_async.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.aio.operations_async.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.aio.operations_async.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.aio.operations_async.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.aio.operations_async.MonitorOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.aio.operations_async.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.aio.operations_async.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.aio.operations_async.SingleSignOnConfigurationOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. - :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 = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.api_key = ApiKeyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( - self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rule = TagRuleOperations( - self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MicrosoftDatadogClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py new file mode 100644 index 00000000000..b2edc8eaf2d --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._marketplace_agreements_operations import MarketplaceAgreementsOperations +from ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations + +__all__ = [ + 'MarketplaceAgreementsOperations', + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', +] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py new file mode 100644 index 00000000000..f8e23530dd3 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py @@ -0,0 +1,175 @@ +# 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 MarketplaceAgreementsOperations: + """MarketplaceAgreementsOperations 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_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogAgreementResourceListResponse"]: + """List Datadog marketplace agreements in the subscription. + + List Datadog marketplace agreements in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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), + } + 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('DatadogAgreementResourceListResponse', 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}/providers/Microsoft.Datadog/agreements'} # type: ignore + + async def create_or_update( + self, + body: Optional["models.DatadogAgreementResource"] = None, + **kwargs + ) -> "models.DatadogAgreementResource": + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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), + } + 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, 'DatadogAgreementResource') + 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('DatadogAgreementResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py new file mode 100644 index 00000000000..c485d529446 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py @@ -0,0 +1,1063 @@ +# 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_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_api_keys( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogApiKeyListResponse"]: + """List the api keys for a given monitor resource. + + List the api keys 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 DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_api_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogApiKeyListResponse', 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + async def get_default_key( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogApiKey": + """Get the default api key. + + Get the default api key. + + :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: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + async def set_default_key( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogApiKey"] = None, + **kwargs + ) -> None: + """Set the default api key. + + Set the default api key. + + :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_datadog_client.models.DatadogApiKey + :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 = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogHostListResponse"]: + """List the hosts for a given monitor resource. + + List the hosts 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 DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogHostListResponse', 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.LinkedResourceListResponse"]: + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target 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 LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_linked_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedResourceListResponse', 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Datadog monitor resource. + + List the resources currently being monitored by the Datadog 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_datadog_client.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 = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: + """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 DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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), + } + 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('DatadogMonitorResourceListResponse', 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}/providers/Microsoft.Datadog/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: + """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 DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', 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.Datadog/monitors'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogMonitorResource": + """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: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResource"] = None, + **kwargs + ) -> "models.DatadogMonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResource') + 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('DatadogMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.DatadogMonitorResource"]: + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource + :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 DatadogMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + 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('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResourceUpdateParameters"] = None, + **kwargs + ) -> "models.DatadogMonitorResource": + """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_datadog_client.models.DatadogMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + 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('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/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 = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, 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.Datadog/monitors/{monitorName}'} # type: ignore + + async def refresh_set_password_link( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogSetPasswordLink": + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :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: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py similarity index 87% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py index e49ef087be6..a50ee92b7bf 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +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. @@ -45,9 +45,9 @@ def list( self, **kwargs ) -> AsyncIterable["models.OperationListResult"]: - """List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + """List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. :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) @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -92,7 +95,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py similarity index 82% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py index 049816a80b3..79838a3df58 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations: - """SingleSignOnConfigurationOperations async operations. +class SingleSignOnConfigurationsOperations: + """SingleSignOnConfigurationsOperations 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. @@ -53,8 +53,7 @@ def list( List the single sign-on configurations for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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 @@ -64,21 +63,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -107,7 +109,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) @@ -123,22 +125,23 @@ async def _create_or_update_initial( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> "models.DatadogSingleSignOnResource": cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -151,22 +154,21 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + 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, 'DatadogSingleSignOnResource') + if body is not None: + body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -186,22 +188,21 @@ async def begin_create_or_update( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> AsyncLROPoller["models.DatadogSingleSignOnResource"]: """Configures single-sign-on for this resource. Configures single-sign-on for this resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param configuration_name: Configuration name. :type configuration_name: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :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 @@ -224,7 +225,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -239,7 +240,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,12 +272,11 @@ async def get( Gets the datadog single sign-on resource for the given Monitor. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) @@ -277,15 +284,18 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -297,7 +307,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -305,7 +315,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py similarity index 74% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py index d6e840c774e..972b816ad93 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py @@ -5,11 +5,11 @@ # 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, List, Optional, TypeVar +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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TagRuleOperations: - """TagRuleOperations async operations. +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. @@ -51,8 +51,7 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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 @@ -62,21 +61,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -105,7 +107,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) @@ -121,61 +123,40 @@ async def create_or_update( resource_group_name: str, monitor_name: str, rule_set_name: str, - filtering_tags: Optional[List["models.FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - log_rules_filtering_tags: Optional[List["models.FilteringTag"]] = None, + 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 to which the Datadog resource - belongs. + :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: + :param rule_set_name: Rule set name. :type rule_set_name: str - :param filtering_tags: List of filtering tags to be used for capturing metrics. 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_datadog_client.models.FilteringTag] - :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 Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs 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 log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.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_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -188,22 +169,21 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + 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') + 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -225,12 +205,11 @@ async def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) @@ -238,15 +217,18 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -258,7 +240,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -266,7 +248,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py deleted file mode 100644 index c164696fbc8..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 ._api_key_operations_async import ApiKeyOperations -from ._host_operations_async import HostOperations -from ._linked_resource_operations_async import LinkedResourceOperations -from ._monitored_resource_operations_async import MonitoredResourceOperations -from ._operation_operations_async import OperationOperations -from ._monitor_operations_async import MonitorOperations -from ._refresh_set_password_operations_async import RefreshSetPasswordOperations -from ._tag_rule_operations_async import TagRuleOperations -from ._single_sign_on_configuration_operations_async import SingleSignOnConfigurationOperations - -__all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', - 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', -] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py deleted file mode 100644 index ab42f19d5cd..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py +++ /dev/null @@ -1,254 +0,0 @@ -# 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 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 ApiKeyOperations: - """ApiKeyOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogApiKeyListResponse"]: - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('DatadogApiKeyListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore - - async def get_default_key( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogApiKey": - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - async def set_default_key( - self, - resource_group_name: str, - monitor_name: str, - key: str, - created_by: Optional[str] = None, - name: Optional[str] = None, - created: Optional[str] = None, - **kwargs - ) -> None: - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param key: The value of the API key. - :type key: str - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param created: The time of creation of the API key. - :type created: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogApiKey(created_by=created_by, name=name, key=key, created=created) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py deleted file mode 100644 index f219da6c04b..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# 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 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 HostOperations: - """HostOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogHostListResponse"]: - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('DatadogHostListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listHosts'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py deleted file mode 100644 index dc1dd4956fa..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# 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 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 LinkedResourceOperations: - """LinkedResourceOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.LinkedResourceListResponse"]: - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('LinkedResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py deleted file mode 100644 index 8b7176e59b4..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py +++ /dev/null @@ -1,588 +0,0 @@ -# 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 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 MonitorOperations: - """MonitorOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: - """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 DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - } - 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('DatadogMonitorResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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}/providers/Microsoft.Datadog/monitors'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: - """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 to which the Datadog resource - belongs. - :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 DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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('DatadogMonitorResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors'} # type: ignore - - async def get( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogMonitorResource": - """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 to which the Datadog resource - belongs. - :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: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, - **kwargs - ) -> "models.DatadogMonitorResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResource(tags=tags, location=location, type_identity_type=type, provisioning_state=provisioning_state, monitoring_status=monitoring_status, marketplace_subscription_status=marketplace_subscription_status, datadog_organization_properties=datadog_organization_properties, user_info=user_info, name_sku_name=name) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResource') - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, - **kwargs - ) -> AsyncLROPoller["models.DatadogMonitorResource"]: - """Create a monitor resource. - - Create a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param location: - :type location: str - :param tags: Dictionary of :code:``. - :type tags: dict[str, str] - :param type: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.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. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type 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 DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - 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, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=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): - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - monitor_name: str, - tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - **kwargs - ) -> "models.DatadogMonitorResource": - """Update a monitor resource. - - Update a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param tags: The new tags of the monitor resource. - :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResourceUpdateParameters') - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/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 = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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] - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete a monitor resource. - - Delete a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **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.Datadog/monitors/{monitorName}'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py deleted file mode 100644 index 50b609ec8b3..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# 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 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 MonitoredResourceOperations: - """MonitoredResourceOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.MonitoredResourceListResponse"]: - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py deleted file mode 100644 index d57e456daab..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import 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 RefreshSetPasswordOperations: - """RefreshSetPasswordOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogSetPasswordLink": - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py index b284d0dec46..68e79e98bcc 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py @@ -25,18 +25,27 @@ from ._models_py3 import DatadogSingleSignOnProperties from ._models_py3 import DatadogSingleSignOnResource from ._models_py3 import DatadogSingleSignOnResourceListResponse - from ._models_py3 import ErrorResponseBody + 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 LinkedResource from ._models_py3 import LinkedResourceListResponse + from ._models_py3 import LogRules + from ._models_py3 import MetricRules + 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 ResourceProviderDefaultErrorResponse + from ._models_py3 import ResourceSku + from ._models_py3 import SystemData from ._models_py3 import UserInfo except (SyntaxError, ImportError): from ._models import DatadogAgreementProperties # type: ignore @@ -57,21 +66,31 @@ from ._models import DatadogSingleSignOnProperties # type: ignore from ._models import DatadogSingleSignOnResource # type: ignore from ._models import DatadogSingleSignOnResourceListResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore + 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 LinkedResource # type: ignore from ._models import LinkedResourceListResponse # type: ignore + from ._models import LogRules # type: ignore + from ._models import MetricRules # 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 ResourceProviderDefaultErrorResponse # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import SystemData # type: ignore from ._models import UserInfo # type: ignore from ._microsoft_datadog_client_enums import ( + CreatedByType, LiftrResourceCategories, ManagedIdentityTypes, MarketplaceSubscriptionStatus, @@ -82,6 +101,9 @@ ) __all__ = [ + 'DatadogAgreementProperties', + 'DatadogAgreementResource', + 'DatadogAgreementResourceListResponse', 'DatadogApiKey', 'DatadogApiKeyListResponse', 'DatadogHost', @@ -97,19 +119,29 @@ 'DatadogSingleSignOnProperties', 'DatadogSingleSignOnResource', 'DatadogSingleSignOnResourceListResponse', - 'ErrorResponseBody', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'FilteringTag', + 'IdentityProperties', 'LinkedResource', 'LinkedResourceListResponse', + 'LogRules', + 'MetricRules', + 'MonitorProperties', + 'MonitorUpdateProperties', 'MonitoredResource', 'MonitoredResourceListResponse', 'MonitoringTagRules', 'MonitoringTagRulesListResponse', + 'MonitoringTagRulesProperties', 'OperationDisplay', 'OperationListResult', 'OperationResult', - 'ResourceProviderDefaultErrorResponse', + 'ResourceSku', + 'SystemData', 'UserInfo', + 'CreatedByType', 'LiftrResourceCategories', 'ManagedIdentityTypes', 'MarketplaceSubscriptionStatus', diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py index 7e344646af0..eba8198b7a4 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py @@ -26,12 +26,23 @@ def __getattr__(cls, name): 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" @@ -41,8 +52,10 @@ class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str time, the resource will go in Suspended state. """ + PROVISIONING = "Provisioning" ACTIVE = "Active" SUSPENDED = "Suspended" + UNSUBSCRIBED = "Unsubscribed" class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying if the resource monitoring is enabled or disabled. diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py index a9e68644d9e..02652c08a90 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py @@ -71,12 +71,15 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype type: str :param properties: Represents the properties of the resource. :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -84,6 +87,7 @@ class DatadogAgreementResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -95,6 +99,7 @@ def __init__( self.name = None self.type = None self.properties = kwargs.get('properties', None) + self.system_data = None class DatadogAgreementResourceListResponse(msrest.serialization.Model): @@ -320,39 +325,18 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :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_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { @@ -360,29 +344,19 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -393,19 +367,12 @@ def __init__( self.id = None self.name = None self.type = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + self.identity = kwargs.get('identity', None) self.tags = kwargs.get('tags', None) self.location = kwargs['location'] - self.principal_id = None - self.tenant_id = None - self.type_identity_type = kwargs.get('type_identity_type', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.monitoring_status = kwargs.get('monitoring_status', None) - self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', None) - self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) - self.user_info = kwargs.get('user_info', None) - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = kwargs.get('name_sku_name', None) + self.system_data = None class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -434,16 +401,16 @@ def __init__( class DatadogMonitorResourceUpdateParameters(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_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( @@ -451,12 +418,12 @@ def __init__( **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) self.tags = kwargs.get('tags', None) - self.monitoring_status = kwargs.get('monitoring_status', None) class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -469,6 +436,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -483,6 +456,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -495,6 +471,9 @@ def __init__( self.id = None self.linking_auth_code = kwargs.get('linking_auth_code', None) self.linking_client_id = kwargs.get('linking_client_id', None) + self.redirect_uri = kwargs.get('redirect_uri', None) + self.api_key = kwargs.get('api_key', None) + self.application_key = kwargs.get('application_key', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) @@ -520,16 +499,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :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_datadog_client.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 Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -540,9 +529,10 @@ def __init__( **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) 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.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -558,12 +548,15 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype type: str :param properties: :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -571,6 +564,7 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogSingleSignOnProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -582,6 +576,7 @@ def __init__( self.name = None self.type = None self.properties = kwargs.get('properties', None) + self.system_data = None class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): @@ -607,35 +602,98 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class ErrorResponseBody(msrest.serialization.Model): - """ErrorResponseBody. +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. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~microsoft_datadog_client.models.ErrorResponseBody] + :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_datadog_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_datadog_client.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': '[ErrorResponseBody]'}, + '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_datadog_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class FilteringTag(msrest.serialization.Model): @@ -666,6 +724,40 @@ def __init__( 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_datadog_client.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 LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -708,6 +800,64 @@ def __init__( self.next_link = kwargs.get('next_link', 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 Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs 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_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', '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_resource_logs = kwargs.get('send_resource_logs', None) + self.filtering_tags = kwargs.get('filtering_tags', None) + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. 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_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = kwargs.get('filtering_tags', None) + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -779,44 +929,25 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. 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_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :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 Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs 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_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _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'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -827,11 +958,8 @@ def __init__( self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = kwargs.get('filtering_tags_properties_metric_rules_filtering_tags', None) - self.send_aad_logs = kwargs.get('send_aad_logs', None) - self.send_subscription_logs = kwargs.get('send_subscription_logs', None) - self.send_resource_logs = kwargs.get('send_resource_logs', None) - self.filtering_tags_properties_log_rules_filtering_tags = kwargs.get('filtering_tags_properties_log_rules_filtering_tags', None) + self.properties = kwargs.get('properties', None) + self.system_data = None class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -857,6 +985,112 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.log_rules = kwargs.get('log_rules', None) + self.metric_rules = kwargs.get('metric_rules', 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. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.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_datadog_client.models.MonitoringStatus + :ivar 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: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'marketplace_subscription_status': {'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'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + '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 = kwargs.get('provisioning_state', None) + self.monitoring_status = kwargs.get('monitoring_status', "Enabled") + self.marketplace_subscription_status = None + self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) + self.user_info = kwargs.get('user_info', 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_datadog_client.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. @@ -938,27 +1172,74 @@ def __init__( self.is_data_action = kwargs.get('is_data_action', None) -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """ResourceProviderDefaultErrorResponse. +class ResourceSku(msrest.serialization.Model): + """ResourceSku. - :param error: - :type error: ~microsoft_datadog_client.models.ErrorResponseBody + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +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_datadog_client.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_datadog_client.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. + """User info. :param name: Name of the user. :type name: str diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py index 25bd10eff4a..c06931d8361 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py @@ -85,12 +85,15 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype type: str :param properties: Represents the properties of the resource. :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -98,6 +101,7 @@ class DatadogAgreementResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -111,6 +115,7 @@ def __init__( self.name = None self.type = None self.properties = properties + self.system_data = None class DatadogAgreementResourceListResponse(msrest.serialization.Model): @@ -365,39 +370,18 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :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_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { @@ -405,62 +389,41 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, *, location: str, + sku: Optional["ResourceSku"] = None, + properties: Optional["MonitorProperties"] = None, + identity: Optional["IdentityProperties"] = None, tags: Optional[Dict[str, str]] = None, - type_identity_type: Optional[Union[str, "ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, - user_info: Optional["UserInfo"] = None, - name_sku_name: Optional[str] = None, **kwargs ): super(DatadogMonitorResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.sku = sku + self.properties = properties + self.identity = identity self.tags = tags self.location = location - self.principal_id = None - self.tenant_id = None - self.type_identity_type = type_identity_type - self.provisioning_state = provisioning_state - self.monitoring_status = monitoring_status - self.marketplace_subscription_status = marketplace_subscription_status - self.datadog_organization_properties = datadog_organization_properties - self.user_info = user_info - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = name_sku_name + self.system_data = None class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -492,32 +455,32 @@ def __init__( class DatadogMonitorResourceUpdateParameters(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_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( self, *, + properties: Optional["MonitorUpdateProperties"] = None, tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = properties self.tags = tags - self.monitoring_status = monitoring_status class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,6 +493,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -544,6 +513,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -552,6 +524,9 @@ def __init__( *, linking_auth_code: Optional[str] = None, linking_client_id: Optional[str] = None, + redirect_uri: Optional[str] = None, + api_key: Optional[str] = None, + application_key: Optional[str] = None, enterprise_app_id: Optional[str] = None, **kwargs ): @@ -560,6 +535,9 @@ def __init__( self.id = None self.linking_auth_code = linking_auth_code self.linking_client_id = linking_client_id + self.redirect_uri = redirect_uri + self.api_key = api_key + self.application_key = application_key self.enterprise_app_id = enterprise_app_id @@ -587,16 +565,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :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_datadog_client.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 Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -605,15 +593,16 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): def __init__( self, *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, - single_sign_on_url: Optional[str] = None, **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state 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.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -629,12 +618,15 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype type: str :param properties: :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -642,6 +634,7 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogSingleSignOnProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -655,6 +648,7 @@ def __init__( self.name = None self.type = None self.properties = properties + self.system_data = None class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): @@ -683,40 +677,100 @@ def __init__( self.next_link = next_link -class ErrorResponseBody(msrest.serialization.Model): - """ErrorResponseBody. +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. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~microsoft_datadog_client.models.ErrorResponseBody] + 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_datadog_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_datadog_client.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': '[ErrorResponseBody]'}, + '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_datadog_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["ErrorResponseBody"]] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class FilteringTag(msrest.serialization.Model): @@ -751,6 +805,42 @@ def __init__( 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_datadog_client.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 LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -798,6 +888,71 @@ def __init__( self.next_link = next_link +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 Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs 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_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + send_aad_logs: Optional[bool] = None, + send_subscription_logs: Optional[bool] = None, + send_resource_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_resource_logs = send_resource_logs + self.filtering_tags = filtering_tags + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. 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_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = filtering_tags + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -878,65 +1033,39 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. 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_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :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 Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs 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_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _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'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, *, - filtering_tags_properties_metric_rules_filtering_tags: Optional[List["FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - filtering_tags_properties_log_rules_filtering_tags: Optional[List["FilteringTag"]] = None, + properties: Optional["MonitoringTagRulesProperties"] = None, **kwargs ): super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = filtering_tags_properties_metric_rules_filtering_tags - self.send_aad_logs = send_aad_logs - self.send_subscription_logs = send_subscription_logs - self.send_resource_logs = send_resource_logs - self.filtering_tags_properties_log_rules_filtering_tags = filtering_tags_properties_log_rules_filtering_tags + self.properties = properties + self.system_data = None class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -965,6 +1094,123 @@ def __init__( self.next_link = next_link +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + log_rules: Optional["LogRules"] = None, + metric_rules: Optional["MetricRules"] = None, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.log_rules = log_rules + self.metric_rules = metric_rules + + +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. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.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_datadog_client.models.MonitoringStatus + :ivar 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: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'marketplace_subscription_status': {'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'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", + datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, + user_info: Optional["UserInfo"] = None, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.monitoring_status = monitoring_status + self.marketplace_subscription_status = None + self.datadog_organization_properties = datadog_organization_properties + self.user_info = user_info + 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_datadog_client.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. @@ -1058,29 +1304,83 @@ def __init__( self.is_data_action = is_data_action -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """ResourceProviderDefaultErrorResponse. +class ResourceSku(msrest.serialization.Model): + """ResourceSku. - :param error: - :type error: ~microsoft_datadog_client.models.ErrorResponseBody + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, *, - error: Optional["ErrorResponseBody"] = None, + name: str, **kwargs ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = error + super(ResourceSku, self).__init__(**kwargs) + self.name = name + + +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_datadog_client.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_datadog_client.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. + """User info. :param name: Name of the user. :type name: str diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py index c7b486bf932..b2edc8eaf2d 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py @@ -7,24 +7,15 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations -from ._api_key_operations import ApiKeyOperations -from ._host_operations import HostOperations -from ._linked_resource_operations import LinkedResourceOperations -from ._monitored_resource_operations import MonitoredResourceOperations -from ._operation_operations import OperationOperations -from ._monitor_operations import MonitorOperations -from ._refresh_set_password_operations import RefreshSetPasswordOperations -from ._tag_rule_operations import TagRuleOperations -from ._single_sign_on_configuration_operations import SingleSignOnConfigurationOperations +from ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', - 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', + 'MarketplaceAgreementsOperations', + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', ] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py deleted file mode 100644 index 1c688a2ea92..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py +++ /dev/null @@ -1,261 +0,0 @@ -# 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 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 ApiKeyOperations(object): - """ApiKeyOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogApiKeyListResponse"] - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('DatadogApiKeyListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore - - def get_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogApiKey" - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - def set_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - key, # type: str - created_by=None, # type: Optional[str] - name=None, # type: Optional[str] - created=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param key: The value of the API key. - :type key: str - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param created: The time of creation of the API key. - :type created: 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogApiKey(created_by=created_by, name=name, key=key, created=created) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py deleted file mode 100644 index 2e8a47a760a..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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 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 HostOperations(object): - """HostOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogHostListResponse"] - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('DatadogHostListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listHosts'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py deleted file mode 100644 index bb4d552082a..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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 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 LinkedResourceOperations(object): - """LinkedResourceOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.LinkedResourceListResponse"] - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('LinkedResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py index 6877b189cdf..87cf37fcaf5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -76,7 +76,7 @@ def prepare_request(next_link=None): # 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'), + '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 @@ -104,7 +104,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) @@ -115,9 +115,9 @@ def get_next(next_link=None): ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore - def create( + def create_or_update( self, - properties=None, # type: Optional["models.DatadogAgreementProperties"] + body=None, # type: Optional["models.DatadogAgreementResource"] **kwargs # type: Any ): # type: (...) -> "models.DatadogAgreementResource" @@ -125,8 +125,8 @@ def create( Create Datadog marketplace agreement in the subscription. - :param properties: Represents the properties of the resource. - :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogAgreementResource, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource @@ -137,20 +137,20 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - body = models.DatadogAgreementResource(properties=properties) + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + 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'), + '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') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -169,7 +169,7 @@ def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) @@ -178,4 +178,4 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py deleted file mode 100644 index 7fb70f7eb58..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py +++ /dev/null @@ -1,600 +0,0 @@ -# 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 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 MonitorOperations(object): - """MonitorOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] - """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 DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - } - 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('DatadogMonitorResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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}/providers/Microsoft.Datadog/monitors'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] - """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 to which the Datadog resource - belongs. - :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 DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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('DatadogMonitorResourceListResponse', 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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors'} # type: ignore - - def get( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - """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 to which the Datadog resource - belongs. - :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: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def _create_initial( - self, - resource_group_name, # type: str - monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResource(tags=tags, location=location, type_identity_type=type, provisioning_state=provisioning_state, monitoring_status=monitoring_status, marketplace_subscription_status=marketplace_subscription_status, datadog_organization_properties=datadog_organization_properties, user_info=user_info, name_sku_name=name) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResource') - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def begin_create( - self, - resource_group_name, # type: str - monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DatadogMonitorResource"] - """Create a monitor resource. - - Create a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param location: - :type location: str - :param tags: Dictionary of :code:``. - :type tags: dict[str, str] - :param type: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.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. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type 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 DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - 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, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=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): - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - monitor_name, # type: str - tags=None, # type: Optional[Dict[str, str]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - """Update a monitor resource. - - Update a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param tags: The new tags of the monitor resource. - :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResourceUpdateParameters') - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/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 = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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] - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Delete a monitor resource. - - Delete a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **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.Datadog/monitors/{monitorName}'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py deleted file mode 100644 index 8e982bdeda7..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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 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 MonitoredResourceOperations(object): - """MonitoredResourceOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.MonitoredResourceListResponse"] - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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.ResourceProviderDefaultErrorResponse, 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.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py new file mode 100644 index 00000000000..248c7a30a26 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py @@ -0,0 +1,1082 @@ +# 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_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_api_keys( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogApiKeyListResponse"] + """List the api keys for a given monitor resource. + + List the api keys 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 DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_api_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogApiKeyListResponse', 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + def get_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogApiKey" + """Get the default api key. + + Get the default api key. + + :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: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + def set_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogApiKey"] + **kwargs # type: Any + ): + # type: (...) -> None + """Set the default api key. + + Set the default api key. + + :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_datadog_client.models.DatadogApiKey + :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 = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(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) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogHostListResponse"] + """List the hosts for a given monitor resource. + + List the hosts 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 DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogHostListResponse', 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LinkedResourceListResponse"] + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target 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 LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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_linked_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedResourceListResponse', 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + 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 Datadog monitor resource. + + List the resources currently being monitored by the Datadog 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_datadog_client.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 = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] + """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 DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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), + } + 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('DatadogMonitorResourceListResponse', 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}/providers/Microsoft.Datadog/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] + """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 DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', 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.Datadog/monitors'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + """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: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResource') + 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('DatadogMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DatadogMonitorResource"] + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource + :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 DatadogMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + 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('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResourceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + """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_datadog_client.models.DatadogMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + 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('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/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 = "2021-03-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, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, 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.Datadog/monitors/{monitorName}'} # type: ignore + + def refresh_set_password_link( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogSetPasswordLink" + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :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: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py similarity index 87% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py index 1c90d2b4cbd..8cc38ea3a6b 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +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. @@ -50,9 +50,9 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["models.OperationListResult"] - """List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + """List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. :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) @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -97,7 +100,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py deleted file mode 100644 index 2406fedbd38..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class RefreshSetPasswordOperations(object): - """RefreshSetPasswordOperations 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_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogSetPasswordLink" - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :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: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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'] = 'application/json' - - 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.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py similarity index 81% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py index 6b60e79a7a7..6f2e25ce942 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations(object): - """SingleSignOnConfigurationOperations operations. +class SingleSignOnConfigurationsOperations(object): + """SingleSignOnConfigurationsOperations 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. @@ -58,8 +58,7 @@ def list( List the single sign-on configurations for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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 @@ -69,21 +68,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -112,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) @@ -128,23 +130,24 @@ def _create_or_update_initial( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> "models.DatadogSingleSignOnResource" cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -157,22 +160,21 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + 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, 'DatadogSingleSignOnResource') + if body is not None: + body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -192,7 +194,7 @@ def begin_create_or_update( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> LROPoller["models.DatadogSingleSignOnResource"] @@ -200,15 +202,14 @@ def begin_create_or_update( Configures single-sign-on for this resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param configuration_name: Configuration name. :type configuration_name: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :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 @@ -231,7 +232,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -246,7 +247,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -272,12 +280,11 @@ def get( Gets the datadog single sign-on resource for the given Monitor. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) @@ -285,15 +292,18 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -305,7 +315,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -313,7 +323,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py similarity index 73% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py index d30ab42567d..a9fb453770f 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 @@ -18,13 +18,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar + 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 TagRuleOperations(object): - """TagRuleOperations operations. +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. @@ -56,8 +56,7 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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 @@ -67,21 +66,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -110,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + 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) @@ -126,11 +128,7 @@ def create_or_update( resource_group_name, # type: str monitor_name, # type: str rule_set_name, # type: str - filtering_tags=None, # type: Optional[List["models.FilteringTag"]] - send_aad_logs=None, # type: Optional[bool] - send_subscription_logs=None, # type: Optional[bool] - send_resource_logs=None, # type: Optional[bool] - log_rules_filtering_tags=None, # type: Optional[List["models.FilteringTag"]] + body=None, # type: Optional["models.MonitoringTagRules"] **kwargs # type: Any ): # type: (...) -> "models.MonitoringTagRules" @@ -138,50 +136,33 @@ def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param rule_set_name: Rule set name. :type rule_set_name: str - :param filtering_tags: List of filtering tags to be used for capturing metrics. 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_datadog_client.models.FilteringTag] - :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 Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs 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 log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.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_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -194,22 +175,21 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + 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') + 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -232,12 +212,11 @@ def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :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: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) @@ -245,15 +224,18 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -265,7 +247,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + 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) @@ -273,7 +255,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) diff --git a/src/datadog/setup.py b/src/datadog/setup.py index 5ca60f8b747..d25f729fc1f 100644 --- a/src/datadog/setup.py +++ b/src/datadog/setup.py @@ -31,8 +31,9 @@ ] DEPENDENCIES = [] + try: - from .manual.dependency import DEPENDENCIES + from azext_datadog.manual.dependency import DEPENDENCIES except ImportError: pass From 90f0a900db163a14701f8130682631b98f13e877 Mon Sep 17 00:00:00 2001 From: Limin Gu Date: Sat, 27 Mar 2021 17:10:49 -0700 Subject: [PATCH 2/3] Fix --- .../azext_datadog/tests/latest/recordings/test_datadog.yaml | 4 ++-- .../azext_datadog/tests/latest/test_datadog_scenario.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml b/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml index bb63bedb0e4..e421d2aaf9b 100644 --- a/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml +++ b/src/datadog/azext_datadog/tests/latest/recordings/test_datadog.yaml @@ -2692,8 +2692,8 @@ interactions: message: OK - request: body: '{"sku": {"name": "Linked"}, "properties": {"monitoringStatus": "Enabled", - "datadogOrganizationProperties": {"apiKey": "000000", - "applicationKey": "00000000"}, "userInfo": {"name": + "datadogOrganizationProperties": {"apiKey": "", + "applicationKey": ""}, "userInfo": {"name": "Alice", "emailAddress": "alice@microsoft.com", "phoneNumber": "123-456-7890"}}, "identity": {"type": "SystemAssigned"}, "tags": {"Environment": "Dev"}, "location": "eastus2euap"}' diff --git a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py index 071d01d3893..8cde69dbc38 100644 --- a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -279,8 +279,8 @@ def step__monitors_put_monitors_create_link(test, rg): '--name "{myMonitor}" ' '--sku-name "Linked" ' '--datadog-organization-properties ' - 'api-key=000000 ' - 'application-key=00000000 ' + 'api-key=XX ' + 'application-key=XX ' '--location "East US 2 EUAP" ' '--type "SystemAssigned" ' '--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" ' From cf3e8ca5019250c1afe6e728d68ee11aab686465 Mon Sep 17 00:00:00 2001 From: Limin Gu Date: Mon, 29 Mar 2021 12:03:20 -0700 Subject: [PATCH 3/3] Feedback --- src/datadog/azext_datadog/generated/_help.py | 46 +++++++++++++++++++ .../azext_datadog/generated/_params.py | 10 +--- src/datadog/azext_datadog/generated/action.py | 6 +-- .../azext_datadog/generated/commands.py | 4 +- src/datadog/azext_datadog/generated/custom.py | 43 ++++++++--------- .../vendored_sdks/datadog/models/_models.py | 24 ++++++---- .../datadog/models/_models_py3.py | 27 ++++++----- 7 files changed, 105 insertions(+), 55 deletions(-) diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py index 6ebd1b47e17..f5eded6281a 100644 --- a/src/datadog/azext_datadog/generated/_help.py +++ b/src/datadog/azext_datadog/generated/_help.py @@ -26,6 +26,52 @@ az datadog terms list """ +helps['datadog terms create'] = """ + type: command + short-summary: "Create Datadog marketplace agreement in the subscription." + parameters: + - name: --properties + short-summary: "Represents the properties of the resource." + long-summary: | + Usage: --properties publisher=XX product=XX plan=XX license-text-link=XX privacy-policy-link=XX \ +retrieve-datetime=XX signature=XX accepted=XX + + publisher: Publisher identifier string. + product: Product identifier string. + plan: Plan identifier string. + license-text-link: Link to HTML with Microsoft and Publisher terms. + privacy-policy-link: Link to the privacy policy of the publisher. + retrieve-datetime: Date and time in UTC of when the terms were accepted. This is empty if Accepted is \ +false. + signature: Terms signature. + accepted: If any version of the terms have been accepted, otherwise false. + examples: + - name: MarketplaceAgreements_CreateOrUpdate + text: |- + az datadog terms create --properties accepted=true +""" + +helps['datadog terms update'] = """ + type: command + short-summary: "Update Datadog marketplace agreement in the subscription." + parameters: + - name: --properties + short-summary: "Represents the properties of the resource." + long-summary: | + Usage: --properties publisher=XX product=XX plan=XX license-text-link=XX privacy-policy-link=XX \ +retrieve-datetime=XX signature=XX accepted=XX + + publisher: Publisher identifier string. + product: Product identifier string. + plan: Plan identifier string. + license-text-link: Link to HTML with Microsoft and Publisher terms. + privacy-policy-link: Link to the privacy policy of the publisher. + retrieve-datetime: Date and time in UTC of when the terms were accepted. This is empty if Accepted is \ +false. + signature: Terms signature. + accepted: If any version of the terms have been accepted, otherwise false. +""" + helps['datadog monitor'] = """ type: group short-summary: Manage monitor with datadog diff --git a/src/datadog/azext_datadog/generated/_params.py b/src/datadog/azext_datadog/generated/_params.py index 0a271f71169..88de549148a 100644 --- a/src/datadog/azext_datadog/generated/_params.py +++ b/src/datadog/azext_datadog/generated/_params.py @@ -30,11 +30,11 @@ def load_arguments(self, _): - with self.argument_context('datadog marketplace-agreement create') as c: + with self.argument_context('datadog terms create') as c: c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' 'of the resource.') - with self.argument_context('datadog marketplace-agreement update') as c: + with self.argument_context('datadog terms update') as c: c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' 'of the resource.') @@ -127,9 +127,6 @@ def load_arguments(self, _): 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') - c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Failed', 'Canceled', 'Deleted', - 'NotSpecified']), help='Provisioning state') c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' 'capturing metrics. 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 ' @@ -150,9 +147,6 @@ def load_arguments(self, _): 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', id_part='child_name_1') - c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Failed', 'Canceled', 'Deleted', - 'NotSpecified']), help='Provisioning state') c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' 'capturing metrics. 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 ' diff --git a/src/datadog/azext_datadog/generated/action.py b/src/datadog/azext_datadog/generated/action.py index 2d81235bad9..b7fe7e6cd66 100644 --- a/src/datadog/azext_datadog/generated/action.py +++ b/src/datadog/azext_datadog/generated/action.py @@ -194,13 +194,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'provisioning-state': - d['provisioning_state'] = v[0] - elif kl == 'single-sign-on-state': + if kl == 'single-sign-on-state': d['single_sign_on_state'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] else: raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' - 'provisioning-state, single-sign-on-state, enterprise-app-id'.format(k)) + 'single-sign-on-state, enterprise-app-id'.format(k)) return d diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py index 2e10c20b231..4d908a36b1f 100644 --- a/src/datadog/azext_datadog/generated/commands.py +++ b/src/datadog/azext_datadog/generated/commands.py @@ -22,7 +22,9 @@ def load_command_table(self, _): client_factory=cf_marketplace_agreement) with self.command_group('datadog terms', datadog_marketplace_agreement, client_factory=cf_marketplace_agreement, is_experimental=True) as g: - g.custom_command('list', 'datadog_marketplace_agreement_list') + g.custom_command('list', 'datadog_terms_list') + g.custom_command('create', 'datadog_terms_create') + g.custom_command('update', 'datadog_terms_update') from azext_datadog.generated._client_factory import cf_monitor datadog_monitor = CliCommandType( diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py index 009270c26e0..56858a63ac2 100644 --- a/src/datadog/azext_datadog/generated/custom.py +++ b/src/datadog/azext_datadog/generated/custom.py @@ -14,7 +14,7 @@ from azure.cli.core.util import sdk_no_wait -def datadog_marketplace_agreement_list(client): +def datadog_terms_list(client): return client.list() @@ -25,8 +25,15 @@ def datadog_marketplace_agreement_create(client, return client.create_or_update(body=body) -def datadog_marketplace_agreement_update(client, - properties=None): +def datadog_terms_create(client, + properties=None): + body = {} + body['properties'] = properties + return client.create_or_update(body=body) + + +def datadog_terms_update(client, + properties=None): body = {} body['properties'] = properties return client.create_or_update(body=body) @@ -196,22 +203,19 @@ def datadog_tag_rule_create(client, resource_group_name, monitor_name, rule_set_name, - provisioning_state=None, filtering_tags=None, send_aad_logs=None, send_subscription_logs=None, send_resource_logs=None, log_rules_filtering_tags=None): body = {} - body['properties'] = {} - body['properties']['provisioning_state'] = provisioning_state - body['properties']['metric_rules'] = {} - body['properties']['metric_rules']['filtering_tags'] = filtering_tags - body['properties']['log_rules'] = {} - body['properties']['log_rules']['send_aad_logs'] = send_aad_logs - body['properties']['log_rules']['send_subs_logs'] = send_subscription_logs - body['properties']['log_rules']['send_resource_logs'] = send_resource_logs - body['properties']['log_rules']['filtering_tags'] = log_rules_filtering_tags + body['metric_rules'] = {} + body['metric_rules']['filtering_tags'] = filtering_tags + body['log_rules'] = {} + body['log_rules']['send_aad_logs'] = send_aad_logs + body['log_rules']['send_subscription_logs'] = send_subscription_logs + body['log_rules']['send_resource_logs'] = send_resource_logs + body['log_rules']['filtering_tags'] = log_rules_filtering_tags return client.create_or_update(resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, @@ -222,24 +226,21 @@ def datadog_tag_rule_update(instance, resource_group_name, monitor_name, rule_set_name, - provisioning_state=None, filtering_tags=None, send_aad_logs=None, send_subscription_logs=None, send_resource_logs=None, log_rules_filtering_tags=None): - if provisioning_state is not None: - instance.properties.provisioning_state = provisioning_state if filtering_tags is not None: - instance.properties.metric_rules.filtering_tags = filtering_tags + instance.metric_rules.filtering_tags = filtering_tags if send_aad_logs is not None: - instance.properties.log_rules.send_aad_logs = send_aad_logs + instance.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 + instance.log_rules.send_subscription_logs = send_subscription_logs if send_resource_logs is not None: - instance.properties.log_rules.send_resource_logs = send_resource_logs + instance.log_rules.send_resource_logs = send_resource_logs if log_rules_filtering_tags is not None: - instance.properties.log_rules.filtering_tags = log_rules_filtering_tags + instance.log_rules.filtering_tags = log_rules_filtering_tags return instance diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py index 02652c08a90..77500389ed8 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py @@ -501,9 +501,9 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :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_datadog_client.models.SingleSignOnStates @@ -514,6 +514,7 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): """ _validation = { + 'provisioning_state': {'readonly': True}, 'single_sign_on_url': {'readonly': True}, } @@ -529,7 +530,7 @@ def __init__( **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None 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 = None @@ -988,15 +989,19 @@ def __init__( class MonitoringTagRulesProperties(msrest.serialization.Model): """Definition of the properties for a TagRules resource. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param log_rules: Set of rules for sending logs for the Monitor resource. :type log_rules: ~microsoft_datadog_client.models.LogRules :param metric_rules: Set of rules for sending metrics for the Monitor resource. :type metric_rules: ~microsoft_datadog_client.models.MetricRules """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, @@ -1008,7 +1013,7 @@ def __init__( **kwargs ): super(MonitoringTagRulesProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None self.log_rules = kwargs.get('log_rules', None) self.metric_rules = kwargs.get('metric_rules', None) @@ -1018,9 +1023,9 @@ class MonitorProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.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_datadog_client.models.MonitoringStatus @@ -1042,6 +1047,7 @@ class MonitorProperties(msrest.serialization.Model): """ _validation = { + 'provisioning_state': {'readonly': True}, 'marketplace_subscription_status': {'readonly': True}, 'liftr_resource_category': {'readonly': True}, 'liftr_resource_preference': {'readonly': True}, @@ -1062,7 +1068,7 @@ def __init__( **kwargs ): super(MonitorProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None self.monitoring_status = kwargs.get('monitoring_status', "Enabled") self.marketplace_subscription_status = None self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py index c06931d8361..403aace93cf 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py @@ -567,9 +567,9 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :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_datadog_client.models.SingleSignOnStates @@ -580,6 +580,7 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): """ _validation = { + 'provisioning_state': {'readonly': True}, 'single_sign_on_url': {'readonly': True}, } @@ -593,13 +594,12 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): def __init__( self, *, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) - self.provisioning_state = provisioning_state + self.provisioning_state = None self.single_sign_on_state = single_sign_on_state self.enterprise_app_id = enterprise_app_id self.single_sign_on_url = None @@ -1097,15 +1097,19 @@ def __init__( class MonitoringTagRulesProperties(msrest.serialization.Model): """Definition of the properties for a TagRules resource. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param log_rules: Set of rules for sending logs for the Monitor resource. :type log_rules: ~microsoft_datadog_client.models.LogRules :param metric_rules: Set of rules for sending metrics for the Monitor resource. :type metric_rules: ~microsoft_datadog_client.models.MetricRules """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, @@ -1115,13 +1119,12 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): def __init__( self, *, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, log_rules: Optional["LogRules"] = None, metric_rules: Optional["MetricRules"] = None, **kwargs ): super(MonitoringTagRulesProperties, self).__init__(**kwargs) - self.provisioning_state = provisioning_state + self.provisioning_state = None self.log_rules = log_rules self.metric_rules = metric_rules @@ -1131,9 +1134,9 @@ class MonitorProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :vartype provisioning_state: str or ~microsoft_datadog_client.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_datadog_client.models.MonitoringStatus @@ -1155,6 +1158,7 @@ class MonitorProperties(msrest.serialization.Model): """ _validation = { + 'provisioning_state': {'readonly': True}, 'marketplace_subscription_status': {'readonly': True}, 'liftr_resource_category': {'readonly': True}, 'liftr_resource_preference': {'readonly': True}, @@ -1173,14 +1177,13 @@ class MonitorProperties(msrest.serialization.Model): def __init__( self, *, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, user_info: Optional["UserInfo"] = None, **kwargs ): super(MonitorProperties, self).__init__(**kwargs) - self.provisioning_state = provisioning_state + self.provisioning_state = None self.monitoring_status = monitoring_status self.marketplace_subscription_status = None self.datadog_organization_properties = datadog_organization_properties