diff --git a/src/datadog/azext_datadog/azext_metadata.json b/src/datadog/azext_datadog/azext_metadata.json index 4f48fa652a5..cfc30c747c7 100644 --- a/src/datadog/azext_datadog/azext_metadata.json +++ b/src/datadog/azext_datadog/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.11.0" + "azext.minCliCoreVersion": "2.15.0" } \ No newline at end of file diff --git a/src/datadog/azext_datadog/generated/_client_factory.py b/src/datadog/azext_datadog/generated/_client_factory.py index 2846bbd5a71..65c182d037c 100644 --- a/src/datadog/azext_datadog/generated/_client_factory.py +++ b/src/datadog/azext_datadog/generated/_client_factory.py @@ -11,29 +11,33 @@ def cf_datadog_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client - from ..vendored_sdks.datadog import MicrosoftDatadogClient + from azext_datadog.vendored_sdks.datadog import MicrosoftDatadogClient return get_mgmt_service_client(cli_ctx, MicrosoftDatadogClient) +def cf_marketplace_agreement(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).marketplace_agreements + + def cf_api_key(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).api_key + return cf_datadog_cl(cli_ctx).api_keys def cf_host(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).host + return cf_datadog_cl(cli_ctx).hosts def cf_linked_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).linked_resource + return cf_datadog_cl(cli_ctx).linked_resources def cf_monitored_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitored_resource + return cf_datadog_cl(cli_ctx).monitored_resources def cf_monitor(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitor + return cf_datadog_cl(cli_ctx).monitors def cf_refresh_set_password(cli_ctx, *_): @@ -41,8 +45,8 @@ def cf_refresh_set_password(cli_ctx, *_): def cf_tag_rule(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).tag_rule + return cf_datadog_cl(cli_ctx).tag_rules def cf_single_sign_on_configuration(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).single_sign_on_configuration + return cf_datadog_cl(cli_ctx).single_sign_on_configurations diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py index 1246e6be0a8..3530639d0cf 100644 --- a/src/datadog/azext_datadog/generated/_help.py +++ b/src/datadog/azext_datadog/generated/_help.py @@ -12,9 +12,48 @@ from knack.help_files import helps +helps['datadog marketplace-agreement'] = """ + type: group + short-summary: Manage marketplace agreement with datadog +""" + +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 + short-summary: Manage api key with datadog """ helps['datadog api-key list'] = """ @@ -47,7 +86,7 @@ helps['datadog host'] = """ type: group - short-summary: datadog host + short-summary: Manage host with datadog """ helps['datadog host list'] = """ @@ -61,7 +100,7 @@ helps['datadog linked-resource'] = """ type: group - short-summary: datadog linked-resource + short-summary: Manage linked resource with datadog """ helps['datadog linked-resource list'] = """ @@ -75,7 +114,7 @@ helps['datadog monitored-resource'] = """ type: group - short-summary: datadog monitored-resource + short-summary: Manage monitored resource with datadog """ helps['datadog monitored-resource list'] = """ @@ -89,16 +128,20 @@ helps['datadog monitor'] = """ type: group - short-summary: datadog monitor + short-summary: Manage monitor with datadog """ helps['datadog monitor list'] = """ type: command - short-summary: "List all monitors under the specified subscription." + short-summary: "List all monitors under the specified resource group. And List all monitors under the specified \ +subscription." examples: - name: Monitors_ListByResourceGroup text: |- az datadog monitor list --resource-group "myResourceGroup" + - name: Monitors_List + text: |- + az datadog monitor list """ helps['datadog monitor show'] = """ @@ -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 --monitor-name "myMonitor" --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" --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'] = """ @@ -171,7 +216,7 @@ helps['datadog set-password-link'] = """ type: group - short-summary: datadog set-password-link + short-summary: Manage set password link with datadog """ helps['datadog set-password-link get'] = """ @@ -185,7 +230,7 @@ helps['datadog tag-rule'] = """ type: group - short-summary: datadog tag-rule + short-summary: Manage tag rule with datadog """ helps['datadog tag-rule list'] = """ @@ -211,18 +256,18 @@ type: command short-summary: "Create a tag rule set for a given monitor resource." parameters: - - name: --metric-rules-filtering-tags + - name: --filtering-tags short-summary: "List of filtering tags to be used for capturing metrics. If empty, all resources will be \ captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include \ actions are specified, the rules will only include resources with the associated tags." long-summary: | - Usage: --metric-rules-filtering-tags name=XX value=XX action=XX + Usage: --filtering-tags name=XX value=XX action=XX name: The name (also known as the key) of the tag. value: The value of the tag. action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. - Multiple actions can be specified by using more than one --metric-rules-filtering-tags argument. + Multiple actions can be specified by using more than one --filtering-tags argument. - name: --log-rules-filtering-tags short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ @@ -241,26 +286,26 @@ text: |- az datadog tag-rule create --monitor-name "myMonitor" --log-rules-filtering-tags name="Environment" \ action="Include" value="Prod" --log-rules-filtering-tags name="Environment" action="Exclude" value="Dev" \ ---log-rules-send-aad-logs false --log-rules-send-resource-logs true --log-rules-send-subscription-logs true \ ---resource-group "myResourceGroup" --rule-set-name "default" +--send-aad-logs false --send-resource-logs true --send-subscription-logs true --resource-group "myResourceGroup" \ +--rule-set-name "default" """ helps['datadog tag-rule update'] = """ type: command short-summary: "Update a tag rule set for a given monitor resource." parameters: - - name: --metric-rules-filtering-tags + - name: --filtering-tags short-summary: "List of filtering tags to be used for capturing metrics. If empty, all resources will be \ captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include \ actions are specified, the rules will only include resources with the associated tags." long-summary: | - Usage: --metric-rules-filtering-tags name=XX value=XX action=XX + Usage: --filtering-tags name=XX value=XX action=XX name: The name (also known as the key) of the tag. value: The value of the tag. action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. - Multiple actions can be specified by using more than one --metric-rules-filtering-tags argument. + Multiple actions can be specified by using more than one --filtering-tags argument. - name: --log-rules-filtering-tags short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ @@ -278,7 +323,7 @@ helps['datadog sso-config'] = """ type: group - short-summary: datadog sso-config + short-summary: Manage sso config with datadog """ helps['datadog sso-config list'] = """ @@ -287,8 +332,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 +341,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'] = """ @@ -307,37 +351,40 @@ parameters: - name: --properties long-summary: | - Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-state: Various states of the SSO resource enterprise-app-id: The Id of the Enterprise App used for Single sign-on. - single-sign-on-url: The login URL specific to this Datadog Organization. examples: - name: SingleSignOnConfigurations_CreateOrUpdate text: |- - az datadog sso-config create --configuration-name "default" --monitor-name \ -"myMonitor" --properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" \ ---resource-group "myResourceGroup" + az datadog sso-config create --configuration-name "default" --monitor-name "myMonitor" --properties \ +enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" --resource-group \ +"myResourceGroup" """ helps['datadog sso-config update'] = """ type: command short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. """ helps['datadog sso-config wait'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is \ -met. + short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is met. examples: - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -created. + - name: Pause executing next line of CLI script until the datadog sso-config is successfully created. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -updated. + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog sso-config is successfully updated. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --updated + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --updated """ diff --git a/src/datadog/azext_datadog/generated/_params.py b/src/datadog/azext_datadog/generated/_params.py index 6aa9c602fa6..7d60bee6a14 100644 --- a/src/datadog/azext_datadog/generated/_params.py +++ b/src/datadog/azext_datadog/generated/_params.py @@ -19,16 +19,21 @@ ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from azext_datadog.action import ( + AddMarketplaceagreementsProperties, AddDatadogOrganizationProperties, AddUserInfo, - AddMetricRulesFilteringTags, + AddFilteringTags, AddLogRulesFilteringTags, - AddProperties + AddSinglesignonconfigurationsProperties ) def load_arguments(self, _): + with self.argument_context('datadog 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') @@ -67,32 +72,22 @@ def load_arguments(self, _): with self.argument_context('datadog monitor create') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' - 'name') + c.argument('monitor_name', type=str, help='Monitor resource name') c.argument('tags', tags_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('identity_type', arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), help='Identity type') - c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Failed', 'Canceled', 'Deleted', - 'NotSpecified']), help='Provisioning state') - c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' - 'resource monitoring is enabled or disabled.') - c.argument('marketplace_subscription_status', arg_type=get_enum_type(['Active', 'Suspended']), help='Flag ' - 'specifying the Marketplace Subscription Status of the resource. If payment is not made in time, ' - 'the resource will go in Suspended state.') - c.argument('datadog_organization_properties', action=AddDatadogOrganizationProperties, nargs='*', + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), + help='Identity type', arg_group='Identity') + c.argument('datadog_organization_properties', action=AddDatadogOrganizationProperties, nargs='+', help='Datadog organization properties') - c.argument('user_info', action=AddUserInfo, nargs='*', help='User info') - c.argument('sku_name', type=str, help='Name of the SKU.') + c.argument('user_info', action=AddUserInfo, nargs='+', help='User info') + c.argument('name', type=str, help='Name of the SKU.', arg_group='Sku') with self.argument_context('datadog monitor update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' 'name', id_part='name') c.argument('tags', tags_type) - c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' - 'resource monitoring is enabled or disabled.') with self.argument_context('datadog monitor delete') as c: c.argument('resource_group_name', resource_group_name_type) @@ -121,41 +116,42 @@ def load_arguments(self, _): c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name') c.argument('rule_set_name', type=str, help='Rule set name') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only ' - 'Exclude action is specified, the rules will apply to the list of all available resources. If ' - 'Include actions are specified, the rules will only include resources with the associated tags.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, ' + 'the rules will apply to the list of all available resources. If Include actions are specified, the ' + 'rules will only include resources with the associated tags.', arg_group='Metric Rules') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' + 'subscription logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure resource logs ' + 'should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='+', help='List of filtering ' 'tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If ' 'empty, all resources will be captured. If only Exclude action is specified, the rules will apply ' 'to the list of all available resources. If Include actions are specified, the rules will only ' - 'include resources with the associated tags.') + 'include resources with the associated tags.', arg_group='Log Rules') with self.argument_context('datadog tag-rule update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') c.argument('rule_set_name', type=str, help='Rule set name', id_part='child_name_1') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only ' - 'Exclude action is specified, the rules will apply to the list of all available resources. If ' - 'Include actions are specified, the rules will only include resources with the associated tags.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, ' + 'the rules will apply to the list of all available resources. If Include actions are specified, the ' + 'rules will only include resources with the associated tags.', arg_group='Metric Rules') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' + 'subscription logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure resource logs ' + 'should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='+', help='List of filtering ' 'tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If ' 'empty, all resources will be captured. If only Exclude action is specified, the rules will apply ' 'to the list of all available resources. If Include actions are specified, the rules will only ' - 'include resources with the associated tags.') + 'include resources with the associated tags.', arg_group='Log Rules') + c.ignore('body') with self.argument_context('datadog sso-config list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -170,13 +166,14 @@ def load_arguments(self, _): c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name') c.argument('configuration_name', type=str, help='Configuration name') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') with self.argument_context('datadog sso-config update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') c.argument('configuration_name', type=str, help='Configuration name', id_part='child_name_1') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') + c.ignore('body') with self.argument_context('datadog sso-config wait') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/datadog/azext_datadog/generated/action.py b/src/datadog/azext_datadog/generated/action.py index 27649270eec..9598b252c68 100644 --- a/src/datadog/azext_datadog/generated/action.py +++ b/src/datadog/azext_datadog/generated/action.py @@ -14,6 +14,46 @@ from knack.util import CLIError +class AddMarketplaceagreementsProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'publisher': + d['publisher'] = v[0] + elif kl == 'product': + d['product'] = v[0] + elif kl == 'plan': + d['plan'] = v[0] + elif kl == 'license-text-link': + d['license_text_link'] = v[0] + elif kl == 'privacy-policy-link': + d['privacy_policy_link'] = v[0] + elif kl == 'retrieve-datetime': + d['retrieve_datetime'] = v[0] + elif kl == 'signature': + d['signature'] = v[0] + elif kl == 'accepted': + d['accepted'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'publisher, product, plan, license-text-link, privacy-policy-link, retrieve-datetime, ' + 'signature, accepted'.format(k)) + return d + + class AddDatadogOrganizationProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) @@ -37,6 +77,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['linking_client_id'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter datadog_organization_properties. All ' + 'possible keys are: linking-auth-code, linking-client-id, enterprise-app-id'.format(k)) return d @@ -63,13 +106,16 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['email_address'] = v[0] elif kl == 'phone-number': d['phone_number'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter user_info. All possible keys are: name, ' + 'email-address, phone-number'.format(k)) return d -class AddMetricRulesFilteringTags(argparse._AppendAction): +class AddFilteringTags(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - super(AddMetricRulesFilteringTags, self).__call__(parser, namespace, action, option_string) + super(AddFilteringTags, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -89,6 +135,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['value'] = v[0] elif kl == 'action': d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter filtering_tags. All possible keys are: ' + 'name, value, action'.format(k)) return d @@ -115,10 +164,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['value'] = v[0] elif kl == 'action': d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter log_rules_filtering_tags. All possible ' + 'keys are: name, value, action'.format(k)) return d -class AddProperties(argparse.Action): +class AddSinglesignonconfigurationsProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) namespace.properties = action @@ -139,6 +191,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['single_sign_on_state'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] - elif kl == 'single-sign-on-url': - d['single_sign_on_url'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'single-sign-on-state, enterprise-app-id'.format(k)) return d diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py index 5fa293ddeea..ad5b1847b1d 100644 --- a/src/datadog/azext_datadog/generated/commands.py +++ b/src/datadog/azext_datadog/generated/commands.py @@ -15,45 +15,55 @@ 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_agreements_operations#MarketplaceA' + 'greementsOperations.{}', + client_factory=cf_marketplace_agreement) + with self.command_group('datadog marketplace-agreement', datadog_marketplace_agreement, + client_factory=cf_marketplace_agreement) 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.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._api_keys_operations#ApiKeysOperations.{}', client_factory=cf_api_key) - with self.command_group('datadog api-key', datadog_api_key, client_factory=cf_api_key, is_experimental=True) as g: + with self.command_group('datadog api-key', datadog_api_key, client_factory=cf_api_key) as g: g.custom_command('list', 'datadog_api_key_list') g.custom_command('get-default-key', 'datadog_api_key_get_default_key') g.custom_command('set-default-key', 'datadog_api_key_set_default_key') from azext_datadog.generated._client_factory import cf_host datadog_host = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._host_operations#HostOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._hosts_operations#HostsOperations.{}', client_factory=cf_host) - with self.command_group('datadog host', datadog_host, client_factory=cf_host, is_experimental=True) as g: + with self.command_group('datadog host', datadog_host, client_factory=cf_host) as g: g.custom_command('list', 'datadog_host_list') from azext_datadog.generated._client_factory import cf_linked_resource datadog_linked_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._linked_resource_operations#LinkedResourceOpera' - 'tions.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._linked_resources_operations#LinkedResourcesOpe' + 'rations.{}', client_factory=cf_linked_resource) - with self.command_group('datadog linked-resource', datadog_linked_resource, client_factory=cf_linked_resource, - is_experimental=True) as g: + with self.command_group('datadog linked-resource', datadog_linked_resource, + client_factory=cf_linked_resource) as g: g.custom_command('list', 'datadog_linked_resource_list') from azext_datadog.generated._client_factory import cf_monitored_resource datadog_monitored_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitored_resource_operations#MonitoredResourc' - 'eOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitored_resources_operations#MonitoredResour' + 'cesOperations.{}', client_factory=cf_monitored_resource) with self.command_group('datadog monitored-resource', datadog_monitored_resource, - client_factory=cf_monitored_resource, is_experimental=True) as g: + client_factory=cf_monitored_resource) as g: g.custom_command('list', 'datadog_monitored_resource_list') from azext_datadog.generated._client_factory import cf_monitor datadog_monitor = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitor_operations#MonitorOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitors_operations#MonitorsOperations.{}', client_factory=cf_monitor) - with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor, is_experimental=True) as g: + with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor) as g: g.custom_command('list', 'datadog_monitor_list') g.custom_show_command('show', 'datadog_monitor_show') g.custom_command('create', 'datadog_monitor_create', supports_no_wait=True) @@ -67,31 +77,32 @@ def load_command_table(self, _): '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_refresh_set_password) 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( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rule_operations#TagRuleOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rules_operations#TagRulesOperations.{}', client_factory=cf_tag_rule) - with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule, - is_experimental=True) as g: + with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule) as g: g.custom_command('list', 'datadog_tag_rule_list') g.custom_show_command('show', 'datadog_tag_rule_show') g.custom_command('create', 'datadog_tag_rule_create') - g.custom_command('update', 'datadog_tag_rule_update') + g.generic_update_command('update', setter_arg_name='body', custom_func_name='datadog_tag_rule_update') from azext_datadog.generated._client_factory import cf_single_sign_on_configuration datadog_single_sign_on_configuration = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configuration_operations#Single' - 'SignOnConfigurationOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configurations_operations#Singl' + 'eSignOnConfigurationsOperations.{}', client_factory=cf_single_sign_on_configuration) with self.command_group('datadog sso-config', datadog_single_sign_on_configuration, - client_factory=cf_single_sign_on_configuration, is_experimental=True) as g: - g.custom_command('list', 'datadog_single_sign_on_configuration_list') - g.custom_show_command('show', 'datadog_single_sign_on_configuration_show') - g.custom_command('create', 'datadog_single_sign_on_configuration_create', supports_no_wait=True) - g.generic_update_command('update', setter_arg_name='properties', setter_name='begin_create_or_update', - custom_func_name='datadog_single_sign_on_configuration_update', - supports_no_wait=True) - g.custom_wait_command('wait', 'datadog_single_sign_on_configuration_show') + client_factory=cf_single_sign_on_configuration) as g: + g.custom_command('list', 'datadog_sso_config_list') + g.custom_show_command('show', 'datadog_sso_config_show') + g.custom_command('create', 'datadog_sso_config_create', supports_no_wait=True) + g.generic_update_command('update', setter_arg_name='body', setter_name='begin_create_or_update', + custom_func_name='datadog_sso_config_update', supports_no_wait=True) + g.custom_wait_command('wait', 'datadog_sso_config_show') + + with self.command_group('datadog', is_experimental=True): + pass diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py index 8ff6b15be07..fd77f235d1a 100644 --- a/src/datadog/azext_datadog/generated/custom.py +++ b/src/datadog/azext_datadog/generated/custom.py @@ -13,6 +13,17 @@ 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): + body = {} + body['properties'] = properties + return client.create(body=body) + + def datadog_api_key_list(client, resource_group_name, monitor_name): @@ -30,16 +41,18 @@ 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): + body = {} + body['created_by'] = created_by + body['name'] = name + body['key'] = key + body['created'] = created return client.set_default_key(resource_group_name=resource_group_name, monitor_name=monitor_name, - created_by=created_by, - name=name, - key=key, - created=created) + body=body) def datadog_host_list(client, @@ -80,40 +93,39 @@ def datadog_monitor_show(client, def datadog_monitor_create(client, resource_group_name, monitor_name, - location, tags=None, - identity_type=None, - provisioning_state=None, - monitoring_status=None, - marketplace_subscription_status=None, + location=None, + type_=None, datadog_organization_properties=None, user_info=None, - sku_name=None, + name=None, no_wait=False): + body = {} + body['tags'] = tags + body['location'] = location + body['identity'] = {} + body['identity']['type'] = type_ + body['properties'] = {} + body['properties']['datadog_organization_properties'] = datadog_organization_properties + body['properties']['user_info'] = user_info + body['sku'] = {} + body['sku']['name'] = name return sdk_no_wait(no_wait, client.begin_create, resource_group_name=resource_group_name, monitor_name=monitor_name, - tags=tags, - location=location, - type=identity_type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=sku_name) + body=body) def datadog_monitor_update(client, resource_group_name, monitor_name, - tags=None, - monitoring_status=None): + tags=None): + body = {} + body['tags'] = tags return client.update(resource_group_name=resource_group_name, monitor_name=monitor_name, - tags=tags, - monitoring_status=monitoring_status) + body=body) def datadog_monitor_delete(client, @@ -126,9 +138,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) @@ -153,73 +165,85 @@ def datadog_tag_rule_create(client, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): + body = {} + body['metric_rules'] = {} + body['metric_rules']['filtering_tags'] = filtering_tags + body['log_rules'] = {} + body['log_rules']['send_aad_logs'] = send_aad_logs + body['log_rules']['send_subscription_logs'] = send_subscription_logs + body['log_rules']['send_resource_logs'] = send_resource_logs + body['log_rules']['filtering_tags'] = log_rules_filtering_tags return client.create_or_update(resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + body=body) -def datadog_tag_rule_update(client, +def datadog_tag_rule_update(instance, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): - return client.create_or_update(resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + if filtering_tags is not None: + instance.metric_rules.filtering_tags = filtering_tags + if send_aad_logs is not None: + instance.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.log_rules.send_subscription_logs = send_subscription_logs + if send_resource_logs is not None: + instance.log_rules.send_resource_logs = send_resource_logs + if log_rules_filtering_tags is not None: + instance.log_rules.filtering_tags = log_rules_filtering_tags + return instance -def datadog_single_sign_on_configuration_list(client, - resource_group_name, - monitor_name): +def datadog_sso_config_list(client, + resource_group_name, + monitor_name): return client.list(resource_group_name=resource_group_name, monitor_name=monitor_name) -def datadog_single_sign_on_configuration_show(client, - resource_group_name, - monitor_name, - configuration_name): +def datadog_sso_config_show(client, + resource_group_name, + monitor_name, + configuration_name): return client.get(resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name) -def datadog_single_sign_on_configuration_create(client, - resource_group_name, - monitor_name, - configuration_name, - properties=None, - no_wait=False): +def datadog_sso_config_create(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + body = {} + body['properties'] = properties return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties) + body=body) -def datadog_single_sign_on_configuration_update(instance, - resource_group_name, - monitor_name, - configuration_name, - no_wait=False): +def datadog_sso_config_update(instance, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + if properties is not None: + instance.properties = properties return instance diff --git a/src/datadog/azext_datadog/tests/__init__.py b/src/datadog/azext_datadog/tests/__init__.py index 50e0627daff..70488e93851 100644 --- a/src/datadog/azext_datadog/tests/__init__.py +++ b/src/datadog/azext_datadog/tests/__init__.py @@ -31,8 +31,8 @@ def try_manual(func): def import_manual_function(origin_func): from importlib import import_module - decorated_path = inspect.getfile(origin_func) - module_path = __path__[0] + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() if not decorated_path.startswith(module_path): raise Exception("Decorator can only be used in submodules!") manual_path = os.path.join( @@ -46,7 +46,6 @@ def import_manual_function(origin_func): def get_func_to_call(): func_to_call = func try: - func_to_call = import_manual_function(func) func_to_call = import_manual_function(func) logger.info("Found manual override for %s(...)", func.__name__) except (ImportError, AttributeError): @@ -66,6 +65,9 @@ def wrapper(*args, **kwargs): ret = func_to_call(*args, **kwargs) except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() test_map[func.__name__]["result"] = FAILED test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] diff --git a/src/datadog/azext_datadog/tests/latest/example_steps.py b/src/datadog/azext_datadog/tests/latest/example_steps.py new file mode 100644 index 00000000000..9c1fc4c8337 --- /dev/null +++ b/src/datadog/azext_datadog/tests/latest/example_steps.py @@ -0,0 +1,263 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +from .. import try_manual + + +# EXAMPLE: /MarketplaceAgreements/put/MarketplaceAgreements_Create +@try_manual +def step_marketplace_agreement_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog marketplace-agreement create ' + '--properties accepted=true', + checks=checks) + + +# EXAMPLE: /Monitors/put/Monitors_Create +@try_manual +def step_monitor_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor create ' + '--monitor-name "{myMonitor}" ' + '--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" ' + '--name "free_Monthly" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az datadog monitor wait --created ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_Get +@try_manual +def step_monitor_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor show ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_List +@try_manual +def step_monitor_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /Monitors/get/Monitors_ListByResourceGroup +@try_manual +def step_monitor_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/patch/Monitors_Update +@try_manual +def step_monitor_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor update ' + '--name "{myMonitor}" ' + '--tags Environment="Dev" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /ApiKeys/post/ApiKeys_GetDefaultKey +@try_manual +def step_api_key_get_default_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog api-key get-default-key ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /ApiKeys/post/ApiKeys_List +@try_manual +def step_api_key_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog api-key list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /ApiKeys/post/ApiKeys_SetDefaultKey +@try_manual +def step_api_key_set_default_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog api-key set-default-key ' + '--monitor-name "{myMonitor}" ' + '--key "1111111111111111aaaaaaaaaaaaaaaa" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Hosts/post/Hosts_List +@try_manual +def step_host_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog host list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /LinkedResources/post/LinkedResources_List +@try_manual +def step_linked_resource_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog linked-resource list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /MarketplaceAgreements/get/MarketplaceAgreements_List +@try_manual +def step_marketplace_agreement_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog marketplace-agreement list', + checks=checks) + + +# EXAMPLE: /MonitoredResources/post/MonitoredResources_List +@try_manual +def step_monitored_resource_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitored-resource list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RefreshSetPassword/post/RefreshSetPassword_Get +@try_manual +def step_set_password_link_get(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog set-password-link get ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOnConfigurations/put/SingleSignOnConfigurations_CreateOrUpdate +@try_manual +def step_sso_config_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('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 "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_Get +@try_manual +def step_sso_config_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog sso-config show ' + '--configuration-name "default" ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_List +@try_manual +def step_sso_config_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog sso-config list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /TagRules/put/TagRules_CreateOrUpdate +@try_manual +def step_tag_rule_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az 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" ' + '--send-aad-logs false ' + '--send-resource-logs true ' + '--send-subscription-logs true ' + '--resource-group "{rg}" ' + '--rule-set-name "default"', + checks=checks) + + +# EXAMPLE: /TagRules/get/TagRules_Get +@try_manual +def step_tag_rule_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog tag-rule show ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}" ' + '--rule-set-name "default"', + checks=checks) + + +# EXAMPLE: /TagRules/get/TagRules_List +@try_manual +def step_tag_rule_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog tag-rule list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/delete/Monitors_Delete +@try_manual +def step_monitor_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor delete -y ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + 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..641bf777dd4 100644 --- a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -10,299 +10,110 @@ import os from azure.cli.testsdk import ScenarioTest -from .. import try_manual, raise_if, calc_coverage from azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_marketplace_agreement_create +from .example_steps import step_monitor_create +from .example_steps import step_monitor_show +from .example_steps import step_monitor_list +from .example_steps import step_monitor_list2 +from .example_steps import step_monitor_update +from .example_steps import step_api_key_get_default_key +from .example_steps import step_api_key_list +from .example_steps import step_api_key_set_default_key +from .example_steps import step_host_list +from .example_steps import step_linked_resource_list +from .example_steps import step_marketplace_agreement_list +from .example_steps import step_monitored_resource_list +from .example_steps import step_set_password_link_get +from .example_steps import step_sso_config_create +from .example_steps import step_sso_config_show +from .example_steps import step_sso_config_list +from .example_steps import step_tag_rule_create +from .example_steps import step_tag_rule_show +from .example_steps import step_tag_rule_list +from .example_steps import step_monitor_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) +# Env setup_scenario @try_manual -def setup(test, rg): +def setup_scenario(test, rg): pass -# EXAMPLE: /Monitors/put/Monitors_Create +# Env cleanup_scenario @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), - ]) - - -# EXAMPLE: /Monitors/get/Monitors_ListByResourceGroup -@try_manual -def step__monitors_get_monitors_listbyresourcegroup(test, rg): - test.cmd('az datadog monitor list ' - '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) - - -# EXAMPLE: /Monitors/patch/Monitors_Update -@try_manual -def step__monitors_patch_monitors_update(test, rg): - test.cmd('az datadog monitor update ' - '--name "{myMonitor}" ' - '--monitoring-status "Enabled" ' - '--tags Environment="Dev2" ' - '--resource-group "{rg}"', - checks=[ - test.check("name", "{myMonitor}", case_sensitive=False), - test.check("nameSkuName", "drawdown_testing_20200904_Monthly", case_sensitive=False), - test.check("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), - ]) - - -# EXAMPLE: /ApiKeys/post/ApiKeys_List -@try_manual -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), - ]) - - -# EXAMPLE: /ApiKeys/post/ApiKeys_SetDefaultKey -@try_manual -def step__apikeys_post_apikeys_setdefaultkey(test, rg): - test.cmd('az datadog api-key set-default-key ' - '--monitor-name "{myMonitor}" ' - '--key "1111111111111111aaaaaaaaaaaaaaaa" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /Hosts/post/Hosts_List -@try_manual -def step__hosts_post_hosts_list(test, rg): - test.cmd('az datadog host list ' - '--monitor-name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /LinkedResources/post/LinkedResources_List -@try_manual -def step__linkedresources_post_linkedresources_list(test, rg): - test.cmd('az datadog linked-resource list ' - '--monitor-name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) - - -# EXAMPLE: /MonitoredResources/post/MonitoredResources_List -@try_manual -def step__monitoredresources_post(test, rg): - test.cmd('az datadog monitored-resource list ' - '--monitor-name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /RefreshSetPassword/post/RefreshSetPassword_Get -@try_manual -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), - ]) - - -# EXAMPLE: /SingleSignOnConfigurations/put/SingleSignOnConfigurations_CreateOrUpdate -@try_manual -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" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_Get -@try_manual -def step__singlesignonconfigurations_get(test, rg): - test.cmd('az datadog sso-config show ' - '--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), - ]) - - -# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_List -@try_manual -def step__singlesignonconfigurations_get2(test, rg): - test.cmd('az datadog sso-config list ' - '--monitor-name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1), - ]) - - -# EXAMPLE: /TagRules/put/TagRules_CreateOrUpdate -@try_manual -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), - ]) - - -# EXAMPLE: /TagRules/get/TagRules_Get -@try_manual -def step__tagrules_get_tagrules_get(test, rg): - test.cmd('az datadog tag-rule show ' - '--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), - ]) - - -# EXAMPLE: /TagRules/get/TagRules_List -@try_manual -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), - ]) - - -# EXAMPLE: /Monitors/delete/Monitors_Delete -@try_manual -def step__monitors_delete_monitors_delete(test, rg): - test.cmd('az datadog monitor delete -y ' - '--name "{myMonitor}" ' - '--resource-group "{rg}"', - checks=[]) - - -@try_manual -def cleanup(test, rg): +def cleanup_scenario(test, rg): pass +# Testcase: Scenario @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__hosts_post_hosts_list(test, rg) - step__linkedresources_post_linkedresources_list(test, rg) - step__monitoredresources_post(test, rg) - step__refreshsetpassword_post(test, rg) - step__singlesignonconfigurations_put(test, rg) - step__singlesignonconfigurations_get(test, rg) - step__singlesignonconfigurations_get2(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) - - -@try_manual -class MicrosoftDatadogClientScenarioTest(ScenarioTest): - - @ResourceGroupPreparer(name_prefix='clitestdatadog_myResourceGroup'[:7], key='rg', parameter_name='rg') - def test_datadog(self, rg): - + setup_scenario(test, rg) + step_marketplace_agreement_create(test, rg, checks=[]) + step_monitor_create(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("sku.name", "free_Monthly", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_monitor_show(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_monitor_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_monitor_list2(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_monitor_update(test, rg, checks=[ + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("name", "{myMonitor}", case_sensitive=False), + test.check("location", "West US", case_sensitive=False), + test.check("tags.Environment", "Dev", case_sensitive=False), + ]) + step_api_key_get_default_key(test, rg, checks=[]) + step_api_key_list(test, rg, checks=[]) + step_api_key_set_default_key(test, rg, checks=[]) + step_host_list(test, rg, checks=[]) + step_linked_resource_list(test, rg, checks=[]) + step_marketplace_agreement_list(test, rg, checks=[]) + step_monitored_resource_list(test, rg, checks=[]) + step_set_password_link_get(test, rg, checks=[]) + step_sso_config_create(test, rg, checks=[]) + step_sso_config_show(test, rg, checks=[]) + step_sso_config_list(test, rg, checks=[]) + step_tag_rule_create(test, rg, checks=[]) + step_tag_rule_show(test, rg, checks=[]) + step_tag_rule_list(test, rg, checks=[]) + step_monitor_delete(test, rg, checks=[]) + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class DatadogScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(DatadogScenarioTest, self).__init__(*args, **kwargs) self.kwargs.update({ 'myMonitor': 'myMonitor', }) + + @ResourceGroupPreparer(name_prefix='clitestdatadog_myResourceGroup'[:7], key='rg', parameter_name='rg') + def test_datadog_Scenario(self, rg): call_scenario(self, rg) calc_coverage(__file__) raise_if() + 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..177e85e1055 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,39 +18,42 @@ from azure.core.credentials import TokenCredential from ._configuration import MicrosoftDatadogClientConfiguration -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 MarketplaceAgreementsOperations +from .operations import ApiKeysOperations +from .operations import HostsOperations +from .operations import LinkedResourcesOperations +from .operations import MonitoredResourcesOperations +from .operations import Operations +from .operations import MonitorsOperations from .operations import RefreshSetPasswordOperations -from .operations import TagRuleOperations -from .operations import SingleSignOnConfigurationOperations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations from . import models class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.operations.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.operations.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.operations.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.operations.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.operations.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.operations.MonitorOperations + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.operations.MarketplaceAgreementsOperations + :ivar api_keys: ApiKeysOperations operations + :vartype api_keys: microsoft_datadog_client.operations.ApiKeysOperations + :ivar hosts: HostsOperations operations + :vartype hosts: microsoft_datadog_client.operations.HostsOperations + :ivar linked_resources: LinkedResourcesOperations operations + :vartype linked_resources: microsoft_datadog_client.operations.LinkedResourcesOperations + :ivar monitored_resources: MonitoredResourcesOperations operations + :vartype monitored_resources: microsoft_datadog_client.operations.MonitoredResourcesOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.operations.Operations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.operations.MonitorsOperations :ivar refresh_set_password: RefreshSetPasswordOperations operations :vartype refresh_set_password: microsoft_datadog_client.operations.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.operations.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.operations.SingleSignOnConfigurationOperations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. @@ -76,23 +79,25 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.api_key = ApiKeyOperations( + self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( + self.api_keys = ApiKeysOperations( self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( + self.hosts = HostsOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( + self.linked_resources = LinkedResourcesOperations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.monitored_resources = MonitoredResourcesOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( 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.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( + self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py index 3b629c26f27..b43d36247a5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_datadog_client_async import MicrosoftDatadogClient +from ._microsoft_datadog_client import MicrosoftDatadogClient __all__ = ['MicrosoftDatadogClient'] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py similarity index 95% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py index e2d16a4bf3e..6e5bf0df71d 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py @@ -45,8 +45,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/aio/_microsoft_datadog_client_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py similarity index 55% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py index 7b6366c0e29..6e4ded3c6ae 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py @@ -15,40 +15,43 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import MicrosoftDatadogClientConfiguration -from .operations_async import ApiKeyOperations -from .operations_async import HostOperations -from .operations_async import LinkedResourceOperations -from .operations_async import MonitoredResourceOperations -from .operations_async import OperationOperations -from .operations_async import MonitorOperations -from .operations_async import RefreshSetPasswordOperations -from .operations_async import TagRuleOperations -from .operations_async import SingleSignOnConfigurationOperations +from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations +from .operations import ApiKeysOperations +from .operations import HostsOperations +from .operations import LinkedResourcesOperations +from .operations import MonitoredResourcesOperations +from .operations import Operations +from .operations import MonitorsOperations +from .operations import RefreshSetPasswordOperations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations from .. import models class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.aio.operations_async.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.aio.operations_async.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.aio.operations_async.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.aio.operations_async.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.aio.operations_async.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.aio.operations_async.MonitorOperations + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations + :ivar api_keys: ApiKeysOperations operations + :vartype api_keys: microsoft_datadog_client.aio.operations.ApiKeysOperations + :ivar hosts: HostsOperations operations + :vartype hosts: microsoft_datadog_client.aio.operations.HostsOperations + :ivar linked_resources: LinkedResourcesOperations operations + :vartype linked_resources: microsoft_datadog_client.aio.operations.LinkedResourcesOperations + :ivar monitored_resources: MonitoredResourcesOperations operations + :vartype monitored_resources: microsoft_datadog_client.aio.operations.MonitoredResourcesOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.aio.operations.Operations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.aio.operations.MonitorsOperations :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.aio.operations_async.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.aio.operations_async.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.aio.operations_async.SingleSignOnConfigurationOperations + :vartype refresh_set_password: microsoft_datadog_client.aio.operations.RefreshSetPasswordOperations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.aio.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.aio.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. @@ -73,23 +76,25 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.api_key = ApiKeyOperations( + self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( + self.api_keys = ApiKeysOperations( self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( + self.hosts = HostsOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( + self.linked_resources = LinkedResourcesOperations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.monitored_resources = MonitoredResourcesOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( 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.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( + self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: 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..0ba3af657d6 --- /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_agreements_operations import MarketplaceAgreementsOperations +from ._api_keys_operations import ApiKeysOperations +from ._hosts_operations import HostsOperations +from ._linked_resources_operations import LinkedResourcesOperations +from ._monitored_resources_operations import MonitoredResourcesOperations +from ._operations import Operations +from ._monitors_operations import MonitorsOperations +from ._refresh_set_password_operations import RefreshSetPasswordOperations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations + +__all__ = [ + 'MarketplaceAgreementsOperations', + 'ApiKeysOperations', + 'HostsOperations', + 'LinkedResourcesOperations', + 'MonitoredResourcesOperations', + 'Operations', + 'MonitorsOperations', + 'RefreshSetPasswordOperations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', +] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_keys_operations.py similarity index 89% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_keys_operations.py index ab42f19d5cd..c1f9364386a 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_api_keys_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ApiKeyOperations: - """ApiKeyOperations async operations. +class ApiKeysOperations: + """ApiKeysOperations 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. @@ -62,14 +62,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 @@ -137,9 +140,12 @@ async 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 @@ -156,7 +162,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -179,10 +185,7 @@ async def set_default_key( self, resource_group_name: str, monitor_name: str, - key: str, - created_by: Optional[str] = None, - name: Optional[str] = None, - created: Optional[str] = None, + body: Optional["models.DatadogApiKey"] = None, **kwargs ) -> None: """Set the default api key. @@ -194,26 +197,21 @@ async 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 created: The time of creation of the API key. - :type created: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {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) 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 @@ -231,15 +229,15 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_hosts_operations.py similarity index 92% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_hosts_operations.py index f219da6c04b..d2f64f47d5b 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_hosts_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class HostOperations: - """HostOperations async operations. +class HostsOperations: + """HostsOperations 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. @@ -62,14 +62,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/aio/operations_async/_linked_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resources_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resources_operations.py index dc1dd4956fa..69b61f46d29 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_linked_resources_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LinkedResourceOperations: - """LinkedResourceOperations async operations. +class LinkedResourcesOperations: + """LinkedResourcesOperations 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. @@ -62,14 +62,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/aio/operations/_marketplace_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py new file mode 100644 index 00000000000..902db731ad6 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py @@ -0,0 +1,175 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MarketplaceAgreementsOperations: + """MarketplaceAgreementsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogAgreementResourceListResponse"]: + """List Datadog marketplace agreements in the subscription. + + List Datadog marketplace agreements in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "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('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, + body: Optional["models.DatadogAgreementResource"] = None, + **kwargs + ) -> "models.DatadogAgreementResource": + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogAgreementResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.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_async/_monitored_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resources_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resources_operations.py index 50b609ec8b3..e84cdc989d3 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitored_resources_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MonitoredResourceOperations: - """MonitoredResourceOperations async operations. +class MonitoredResourcesOperations: + """MonitoredResourcesOperations 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. @@ -62,14 +62,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/aio/operations_async/_monitor_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py similarity index 83% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py index 8b7176e59b4..38d9bb40c6f 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MonitorOperations: - """MonitorOperations async operations. +class MonitorsOperations: + """MonitorsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -57,14 +57,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 @@ -127,14 +130,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 @@ -201,9 +207,12 @@ async 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 @@ -220,7 +229,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -243,24 +252,17 @@ async def _create_initial( self, resource_group_name: str, monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, + body: Optional["models.DatadogMonitorResource"] = None, **kwargs ) -> "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) 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 @@ -278,16 +280,15 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,15 +313,7 @@ async def begin_create( self, resource_group_name: str, monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, + body: Optional["models.DatadogMonitorResource"] = None, **kwargs ) -> AsyncLROPoller["models.DatadogMonitorResource"]: """Create a monitor resource. @@ -332,25 +325,8 @@ async 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: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -372,15 +348,7 @@ async def begin_create( raw_result = await self._create_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -395,7 +363,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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: @@ -413,8 +387,7 @@ 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, + body: Optional["models.DatadogMonitorResourceUpdateParameters"] = None, **kwargs ) -> "models.DatadogMonitorResource": """Update a monitor resource. @@ -426,22 +399,21 @@ async def update( :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 + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogMonitorResource, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {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) 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 @@ -459,16 +431,15 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -492,9 +463,12 @@ async def _delete_initial( **kwargs ) -> 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 @@ -511,6 +485,7 @@ async 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 = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -573,7 +548,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(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 = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py similarity index 90% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py index e49ef087be6..ad111c77caf 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +class Operations: + """Operations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-02-01-preview" + 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/aio/operations_async/_refresh_set_password_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py index d57e456daab..ef0c3f818b5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_refresh_set_password_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar 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 AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -61,9 +61,12 @@ async 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 @@ -80,7 +83,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py similarity index 88% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py index 049816a80b3..2f5b2171bd0 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations: - """SingleSignOnConfigurationOperations async operations. +class SingleSignOnConfigurationsOperations: + """SingleSignOnConfigurationsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -64,14 +64,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 @@ -123,16 +126,17 @@ async def _create_or_update_initial( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> "models.DatadogSingleSignOnResource": cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -151,16 +155,15 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogSingleSignOnResource') + if body is not None: + body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -186,7 +189,7 @@ async def begin_create_or_update( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> AsyncLROPoller["models.DatadogSingleSignOnResource"]: """Configures single-sign-on for this resource. @@ -198,10 +201,10 @@ async 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 + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -224,7 +227,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -239,7 +242,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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: @@ -269,7 +279,7 @@ async 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) @@ -277,9 +287,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-02-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -297,7 +310,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py similarity index 80% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py index d6e840c774e..85fc67c18b9 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py @@ -5,11 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TagRuleOperations: - """TagRuleOperations async operations. +class TagRulesOperations: + """TagRulesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -62,14 +62,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 @@ -121,11 +124,7 @@ async def create_or_update( resource_group_name: str, monitor_name: str, rule_set_name: str, - filtering_tags: Optional[List["models.FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - log_rules_filtering_tags: Optional[List["models.FilteringTag"]] = None, + body: Optional["models.MonitoringTagRules"] = None, **kwargs ) -> "models.MonitoringTagRules": """Create or update a tag rule set for a given monitor resource. @@ -137,39 +136,23 @@ async 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 - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be - captured. If only Exclude action is specified, the rules will apply to the list of all - available resources. If Include actions are specified, the rules will only include resources - with the associated tags. - :type log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.models.MonitoringTagRules :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -188,16 +171,15 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'MonitoringTagRules') + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,7 +212,7 @@ async 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) @@ -238,9 +220,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-02-01-preview" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -258,7 +243,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py deleted file mode 100644 index c164696fbc8..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._api_key_operations_async import ApiKeyOperations -from ._host_operations_async import HostOperations -from ._linked_resource_operations_async import LinkedResourceOperations -from ._monitored_resource_operations_async import MonitoredResourceOperations -from ._operation_operations_async import OperationOperations -from ._monitor_operations_async import MonitorOperations -from ._refresh_set_password_operations_async import RefreshSetPasswordOperations -from ._tag_rule_operations_async import TagRuleOperations -from ._single_sign_on_configuration_operations_async import SingleSignOnConfigurationOperations - -__all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', - 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', -] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py index f703afa79c2..214693e7ae4 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 @@ -24,18 +27,28 @@ from ._models_py3 import DatadogSingleSignOnResourceListResponse from ._models_py3 import ErrorResponseBody from ._models_py3 import FilteringTag + from ._models_py3 import IdentityProperties from ._models_py3 import LinkedResource from ._models_py3 import LinkedResourceListResponse + from ._models_py3 import LogRules + from ._models_py3 import MetricRules + from ._models_py3 import MonitorProperties + from ._models_py3 import MonitorUpdateProperties from ._models_py3 import MonitoredResource from ._models_py3 import MonitoredResourceListResponse from ._models_py3 import MonitoringTagRules from ._models_py3 import MonitoringTagRulesListResponse + from ._models_py3 import MonitoringTagRulesProperties from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import OperationResult from ._models_py3 import ResourceProviderDefaultErrorResponse + from ._models_py3 import ResourceSku from ._models_py3 import 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 @@ -53,16 +66,23 @@ from ._models import DatadogSingleSignOnResourceListResponse # type: ignore from ._models import ErrorResponseBody # type: ignore from ._models import FilteringTag # type: ignore + from ._models import IdentityProperties # type: ignore from ._models import LinkedResource # type: ignore from ._models import LinkedResourceListResponse # type: ignore + from ._models import LogRules # type: ignore + from ._models import MetricRules # type: ignore + from ._models import MonitorProperties # type: ignore + from ._models import MonitorUpdateProperties # type: ignore from ._models import MonitoredResource # type: ignore from ._models import MonitoredResourceListResponse # type: ignore from ._models import MonitoringTagRules # type: ignore from ._models import MonitoringTagRulesListResponse # type: ignore + from ._models import MonitoringTagRulesProperties # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore from ._models import OperationResult # type: ignore from ._models import ResourceProviderDefaultErrorResponse # type: ignore + from ._models import ResourceSku # type: ignore from ._models import UserInfo # type: ignore from ._microsoft_datadog_client_enums import ( @@ -76,6 +96,9 @@ ) __all__ = [ + 'DatadogAgreementProperties', + 'DatadogAgreementResource', + 'DatadogAgreementResourceListResponse', 'DatadogApiKey', 'DatadogApiKeyListResponse', 'DatadogHost', @@ -93,16 +116,23 @@ 'DatadogSingleSignOnResourceListResponse', 'ErrorResponseBody', 'FilteringTag', + 'IdentityProperties', 'LinkedResource', 'LinkedResourceListResponse', + 'LogRules', + 'MetricRules', + 'MonitorProperties', + 'MonitorUpdateProperties', 'MonitoredResource', 'MonitoredResourceListResponse', 'MonitoringTagRules', 'MonitoringTagRulesListResponse', + 'MonitoringTagRulesProperties', 'OperationDisplay', 'OperationListResult', 'OperationResult', 'ResourceProviderDefaultErrorResponse', + 'ResourceSku', 'UserInfo', 'LiftrResourceCategories', 'ManagedIdentityTypes', 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..f8d7f9888e0 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. @@ -210,39 +320,16 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type_identity_type: Possible values include: "SystemAssigned", "UserAssigned". - :type type_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str """ _validation = { @@ -250,29 +337,17 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, } def __init__( @@ -283,19 +358,11 @@ def __init__( self.id = None self.name = None self.type = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + self.identity = kwargs.get('identity', None) self.tags = kwargs.get('tags', None) self.location = kwargs['location'] - self.principal_id = None - self.tenant_id = None - self.type_identity_type = kwargs.get('type_identity_type', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.monitoring_status = kwargs.get('monitoring_status', None) - self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', None) - self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) - self.user_info = kwargs.get('user_info', None) - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = kwargs.get('name_sku_name', None) class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -324,16 +391,16 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( @@ -341,12 +408,12 @@ def __init__( **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) self.tags = kwargs.get('tags', None) - self.monitoring_status = kwargs.get('monitoring_status', None) class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -410,15 +477,21 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, @@ -432,7 +505,7 @@ def __init__( super(DatadogSingleSignOnProperties, self).__init__(**kwargs) self.single_sign_on_state = kwargs.get('single_sign_on_state', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) - self.single_sign_on_url = kwargs.get('single_sign_on_url', None) + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -556,6 +629,40 @@ def __init__( self.action = kwargs.get('action', None) +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -598,6 +705,64 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = kwargs.get('send_aad_logs', None) + self.send_subscription_logs = kwargs.get('send_subscription_logs', None) + self.send_resource_logs = kwargs.get('send_resource_logs', None) + self.filtering_tags = kwargs.get('filtering_tags', None) + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = kwargs.get('filtering_tags', None) + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -669,27 +834,8 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. If empty, all resources will be captured. If only Exclude action is - specified, the rules will apply to the list of all available resources. If Include actions are - specified, the rules will only include resources with the associated tags. - :type filtering_tags_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties """ _validation = { @@ -702,11 +848,7 @@ class MonitoringTagRules(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, } def __init__( @@ -717,11 +859,7 @@ def __init__( self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = kwargs.get('filtering_tags_properties_metric_rules_filtering_tags', None) - self.send_aad_logs = kwargs.get('send_aad_logs', None) - self.send_subscription_logs = kwargs.get('send_subscription_logs', None) - self.send_resource_logs = kwargs.get('send_resource_logs', None) - self.filtering_tags_properties_log_rules_filtering_tags = kwargs.get('filtering_tags_properties_log_rules_filtering_tags', None) + self.properties = kwargs.get('properties', None) class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -747,6 +885,114 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.log_rules = kwargs.get('log_rules', None) + self.metric_rules = kwargs.get('metric_rules', None) + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Active", "Suspended". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'monitoring_status': {'readonly': True}, + 'marketplace_subscription_status': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.monitoring_status = None + self.marketplace_subscription_status = None + self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) + self.user_info = kwargs.get('user_info', None) + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ + + _validation = { + 'monitoring_status': {'readonly': True}, + } + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = None + + class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. @@ -847,8 +1093,33 @@ def __init__( self.error = kwargs.get('error', None) +class ResourceSku(msrest.serialization.Model): + """ResourceSku. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs['name'] + + 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..5bccce104a8 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. @@ -240,39 +365,16 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type_identity_type: Possible values include: "SystemAssigned", "UserAssigned". - :type type_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str """ _validation = { @@ -280,62 +382,38 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, } def __init__( self, *, location: str, + sku: Optional["ResourceSku"] = None, + properties: Optional["MonitorProperties"] = None, + identity: Optional["IdentityProperties"] = None, tags: Optional[Dict[str, str]] = None, - type_identity_type: Optional[Union[str, "ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, - user_info: Optional["UserInfo"] = None, - name_sku_name: Optional[str] = None, **kwargs ): super(DatadogMonitorResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.sku = sku + self.properties = properties + self.identity = identity self.tags = tags self.location = location - self.principal_id = None - self.tenant_id = None - self.type_identity_type = type_identity_type - self.provisioning_state = provisioning_state - self.monitoring_status = monitoring_status - self.marketplace_subscription_status = marketplace_subscription_status - self.datadog_organization_properties = datadog_organization_properties - self.user_info = user_info - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = name_sku_name class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -367,32 +445,32 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( self, *, + properties: Optional["MonitorUpdateProperties"] = None, tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = properties self.tags = tags - self.monitoring_status = monitoring_status class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -462,15 +540,21 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, @@ -482,13 +566,12 @@ def __init__( *, single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, - single_sign_on_url: Optional[str] = None, **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) self.single_sign_on_state = single_sign_on_state self.enterprise_app_id = enterprise_app_id - self.single_sign_on_url = single_sign_on_url + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -626,6 +709,42 @@ def __init__( self.action = action +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityTypes"]] = None, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -673,6 +792,71 @@ def __init__( self.next_link = next_link +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + send_aad_logs: Optional[bool] = None, + send_subscription_logs: Optional[bool] = None, + send_resource_logs: Optional[bool] = None, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = send_aad_logs + self.send_subscription_logs = send_subscription_logs + self.send_resource_logs = send_resource_logs + self.filtering_tags = filtering_tags + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = filtering_tags + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -753,27 +937,8 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. If empty, all resources will be captured. If only Exclude action is - specified, the rules will apply to the list of all available resources. If Include actions are - specified, the rules will only include resources with the associated tags. - :type filtering_tags_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties """ _validation = { @@ -786,32 +951,20 @@ class MonitoringTagRules(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, } def __init__( self, *, - filtering_tags_properties_metric_rules_filtering_tags: Optional[List["FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - filtering_tags_properties_log_rules_filtering_tags: Optional[List["FilteringTag"]] = None, + properties: Optional["MonitoringTagRulesProperties"] = None, **kwargs ): super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = filtering_tags_properties_metric_rules_filtering_tags - self.send_aad_logs = send_aad_logs - self.send_subscription_logs = send_subscription_logs - self.send_resource_logs = send_resource_logs - self.filtering_tags_properties_log_rules_filtering_tags = filtering_tags_properties_log_rules_filtering_tags + self.properties = properties class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -840,6 +993,121 @@ def __init__( self.next_link = next_link +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + *, + log_rules: Optional["LogRules"] = None, + metric_rules: Optional["MetricRules"] = None, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.log_rules = log_rules + self.metric_rules = metric_rules + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Active", "Suspended". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'monitoring_status': {'readonly': True}, + 'marketplace_subscription_status': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, + user_info: Optional["UserInfo"] = None, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.monitoring_status = None + self.marketplace_subscription_status = None + self.datadog_organization_properties = datadog_organization_properties + self.user_info = user_info + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ + + _validation = { + 'monitoring_status': {'readonly': True}, + } + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = None + + class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. @@ -954,8 +1222,35 @@ def __init__( self.error = error +class ResourceSku(msrest.serialization.Model): + """ResourceSku. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(ResourceSku, self).__init__(**kwargs) + self.name = name + + 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..0ba3af657d6 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py @@ -6,24 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -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 ._marketplace_agreements_operations import MarketplaceAgreementsOperations +from ._api_keys_operations import ApiKeysOperations +from ._hosts_operations import HostsOperations +from ._linked_resources_operations import LinkedResourcesOperations +from ._monitored_resources_operations import MonitoredResourcesOperations +from ._operations import Operations +from ._monitors_operations import MonitorsOperations from ._refresh_set_password_operations import RefreshSetPasswordOperations -from ._tag_rule_operations import TagRuleOperations -from ._single_sign_on_configuration_operations import SingleSignOnConfigurationOperations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', + 'MarketplaceAgreementsOperations', + 'ApiKeysOperations', + 'HostsOperations', + 'LinkedResourcesOperations', + 'MonitoredResourcesOperations', + 'Operations', + 'MonitorsOperations', 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', ] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_keys_operations.py similarity index 89% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_keys_operations.py index 1c688a2ea92..12e3b03ae54 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_keys_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class ApiKeyOperations(object): - """ApiKeyOperations operations. +class ApiKeysOperations(object): + """ApiKeysOperations 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. @@ -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,10 +191,7 @@ def set_default_key( self, resource_group_name, # type: str monitor_name, # type: str - key, # type: str - created_by=None, # type: Optional[str] - name=None, # type: Optional[str] - created=None, # type: Optional[str] + body=None, # type: Optional["models.DatadogApiKey"] **kwargs # type: Any ): # type: (...) -> None @@ -201,26 +204,21 @@ 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 created: The time of creation of the API key. - :type created: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {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) 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 +236,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/_hosts_operations.py similarity index 92% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_hosts_operations.py index 2e8a47a760a..4381f6de227 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_hosts_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class HostOperations(object): - """HostOperations operations. +class HostsOperations(object): + """HostsOperations 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. @@ -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_resources_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resources_operations.py index bb4d552082a..952fc3fb37c 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resources_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class LinkedResourceOperations(object): - """LinkedResourceOperations operations. +class LinkedResourcesOperations(object): + """LinkedResourcesOperations 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. @@ -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_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py new file mode 100644 index 00000000000..02f1bd130ae --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py @@ -0,0 +1,181 @@ +# 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 MarketplaceAgreementsOperations(object): + """MarketplaceAgreementsOperations 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', {})) + 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 + + 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, + body=None, # type: Optional["models.DatadogAgreementResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogAgreementResource" + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-02-01-preview" + 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] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogAgreementResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = 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/_monitored_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resources_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resources_operations.py index 8e982bdeda7..5eaabd105d4 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resources_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class MonitoredResourceOperations(object): - """MonitoredResourceOperations operations. +class MonitoredResourcesOperations(object): + """MonitoredResourcesOperations 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. @@ -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/_monitor_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py similarity index 82% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py index 7fb70f7eb58..1af7fb7db15 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class MonitorOperations(object): - """MonitorOperations operations. +class MonitorsOperations(object): + """MonitorsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -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,25 +259,18 @@ def _create_initial( self, resource_group_name, # type: str monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] + body=None, # type: Optional["models.DatadogMonitorResource"] **kwargs # type: Any ): # 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) 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 +288,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,15 +321,7 @@ def begin_create( self, resource_group_name, # type: str monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] + body=None, # type: Optional["models.DatadogMonitorResource"] **kwargs # type: Any ): # type: (...) -> LROPoller["models.DatadogMonitorResource"] @@ -341,25 +334,8 @@ 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: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -381,15 +357,7 @@ def begin_create( raw_result = self._create_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -404,7 +372,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: @@ -422,8 +396,7 @@ def update( self, resource_group_name, # type: str monitor_name, # type: str - tags=None, # type: Optional[Dict[str, str]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] + body=None, # type: Optional["models.DatadogMonitorResourceUpdateParameters"] **kwargs # type: Any ): # type: (...) -> "models.DatadogMonitorResource" @@ -436,22 +409,21 @@ def update( :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 + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogMonitorResource, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {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) 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 +441,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 +474,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 +496,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 +560,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/_operation_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py index 1c90d2b4cbd..c346401f740 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +class Operations(object): + """Operations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -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_configurations_operations.py similarity index 87% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py index 6b60e79a7a7..6fcde9516f5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations(object): - """SingleSignOnConfigurationOperations operations. +class SingleSignOnConfigurationsOperations(object): + """SingleSignOnConfigurationsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -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 @@ -128,17 +131,18 @@ def _create_or_update_initial( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> "models.DatadogSingleSignOnResource" cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) api_version = "2020-02-01-preview" 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 +161,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 @@ -192,7 +195,7 @@ def begin_create_or_update( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> LROPoller["models.DatadogSingleSignOnResource"] @@ -205,10 +208,10 @@ 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 + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -231,7 +234,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -246,7 +249,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 +287,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 +295,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 +318,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_rules_operations.py similarity index 79% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py index d30ab42567d..599229bd494 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,13 +18,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class TagRuleOperations(object): - """TagRuleOperations operations. +class TagRulesOperations(object): + """TagRulesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -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 @@ -126,11 +129,7 @@ def create_or_update( resource_group_name, # type: str monitor_name, # type: str rule_set_name, # type: str - filtering_tags=None, # type: Optional[List["models.FilteringTag"]] - send_aad_logs=None, # type: Optional[bool] - send_subscription_logs=None, # type: Optional[bool] - send_resource_logs=None, # type: Optional[bool] - log_rules_filtering_tags=None, # type: Optional[List["models.FilteringTag"]] + body=None, # type: Optional["models.MonitoringTagRules"] **kwargs # type: Any ): # type: (...) -> "models.MonitoringTagRules" @@ -143,39 +142,23 @@ 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 - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be - captured. If only Exclude action is specified, the rules will apply to the list of all - available resources. If Include actions are specified, the rules will only include resources - with the associated tags. - :type log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.models.MonitoringTagRules :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) api_version = "2020-02-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore @@ -194,16 +177,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 +219,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 +227,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 +250,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..e27b3e488a0 --- /dev/null +++ b/src/datadog/report.md @@ -0,0 +1,391 @@ +# 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 --monitor-name "myMonitor" --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" --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 |tags|tags| +|**--location**|string||location|location| +|**--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| +|**--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-filtering-tags name="Environment" action="Include" \ +value="Prod" --log-rules-filtering-tags name="Environment" action="Exclude" value="Dev" --send-aad-logs false \ +--send-resource-logs true --send-subscription-logs true --resource-group "myResourceGroup" --rule-set-name "default" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group 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| +|**--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| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| +|**--log-rules-filtering-tags**|array|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.|log_rules_filtering_tags|filteringTags| + +#### 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| +|**--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| +|**--send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| +|**--log-rules-filtering-tags**|array|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.|log_rules_filtering_tags|filteringTags| 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