From ac2ec782dff13f029d16f081727441ba36711e0a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 13 Nov 2020 01:21:08 +0000 Subject: [PATCH] CodeGen from PR 11639 in Azure/azure-rest-api-specs add openapi-subtype (#11639) --- .../generated/_client_factory.py | 8 +- src/datadog/azext_datadog/generated/_help.py | 128 ++-- .../azext_datadog/generated/_params.py | 36 +- src/datadog/azext_datadog/generated/action.py | 60 +- .../azext_datadog/generated/commands.py | 44 +- src/datadog/azext_datadog/generated/custom.py | 90 +-- .../tests/latest/test_datadog_scenario.py | 180 +++-- .../vendored_sdks/datadog/_configuration.py | 3 +- .../datadog/_microsoft_datadog_client.py | 5 + .../vendored_sdks/datadog/aio/__init__.py | 2 +- .../datadog/aio/_configuration.py | 66 ++ .../datadog/aio/_microsoft_datadog_client.py | 108 +++ .../datadog/aio/operations/__init__.py | 31 + .../aio/operations/_api_key_operations.py | 263 ++++++++ .../aio/operations/_host_operations.py | 120 ++++ .../operations/_linked_resource_operations.py | 120 ++++ .../_marketplace_agreement_operations.py | 173 +++++ .../aio/operations/_monitor_operations.py | 617 ++++++++++++++++++ .../_monitored_resource_operations.py | 120 ++++ .../aio/operations/_operation_operations.py | 107 +++ .../_refresh_set_password_operations.py | 103 +++ ...single_sign_on_configuration_operations.py | 332 ++++++++++ .../aio/operations/_tag_rule_operations.py | 279 ++++++++ .../vendored_sdks/datadog/models/__init__.py | 9 + .../models/_microsoft_datadog_client_enums.py | 2 + .../vendored_sdks/datadog/models/_models.py | 121 +++- .../datadog/models/_models_py3.py | 136 +++- .../datadog/operations/__init__.py | 2 + .../datadog/operations/_api_key_operations.py | 35 +- .../datadog/operations/_host_operations.py | 9 +- .../operations/_linked_resource_operations.py | 9 +- .../_marketplace_agreement_operations.py | 179 +++++ .../datadog/operations/_monitor_operations.py | 89 ++- .../_monitored_resource_operations.py | 9 +- .../operations/_operation_operations.py | 9 +- .../_refresh_set_password_operations.py | 9 +- ...single_sign_on_configuration_operations.py | 43 +- .../operations/_tag_rule_operations.py | 41 +- .../vendored_sdks/datadog/py.typed | 1 + src/datadog/report.md | 388 +++++++++++ src/datadog/setup.cfg | 5 +- src/datadog/setup.py | 3 +- 42 files changed, 3718 insertions(+), 376 deletions(-) create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.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/_api_key_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_host_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resource_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreement_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitor_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resource_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operation_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configuration_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rule_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreement_operations.py create mode 100644 src/datadog/azext_datadog/vendored_sdks/datadog/py.typed create mode 100644 src/datadog/report.md diff --git a/src/datadog/azext_datadog/generated/_client_factory.py b/src/datadog/azext_datadog/generated/_client_factory.py index 2846bbd5a71..8084dc24392 100644 --- a/src/datadog/azext_datadog/generated/_client_factory.py +++ b/src/datadog/azext_datadog/generated/_client_factory.py @@ -16,6 +16,10 @@ def cf_datadog_cl(cli_ctx, *_): MicrosoftDatadogClient) +def cf_marketplace_agreement(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).marketplace_agreement + + def cf_api_key(cli_ctx, *_): return cf_datadog_cl(cli_ctx).api_key @@ -36,7 +40,7 @@ def cf_monitor(cli_ctx, *_): return cf_datadog_cl(cli_ctx).monitor -def cf_refresh_set_password(cli_ctx, *_): +def cf_set_password_link(cli_ctx, *_): return cf_datadog_cl(cli_ctx).refresh_set_password @@ -44,5 +48,5 @@ def cf_tag_rule(cli_ctx, *_): return cf_datadog_cl(cli_ctx).tag_rule -def cf_single_sign_on_configuration(cli_ctx, *_): +def cf_sso_config(cli_ctx, *_): return cf_datadog_cl(cli_ctx).single_sign_on_configuration diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py index 1246e6be0a8..0b191d2ee17 100644 --- a/src/datadog/azext_datadog/generated/_help.py +++ b/src/datadog/azext_datadog/generated/_help.py @@ -12,6 +12,45 @@ from knack.help_files import helps +helps['datadog marketplace-agreement'] = """ + type: group + short-summary: datadog marketplace-agreement +""" + +helps['datadog marketplace-agreement list'] = """ + type: command + short-summary: "List Datadog marketplace agreements in the subscription." + examples: + - name: MarketplaceAgreements_List + text: |- + az datadog marketplace-agreement list +""" + +helps['datadog marketplace-agreement 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_Create + text: |- + az datadog marketplace-agreement create --properties accepted=true +""" + helps['datadog api-key'] = """ type: group short-summary: datadog api-key @@ -94,11 +133,15 @@ 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'] = """ @@ -115,6 +158,7 @@ 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 @@ -122,6 +166,7 @@ linking-client-id: The client_id from an existing in exchange for an auth token to link 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 @@ -131,11 +176,11 @@ examples: - name: Monitors_Create text: |- - az datadog monitor create --name "myMonitor" --location "West US 2" \ + az datadog monitor create --name "myMonitor" --sku-name "myMonitor" --location "West US" \ --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" +--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" --sku-name "free_Monthly" \ +--tags Environment="Dev" --resource-group "myResourceGroup" """ helps['datadog monitor update'] = """ @@ -144,8 +189,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'] = """ @@ -223,26 +268,12 @@ 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. - - 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 \ -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: --log-rules-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 --log-rules-filtering-tags argument. examples: - name: TagRules_CreateOrUpdate 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" + az datadog tag-rule create --monitor-name "myMonitor" --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" """ helps['datadog tag-rule update'] = """ @@ -261,19 +292,6 @@ 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. - - 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 \ -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: --log-rules-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 --log-rules-filtering-tags argument. """ helps['datadog sso-config'] = """ @@ -287,8 +305,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'] = """ @@ -297,8 +314,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'] = """ @@ -315,29 +332,34 @@ 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 single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. + single-sign-on-url: The login URL specific to this Datadog Organization. """ 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..95b0a76d3bd 100644 --- a/src/datadog/azext_datadog/generated/_params.py +++ b/src/datadog/azext_datadog/generated/_params.py @@ -19,16 +19,20 @@ ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from azext_datadog.action import ( + AddMarketplaceagreementsProperties, AddDatadogOrganizationProperties, AddUserInfo, AddMetricRulesFilteringTags, - AddLogRulesFilteringTags, - AddProperties + AddSinglesignonconfigurationsProperties ) def load_arguments(self, _): + 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 api-key list') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name') @@ -73,16 +77,8 @@ def load_arguments(self, _): c.argument('location', arg_type=get_location_type(self.cli_ctx), 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='*', - help='Datadog organization properties') + 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.') @@ -91,8 +87,6 @@ def load_arguments(self, _): 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) @@ -131,11 +125,6 @@ def load_arguments(self, _): '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 ' - '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.') with self.argument_context('datadog tag-rule update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -151,11 +140,6 @@ def load_arguments(self, _): '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 ' - '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.') with self.argument_context('datadog sso-config list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -170,13 +154,13 @@ 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='') 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..45b71d592b6 100644 --- a/src/datadog/azext_datadog/generated/action.py +++ b/src/datadog/azext_datadog/generated/action.py @@ -14,10 +14,10 @@ from knack.util import CLIError -class AddDatadogOrganizationProperties(argparse.Action): +class AddMarketplaceagreementsProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - namespace.datadog_organization_properties = action + namespace.properties = action def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -31,19 +31,29 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'linking-auth-code': - d['linking_auth_code'] = v[0] - elif kl == 'linking-client-id': - d['linking_client_id'] = v[0] - elif kl == 'enterprise-app-id': - d['enterprise_app_id'] = v[0] + 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] return d -class AddUserInfo(argparse.Action): +class AddDatadogOrganizationProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - namespace.user_info = action + namespace.datadog_organization_properties = action def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -57,19 +67,19 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'name': - d['name'] = v[0] - elif kl == 'email-address': - d['email_address'] = v[0] - elif kl == 'phone-number': - d['phone_number'] = v[0] + if kl == 'linking-auth-code': + d['linking_auth_code'] = v[0] + elif kl == 'linking-client-id': + d['linking_client_id'] = v[0] + elif kl == 'enterprise-app-id': + d['enterprise_app_id'] = v[0] return d -class AddMetricRulesFilteringTags(argparse._AppendAction): +class AddUserInfo(argparse.Action): 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) + namespace.user_info = action def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -85,17 +95,17 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use v = properties[k] if kl == 'name': d['name'] = v[0] - elif kl == 'value': - d['value'] = v[0] - elif kl == 'action': - d['action'] = v[0] + elif kl == 'email-address': + d['email_address'] = v[0] + elif kl == 'phone-number': + d['phone_number'] = v[0] return d -class AddLogRulesFilteringTags(argparse._AppendAction): +class AddMetricRulesFilteringTags(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - super(AddLogRulesFilteringTags, self).__call__(parser, namespace, action, option_string) + super(AddMetricRulesFilteringTags, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -118,7 +128,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use 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 diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py index 5fa293ddeea..91405635f94 100644 --- a/src/datadog/azext_datadog/generated/commands.py +++ b/src/datadog/azext_datadog/generated/commands.py @@ -15,6 +15,16 @@ def load_command_table(self, _): + from azext_datadog.generated._client_factory import cf_marketplace_agreement + datadog_marketplace_agreement = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._marketplace_agreement_operations#MarketplaceAg' + 'reementOperations.{}', + client_factory=cf_marketplace_agreement) + with self.command_group('datadog marketplace-agreement', datadog_marketplace_agreement, + client_factory=cf_marketplace_agreement, is_experimental=True) as g: + g.custom_command('list', 'datadog_marketplace_agreement_list') + g.custom_command('create', 'datadog_marketplace_agreement_create') + 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.{}', @@ -61,14 +71,14 @@ def load_command_table(self, _): g.custom_command('delete', 'datadog_monitor_delete', supports_no_wait=True, confirmation=True) g.custom_wait_command('wait', 'datadog_monitor_show') - from azext_datadog.generated._client_factory import cf_refresh_set_password - datadog_refresh_set_password = CliCommandType( + from azext_datadog.generated._client_factory import cf_set_password_link + datadog_set_password_link = 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') + client_factory=cf_set_password_link) + with self.command_group('datadog set-password-link', datadog_set_password_link, + client_factory=cf_set_password_link, is_experimental=True) as g: + g.custom_command('get', 'datadog_set_password_link_get') from azext_datadog.generated._client_factory import cf_tag_rule datadog_tag_rule = CliCommandType( @@ -81,17 +91,15 @@ def load_command_table(self, _): g.custom_command('create', 'datadog_tag_rule_create') g.custom_command('update', 'datadog_tag_rule_update') - from azext_datadog.generated._client_factory import cf_single_sign_on_configuration - datadog_single_sign_on_configuration = CliCommandType( + from azext_datadog.generated._client_factory import cf_sso_config + datadog_sso_config = CliCommandType( operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configuration_operations#Single' 'SignOnConfigurationOperations.{}', - 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_sso_config) + with self.command_group('datadog sso-config', datadog_sso_config, client_factory=cf_sso_config, + is_experimental=True) 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.custom_command('update', 'datadog_sso_config_update', supports_no_wait=True) + g.custom_wait_command('wait', 'datadog_sso_config_show') diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py index 8ff6b15be07..f38260e7152 100644 --- a/src/datadog/azext_datadog/generated/custom.py +++ b/src/datadog/azext_datadog/generated/custom.py @@ -8,11 +8,19 @@ # regenerated. # -------------------------------------------------------------------------- # pylint: disable=too-many-lines -# pylint: disable=unused-argument from azure.cli.core.util import sdk_no_wait +def datadog_marketplace_agreement_list(client): + return client.list() + + +def datadog_marketplace_agreement_create(client, + properties=None): + return client.create(properties=properties) + + def datadog_api_key_list(client, resource_group_name, monitor_name): @@ -30,9 +38,9 @@ def datadog_api_key_get_default_key(client, def datadog_api_key_set_default_key(client, resource_group_name, monitor_name, - key, created_by=None, name=None, + key=None, created=None): return client.set_default_key(resource_group_name=resource_group_name, monitor_name=monitor_name, @@ -80,12 +88,9 @@ def datadog_monitor_show(client, def datadog_monitor_create(client, resource_group_name, monitor_name, - location, tags=None, + location=None, identity_type=None, - provisioning_state=None, - monitoring_status=None, - marketplace_subscription_status=None, datadog_organization_properties=None, user_info=None, sku_name=None, @@ -97,9 +102,9 @@ def datadog_monitor_create(client, tags=tags, location=location, type=identity_type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, + provisioning_state=None, + monitoring_status=None, + marketplace_subscription_status=None, datadog_organization_properties=datadog_organization_properties, user_info=user_info, name=sku_name) @@ -108,12 +113,11 @@ def datadog_monitor_create(client, def datadog_monitor_update(client, resource_group_name, monitor_name, - tags=None, - monitoring_status=None): + tags=None): return client.update(resource_group_name=resource_group_name, monitor_name=monitor_name, tags=tags, - monitoring_status=monitoring_status) + monitoring_status=None) def datadog_monitor_delete(client, @@ -126,9 +130,9 @@ def datadog_monitor_delete(client, monitor_name=monitor_name) -def datadog_refresh_set_password_get(client, - resource_group_name, - monitor_name): +def datadog_set_password_link_get(client, + resource_group_name, + monitor_name): return client.get(resource_group_name=resource_group_name, monitor_name=monitor_name) @@ -156,16 +160,14 @@ def datadog_tag_rule_create(client, metric_rules_filtering_tags=None, log_rules_send_aad_logs=None, log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, - log_rules_filtering_tags=None): + log_rules_send_resource_logs=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) + send_resource_logs=log_rules_send_resource_logs) def datadog_tag_rule_update(client, @@ -175,40 +177,38 @@ def datadog_tag_rule_update(client, metric_rules_filtering_tags=None, log_rules_send_aad_logs=None, log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, - log_rules_filtering_tags=None): + log_rules_send_resource_logs=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) + send_resource_logs=log_rules_send_resource_logs) -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): return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, @@ -217,9 +217,15 @@ def datadog_single_sign_on_configuration_create(client, properties=properties) -def datadog_single_sign_on_configuration_update(instance, - resource_group_name, - monitor_name, - configuration_name, - no_wait=False): - return instance +def datadog_sso_config_update(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + 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) 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 a5b054d047b..6a8173b1aef 100644 --- a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -17,63 +17,19 @@ TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) +# Env setup @try_manual def setup(test, rg): pass -# EXAMPLE: /Monitors/put/Monitors_Create -@try_manual -def step__monitors_put_monitors_create(test, rg): - test.cmd('az datadog monitor create ' - '--name "{myMonitor}" ' - '--sku-name "drawdown_testing_20200904_Monthly" ' - '--location "East US 2 EUAP" ' - '--identity-type "SystemAssigned" ' - '--monitoring-status "Enabled" ' - '--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("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("tags.Environment", "Dev", case_sensitive=False), - ]) - test.cmd('az datadog monitor wait --created ' - '--name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[]) - - # EXAMPLE: /Monitors/get/Monitors_Get @try_manual def step__monitors_get_monitors_get(test, rg): test.cmd('az datadog monitor show ' '--name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check("name", "{myMonitor}", case_sensitive=False), - test.check("nameSkuName", "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("tags.Environment", "Dev", case_sensitive=False), - ]) - - -# EXAMPLE: /Monitors/get/Monitors_List -@try_manual -def step__monitors_get_monitors_list(test, rg): - test.cmd('az datadog monitor list ' - '-g ""', - checks=[ - test.check('length(@)', 1), - ]) + checks=[]) # EXAMPLE: /Monitors/get/Monitors_ListByResourceGroup @@ -81,9 +37,7 @@ def step__monitors_get_monitors_list(test, rg): def step__monitors_get_monitors_listbyresourcegroup(test, rg): test.cmd('az datadog monitor list ' '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) + checks=[]) # EXAMPLE: /Monitors/patch/Monitors_Update @@ -91,28 +45,11 @@ 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" ' + '--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("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("tags.Environment", "Dev2", case_sensitive=False), - ]) - - -# EXAMPLE: /ApiKeys/post/ApiKeys_GetDefaultKey -@try_manual -def step__apikeys_post_apikeys_getdefaultkey(test, rg): - test.cmd('az datadog api-key get-default-key ' - '--monitor-name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[ - test.check("key", "1111111111111111aaaaaaaaaaaaaaaa", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), ]) @@ -122,9 +59,7 @@ def step__apikeys_post_apikeys_list(test, rg): test.cmd('az datadog api-key list ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) + checks=[]) # EXAMPLE: /ApiKeys/post/ApiKeys_SetDefaultKey @@ -152,11 +87,69 @@ def step__linkedresources_post_linkedresources_list(test, rg): test.cmd('az datadog linked-resource list ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /MarketplaceAgreements/put/MarketplaceAgreements_Create +@try_manual +def step__marketplaceagreements_put(test, rg): + test.cmd('az datadog marketplace-agreement create ' + '--properties accepted=true', + checks=[]) + + +# EXAMPLE: /Monitors/put/Monitors_Create +@try_manual +def step__monitors_put_monitors_create(test, rg): + test.cmd('az datadog monitor create ' + '--name "{myMonitor}" ' + '--sku-name "{myMonitor}" ' + '--location "West US" ' + '--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" ' + '--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" ' + '--sku-name "free_Monthly" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + test.check("sku.name", "free_Monthly", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + ]) + test.cmd('az datadog monitor wait --created ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Monitors/get/Monitors_List +@try_manual +def step__monitors_get_monitors_list(test, rg): + test.cmd('az datadog monitor list ' + '-g ""', checks=[ test.check('length(@)', 1), ]) +# EXAMPLE: /ApiKeys/post/ApiKeys_GetDefaultKey +@try_manual +def step__apikeys_post_apikeys_getdefaultkey(test, rg): + test.cmd('az datadog api-key get-default-key ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /MarketplaceAgreements/get/MarketplaceAgreements_List +@try_manual +def step__marketplaceagreements_get(test, rg): + test.cmd('az datadog marketplace-agreement list', + checks=[]) + + # EXAMPLE: /MonitoredResources/post/MonitoredResources_List @try_manual def step__monitoredresources_post(test, rg): @@ -172,9 +165,7 @@ def step__refreshsetpassword_post(test, rg): test.cmd('az datadog set-password-link get ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check("setPasswordLink", None), - ]) + checks=[]) # EXAMPLE: /SingleSignOnConfigurations/put/SingleSignOnConfigurations_CreateOrUpdate @@ -183,7 +174,7 @@ def step__singlesignonconfigurations_put(test, rg): test.cmd('az datadog sso-config create ' '--configuration-name "default" ' '--monitor-name "{myMonitor}" ' - '--properties enterprise-app-id="ac754169-3489-42ae-bd06-8be89db12e58" single-sign-on-state="Enable" ' + '--properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" ' '--resource-group "{rg}"', checks=[]) @@ -195,10 +186,7 @@ def step__singlesignonconfigurations_get(test, rg): '--configuration-name "default" ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check("name", "default", case_sensitive=False), - test.check("type", "Microsoft.Datadog/monitors/singleSignOnConfigurations", case_sensitive=False), - ]) + checks=[]) # EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_List @@ -207,9 +195,7 @@ def step__singlesignonconfigurations_get2(test, rg): test.cmd('az datadog sso-config list ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) + checks=[]) # EXAMPLE: /TagRules/put/TagRules_CreateOrUpdate @@ -217,17 +203,12 @@ def step__singlesignonconfigurations_get2(test, rg): def step__tagrules_put_tagrules_createorupdate(test, rg): test.cmd('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 "{rg}" ' '--rule-set-name "default"', - checks=[ - test.check("name", "default", case_sensitive=False), - test.check("type", "Microsoft.Datadog/monitors/tagRules", case_sensitive=False), - ]) + checks=[]) # EXAMPLE: /TagRules/get/TagRules_Get @@ -237,10 +218,7 @@ def step__tagrules_get_tagrules_get(test, rg): '--monitor-name "{myMonitor}" ' '--resource-group "{rg}" ' '--rule-set-name "default"', - checks=[ - test.check("name", "default", case_sensitive=False), - test.check("type", "Microsoft.Datadog/monitors/tagRules", case_sensitive=False), - ]) + checks=[]) # EXAMPLE: /TagRules/get/TagRules_List @@ -249,9 +227,7 @@ def step__tagrules_get_tagrules_list(test, rg): test.cmd('az datadog tag-rule list ' '--monitor-name "{myMonitor}" ' '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) + checks=[]) # EXAMPLE: /Monitors/delete/Monitors_Delete @@ -263,21 +239,28 @@ def step__monitors_delete_monitors_delete(test, rg): checks=[]) +# Env cleanup @try_manual def cleanup(test, rg): pass +# Testcase @try_manual def call_scenario(test, rg): setup(test, rg) - step__monitors_put_monitors_create(test, rg) step__monitors_get_monitors_get(test, rg) - step__monitors_get_monitors_list(test, rg) step__monitors_get_monitors_listbyresourcegroup(test, rg) step__monitors_patch_monitors_update(test, rg) + step__apikeys_post_apikeys_list(test, rg) + step__apikeys_post_apikeys_setdefaultkey(test, rg) step__hosts_post_hosts_list(test, rg) step__linkedresources_post_linkedresources_list(test, rg) + step__marketplaceagreements_put(test, rg) + step__monitors_put_monitors_create(test, rg) + step__monitors_get_monitors_list(test, rg) + step__apikeys_post_apikeys_getdefaultkey(test, rg) + step__marketplaceagreements_get(test, rg) step__monitoredresources_post(test, rg) step__refreshsetpassword_post(test, rg) step__singlesignonconfigurations_put(test, rg) @@ -286,9 +269,6 @@ def call_scenario(test, rg): step__tagrules_put_tagrules_createorupdate(test, rg) step__tagrules_get_tagrules_get(test, rg) step__tagrules_get_tagrules_list(test, rg) - step__apikeys_post_apikeys_list(test, rg) - step__apikeys_post_apikeys_setdefaultkey(test, rg) - step__apikeys_post_apikeys_getdefaultkey(test, rg) step__monitors_delete_monitors_delete(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..82ad25d63dd 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py @@ -48,8 +48,7 @@ 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.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 318539a3f04..5e1a7a2bb9c 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 @@ -18,6 +18,7 @@ from azure.core.credentials import TokenCredential from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementOperations from .operations import ApiKeyOperations from .operations import HostOperations from .operations import LinkedResourceOperations @@ -33,6 +34,8 @@ class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. + :ivar marketplace_agreement: MarketplaceAgreementOperations operations + :vartype marketplace_agreement: microsoft_datadog_client.operations.MarketplaceAgreementOperations :ivar api_key: ApiKeyOperations operations :vartype api_key: microsoft_datadog_client.operations.ApiKeyOperations :ivar host: HostOperations operations @@ -76,6 +79,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.marketplace_agreement = MarketplaceAgreementOperations( + self._client, self._config, self._serialize, self._deserialize) self.api_key = ApiKeyOperations( self._client, self._config, self._serialize, self._deserialize) self.host = HostOperations( 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.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py new file mode 100644 index 00000000000..6e5bf0df71d --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class MicrosoftDatadogClientConfiguration(Configuration): + """Configuration for MicrosoftDatadogClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-02-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftdatadogclient/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/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..f9a53d214bb --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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 MarketplaceAgreementOperations +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 .. import models + + +class MicrosoftDatadogClient(object): + """MicrosoftDatadogClient. + + :ivar marketplace_agreement: MarketplaceAgreementOperations operations + :vartype marketplace_agreement: microsoft_datadog_client.aio.operations.MarketplaceAgreementOperations + :ivar api_key: ApiKeyOperations operations + :vartype api_key: microsoft_datadog_client.aio.operations.ApiKeyOperations + :ivar host: HostOperations operations + :vartype host: microsoft_datadog_client.aio.operations.HostOperations + :ivar linked_resource: LinkedResourceOperations operations + :vartype linked_resource: microsoft_datadog_client.aio.operations.LinkedResourceOperations + :ivar monitored_resource: MonitoredResourceOperations operations + :vartype monitored_resource: microsoft_datadog_client.aio.operations.MonitoredResourceOperations + :ivar operation: OperationOperations operations + :vartype operation: microsoft_datadog_client.aio.operations.OperationOperations + :ivar monitor: MonitorOperations operations + :vartype monitor: microsoft_datadog_client.aio.operations.MonitorOperations + :ivar refresh_set_password: RefreshSetPasswordOperations operations + :vartype refresh_set_password: microsoft_datadog_client.aio.operations.RefreshSetPasswordOperations + :ivar tag_rule: TagRuleOperations operations + :vartype tag_rule: microsoft_datadog_client.aio.operations.TagRuleOperations + :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations + :vartype single_sign_on_configuration: microsoft_datadog_client.aio.operations.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.marketplace_agreement = MarketplaceAgreementOperations( + self._client, self._config, self._serialize, self._deserialize) + 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..0dc11fc3371 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py @@ -0,0 +1,31 @@ +# 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_agreement_operations import MarketplaceAgreementOperations +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 + +__all__ = [ + 'MarketplaceAgreementOperations', + 'ApiKeyOperations', + 'HostOperations', + 'LinkedResourceOperations', + 'MonitoredResourceOperations', + 'OperationOperations', + 'MonitorOperations', + 'RefreshSetPasswordOperations', + 'TagRuleOperations', + 'SingleSignOnConfigurationOperations', +] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_key_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_key_operations.py new file mode 100644 index 00000000000..b833c19879a --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_key_operations.py @@ -0,0 +1,263 @@ +# 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 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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'), + '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'] = 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.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, + created_by: Optional[str] = None, + name: Optional[str] = None, + key: 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 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 key: The value of the API key. + :type key: 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 = { + 401: ClientAuthenticationError, 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") + 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'), + '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'] = 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.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/_host_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_host_operations.py new file mode 100644 index 00000000000..30b0489a373 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_host_operations.py @@ -0,0 +1,120 @@ +# 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 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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/_linked_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resource_operations.py new file mode 100644 index 00000000000..3621481fab1 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resource_operations.py @@ -0,0 +1,120 @@ +# 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 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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/_marketplace_agreement_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreement_operations.py new file mode 100644 index 00000000000..db66f4890d1 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreement_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from 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 MarketplaceAgreementOperations: + """MarketplaceAgreementOperations 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', {})) + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('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.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/agreements'} # type: ignore + + async def create( + self, + properties: Optional["models.DatadogAgreementProperties"] = None, + **kwargs + ) -> "models.DatadogAgreementResource": + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :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', {})) + + body = models.DatadogAgreementResource(properties=properties) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.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] + + # 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.ResourceProviderDefaultErrorResponse, 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.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitor_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitor_operations.py new file mode 100644 index 00000000000..870b957fff2 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitor_operations.py @@ -0,0 +1,617 @@ +# 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 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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.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, + tags: Optional[Dict[str, str]] = None, + location: Optional[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 = { + 401: ClientAuthenticationError, 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") + 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'), + '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'] = 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.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, + tags: Optional[Dict[str, str]] = None, + location: Optional[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 tags: Dictionary of :code:``. + :type tags: dict[str, str] + :param location: + :type location: str + :param type: Identity 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: 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 + :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, + tags=tags, + location=location, + 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 + + 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'), + } + + 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, + 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 = { + 401: ClientAuthenticationError, 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") + 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'), + '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'] = 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.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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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.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, {}) + + 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'), + } + + 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 diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resource_operations.py new file mode 100644 index 00000000000..3e54ea41516 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resource_operations.py @@ -0,0 +1,120 @@ +# 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 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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/_operation_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operation_operations.py new file mode 100644 index 00000000000..9434339eb95 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operation_operations.py @@ -0,0 +1,107 @@ +# 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 OperationOperations: + """OperationOperations 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.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 2020-02-01-preview 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) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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': '/providers/Microsoft.Datadog/operations'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py new file mode 100644 index 00000000000..ef0c3f818b5 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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.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/aio/operations/_single_sign_on_configuration_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configuration_operations.py new file mode 100644 index 00000000000..f6be07b12d7 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configuration_operations.py @@ -0,0 +1,332 @@ +# 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 SingleSignOnConfigurationOperations: + """SingleSignOnConfigurationOperations 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.DatadogSingleSignOnResourceListResponse"]: + """List the single sign-on configurations for a given monitor resource. + + List the single sign-on configurations for a given monitor resource. + + :param resource_group_name: The name of the resource group 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 DatadogSingleSignOnResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogSingleSignOnResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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.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('DatadogSingleSignOnResourceListResponse', 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}/singleSignOnConfigurations'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + properties: Optional["models.DatadogSingleSignOnProperties"] = None, + **kwargs + ) -> "models.DatadogSingleSignOnResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] + 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" + 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'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, '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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + properties: Optional["models.DatadogSingleSignOnProperties"] = 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. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: Configuration name. + :type configuration_name: str + :param properties: + :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :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 DatadogSingleSignOnResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + properties=properties, + 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('DatadogSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs + ) -> "models.DatadogSingleSignOnResource": + """Gets the datadog single sign-on resource for the given Monitor. + + 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. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :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) + :rtype: ~microsoft_datadog_client.models.DatadogSingleSignOnResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rule_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rule_operations.py new file mode 100644 index 00000000000..5c320f3bc90 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rule_operations.py @@ -0,0 +1,279 @@ +# 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, List, 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 TagRuleOperations: + """TagRuleOperations 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.MonitoringTagRulesListResponse"]: + """List the tag rules for a given monitor resource. + + List the tag rules for a given monitor resource. + + :param resource_group_name: The name of the resource group 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 MonitoringTagRulesListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoringTagRulesListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MonitoringTagRulesListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.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}/tagRules'} # type: ignore + + async def create_or_update( + self, + 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, + **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. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :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 + :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 = { + 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) + api_version = "2020-02-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs + ) -> "models.MonitoringTagRules": + """Get a tag rule set for a given monitor resource. + + Get a tag rule set for a given monitor resource. + + :param resource_group_name: The name of the resource group to which the Datadog resource + belongs. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :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) + :rtype: ~microsoft_datadog_client.models.MonitoringTagRules + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringTagRules', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # 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 f703afa79c2..a35353d1876 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import DatadogAgreementProperties + from ._models_py3 import DatadogAgreementResource + from ._models_py3 import DatadogAgreementResourceListResponse from ._models_py3 import DatadogApiKey from ._models_py3 import DatadogApiKeyListResponse from ._models_py3 import DatadogHost @@ -36,6 +39,9 @@ from ._models_py3 import ResourceProviderDefaultErrorResponse from ._models_py3 import UserInfo except (SyntaxError, ImportError): + from ._models import DatadogAgreementProperties # type: ignore + from ._models import DatadogAgreementResource # type: ignore + from ._models import DatadogAgreementResourceListResponse # type: ignore from ._models import DatadogApiKey # type: ignore from ._models import DatadogApiKeyListResponse # type: ignore from ._models import DatadogHost # type: ignore @@ -76,6 +82,9 @@ ) __all__ = [ + 'DatadogAgreementProperties', + 'DatadogAgreementResource', + 'DatadogAgreementResourceListResponse', 'DatadogApiKey', 'DatadogApiKeyListResponse', 'DatadogHost', 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..942b2ad730d 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 @@ -32,6 +32,8 @@ class LiftrResourceCategories(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum MONITOR_LOGS = "MonitorLogs" class ManagedIdentityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Identity type + """ SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" 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 46eb3288f11..ff3e5b02799 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py @@ -10,6 +10,116 @@ import msrest.serialization +class DatadogAgreementProperties(msrest.serialization.Model): + """Terms properties. + + :param publisher: Publisher identifier string. + :type publisher: str + :param product: Product identifier string. + :type product: str + :param plan: Plan identifier string. + :type plan: str + :param license_text_link: Link to HTML with Microsoft and Publisher terms. + :type license_text_link: str + :param privacy_policy_link: Link to the privacy policy of the publisher. + :type privacy_policy_link: str + :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :type retrieve_datetime: ~datetime.datetime + :param signature: Terms signature. + :type signature: str + :param accepted: If any version of the terms have been accepted, otherwise false. + :type accepted: bool + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'license_text_link': {'key': 'licenseTextLink', 'type': 'str'}, + 'privacy_policy_link': {'key': 'privacyPolicyLink', 'type': 'str'}, + 'retrieve_datetime': {'key': 'retrieveDatetime', 'type': 'iso-8601'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'accepted': {'key': 'accepted', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.plan = kwargs.get('plan', None) + self.license_text_link = kwargs.get('license_text_link', None) + self.privacy_policy_link = kwargs.get('privacy_policy_link', None) + self.retrieve_datetime = kwargs.get('retrieve_datetime', None) + self.signature = kwargs.get('signature', None) + self.accepted = kwargs.get('accepted', None) + + +class DatadogAgreementResource(msrest.serialization.Model): + """DatadogAgreementResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the agreement. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class DatadogAgreementResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatadogAgreementResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class DatadogApiKey(msrest.serialization.Model): """DatadogApiKey. @@ -218,7 +328,8 @@ class DatadogMonitorResource(msrest.serialization.Model): :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". + :param type_identity_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". @@ -231,10 +342,10 @@ class DatadogMonitorResource(msrest.serialization.Model): values include: "Active", "Suspended". :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: + :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: + :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 @@ -346,7 +457,7 @@ def __init__( class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -848,7 +959,7 @@ def __init__( 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 db5f71213cb..921cfb2b738 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 @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -14,6 +15,130 @@ from ._microsoft_datadog_client_enums import * +class DatadogAgreementProperties(msrest.serialization.Model): + """Terms properties. + + :param publisher: Publisher identifier string. + :type publisher: str + :param product: Product identifier string. + :type product: str + :param plan: Plan identifier string. + :type plan: str + :param license_text_link: Link to HTML with Microsoft and Publisher terms. + :type license_text_link: str + :param privacy_policy_link: Link to the privacy policy of the publisher. + :type privacy_policy_link: str + :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :type retrieve_datetime: ~datetime.datetime + :param signature: Terms signature. + :type signature: str + :param accepted: If any version of the terms have been accepted, otherwise false. + :type accepted: bool + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'license_text_link': {'key': 'licenseTextLink', 'type': 'str'}, + 'privacy_policy_link': {'key': 'privacyPolicyLink', 'type': 'str'}, + 'retrieve_datetime': {'key': 'retrieveDatetime', 'type': 'iso-8601'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'accepted': {'key': 'accepted', 'type': 'bool'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + product: Optional[str] = None, + plan: Optional[str] = None, + license_text_link: Optional[str] = None, + privacy_policy_link: Optional[str] = None, + retrieve_datetime: Optional[datetime.datetime] = None, + signature: Optional[str] = None, + accepted: Optional[bool] = None, + **kwargs + ): + super(DatadogAgreementProperties, self).__init__(**kwargs) + self.publisher = publisher + self.product = product + self.plan = plan + self.license_text_link = license_text_link + self.privacy_policy_link = privacy_policy_link + self.retrieve_datetime = retrieve_datetime + self.signature = signature + self.accepted = accepted + + +class DatadogAgreementResource(msrest.serialization.Model): + """DatadogAgreementResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM id of the resource. + :vartype id: str + :ivar name: Name of the agreement. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DatadogAgreementProperties"] = None, + **kwargs + ): + super(DatadogAgreementResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DatadogAgreementResourceListResponse(msrest.serialization.Model): + """Response of a list operation. + + :param value: Results of a list operation. + :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatadogAgreementResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DatadogAgreementResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class DatadogApiKey(msrest.serialization.Model): """DatadogApiKey. @@ -248,7 +373,8 @@ class DatadogMonitorResource(msrest.serialization.Model): :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". + :param type_identity_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". @@ -261,10 +387,10 @@ class DatadogMonitorResource(msrest.serialization.Model): values include: "Active", "Suspended". :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: + :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: + :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 @@ -392,7 +518,7 @@ def __init__( class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -955,7 +1081,7 @@ def __init__( 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 013d425c748..0dc11fc3371 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._marketplace_agreement_operations import MarketplaceAgreementOperations from ._api_key_operations import ApiKeyOperations from ._host_operations import HostOperations from ._linked_resource_operations import LinkedResourceOperations @@ -17,6 +18,7 @@ from ._single_sign_on_configuration_operations import SingleSignOnConfigurationOperations __all__ = [ + 'MarketplaceAgreementOperations', 'ApiKeyOperations', 'HostOperations', 'LinkedResourceOperations', 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 index 1c688a2ea92..799bb503863 100644 --- 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 @@ -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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] - 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" + 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 @@ -143,9 +146,12 @@ def get_default_key( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] - 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" + accept = "application/json" # Construct URL url = self.get_default_key.metadata['url'] # type: ignore @@ -162,7 +168,7 @@ def get_default_key( # 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.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -185,9 +191,9 @@ 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] + key=None, # type: Optional[str] created=None, # type: Optional[str] **kwargs # type: Any ): @@ -201,12 +207,12 @@ def set_default_key( :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 key: The value of the API key. + :type key: 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 @@ -215,12 +221,15 @@ def set_default_key( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _body = models.DatadogApiKey(created_by=created_by, name=name, key=key, created=created) + 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") + accept = "application/json" # Construct URL url = self.set_default_key.metadata['url'] # type: ignore @@ -238,15 +247,15 @@ def set_default_key( # 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') + 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 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 index 2e8a47a760a..e0154e47335 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] - 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" + 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 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 index bb4d552082a..03a73b6ea6d 100644 --- 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 @@ -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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] - 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" + 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 diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreement_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreement_operations.py new file mode 100644 index 00000000000..6e50b73a905 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreement_operations.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MarketplaceAgreementOperations(object): + """MarketplaceAgreementOperations 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.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.paging.ItemPaged[~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', {})) + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogAgreementResourceListResponse', 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/agreements'} # type: ignore + + def create( + self, + properties=None, # type: Optional["models.DatadogAgreementProperties"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogAgreementResource" + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param properties: Represents the properties of the resource. + :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :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', {})) + + body = models.DatadogAgreementResource(properties=properties) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.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] + + # 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 = 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('DatadogAgreementResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.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 index 7fb70f7eb58..244df408308 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_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 @@ -62,14 +62,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - 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" + 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 @@ -133,14 +136,17 @@ def list_by_resource_group( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - 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" + 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 @@ -208,9 +214,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - 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" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -227,7 +236,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) @@ -250,8 +259,8 @@ def _create_initial( self, resource_group_name, # type: str monitor_name, # type: str - location, # type: str tags=None, # type: Optional[Dict[str, str]] + location=None, # type: Optional[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"]] @@ -263,12 +272,15 @@ def _create_initial( ): # type: (...) -> "models.DatadogMonitorResource" cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 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) + 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") + accept = "application/json" # Construct URL url = self._create_initial.metadata['url'] # type: ignore @@ -286,16 +298,15 @@ def _create_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, 'DatadogMonitorResource') + 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 @@ -320,8 +331,8 @@ def begin_create( self, resource_group_name, # type: str monitor_name, # type: str - location, # type: str tags=None, # type: Optional[Dict[str, str]] + location=None, # type: Optional[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"]] @@ -341,11 +352,11 @@ def begin_create( :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: + :param location: + :type location: str + :param type: Identity type. :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes :param provisioning_state: :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState @@ -354,9 +365,9 @@ def begin_create( :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: + :param datadog_organization_properties: Datadog organization properties. :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: + :param user_info: User info. :type user_info: ~microsoft_datadog_client.models.UserInfo :param name: Name of the SKU. :type name: str @@ -381,8 +392,8 @@ def begin_create( raw_result = self._create_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, - location=location, tags=tags, + location=location, type=type, provisioning_state=provisioning_state, monitoring_status=monitoring_status, @@ -404,7 +415,13 @@ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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: @@ -446,12 +463,15 @@ def update( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) + body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore @@ -469,16 +489,15 @@ def 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, 'DatadogMonitorResourceUpdateParameters') + 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 @@ -503,9 +522,12 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - 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" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -522,6 +544,7 @@ def _delete_initial( # 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) @@ -585,7 +608,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + 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: 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 index 8e982bdeda7..447b4c84187 100644 --- 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 @@ -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 @@ -67,14 +67,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] - 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" + 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 diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py index 1c90d2b4cbd..d23072aa75b 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_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 @@ -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" + 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 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 index 2406fedbd38..a5c5e20d763 100644 --- 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 @@ -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.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -66,9 +66,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] - 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" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -85,7 +88,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.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) 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_configuration_operations.py index 6b60e79a7a7..1046c8b8197 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_configuration_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 @@ -69,14 +69,17 @@ 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" + 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 @@ -133,12 +136,15 @@ def _create_or_update_initial( ): # 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) + body = models.DatadogSingleSignOnResource(properties=properties) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -157,16 +163,15 @@ 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 @@ -205,7 +210,7 @@ def begin_create_or_update( :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 @@ -246,7 +251,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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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: @@ -277,7 +289,7 @@ def get( :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,9 +297,12 @@ 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" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -305,7 +320,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) 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_rule_operations.py index d30ab42567d..afe0bb213ce 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_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 @@ -67,14 +67,17 @@ 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" + 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 @@ -130,7 +133,6 @@ def create_or_update( 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"]] **kwargs # type: Any ): # type: (...) -> "models.MonitoringTagRules" @@ -143,7 +145,7 @@ def create_or_update( :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 @@ -158,24 +160,21 @@ def create_or_update( :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] :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) + 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) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -194,16 +193,15 @@ 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 @@ -237,7 +235,7 @@ def get( :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,9 +243,12 @@ 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" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -265,7 +266,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) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/py.typed b/src/datadog/azext_datadog/vendored_sdks/datadog/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/datadog/report.md b/src/datadog/report.md new file mode 100644 index 00000000000..07f6cea35f4 --- /dev/null +++ b/src/datadog/report.md @@ -0,0 +1,388 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az datadog|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az datadog` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az datadog marketplace-agreement|MarketplaceAgreements|[commands](#CommandsInMarketplaceAgreements)| +|az datadog api-key|ApiKeys|[commands](#CommandsInApiKeys)| +|az datadog host|Hosts|[commands](#CommandsInHosts)| +|az datadog linked-resource|LinkedResources|[commands](#CommandsInLinkedResources)| +|az datadog monitored-resource|MonitoredResources|[commands](#CommandsInMonitoredResources)| +|az datadog monitor|Monitors|[commands](#CommandsInMonitors)| +|az datadog set-password-link|RefreshSetPassword|[commands](#CommandsInRefreshSetPassword)| +|az datadog tag-rule|TagRules|[commands](#CommandsInTagRules)| +|az datadog sso-config|SingleSignOnConfigurations|[commands](#CommandsInSingleSignOnConfigurations)| + +## COMMANDS +### Commands in `az datadog api-key` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog api-key list](#ApiKeysList)|List|[Parameters](#ParametersApiKeysList)|[Example](#ExamplesApiKeysList)| +|[az datadog api-key get-default-key](#ApiKeysGetDefaultKey)|GetDefaultKey|[Parameters](#ParametersApiKeysGetDefaultKey)|[Example](#ExamplesApiKeysGetDefaultKey)| +|[az datadog api-key set-default-key](#ApiKeysSetDefaultKey)|SetDefaultKey|[Parameters](#ParametersApiKeysSetDefaultKey)|[Example](#ExamplesApiKeysSetDefaultKey)| + +### Commands in `az datadog host` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog host list](#HostsList)|List|[Parameters](#ParametersHostsList)|[Example](#ExamplesHostsList)| + +### Commands in `az datadog linked-resource` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog linked-resource list](#LinkedResourcesList)|List|[Parameters](#ParametersLinkedResourcesList)|[Example](#ExamplesLinkedResourcesList)| + +### Commands in `az datadog marketplace-agreement` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog marketplace-agreement list](#MarketplaceAgreementsList)|List|[Parameters](#ParametersMarketplaceAgreementsList)|[Example](#ExamplesMarketplaceAgreementsList)| +|[az datadog marketplace-agreement create](#MarketplaceAgreementsCreate)|Create|[Parameters](#ParametersMarketplaceAgreementsCreate)|[Example](#ExamplesMarketplaceAgreementsCreate)| + +### Commands in `az datadog monitor` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog monitor list](#MonitorsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersMonitorsListByResourceGroup)|[Example](#ExamplesMonitorsListByResourceGroup)| +|[az datadog monitor list](#MonitorsList)|List|[Parameters](#ParametersMonitorsList)|[Example](#ExamplesMonitorsList)| +|[az datadog monitor show](#MonitorsGet)|Get|[Parameters](#ParametersMonitorsGet)|[Example](#ExamplesMonitorsGet)| +|[az datadog monitor create](#MonitorsCreate)|Create|[Parameters](#ParametersMonitorsCreate)|[Example](#ExamplesMonitorsCreate)| +|[az datadog monitor update](#MonitorsUpdate)|Update|[Parameters](#ParametersMonitorsUpdate)|[Example](#ExamplesMonitorsUpdate)| +|[az datadog monitor delete](#MonitorsDelete)|Delete|[Parameters](#ParametersMonitorsDelete)|[Example](#ExamplesMonitorsDelete)| + +### Commands in `az datadog monitored-resource` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog monitored-resource list](#MonitoredResourcesList)|List|[Parameters](#ParametersMonitoredResourcesList)|[Example](#ExamplesMonitoredResourcesList)| + +### Commands in `az datadog set-password-link` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog set-password-link get](#RefreshSetPasswordGet)|Get|[Parameters](#ParametersRefreshSetPasswordGet)|[Example](#ExamplesRefreshSetPasswordGet)| + +### Commands in `az datadog sso-config` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog sso-config list](#SingleSignOnConfigurationsList)|List|[Parameters](#ParametersSingleSignOnConfigurationsList)|[Example](#ExamplesSingleSignOnConfigurationsList)| +|[az datadog sso-config show](#SingleSignOnConfigurationsGet)|Get|[Parameters](#ParametersSingleSignOnConfigurationsGet)|[Example](#ExamplesSingleSignOnConfigurationsGet)| +|[az datadog sso-config create](#SingleSignOnConfigurationsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersSingleSignOnConfigurationsCreateOrUpdate#Create)|[Example](#ExamplesSingleSignOnConfigurationsCreateOrUpdate#Create)| +|[az datadog sso-config update](#SingleSignOnConfigurationsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersSingleSignOnConfigurationsCreateOrUpdate#Update)|Not Found| + +### Commands in `az datadog tag-rule` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az datadog tag-rule list](#TagRulesList)|List|[Parameters](#ParametersTagRulesList)|[Example](#ExamplesTagRulesList)| +|[az datadog tag-rule show](#TagRulesGet)|Get|[Parameters](#ParametersTagRulesGet)|[Example](#ExamplesTagRulesGet)| +|[az datadog tag-rule create](#TagRulesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersTagRulesCreateOrUpdate#Create)|[Example](#ExamplesTagRulesCreateOrUpdate#Create)| +|[az datadog tag-rule update](#TagRulesCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersTagRulesCreateOrUpdate#Update)|Not Found| + + +## COMMAND DETAILS + +### group `az datadog api-key` +#### Command `az datadog api-key list` + +##### Example +``` +az datadog api-key list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog api-key get-default-key` + +##### Example +``` +az datadog api-key get-default-key --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog api-key set-default-key` + +##### Example +``` +az datadog api-key set-default-key --monitor-name "myMonitor" --key "1111111111111111aaaaaaaaaaaaaaaa" \ +--resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--created-by**|string|The user that created the API key.|created_by|createdBy| +|**--name**|string|The name of the API key.|name|name| +|**--key**|string|The value of the API key.|key|key| +|**--created**|string|The time of creation of the API key.|created|created| + +### group `az datadog host` +#### Command `az datadog host list` + +##### Example +``` +az datadog host list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az datadog linked-resource` +#### Command `az datadog linked-resource list` + +##### Example +``` +az datadog linked-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az datadog marketplace-agreement` +#### Command `az datadog marketplace-agreement list` + +##### Example +``` +az datadog marketplace-agreement list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az datadog marketplace-agreement create` + +##### Example +``` +az datadog marketplace-agreement create --properties accepted=true +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--properties**|object|Represents the properties of the resource.|properties|properties| + +### group `az datadog monitor` +#### Command `az datadog monitor list` + +##### Example +``` +az datadog monitor list --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| + +#### Command `az datadog monitor list` + +##### Example +``` +az datadog monitor list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az datadog monitor show` + +##### Example +``` +az datadog monitor show --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor create` + +##### Example +``` +az datadog monitor create --name "myMonitor" --sku-name "myMonitor" --location "West US" \ +--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" \ +--user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" --sku-name "free_Monthly" \ +--tags Environment="Dev" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--tags**|dictionary|Dictionary of :code:``|tags|tags| +|**--location**|string||location|location| +|**--identity-type**|choice|Identity type|type|type| +|**--datadog-organization-properties**|object|Datadog organization properties|datadog_organization_properties|datadogOrganizationProperties| +|**--user-info**|object|User info|user_info|userInfo| +|**--sku-name**|string|Name of the SKU.|name|name| + +#### Command `az datadog monitor update` + +##### Example +``` +az datadog monitor update --name "myMonitor" --tags Environment="Dev" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--tags**|dictionary|The new tags of the monitor resource.|tags|tags| + +#### Command `az datadog monitor delete` + +##### Example +``` +az datadog monitor delete --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az datadog monitored-resource` +#### Command `az datadog monitored-resource list` + +##### Example +``` +az datadog monitored-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az datadog set-password-link` +#### Command `az datadog set-password-link get` + +##### Example +``` +az datadog set-password-link get --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +### group `az datadog sso-config` +#### Command `az datadog sso-config list` + +##### Example +``` +az datadog sso-config list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog sso-config show` + +##### Example +``` +az datadog sso-config show --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string|Configuration name|configuration_name|configurationName| + +#### Command `az datadog sso-config create` + +##### Example +``` +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" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string|Configuration name|configuration_name|configurationName| +|**--properties**|object||properties|properties| + +#### Command `az datadog sso-config update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--configuration-name**|string|Configuration name|configuration_name|configurationName| +|**--properties**|object||properties|properties| + +### group `az datadog tag-rule` +#### Command `az datadog tag-rule list` + +##### Example +``` +az datadog tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog tag-rule show` + +##### Example +``` +az datadog tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string|Rule set name|rule_set_name|ruleSetName| + +#### Command `az datadog tag-rule create` + +##### Example +``` +az datadog tag-rule create --monitor-name "myMonitor" --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" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string|Rule set name|rule_set_name|ruleSetName| +|**--metric-rules-filtering-tags**|array|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.|filtering_tags|filteringTags| +|**--log-rules-send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--log-rules-send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--log-rules-send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| + +#### Command `az datadog tag-rule update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group to which the Datadog resource belongs.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string|Rule set name|rule_set_name|ruleSetName| +|**--metric-rules-filtering-tags**|array|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.|filtering_tags|filteringTags| +|**--log-rules-send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--log-rules-send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--log-rules-send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| diff --git a/src/datadog/setup.cfg b/src/datadog/setup.cfg index 8bfd5a12f85..2fdd96e5d39 100644 --- a/src/datadog/setup.cfg +++ b/src/datadog/setup.cfg @@ -1,4 +1 @@ -[egg_info] -tag_build = -tag_date = 0 - +#setup.cfg \ No newline at end of file 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