diff --git a/src/datadog/HISTORY.rst b/src/datadog/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/datadog/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/datadog/README.md b/src/datadog/README.md new file mode 100644 index 00000000000..b5ab201dcc0 --- /dev/null +++ b/src/datadog/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'datadog' Extension +========================================== + +This package is for the 'datadog' extension. +i.e. 'az datadog' diff --git a/src/datadog/azext_datadog/__init__.py b/src/datadog/azext_datadog/__init__.py new file mode 100644 index 00000000000..51fecb70315 --- /dev/null +++ b/src/datadog/azext_datadog/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_datadog.generated._help import helps # pylint: disable=unused-import +try: + from azext_datadog.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class MicrosoftDatadogClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_datadog.generated._client_factory import cf_datadog_cl + datadog_custom = CliCommandType( + operations_tmpl='azext_datadog.custom#{}', + client_factory=cf_datadog_cl) + parent = super(MicrosoftDatadogClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=datadog_custom) + + def load_command_table(self, args): + from azext_datadog.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_datadog.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_datadog.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_datadog.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = MicrosoftDatadogClientCommandsLoader diff --git a/src/datadog/azext_datadog/action.py b/src/datadog/azext_datadog/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/datadog/azext_datadog/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/datadog/azext_datadog/azext_metadata.json b/src/datadog/azext_datadog/azext_metadata.json new file mode 100644 index 00000000000..4f48fa652a5 --- /dev/null +++ b/src/datadog/azext_datadog/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.11.0" +} \ No newline at end of file diff --git a/src/datadog/azext_datadog/custom.py b/src/datadog/azext_datadog/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/datadog/azext_datadog/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/datadog/azext_datadog/generated/__init__.py b/src/datadog/azext_datadog/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/datadog/azext_datadog/generated/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/datadog/azext_datadog/generated/_client_factory.py b/src/datadog/azext_datadog/generated/_client_factory.py new file mode 100644 index 00000000000..2846bbd5a71 --- /dev/null +++ b/src/datadog/azext_datadog/generated/_client_factory.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def cf_datadog_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.datadog import MicrosoftDatadogClient + return get_mgmt_service_client(cli_ctx, + MicrosoftDatadogClient) + + +def cf_api_key(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).api_key + + +def cf_host(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).host + + +def cf_linked_resource(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).linked_resource + + +def cf_monitored_resource(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).monitored_resource + + +def cf_monitor(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).monitor + + +def cf_refresh_set_password(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).refresh_set_password + + +def cf_tag_rule(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).tag_rule + + +def cf_single_sign_on_configuration(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).single_sign_on_configuration diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py new file mode 100644 index 00000000000..f05316bb415 --- /dev/null +++ b/src/datadog/azext_datadog/generated/_help.py @@ -0,0 +1,351 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['datadog api-key'] = """ + type: group + short-summary: datadog api-key +""" + +helps['datadog api-key list'] = """ + type: command + short-summary: "List the api keys for a given monitor resource." + examples: + - name: ApiKeys_List + text: |- + az datadog api-key list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog api-key get-default-key'] = """ + type: command + short-summary: "Get the default api key." + examples: + - name: ApiKeys_GetDefaultKey + text: |- + az datadog api-key get-default-key --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog api-key set-default-key'] = """ + type: command + short-summary: "Set the default api key." + examples: + - name: ApiKeys_SetDefaultKey + text: |- + az datadog api-key set-default-key --monitor-name "myMonitor" --key "1111111111111111aaaaaaaaaaaaaaaa" \ +--resource-group "myResourceGroup" +""" + +helps['datadog host'] = """ + type: group + short-summary: datadog host +""" + +helps['datadog host list'] = """ + type: command + short-summary: "List the hosts for a given monitor resource." + examples: + - name: Hosts_List + text: |- + az datadog host list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog linked-resource'] = """ + type: group + short-summary: datadog linked-resource +""" + +helps['datadog linked-resource list'] = """ + type: command + short-summary: "List all Azure resources associated to the same Datadog organization as the target resource." + examples: + - name: LinkedResources_List + text: |- + az datadog linked-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitored-resource'] = """ + type: group + short-summary: datadog monitored-resource +""" + +helps['datadog monitored-resource list'] = """ + type: command + short-summary: "List the resources currently being monitored by the Datadog monitor resource." + examples: + - name: MonitoredResources_List + text: |- + az datadog monitored-resource list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor'] = """ + type: group + short-summary: datadog monitor +""" + +helps['datadog monitor list'] = """ + type: command + short-summary: "List all monitors under the specified subscription." + examples: + - name: Monitors_ListByResourceGroup + text: |- + az datadog monitor list --resource-group "myResourceGroup" +""" + +helps['datadog monitor show'] = """ + type: command + short-summary: "Get the properties of a specific monitor resource." + examples: + - name: Monitors_Get + text: |- + az datadog monitor show --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor create'] = """ + type: command + short-summary: "Create a monitor resource." + parameters: + - name: --datadog-organization-properties + long-summary: | + Usage: --datadog-organization-properties linking-auth-code=XX linking-client-id=XX enterprise-app-id=XX + + linking-auth-code: The auth code used to linking to an existing datadog organization. + linking-client-id: The client_id from an existing in exchange for an auth token to link organization. + enterprise-app-id: The Id of the Enterprise App used for Single sign on. + - name: --user-info + long-summary: | + Usage: --user-info name=XX email-address=XX phone-number=XX + + name: Name of the user + email-address: Email of the user used by Datadog for contacting them if needed + phone-number: Phone number of the user used by Datadog for contacting them if needed + examples: + - name: Monitors_Create + text: |- + az datadog monitor create --name "myMonitor" --sku-name "myMonitor" --location "West US" \ +--datadog-organization-properties name="myOrg" enterprise-app-id="00000000-0000-0000-0000-000000000000" \ +linking-auth-code="someAuthCode" linking-client-id="00000000-0000-0000-0000-000000000000" subscription="pro" \ +--monitoring-status "Enabled" --user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890" \ +--sku-name "free_Monthly" --tags Environment="Dev" --resource-group "myResourceGroup" +""" + +helps['datadog monitor update'] = """ + type: command + short-summary: "Update a monitor resource." + examples: + - name: Monitors_Update + text: |- + az datadog monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ +--resource-group "myResourceGroup" +""" + +helps['datadog monitor delete'] = """ + type: command + short-summary: "Delete a monitor resource." + examples: + - name: Monitors_Delete + text: |- + az datadog monitor delete --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the datadog monitor is met. + examples: + - name: Pause executing next line of CLI script until the datadog monitor is successfully created. + text: |- + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog monitor is successfully deleted. + text: |- + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted +""" + +helps['datadog refresh-set-password'] = """ + type: group + short-summary: datadog refresh-set-password +""" + +helps['datadog refresh-set-password get'] = """ + type: command + short-summary: "Refresh the set password link and return a latest one." + examples: + - name: RefreshSetPassword_Get + text: |- + az datadog refresh-set-password get --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog tag-rule'] = """ + type: group + short-summary: datadog tag-rule +""" + +helps['datadog tag-rule list'] = """ + type: command + short-summary: "List the tag rules for a given monitor resource." + examples: + - name: TagRules_List + text: |- + az datadog tag-rule list --monitor-name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog tag-rule show'] = """ + type: command + short-summary: "Get a tag rule set for a given monitor resource." + examples: + - name: TagRules_Get + text: |- + az datadog tag-rule show --monitor-name "myMonitor" --resource-group "myResourceGroup" --rule-set-name \ +"default" +""" + +helps['datadog tag-rule create'] = """ + type: command + short-summary: "Create or update a tag rule set for a given monitor resource." + parameters: + - name: --metric-rules-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 + + 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. + - name: --log-rules-filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --log-rules-filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --log-rules-filtering-tags argument. + examples: + - name: TagRules_CreateOrUpdate + text: |- + az datadog tag-rule create --monitor-name "myMonitor" --log-rules-filtering-tags name="Environment" \ +action="Include" value="Prod" --log-rules-filtering-tags name="Environment" action="Exclude" value="Dev" \ +--log-rules-send-aad-logs false --log-rules-send-resource-logs true --log-rules-send-subscription-logs true \ +--resource-group "myResourceGroup" --rule-set-name "default" +""" + +helps['datadog tag-rule update'] = """ + type: command + short-summary: "Create or update a tag rule set for a given monitor resource." + parameters: + - name: --metric-rules-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 + + 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. + - name: --log-rules-filtering-tags + short-summary: "List of filtering tags to be used for capturing logs. This only takes effect if \ +SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the \ +rules will apply to the list of all available resources. If Include actions are specified, the rules will only include \ +resources with the associated tags." + long-summary: | + Usage: --log-rules-filtering-tags name=XX value=XX action=XX + + name: The name (also known as the key) of the tag. + value: The value of the tag. + action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + + Multiple actions can be specified by using more than one --log-rules-filtering-tags argument. +""" + +helps['datadog single-sign-on-configuration'] = """ + type: group + short-summary: datadog single-sign-on-configuration +""" + +helps['datadog single-sign-on-configuration list'] = """ + type: command + short-summary: "List the single sign-on configurations for a given monitor resource." + examples: + - name: SingleSignOnConfigurations_List + text: |- + az datadog single-sign-on-configuration list --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" +""" + +helps['datadog single-sign-on-configuration show'] = """ + type: command + short-summary: "Gets the datadog single sign-on resource for the given Monitor." + examples: + - name: SingleSignOnConfigurations_Get + text: |- + az datadog single-sign-on-configuration show --configuration-name "default" --monitor-name "myMonitor" \ +--resource-group "myResourceGroup" +""" + +helps['datadog single-sign-on-configuration create'] = """ + type: command + short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. + single-sign-on-url: The login URL specific to this Datadog Organization. + examples: + - name: SingleSignOnConfigurations_CreateOrUpdate + text: |- + az datadog single-sign-on-configuration 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 single-sign-on-configuration update'] = """ + type: command + short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties single-sign-on-state=XX enterprise-app-id=XX single-sign-on-url=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. + single-sign-on-url: The login URL specific to this Datadog Organization. +""" + +helps['datadog single-sign-on-configuration wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the datadog single-sign-on-configuration is \ +met. + examples: + - name: Pause executing next line of CLI script until the datadog single-sign-on-configuration is successfully \ +created. + text: |- + az datadog single-sign-on-configuration wait --configuration-name "default" --monitor-name "myMonitor" \ +--resource-group "myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog single-sign-on-configuration is successfully \ +updated. + text: |- + az datadog single-sign-on-configuration 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 new file mode 100644 index 00000000000..3f8dea6d53b --- /dev/null +++ b/src/datadog/azext_datadog/generated/_params.py @@ -0,0 +1,183 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + get_three_state_flag, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_datadog.action import ( + AddDatadogOrganizationProperties, + AddUserInfo, + AddMetricRulesFilteringTags, + AddLogRulesFilteringTags, + AddProperties +) + + +def load_arguments(self, _): + + with self.argument_context('datadog api-key list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog api-key get-default-key') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + + with self.argument_context('datadog api-key set-default-key') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('created_by', type=str, help='The user that created the API key.') + c.argument('name', type=str, help='The name of the API key.') + c.argument('key', type=str, help='The value of the API key.') + c.argument('created', type=str, help='The time of creation of the API key.') + + with self.argument_context('datadog host list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog linked-resource list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog monitored-resource list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog monitor list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('datadog monitor show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('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('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('identity_type', arg_type=get_enum_type(['SystemAssigned', 'UserAssigned']), help='') + c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', '' + 'Succeeded', 'Failed', 'Canceled', 'Deleted', '' + 'NotSpecified']), help='') + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + c.argument('marketplace_subscription_status', arg_type=get_enum_type(['Active', 'Suspended']), help='Flag ' + 'specifying the Marketplace Subscription Status of the resource. If payment is not made in time, ' + 'the resource will go in Suspended state.') + c.argument('datadog_organization_properties', action=AddDatadogOrganizationProperties, nargs='*', help='') + c.argument('user_info', action=AddUserInfo, nargs='*', help='') + c.argument('sku_name', type=str, help='Name of the SKU.') + + with self.argument_context('datadog monitor update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + c.argument('tags', tags_type) + c.argument('monitoring_status', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Flag specifying if the ' + 'resource monitoring is enabled or disabled.') + + with self.argument_context('datadog monitor delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('datadog monitor wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('datadog refresh-set-password get') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + + with self.argument_context('datadog tag-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog tag-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('rule_set_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('datadog tag-rule create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('rule_set_name', type=str, help='') + c.argument('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 ' + 'tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If ' + 'empty, all resources will be captured. If only Exclude action is specified, the rules will apply ' + 'to the list of all available resources. If Include actions are specified, the rules will only ' + 'include resources with the associated tags.') + + with self.argument_context('datadog tag-rule update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('rule_set_name', type=str, help='', id_part='child_name_1') + c.argument('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 ' + 'tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If ' + 'empty, all resources will be captured. If only Exclude action is specified, the rules will apply ' + 'to the list of all available resources. If Include actions are specified, the rules will only ' + 'include resources with the associated tags.') + + with self.argument_context('datadog single-sign-on-configuration list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + + with self.argument_context('datadog single-sign-on-configuration show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') + + with self.argument_context('datadog single-sign-on-configuration create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name') + c.argument('configuration_name', type=str, help='') + c.argument('properties', action=AddProperties, nargs='*', help='') + + with self.argument_context('datadog single-sign-on-configuration update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') + c.argument('properties', action=AddProperties, nargs='*', help='') + + with self.argument_context('datadog single-sign-on-configuration wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('configuration_name', type=str, help='', id_part='child_name_1') diff --git a/src/datadog/azext_datadog/generated/_validators.py b/src/datadog/azext_datadog/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/datadog/azext_datadog/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- diff --git a/src/datadog/azext_datadog/generated/action.py b/src/datadog/azext_datadog/generated/action.py new file mode 100644 index 00000000000..27649270eec --- /dev/null +++ b/src/datadog/azext_datadog/generated/action.py @@ -0,0 +1,144 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from collections import defaultdict +from knack.util import CLIError + + +class AddDatadogOrganizationProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.datadog_organization_properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'linking-auth-code': + d['linking_auth_code'] = v[0] + elif kl == 'linking-client-id': + d['linking_client_id'] = v[0] + elif kl == 'enterprise-app-id': + d['enterprise_app_id'] = v[0] + return d + + +class AddUserInfo(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.user_info = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'email-address': + d['email_address'] = v[0] + elif kl == 'phone-number': + d['phone_number'] = v[0] + return d + + +class AddMetricRulesFilteringTags(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) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'value': + d['value'] = v[0] + elif kl == 'action': + d['action'] = v[0] + return d + + +class AddLogRulesFilteringTags(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddLogRulesFilteringTags, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'value': + d['value'] = v[0] + elif kl == 'action': + d['action'] = v[0] + return d + + +class AddProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'single-sign-on-state': + d['single_sign_on_state'] = v[0] + elif kl == 'enterprise-app-id': + d['enterprise_app_id'] = v[0] + elif kl == 'single-sign-on-url': + d['single_sign_on_url'] = v[0] + return d diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py new file mode 100644 index 00000000000..93f36271259 --- /dev/null +++ b/src/datadog/azext_datadog/generated/commands.py @@ -0,0 +1,97 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_datadog.generated._client_factory import cf_api_key + datadog_api_key = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._api_key_operations#ApiKeyOperations.{}', + client_factory=cf_api_key) + with self.command_group('datadog api-key', datadog_api_key, client_factory=cf_api_key, is_experimental=True) as g: + g.custom_command('list', 'datadog_api_key_list') + g.custom_command('get-default-key', 'datadog_api_key_get_default_key') + g.custom_command('set-default-key', 'datadog_api_key_set_default_key') + + from azext_datadog.generated._client_factory import cf_host + datadog_host = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._host_operations#HostOperations.{}', + client_factory=cf_host) + with self.command_group('datadog host', datadog_host, client_factory=cf_host, is_experimental=True) as g: + g.custom_command('list', 'datadog_host_list') + + from azext_datadog.generated._client_factory import cf_linked_resource + datadog_linked_resource = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._linked_resource_operations#LinkedResourceOpera' + 'tions.{}', + client_factory=cf_linked_resource) + with self.command_group('datadog linked-resource', datadog_linked_resource, client_factory=cf_linked_resource, + is_experimental=True) as g: + g.custom_command('list', 'datadog_linked_resource_list') + + from azext_datadog.generated._client_factory import cf_monitored_resource + datadog_monitored_resource = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitored_resource_operations#MonitoredResourc' + 'eOperations.{}', + client_factory=cf_monitored_resource) + with self.command_group('datadog monitored-resource', datadog_monitored_resource, + client_factory=cf_monitored_resource, is_experimental=True) as g: + g.custom_command('list', 'datadog_monitored_resource_list') + + from azext_datadog.generated._client_factory import cf_monitor + datadog_monitor = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitor_operations#MonitorOperations.{}', + client_factory=cf_monitor) + with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor, is_experimental=True) as g: + g.custom_command('list', 'datadog_monitor_list') + g.custom_show_command('show', 'datadog_monitor_show') + g.custom_command('create', 'datadog_monitor_create', supports_no_wait=True) + g.custom_command('update', 'datadog_monitor_update') + g.custom_command('delete', 'datadog_monitor_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'datadog_monitor_show') + + from azext_datadog.generated._client_factory import cf_refresh_set_password + datadog_refresh_set_password = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._refresh_set_password_operations#RefreshSetPass' + 'wordOperations.{}', + client_factory=cf_refresh_set_password) + with self.command_group('datadog refresh-set-password', datadog_refresh_set_password, + client_factory=cf_refresh_set_password, is_experimental=True) as g: + g.custom_command('get', 'datadog_refresh_set_password_get') + + from azext_datadog.generated._client_factory import cf_tag_rule + datadog_tag_rule = CliCommandType( + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rule_operations#TagRuleOperations.{}', + 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: + 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') + + 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.{}', + client_factory=cf_single_sign_on_configuration) + with self.command_group('datadog single-sign-on-configuration', 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') diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py new file mode 100644 index 00000000000..8ff6b15be07 --- /dev/null +++ b/src/datadog/azext_datadog/generated/custom.py @@ -0,0 +1,225 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=unused-argument + +from azure.cli.core.util import sdk_no_wait + + +def datadog_api_key_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_api_key_get_default_key(client, + resource_group_name, + monitor_name): + return client.get_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_api_key_set_default_key(client, + resource_group_name, + monitor_name, + key, + created_by=None, + name=None, + created=None): + return client.set_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name, + created_by=created_by, + name=name, + key=key, + created=created) + + +def datadog_host_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_linked_resource_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitored_resource_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list() + + +def datadog_monitor_show(client, + resource_group_name, + monitor_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +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, + datadog_organization_properties=None, + user_info=None, + sku_name=None, + no_wait=False): + 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) + + +def datadog_monitor_update(client, + resource_group_name, + monitor_name, + tags=None, + monitoring_status=None): + return client.update(resource_group_name=resource_group_name, + monitor_name=monitor_name, + tags=tags, + monitoring_status=monitoring_status) + + +def datadog_monitor_delete(client, + resource_group_name, + monitor_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_refresh_set_password_get(client, + resource_group_name, + monitor_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_tag_rule_list(client, + resource_group_name, + monitor_name): + return client.list(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_tag_rule_show(client, + resource_group_name, + monitor_name, + rule_set_name): + return client.get(resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name) + + +def 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, + 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) + + +def datadog_tag_rule_update(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, + 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) + + +def datadog_single_sign_on_configuration_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): + 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): + 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) + + +def datadog_single_sign_on_configuration_update(instance, + resource_group_name, + monitor_name, + configuration_name, + no_wait=False): + return instance diff --git a/src/datadog/azext_datadog/manual/__init__.py b/src/datadog/azext_datadog/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/datadog/azext_datadog/manual/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/datadog/azext_datadog/tests/__init__.py b/src/datadog/azext_datadog/tests/__init__.py new file mode 100644 index 00000000000..50e0627daff --- /dev/null +++ b/src/datadog/azext_datadog/tests/__init__.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/datadog/azext_datadog/tests/latest/__init__.py b/src/datadog/azext_datadog/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/datadog/azext_datadog/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py new file mode 100644 index 00000000000..ac22a35637a --- /dev/null +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -0,0 +1,283 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from .. import try_manual, raise_if, calc_coverage +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /Monitors/put/Monitors_Create +@try_manual +def step__monitors_put_monitors_create(test, rg): + test.cmd('az datadog monitor create ' + '--name "{myMonitor}" ' + '--sku-name "{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 "free_Monthly" ' + '--tags Environment="Dev" ' + '--resource-group "{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("monitoringStatus", "Enabled", 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("location", "West US", case_sensitive=False), + test.check("monitoringStatus", "Enabled", 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="Dev" ' + '--resource-group "{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("monitoringStatus", "Enabled", case_sensitive=False), + test.check("tags.Environment", "Dev", 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=[]) + + +# 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=[]) + + +# 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=[]) + + +# 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 refresh-set-password get ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /SingleSignOnConfigurations/put/SingleSignOnConfigurations_CreateOrUpdate +@try_manual +def step__singlesignonconfigurations_put(test, rg): + test.cmd('az datadog single-sign-on-configuration 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=[]) + + +# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_Get +@try_manual +def step__singlesignonconfigurations_get(test, rg): + test.cmd('az datadog single-sign-on-configuration show ' + '--configuration-name "default" ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /SingleSignOnConfigurations/get/SingleSignOnConfigurations_List +@try_manual +def step__singlesignonconfigurations_get2(test, rg): + test.cmd('az datadog single-sign-on-configuration list ' + '--monitor-name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=[]) + + +# 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=[]) + + +# 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=[]) + + +# 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=[]) + + +# 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): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__monitors_put_monitors_create(test, rg) + step__monitors_get_monitors_get(test, rg) + step__monitors_get_monitors_list(test, rg) + step__monitors_get_monitors_listbyresourcegroup(test, rg) + step__monitors_patch_monitors_update(test, rg) + step__apikeys_post_apikeys_getdefaultkey(test, rg) + step__apikeys_post_apikeys_list(test, rg) + step__apikeys_post_apikeys_setdefaultkey(test, rg) + step__hosts_post_hosts_list(test, rg) + step__linkedresources_post_linkedresources_list(test, rg) + step__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__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): + + self.kwargs.update({ + 'myMonitor': 'myMonitor', + }) + + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() diff --git a/src/datadog/azext_datadog/vendored_sdks/__init__.py b/src/datadog/azext_datadog/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/datadog/report.md b/src/datadog/report.md new file mode 100644 index 00000000000..e28371c14ac --- /dev/null +++ b/src/datadog/report.md @@ -0,0 +1,434 @@ +# Azure CLI Module Creation Report + +### datadog api-key get-default-key + +get-default-key a datadog api-key. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog api-key|ApiKeys| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|get-default-key|GetDefaultKey| + +#### 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| + +### datadog api-key list + +list a datadog api-key. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog api-key|ApiKeys| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog api-key set-default-key + +set-default-key a datadog api-key. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog api-key|ApiKeys| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|set-default-key|SetDefaultKey| + +#### 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| +|**--key**|string|The value of the API key.|key|key| +|**--created-by**|string|The user that created the API key.|created_by|createdBy| +|**--name**|string|The name of the API key.|name|name| +|**--created**|string|The time of creation of the API key.|created|created| + +### datadog host list + +list a datadog host. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog host|Hosts| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog linked-resource list + +list a datadog linked-resource. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog linked-resource|LinkedResources| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog monitor create + +create a datadog monitor. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitor|Monitors| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|create|Create| + +#### 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| +|**--location**|string||location|location| +|**--tags**|dictionary|Dictionary of :code:``|tags|tags| +|**--identity-type**|choice||type|type| +|**--provisioning-state**|choice||provisioning_state|provisioningState| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| +|**--marketplace-subscription-status**|choice|Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state.|marketplace_subscription_status|marketplaceSubscriptionStatus| +|**--datadog-organization-properties**|object||datadog_organization_properties|datadogOrganizationProperties| +|**--user-info**|object||user_info|userInfo| +|**--sku-name**|string|Name of the SKU.|name|name| + +### datadog monitor delete + +delete a datadog monitor. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitor|Monitors| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|delete|Delete| + +#### 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| + +### datadog monitor list + +list a datadog monitor. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitor|Monitors| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|ListByResourceGroup| +|list|List| + +#### 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| + +### datadog monitor show + +show a datadog monitor. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitor|Monitors| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### 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| + +### datadog monitor update + +update a datadog monitor. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitor|Monitors| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|update|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| +|**--tags**|dictionary|The new tags of the monitor resource.|tags|tags| +|**--monitoring-status**|choice|Flag specifying if the resource monitoring is enabled or disabled.|monitoring_status|monitoringStatus| + +### datadog monitored-resource list + +list a datadog monitored-resource. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog monitored-resource|MonitoredResources| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog refresh-set-password get + +get a datadog refresh-set-password. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog refresh-set-password|RefreshSetPassword| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|get|Get| + +#### 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| + +### datadog single-sign-on-configuration create + +create a datadog single-sign-on-configuration. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog single-sign-on-configuration|SingleSignOnConfigurations| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|create|CreateOrUpdate#Create| + +#### 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|configurationName| +|**--properties**|object||properties|properties| + +### datadog single-sign-on-configuration list + +list a datadog single-sign-on-configuration. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog single-sign-on-configuration|SingleSignOnConfigurations| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog single-sign-on-configuration show + +show a datadog single-sign-on-configuration. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog single-sign-on-configuration|SingleSignOnConfigurations| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### 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|configurationName| + +### datadog single-sign-on-configuration update + +update a datadog single-sign-on-configuration. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog single-sign-on-configuration|SingleSignOnConfigurations| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|update|CreateOrUpdate#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|configurationName| +|**--properties**|object||properties|properties| + +### datadog tag-rule create + +create a datadog tag-rule. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog tag-rule|TagRules| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|create|CreateOrUpdate#Create| + +#### 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|ruleSetName| +|**--metric-rules-filtering-tags**|array|List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| +|**--log-rules-send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--log-rules-send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--log-rules-send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| +|**--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| + +### datadog tag-rule list + +list a datadog tag-rule. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog tag-rule|TagRules| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### datadog tag-rule show + +show a datadog tag-rule. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog tag-rule|TagRules| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### 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|ruleSetName| + +### datadog tag-rule update + +update a datadog tag-rule. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|datadog tag-rule|TagRules| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|update|CreateOrUpdate#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|ruleSetName| +|**--metric-rules-filtering-tags**|array|List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.|filtering_tags|filteringTags| +|**--log-rules-send-aad-logs**|boolean|Flag specifying if AAD logs should be sent for the Monitor resource.|send_aad_logs|sendAadLogs| +|**--log-rules-send-subscription-logs**|boolean|Flag specifying if Azure subscription logs should be sent for the Monitor resource.|send_subscription_logs|sendSubscriptionLogs| +|**--log-rules-send-resource-logs**|boolean|Flag specifying if Azure resource logs should be sent for the Monitor resource.|send_resource_logs|sendResourceLogs| +|**--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 new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/datadog/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/datadog/setup.py b/src/datadog/setup.py new file mode 100644 index 00000000000..5ca60f8b747 --- /dev/null +++ b/src/datadog/setup.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_datadog.manual.version import VERSION +except ImportError: + pass + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] +try: + from .manual.dependency import DEPENDENCIES +except ImportError: + pass + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='datadog', + version=VERSION, + description='Microsoft Azure Command-Line Tools MicrosoftDatadogClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/datadog', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_datadog': ['azext_metadata.json']}, +)