diff --git a/src/datadog/azext_datadog/azext_metadata.json b/src/datadog/azext_datadog/azext_metadata.json index 14d2c1ae419..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.17.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 7e71886718f..920835d7499 100644 --- a/src/datadog/azext_datadog/generated/_client_factory.py +++ b/src/datadog/azext_datadog/generated/_client_factory.py @@ -11,42 +11,22 @@ def cf_datadog_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client - from ..vendored_sdks.datadog import MicrosoftDatadogClient + from azext_datadog.vendored_sdks.datadog import MicrosoftDatadogClient return get_mgmt_service_client(cli_ctx, MicrosoftDatadogClient) -def cf_api_key(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).api_key - - -def cf_host(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).host - - -def cf_linked_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).linked_resource - - -def cf_monitored_resource(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitored_resource +def cf_marketplace_agreement(cli_ctx, *_): + return cf_datadog_cl(cli_ctx).marketplace_agreements def cf_monitor(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).monitor - - -def cf_refresh_set_password(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).refresh_set_password + return cf_datadog_cl(cli_ctx).monitors def cf_tag_rule(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).tag_rule + return cf_datadog_cl(cli_ctx).tag_rules def cf_single_sign_on_configuration(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).single_sign_on_configuration - - -def cf_marketplace_agreement(cli_ctx, *_): - return cf_datadog_cl(cli_ctx).marketplace_agreements + return cf_datadog_cl(cli_ctx).single_sign_on_configurations diff --git a/src/datadog/azext_datadog/generated/_help.py b/src/datadog/azext_datadog/generated/_help.py index 3b96a8176e4..d94db5689b6 100644 --- a/src/datadog/azext_datadog/generated/_help.py +++ b/src/datadog/azext_datadog/generated/_help.py @@ -12,107 +12,82 @@ from knack.help_files import helps -helps['datadog terms'] = """ +helps['datadog marketplace-agreement'] = """ type: group - short-summary: Manage marketplace agreements with datadog + short-summary: Manage marketplace agreement with datadog """ -helps['datadog terms list'] = """ +helps['datadog marketplace-agreement list'] = """ type: command - short-summary: "List datadog marketplace agreements" + short-summary: "List Datadog marketplace agreements in the subscription." examples: - - name: List marketplace agreements + - name: MarketplaceAgreements_List text: |- - az datadog terms list + az datadog marketplace-agreement list """ -helps['datadog api-key'] = """ - type: group - short-summary: datadog api-key -""" - -helps['datadog api-key list'] = """ - type: command - short-summary: "List the api keys for a given monitor resource." - examples: - - name: ApiKeys_List - text: |- - az datadog api-key list --monitor-name "myMonitor" --resource-group "myResourceGroup" -""" - -helps['datadog api-key get-default-key'] = """ +helps['datadog marketplace-agreement create'] = """ 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." + 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: Hosts_List + - name: MarketplaceAgreements_CreateOrUpdate text: |- - az datadog host list --monitor-name "myMonitor" --resource-group "myResourceGroup" + az datadog marketplace-agreement create --properties accepted=true """ -helps['datadog linked-resource'] = """ - type: group - short-summary: datadog linked-resource -""" - -helps['datadog linked-resource list'] = """ +helps['datadog marketplace-agreement update'] = """ 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 -""" + short-summary: "Update Datadog marketplace agreement in the subscription." + parameters: + - name: --properties + short-summary: "Represents the properties of the resource." + long-summary: | + Usage: --properties publisher=XX product=XX plan=XX license-text-link=XX privacy-policy-link=XX \ +retrieve-datetime=XX signature=XX accepted=XX -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" + publisher: Publisher identifier string. + product: Product identifier string. + plan: Plan identifier string. + license-text-link: Link to HTML with Microsoft and Publisher terms. + privacy-policy-link: Link to the privacy policy of the publisher. + retrieve-datetime: Date and time in UTC of when the terms were accepted. This is empty if Accepted is \ +false. + signature: Terms signature. + accepted: If any version of the terms have been accepted, otherwise false. """ helps['datadog monitor'] = """ type: group - short-summary: datadog monitor + short-summary: Manage monitor with datadog """ helps['datadog monitor list'] = """ type: command - short-summary: "List all monitors under the specified subscription." + short-summary: "List all monitors under the specified resource group. And List all monitors under the specified \ +subscription." examples: - name: Monitors_ListByResourceGroup text: |- az datadog monitor list --resource-group "myResourceGroup" + - name: Monitors_List + text: |- + az datadog monitor list """ helps['datadog monitor show'] = """ @@ -129,13 +104,19 @@ short-summary: "Create a monitor resource." parameters: - name: --datadog-organization-properties + short-summary: "Datadog organization properties" long-summary: | - Usage: --datadog-organization-properties linking-auth-code=XX linking-client-id=XX enterprise-app-id=XX + Usage: --datadog-organization-properties linking-auth-code=XX linking-client-id=XX redirect-uri=XX \ +api-key=XX application-key=XX enterprise-app-id=XX linking-auth-code: The auth code used to linking to an existing datadog organization. linking-client-id: The client_id from an existing in exchange for an auth token to link organization. + redirect-uri: The redirect uri for linking. + api-key: Api key associated to the Datadog organization. + application-key: Application key associated to the Datadog organization. enterprise-app-id: The Id of the Enterprise App used for Single sign on. - name: --user-info + short-summary: "User info" long-summary: | Usage: --user-info name=XX email-address=XX phone-number=XX @@ -145,11 +126,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'] = """ @@ -158,8 +139,8 @@ examples: - name: Monitors_Update text: |- - az datadog monitor update --name "myMonitor" --monitoring-status "Enabled" --tags Environment="Dev" \ ---resource-group "myResourceGroup" + az datadog monitor update --name "myMonitor" --tags Environment="Dev" --resource-group \ +"myResourceGroup" """ helps['datadog monitor delete'] = """ @@ -171,35 +152,85 @@ az datadog monitor delete --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog monitor wait'] = """ +helps['datadog monitor get-default-key'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the datadog monitor is met. + short-summary: "Get the default api key." examples: - - name: Pause executing next line of CLI script until the datadog monitor is successfully created. + - name: Monitors_GetDefaultKey text: |- - az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the datadog monitor is successfully deleted. + az datadog monitor get-default-key --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor list-api-key'] = """ + type: command + short-summary: "List the api keys for a given monitor resource." + examples: + - name: Monitors_ListApiKeys text: |- - az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted + az datadog monitor list-api-key --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog set-password-link'] = """ - type: group - short-summary: datadog set-password-link +helps['datadog monitor list-host'] = """ + type: command + short-summary: "List the hosts for a given monitor resource." + examples: + - name: Monitors_ListHosts + text: |- + az datadog monitor list-host --name "myMonitor" --resource-group "myResourceGroup" """ -helps['datadog set-password-link get'] = """ +helps['datadog monitor list-linked-resource'] = """ + type: command + short-summary: "List all Azure resources associated to the same Datadog organization as the target resource." + examples: + - name: Monitors_ListLinkedResources + text: |- + az datadog monitor list-linked-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor list-monitored-resource'] = """ + type: command + short-summary: "List the resources currently being monitored by the Datadog monitor resource." + examples: + - name: Monitors_ListMonitoredResources + text: |- + az datadog monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor refresh-set-password-link'] = """ type: command short-summary: "Refresh the set password link and return a latest one." examples: - - name: RefreshSetPassword_Get + - name: Monitors_RefreshSetPasswordLink + text: |- + az datadog monitor refresh-set-password-link --name "myMonitor" --resource-group "myResourceGroup" +""" + +helps['datadog monitor set-default-key'] = """ + type: command + short-summary: "Set the default api key." + examples: + - name: Monitors_SetDefaultKey text: |- - az datadog set-password-link get --monitor-name "myMonitor" --resource-group "myResourceGroup" + az datadog monitor set-default-key --monitor-name "myMonitor" --key "1111111111111111aaaaaaaaaaaaaaaa" \ +--resource-group "myResourceGroup" +""" + +helps['datadog monitor wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the datadog monitor is met. + examples: + - name: Pause executing next line of CLI script until the datadog monitor is successfully created. + text: |- + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog monitor is successfully deleted. + text: |- + az datadog monitor wait --name "myMonitor" --resource-group "myResourceGroup" --deleted """ helps['datadog tag-rule'] = """ type: group - short-summary: datadog tag-rule + short-summary: Manage tag rule with datadog """ helps['datadog tag-rule list'] = """ @@ -225,18 +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 \ @@ -255,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 \ @@ -292,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'] = """ @@ -301,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'] = """ @@ -311,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'] = """ @@ -321,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 provisioning-state=XX single-sign-on-state=XX enterprise-app-id=XX single-sign-on-state: Various states of the SSO resource enterprise-app-id: The Id of the Enterprise App used for Single sign-on. - single-sign-on-url: The login URL specific to this Datadog Organization. examples: - name: SingleSignOnConfigurations_CreateOrUpdate text: |- - az datadog sso-config create --configuration-name "default" --monitor-name \ -"myMonitor" --properties enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" \ ---resource-group "myResourceGroup" + az datadog sso-config create --configuration-name "default" --monitor-name "myMonitor" --properties \ +enterprise-app-id="00000000-0000-0000-0000-000000000000" single-sign-on-state="Enable" --resource-group \ +"myResourceGroup" """ helps['datadog sso-config update'] = """ type: command short-summary: "Configures single-sign-on for this resource." + parameters: + - name: --properties + long-summary: | + Usage: --properties provisioning-state=XX single-sign-on-state=XX enterprise-app-id=XX + + single-sign-on-state: Various states of the SSO resource + enterprise-app-id: The Id of the Enterprise App used for Single sign-on. """ helps['datadog sso-config wait'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is \ -met. + short-summary: Place the CLI in a waiting state until a condition of the datadog sso-config is met. examples: - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -created. + - name: Pause executing next line of CLI script until the datadog sso-config is successfully created. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the datadog sso-config is successfully \ -updated. + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --created + - name: Pause executing next line of CLI script until the datadog sso-config is successfully updated. text: |- - az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" \ ---resource-group "myResourceGroup" --updated + az datadog sso-config wait --configuration-name "default" --monitor-name "myMonitor" --resource-group \ +"myResourceGroup" --updated """ diff --git a/src/datadog/azext_datadog/generated/_params.py b/src/datadog/azext_datadog/generated/_params.py index 6aa9c602fa6..0361d289203 100644 --- a/src/datadog/azext_datadog/generated/_params.py +++ b/src/datadog/azext_datadog/generated/_params.py @@ -19,43 +19,24 @@ ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from azext_datadog.action import ( + AddMarketplaceagreementsProperties, AddDatadogOrganizationProperties, AddUserInfo, - AddMetricRulesFilteringTags, + AddFilteringTags, AddLogRulesFilteringTags, - AddProperties + AddSinglesignonconfigurationsProperties ) def load_arguments(self, _): - with self.argument_context('datadog api-key list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name') - - with self.argument_context('datadog api-key get-default-key') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') - - with self.argument_context('datadog api-key set-default-key') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') - c.argument('created_by', type=str, help='The user that created the API key.') - c.argument('name', type=str, help='The name of the API key.') - c.argument('key', type=str, help='The value of the API key.') - c.argument('created', type=str, help='The time of creation of the API key.') - - with self.argument_context('datadog host list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name') + with self.argument_context('datadog marketplace-agreement create') as c: + c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' + 'of the resource.') - with self.argument_context('datadog linked-resource list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name') - - with self.argument_context('datadog monitored-resource list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('monitor_name', type=str, help='Monitor resource name') + with self.argument_context('datadog marketplace-agreement update') as c: + c.argument('properties', action=AddMarketplaceagreementsProperties, nargs='+', help='Represents the properties ' + 'of the resource.') with self.argument_context('datadog monitor list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -67,46 +48,70 @@ 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) c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' 'name', id_part='name') - with self.argument_context('datadog monitor wait') as c: + with self.argument_context('datadog monitor get-default-key') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' 'name', id_part='name') - with self.argument_context('datadog set-password-link get') as c: + with self.argument_context('datadog monitor list-api-key') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor list-host') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor list-linked-resource') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor list-monitored-resource') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name') + + with self.argument_context('datadog monitor refresh-set-password-link') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') + + with self.argument_context('datadog monitor set-default-key') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') + c.argument('created_by', type=str, help='The user that created the API key.') + c.argument('name', type=str, help='The name of the API key.') + c.argument('key', type=str, help='The value of the API key.') + c.argument('created', type=str, help='The time of creation of the API key.') + + with self.argument_context('datadog monitor wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('monitor_name', options_list=['--name', '-n', '--monitor-name'], type=str, help='Monitor resource ' + 'name', id_part='name') with self.argument_context('datadog tag-rule list') as c: c.argument('resource_group_name', resource_group_name_type) @@ -121,41 +126,48 @@ def load_arguments(self, _): c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name') c.argument('rule_set_name', type=str, help='Rule set name') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only ' - 'Exclude action is specified, the rules will apply to the list of all available resources. If ' - 'Include actions are specified, the rules will only include resources with the associated tags.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'NotSpecified']), help='') + c.argument('filtering_tags', action=AddFilteringTags, nargs='+', help='List of filtering tags to be used for ' + 'capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, ' + 'the rules will apply to the list of all available resources. If Include actions are specified, the ' + 'rules will only include resources with the associated tags.', arg_group='Metric Rules') + c.argument('send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs should be sent ' + 'for the Monitor resource.', arg_group='Log Rules') + c.argument('send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' + 'subscription logs should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure resource logs ' + 'should be sent for the Monitor resource.', arg_group='Log Rules') + c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='+', help='List of filtering ' 'tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If ' 'empty, all resources will be captured. If only Exclude action is specified, the rules will apply ' 'to the list of all available resources. If Include actions are specified, the rules will only ' - 'include resources with the associated tags.') + 'include resources with the associated tags.', arg_group='Log Rules') with self.argument_context('datadog tag-rule update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') c.argument('rule_set_name', type=str, help='Rule set name', id_part='child_name_1') - c.argument('metric_rules_filtering_tags', action=AddMetricRulesFilteringTags, nargs='*', help='List of ' - 'filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only ' - 'Exclude action is specified, the rules will apply to the list of all available resources. If ' - 'Include actions are specified, the rules will only include resources with the associated tags.') - c.argument('log_rules_send_aad_logs', arg_type=get_three_state_flag(), help='Flag specifying if AAD logs ' - 'should be sent for the Monitor resource.') - c.argument('log_rules_send_subscription_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'subscription logs should be sent for the Monitor resource.') - c.argument('log_rules_send_resource_logs', arg_type=get_three_state_flag(), help='Flag specifying if Azure ' - 'resource logs should be sent for the Monitor resource.') - c.argument('log_rules_filtering_tags', action=AddLogRulesFilteringTags, nargs='*', help='List of filtering ' + c.argument('provisioning_state', arg_type=get_enum_type(['Accepted', 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Canceled', 'Deleted', + 'NotSpecified']), help='') + 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 +182,14 @@ def load_arguments(self, _): c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name') c.argument('configuration_name', type=str, help='Configuration name') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') with self.argument_context('datadog sso-config update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('monitor_name', type=str, help='Monitor resource name', id_part='name') c.argument('configuration_name', type=str, help='Configuration name', id_part='child_name_1') - c.argument('properties', action=AddProperties, nargs='*', help='') + c.argument('properties', action=AddSinglesignonconfigurationsProperties, nargs='+', help='') + c.ignore('body') with self.argument_context('datadog sso-config wait') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/datadog/azext_datadog/generated/action.py b/src/datadog/azext_datadog/generated/action.py index 27649270eec..2d81235bad9 100644 --- a/src/datadog/azext_datadog/generated/action.py +++ b/src/datadog/azext_datadog/generated/action.py @@ -14,6 +14,46 @@ from knack.util import CLIError +class AddMarketplaceagreementsProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.properties = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'publisher': + d['publisher'] = v[0] + elif kl == 'product': + d['product'] = v[0] + elif kl == 'plan': + d['plan'] = v[0] + elif kl == 'license-text-link': + d['license_text_link'] = v[0] + elif kl == 'privacy-policy-link': + d['privacy_policy_link'] = v[0] + elif kl == 'retrieve-datetime': + d['retrieve_datetime'] = v[0] + elif kl == 'signature': + d['signature'] = v[0] + elif kl == 'accepted': + d['accepted'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'publisher, product, plan, license-text-link, privacy-policy-link, retrieve-datetime, ' + 'signature, accepted'.format(k)) + return d + + class AddDatadogOrganizationProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) @@ -35,8 +75,18 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['linking_auth_code'] = v[0] elif kl == 'linking-client-id': d['linking_client_id'] = v[0] + elif kl == 'redirect-uri': + d['redirect_uri'] = v[0] + elif kl == 'api-key': + d['api_key'] = v[0] + elif kl == 'application-key': + d['application_key'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter datadog_organization_properties. All ' + 'possible keys are: linking-auth-code, linking-client-id, redirect-uri, api-key, ' + 'application-key, enterprise-app-id'.format(k)) return d @@ -63,13 +113,16 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['email_address'] = v[0] elif kl == 'phone-number': d['phone_number'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter user_info. All possible keys are: name, ' + 'email-address, phone-number'.format(k)) return d -class AddMetricRulesFilteringTags(argparse._AppendAction): +class AddFilteringTags(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - super(AddMetricRulesFilteringTags, self).__call__(parser, namespace, action, option_string) + super(AddFilteringTags, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -89,6 +142,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['value'] = v[0] elif kl == 'action': d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter filtering_tags. All possible keys are: ' + 'name, value, action'.format(k)) return d @@ -115,10 +171,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['value'] = v[0] elif kl == 'action': d['action'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter log_rules_filtering_tags. All possible ' + 'keys are: name, value, action'.format(k)) return d -class AddProperties(argparse.Action): +class AddSinglesignonconfigurationsProperties(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) namespace.properties = action @@ -135,10 +194,13 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'single-sign-on-state': + if kl == 'provisioning-state': + d['provisioning_state'] = v[0] + elif kl == 'single-sign-on-state': d['single_sign_on_state'] = v[0] elif kl == 'enterprise-app-id': d['enterprise_app_id'] = v[0] - elif kl == 'single-sign-on-url': - d['single_sign_on_url'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter properties. All possible keys are: ' + 'provisioning-state, single-sign-on-state, enterprise-app-id'.format(k)) return d diff --git a/src/datadog/azext_datadog/generated/commands.py b/src/datadog/azext_datadog/generated/commands.py index a35c103807c..42555a1060d 100644 --- a/src/datadog/azext_datadog/generated/commands.py +++ b/src/datadog/azext_datadog/generated/commands.py @@ -20,87 +20,54 @@ def load_command_table(self, _): operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._marketplace_agreements_operations#MarketplaceA' 'greementsOperations.{}', client_factory=cf_marketplace_agreement) - with self.command_group('datadog terms', datadog_marketplace_agreement, - client_factory=cf_marketplace_agreement, is_experimental=True) as g: - g.custom_command('list', 'datadog_terms_list') - - from azext_datadog.generated._client_factory import cf_api_key - datadog_api_key = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._api_key_operations#ApiKeyOperations.{}', - client_factory=cf_api_key) - with self.command_group('datadog api-key', datadog_api_key, client_factory=cf_api_key, is_experimental=True) as g: - g.custom_command('list', 'datadog_api_key_list') - g.custom_command('get-default-key', 'datadog_api_key_get_default_key') - g.custom_command('set-default-key', 'datadog_api_key_set_default_key') - - from azext_datadog.generated._client_factory import cf_host - datadog_host = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._host_operations#HostOperations.{}', - client_factory=cf_host) - with self.command_group('datadog host', datadog_host, client_factory=cf_host, is_experimental=True) as g: - g.custom_command('list', 'datadog_host_list') - - from azext_datadog.generated._client_factory import cf_linked_resource - datadog_linked_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._linked_resource_operations#LinkedResourceOpera' - 'tions.{}', - client_factory=cf_linked_resource) - with self.command_group('datadog linked-resource', datadog_linked_resource, client_factory=cf_linked_resource, - is_experimental=True) as g: - g.custom_command('list', 'datadog_linked_resource_list') - - from azext_datadog.generated._client_factory import cf_monitored_resource - datadog_monitored_resource = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitored_resource_operations#MonitoredResourc' - 'eOperations.{}', - client_factory=cf_monitored_resource) - with self.command_group('datadog monitored-resource', datadog_monitored_resource, - client_factory=cf_monitored_resource, is_experimental=True) as g: - g.custom_command('list', 'datadog_monitored_resource_list') + 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') + g.custom_command('update', 'datadog_marketplace_agreement_update') from azext_datadog.generated._client_factory import cf_monitor datadog_monitor = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitor_operations#MonitorOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._monitors_operations#MonitorsOperations.{}', client_factory=cf_monitor) - with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor, is_experimental=True) as g: + with self.command_group('datadog monitor', datadog_monitor, client_factory=cf_monitor) as g: g.custom_command('list', 'datadog_monitor_list') g.custom_show_command('show', 'datadog_monitor_show') g.custom_command('create', 'datadog_monitor_create', supports_no_wait=True) g.custom_command('update', 'datadog_monitor_update') g.custom_command('delete', 'datadog_monitor_delete', supports_no_wait=True, confirmation=True) + g.custom_command('get-default-key', 'datadog_monitor_get_default_key') + g.custom_command('list-api-key', 'datadog_monitor_list_api_key') + g.custom_command('list-host', 'datadog_monitor_list_host') + g.custom_command('list-linked-resource', 'datadog_monitor_list_linked_resource') + g.custom_command('list-monitored-resource', 'datadog_monitor_list_monitored_resource') + g.custom_command('refresh-set-password-link', 'datadog_monitor_refresh_set_password_link') + g.custom_command('set-default-key', 'datadog_monitor_set_default_key') g.custom_wait_command('wait', 'datadog_monitor_show') - from azext_datadog.generated._client_factory import cf_refresh_set_password - datadog_refresh_set_password = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._refresh_set_password_operations#RefreshSetPass' - 'wordOperations.{}', - client_factory=cf_refresh_set_password) - with self.command_group('datadog set-password-link', datadog_refresh_set_password, - client_factory=cf_refresh_set_password, is_experimental=True) as g: - g.custom_command('get', 'datadog_refresh_set_password_get') - from azext_datadog.generated._client_factory import cf_tag_rule datadog_tag_rule = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rule_operations#TagRuleOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._tag_rules_operations#TagRulesOperations.{}', client_factory=cf_tag_rule) - with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule, - is_experimental=True) as g: + with self.command_group('datadog tag-rule', datadog_tag_rule, client_factory=cf_tag_rule) as g: g.custom_command('list', 'datadog_tag_rule_list') g.custom_show_command('show', 'datadog_tag_rule_show') g.custom_command('create', 'datadog_tag_rule_create') - g.custom_command('update', 'datadog_tag_rule_update') + g.generic_update_command('update', setter_arg_name='body', custom_func_name='datadog_tag_rule_update') from azext_datadog.generated._client_factory import cf_single_sign_on_configuration datadog_single_sign_on_configuration = CliCommandType( - operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configuration_operations#Single' - 'SignOnConfigurationOperations.{}', + operations_tmpl='azext_datadog.vendored_sdks.datadog.operations._single_sign_on_configurations_operations#Singl' + 'eSignOnConfigurationsOperations.{}', client_factory=cf_single_sign_on_configuration) with self.command_group('datadog sso-config', datadog_single_sign_on_configuration, - client_factory=cf_single_sign_on_configuration, is_experimental=True) as g: - g.custom_command('list', 'datadog_single_sign_on_configuration_list') - g.custom_show_command('show', 'datadog_single_sign_on_configuration_show') - g.custom_command('create', 'datadog_single_sign_on_configuration_create', supports_no_wait=True) - g.generic_update_command('update', setter_arg_name='properties', setter_name='begin_create_or_update', - custom_func_name='datadog_single_sign_on_configuration_update', - supports_no_wait=True) - g.custom_wait_command('wait', 'datadog_single_sign_on_configuration_show') + client_factory=cf_single_sign_on_configuration) as g: + g.custom_command('list', 'datadog_sso_config_list') + g.custom_show_command('show', 'datadog_sso_config_show') + g.custom_command('create', 'datadog_sso_config_create', supports_no_wait=True) + g.generic_update_command('update', setter_arg_name='body', setter_name='begin_create_or_update', + custom_func_name='datadog_sso_config_update', supports_no_wait=True) + g.custom_wait_command('wait', 'datadog_sso_config_show') + + with self.command_group('datadog', is_experimental=True): + pass diff --git a/src/datadog/azext_datadog/generated/custom.py b/src/datadog/azext_datadog/generated/custom.py index a4d66c84e0b..214a081f292 100644 --- a/src/datadog/azext_datadog/generated/custom.py +++ b/src/datadog/azext_datadog/generated/custom.py @@ -10,62 +10,25 @@ # pylint: disable=too-many-lines # pylint: disable=unused-argument -from azure.cli.command_modules.role.custom import create_role_assignment, list_role_assignments, delete_role_assignments from azure.cli.core.util import sdk_no_wait -def datadog_terms_list(client): +def datadog_marketplace_agreement_list(client): return client.list() -def datadog_api_key_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) +def datadog_marketplace_agreement_create(client, + properties=None): + body = {} + body['properties'] = properties + return client.create_or_update(body=body) -def datadog_api_key_get_default_key(client, - resource_group_name, - monitor_name): - return client.get_default_key(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_api_key_set_default_key(client, - resource_group_name, - monitor_name, - key, - created_by=None, - name=None, - created=None): - return client.set_default_key(resource_group_name=resource_group_name, - monitor_name=monitor_name, - created_by=created_by, - name=name, - key=key, - created=created) - - -def datadog_host_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_linked_resource_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) - - -def datadog_monitored_resource_list(client, - resource_group_name, - monitor_name): - return client.list(resource_group_name=resource_group_name, - monitor_name=monitor_name) +def datadog_marketplace_agreement_update(client, + properties=None): + body = {} + body['properties'] = properties + return client.create_or_update(body=body) def datadog_monitor_list(client, @@ -82,79 +45,114 @@ def datadog_monitor_show(client, monitor_name=monitor_name) -def datadog_monitor_create(cmd, - 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): - poller = sdk_no_wait(no_wait, - client.begin_create, - resource_group_name=resource_group_name, - monitor_name=monitor_name, - tags=tags, - location=location, - type=identity_type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=sku_name) - result = poller.result() - if result and result.principal_id: - scrope = '/subscriptions/' + result.id.split('/')[2] - create_role_assignment(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05', assignee_object_id=result.principal_id, - scope=scrope, assignee_principal_type='ServicePrincipal') - return poller + body = {} + body['tags'] = tags + body['location'] = location + body['identity'] = {} + body['identity']['type'] = type_ + body['properties'] = {} + body['properties']['monitoring_status'] = "Enabled" + body['properties']['datadog_organization_properties'] = datadog_organization_properties + body['properties']['user_info'] = user_info + body['sku'] = {} + body['sku']['name'] = name + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) def datadog_monitor_update(client, resource_group_name, monitor_name, - tags=None, - monitoring_status=None): + tags=None): + body = {} + body['tags'] = tags + body['properties'] = {} + body['properties']['monitoring_status'] = "Enabled" return client.update(resource_group_name=resource_group_name, monitor_name=monitor_name, - tags=tags, - monitoring_status=monitoring_status) + body=body) -def datadog_monitor_delete(cmd, - client, +def datadog_monitor_delete(client, resource_group_name, monitor_name, no_wait=False): - monitor = client.get(resource_group_name=resource_group_name, - monitor_name=monitor_name) - poller = sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - monitor_name=monitor_name) - result = poller.result() - if not result: - scrope = '/subscriptions/' + monitor.id.split('/')[2] - role_assignments = list_role_assignments(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05', scope=scrope) - for i in role_assignments: - if i.get('principalId') == monitor.principal_id: - delete_role_assignments(cmd, ids=[i.get('id')]) - break - return poller - - -def datadog_refresh_set_password_get(client, - resource_group_name, - monitor_name): - return client.get(resource_group_name=resource_group_name, - monitor_name=monitor_name) + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_get_default_key(client, + resource_group_name, + monitor_name): + return client.get_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_api_key(client, + resource_group_name, + monitor_name): + return client.list_api_keys(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_host(client, + resource_group_name, + monitor_name): + return client.list_hosts(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_linked_resource(client, + resource_group_name, + monitor_name): + return client.list_linked_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_list_monitored_resource(client, + resource_group_name, + monitor_name): + return client.list_monitored_resources(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_refresh_set_password_link(client, + resource_group_name, + monitor_name): + return client.refresh_set_password_link(resource_group_name=resource_group_name, + monitor_name=monitor_name) + + +def datadog_monitor_set_default_key(client, + resource_group_name, + monitor_name, + created_by=None, + name=None, + key=None, + created=None): + body = {} + body['created_by'] = created_by + body['name'] = name + body['key'] = key + body['created'] = created + return client.set_default_key(resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body) def datadog_tag_rule_list(client, @@ -177,73 +175,91 @@ def datadog_tag_rule_create(client, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + provisioning_state=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): + body = {} + body['properties'] = {} + body['properties']['provisioning_state'] = provisioning_state + body['properties']['metric_rules'] = {} + body['properties']['metric_rules']['filtering_tags'] = filtering_tags + body['properties']['log_rules'] = {} + body['properties']['log_rules']['send_aad_logs'] = send_aad_logs + body['properties']['log_rules']['send_subscription_logs'] = send_subscription_logs + body['properties']['log_rules']['send_resource_logs'] = send_resource_logs + body['properties']['log_rules']['filtering_tags'] = log_rules_filtering_tags return client.create_or_update(resource_group_name=resource_group_name, monitor_name=monitor_name, rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + body=body) -def datadog_tag_rule_update(client, +def datadog_tag_rule_update(instance, resource_group_name, monitor_name, rule_set_name, - metric_rules_filtering_tags=None, - log_rules_send_aad_logs=None, - log_rules_send_subscription_logs=None, - log_rules_send_resource_logs=None, + provisioning_state=None, + filtering_tags=None, + send_aad_logs=None, + send_subscription_logs=None, + send_resource_logs=None, log_rules_filtering_tags=None): - return client.create_or_update(resource_group_name=resource_group_name, - monitor_name=monitor_name, - rule_set_name=rule_set_name, - filtering_tags=metric_rules_filtering_tags, - send_aad_logs=log_rules_send_aad_logs, - send_subscription_logs=log_rules_send_subscription_logs, - send_resource_logs=log_rules_send_resource_logs, - log_rules_filtering_tags=log_rules_filtering_tags) + if provisioning_state is not None: + instance.properties.provisioning_state = provisioning_state + if filtering_tags is not None: + instance.properties.metric_rules.filtering_tags = filtering_tags + if send_aad_logs is not None: + instance.properties.log_rules.send_aad_logs = send_aad_logs + if send_subscription_logs is not None: + instance.properties.log_rules.send_subscription_logs = send_subscription_logs + if send_resource_logs is not None: + instance.properties.log_rules.send_resource_logs = send_resource_logs + if log_rules_filtering_tags is not None: + instance.properties.log_rules.filtering_tags = log_rules_filtering_tags + return instance -def datadog_single_sign_on_configuration_list(client, - resource_group_name, - monitor_name): +def datadog_sso_config_list(client, + resource_group_name, + monitor_name): return client.list(resource_group_name=resource_group_name, monitor_name=monitor_name) -def datadog_single_sign_on_configuration_show(client, - resource_group_name, - monitor_name, - configuration_name): +def datadog_sso_config_show(client, + resource_group_name, + monitor_name, + configuration_name): return client.get(resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name) -def datadog_single_sign_on_configuration_create(client, - resource_group_name, - monitor_name, - configuration_name, - properties=None, - no_wait=False): +def datadog_sso_config_create(client, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + body = {} + body['properties'] = properties return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties) + body=body) -def datadog_single_sign_on_configuration_update(instance, - resource_group_name, - monitor_name, - configuration_name, - no_wait=False): +def datadog_sso_config_update(instance, + resource_group_name, + monitor_name, + configuration_name, + properties=None, + no_wait=False): + if properties is not None: + instance.properties = properties return instance diff --git a/src/datadog/azext_datadog/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..abf02d94475 --- /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_CreateOrUpdate +@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: /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: /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: /Monitors/post/Monitors_GetDefaultKey +@try_manual +def step_monitor_get_default_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor get-default-key ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_ListApiKeys +@try_manual +def step_monitor_list_api_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list-api-key ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_ListHosts +@try_manual +def step_monitor_list_host(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list-host ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_ListLinkedResources +@try_manual +def step_monitor_list_linked_resource(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list-linked-resource ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_ListMonitoredResources +@try_manual +def step_monitor_list_monitored_resource(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor list-monitored-resource ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_RefreshSetPasswordLink +@try_manual +def step_monitor_refresh_set_password_link(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor refresh-set-password-link ' + '--name "{myMonitor}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Monitors/post/Monitors_SetDefaultKey +@try_manual +def step_monitor_set_default_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az datadog monitor set-default-key ' + '--monitor-name "{myMonitor}" ' + '--key "1111111111111111aaaaaaaaaaaaaaaa" ' + '--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 d92b9dea80f..6a3956be180 100644 --- a/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py +++ b/src/datadog/azext_datadog/tests/latest/test_datadog_scenario.py @@ -9,313 +9,111 @@ # -------------------------------------------------------------------------- import os -import mock from azure.cli.testsdk import ScenarioTest -from .. import try_manual, raise_if, calc_coverage from azure.cli.testsdk import ResourceGroupPreparer -from azure_devtools.scenario_tests import AllowLargeResponse +from .example_steps import step_marketplace_agreement_create +from .example_steps import step_marketplace_agreement_list +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_monitor_get_default_key +from .example_steps import step_monitor_list_api_key +from .example_steps import step_monitor_list_host +from .example_steps import step_monitor_list_linked_resource +from .example_steps import step_monitor_list_monitored_resource +from .example_steps import step_monitor_refresh_set_password_link +from .example_steps import step_monitor_set_default_key +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): - with mock.patch('azure.cli.command_modules.role.custom._gen_guid', side_effect=test.create_guid): - test.cmd('az datadog monitor create ' - '--name "{myMonitor}" ' - '--sku-name "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 step__terms_list(test, rg): - test.cmd('az datadog terms list', - checks=[ - test.check('length(@)', 2) - ]) - - -@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) - step__terms_list(test, rg) - cleanup(test, rg) - - -@try_manual -class MicrosoftDatadogClientScenarioTest(ScenarioTest): - - @AllowLargeResponse() - @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_marketplace_agreement_list(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_monitor_get_default_key(test, rg, checks=[]) + step_monitor_list_api_key(test, rg, checks=[]) + step_monitor_list_host(test, rg, checks=[]) + step_monitor_list_linked_resource(test, rg, checks=[]) + step_monitor_list_monitored_resource(test, rg, checks=[]) + step_monitor_refresh_set_password_link(test, rg, checks=[]) + step_monitor_set_default_key(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..3b844c5adca 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/_configuration.py @@ -28,7 +28,7 @@ class MicrosoftDatadogClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -47,9 +47,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-02-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'microsoftdatadogclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py b/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py index 72160660d16..d557b59868e 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/_microsoft_datadog_client.py @@ -19,15 +19,10 @@ from ._configuration import MicrosoftDatadogClientConfiguration from .operations import MarketplaceAgreementsOperations -from .operations import ApiKeyOperations -from .operations import HostOperations -from .operations import LinkedResourceOperations -from .operations import MonitoredResourceOperations -from .operations import OperationOperations -from .operations import MonitorOperations -from .operations import RefreshSetPasswordOperations -from .operations import TagRuleOperations -from .operations import SingleSignOnConfigurationOperations +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations from . import models @@ -36,27 +31,17 @@ class MicrosoftDatadogClient(object): :ivar marketplace_agreements: MarketplaceAgreementsOperations operations :vartype marketplace_agreements: microsoft_datadog_client.operations.MarketplaceAgreementsOperations - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.operations.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.operations.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.operations.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.operations.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.operations.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.operations.MonitorOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.operations.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.operations.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.operations.SingleSignOnConfigurationOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -81,23 +66,13 @@ def __init__( self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize) - self.api_key = ApiKeyOperations( + self.monitors = MonitorsOperations( self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( + self.tag_rules = TagRulesOperations( self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rule = TagRuleOperations( - self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( + self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py index 3b629c26f27..b43d36247a5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._microsoft_datadog_client_async import MicrosoftDatadogClient +from ._microsoft_datadog_client import MicrosoftDatadogClient __all__ = ['MicrosoftDatadogClient'] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py similarity index 91% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py index e2d16a4bf3e..f4e5b7f1f0d 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_configuration.py @@ -26,7 +26,7 @@ class MicrosoftDatadogClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -44,9 +44,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-02-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'microsoftdatadogclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py new file mode 100644 index 00000000000..c378a32e2f2 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations +from .operations import MonitorsOperations +from .operations import Operations +from .operations import TagRulesOperations +from .operations import SingleSignOnConfigurationsOperations +from .. import models + + +class MicrosoftDatadogClient(object): + """MicrosoftDatadogClient. + + :ivar marketplace_agreements: MarketplaceAgreementsOperations operations + :vartype marketplace_agreements: microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations + :ivar monitors: MonitorsOperations operations + :vartype monitors: microsoft_datadog_client.aio.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: microsoft_datadog_client.aio.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: microsoft_datadog_client.aio.operations.TagRulesOperations + :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations + :vartype single_sign_on_configurations: microsoft_datadog_client.aio.operations.SingleSignOnConfigurationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.marketplace_agreements = MarketplaceAgreementsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MicrosoftDatadogClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py deleted file mode 100644 index 7b6366c0e29..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/_microsoft_datadog_client_async.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration_async import MicrosoftDatadogClientConfiguration -from .operations_async import ApiKeyOperations -from .operations_async import HostOperations -from .operations_async import LinkedResourceOperations -from .operations_async import MonitoredResourceOperations -from .operations_async import OperationOperations -from .operations_async import MonitorOperations -from .operations_async import RefreshSetPasswordOperations -from .operations_async import TagRuleOperations -from .operations_async import SingleSignOnConfigurationOperations -from .. import models - - -class MicrosoftDatadogClient(object): - """MicrosoftDatadogClient. - - :ivar api_key: ApiKeyOperations operations - :vartype api_key: microsoft_datadog_client.aio.operations_async.ApiKeyOperations - :ivar host: HostOperations operations - :vartype host: microsoft_datadog_client.aio.operations_async.HostOperations - :ivar linked_resource: LinkedResourceOperations operations - :vartype linked_resource: microsoft_datadog_client.aio.operations_async.LinkedResourceOperations - :ivar monitored_resource: MonitoredResourceOperations operations - :vartype monitored_resource: microsoft_datadog_client.aio.operations_async.MonitoredResourceOperations - :ivar operation: OperationOperations operations - :vartype operation: microsoft_datadog_client.aio.operations_async.OperationOperations - :ivar monitor: MonitorOperations operations - :vartype monitor: microsoft_datadog_client.aio.operations_async.MonitorOperations - :ivar refresh_set_password: RefreshSetPasswordOperations operations - :vartype refresh_set_password: microsoft_datadog_client.aio.operations_async.RefreshSetPasswordOperations - :ivar tag_rule: TagRuleOperations operations - :vartype tag_rule: microsoft_datadog_client.aio.operations_async.TagRuleOperations - :ivar single_sign_on_configuration: SingleSignOnConfigurationOperations operations - :vartype single_sign_on_configuration: microsoft_datadog_client.aio.operations_async.SingleSignOnConfigurationOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.api_key = ApiKeyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.host = HostOperations( - self._client, self._config, self._serialize, self._deserialize) - self.linked_resource = LinkedResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resource = MonitoredResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.refresh_set_password = RefreshSetPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rule = TagRuleOperations( - self._client, self._config, self._serialize, self._deserialize) - self.single_sign_on_configuration = SingleSignOnConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MicrosoftDatadogClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py new file mode 100644 index 00000000000..b2edc8eaf2d --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._marketplace_agreements_operations import MarketplaceAgreementsOperations +from ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations + +__all__ = [ + 'MarketplaceAgreementsOperations', + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', +] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py new file mode 100644 index 00000000000..f8e23530dd3 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_marketplace_agreements_operations.py @@ -0,0 +1,175 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MarketplaceAgreementsOperations: + """MarketplaceAgreementsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogAgreementResourceListResponse"]: + """List Datadog marketplace agreements in the subscription. + + List Datadog marketplace agreements in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogAgreementResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore + + async def create_or_update( + self, + body: Optional["models.DatadogAgreementResource"] = None, + **kwargs + ) -> "models.DatadogAgreementResource": + """Create Datadog marketplace agreement in the subscription. + + Create Datadog marketplace agreement in the subscription. + + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogAgreementResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogAgreementResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogAgreementResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py new file mode 100644 index 00000000000..c485d529446 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_monitors_operations.py @@ -0,0 +1,1063 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitorsOperations: + """MonitorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_api_keys( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogApiKeyListResponse"]: + """List the api keys for a given monitor resource. + + List the api keys for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_api_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + async def get_default_key( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogApiKey": + """Get the default api key. + + Get the default api key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + async def set_default_key( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogApiKey"] = None, + **kwargs + ) -> None: + """Set the default api key. + + Set the default api key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogHostListResponse"]: + """List the hosts for a given monitor resource. + + List the hosts for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.LinkedResourceListResponse"]: + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_linked_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncIterable["models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Datadog monitor resource. + + List the resources currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: + """List all monitors under the specified subscription. + + List all monitors under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: + """List all monitors under the specified resource group. + + List all monitors under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore + + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogMonitorResource": + """Get the properties of a specific monitor resource. + + Get the properties of a specific monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResource"] = None, + **kwargs + ) -> "models.DatadogMonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.DatadogMonitorResource"]: + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DatadogMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: Optional["models.DatadogMonitorResourceUpdateParameters"] = None, + **kwargs + ) -> "models.DatadogMonitorResource": + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + async def refresh_set_password_link( + self, + resource_group_name: str, + monitor_name: str, + **kwargs + ) -> "models.DatadogSetPasswordLink": + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py similarity index 87% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py index e49ef087be6..a50ee92b7bf 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_operation_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +class Operations: + """Operations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -45,9 +45,9 @@ def list( self, **kwargs ) -> AsyncIterable["models.OperationListResult"]: - """List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + """List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) @@ -55,14 +55,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -92,7 +95,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py similarity index 82% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py index 049816a80b3..79838a3df58 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_single_sign_on_configuration_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_single_sign_on_configurations_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations: - """SingleSignOnConfigurationOperations async operations. +class SingleSignOnConfigurationsOperations: + """SingleSignOnConfigurationsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -53,8 +53,7 @@ def list( List the single sign-on configurations for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str @@ -64,21 +63,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -107,7 +109,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -123,22 +125,23 @@ async def _create_or_update_initial( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> "models.DatadogSingleSignOnResource": cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -151,22 +154,21 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogSingleSignOnResource') + if body is not None: + body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -186,22 +188,21 @@ async def begin_create_or_update( resource_group_name: str, monitor_name: str, configuration_name: str, - properties: Optional["models.DatadogSingleSignOnProperties"] = None, + body: Optional["models.DatadogSingleSignOnResource"] = None, **kwargs ) -> AsyncLROPoller["models.DatadogSingleSignOnResource"]: """Configures single-sign-on for this resource. Configures single-sign-on for this resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -224,7 +225,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -239,7 +240,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,12 +272,11 @@ async def get( Gets the datadog single sign-on resource for the given Monitor. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) @@ -277,15 +284,18 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -297,7 +307,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -305,7 +315,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py similarity index 74% rename from src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py index d6e840c774e..972b816ad93 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_tag_rule_operations_async.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations/_tag_rules_operations.py @@ -5,11 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TagRuleOperations: - """TagRuleOperations async operations. +class TagRulesOperations: + """TagRulesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -51,8 +51,7 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str @@ -62,21 +61,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -105,7 +107,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -121,61 +123,40 @@ async def create_or_update( resource_group_name: str, monitor_name: str, rule_set_name: str, - filtering_tags: Optional[List["models.FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - log_rules_filtering_tags: Optional[List["models.FilteringTag"]] = None, + body: Optional["models.MonitoringTagRules"] = None, **kwargs ) -> "models.MonitoringTagRules": """Create or update a tag rule set for a given monitor resource. Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str - :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be - captured. If only Exclude action is specified, the rules will apply to the list of all - available resources. If Include actions are specified, the rules will only include resources - with the associated tags. - :type log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.models.MonitoringTagRules :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -188,22 +169,21 @@ async def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'MonitoringTagRules') + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -225,12 +205,11 @@ async def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) @@ -238,15 +217,18 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -258,7 +240,7 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -266,7 +248,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py deleted file mode 100644 index c164696fbc8..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._api_key_operations_async import ApiKeyOperations -from ._host_operations_async import HostOperations -from ._linked_resource_operations_async import LinkedResourceOperations -from ._monitored_resource_operations_async import MonitoredResourceOperations -from ._operation_operations_async import OperationOperations -from ._monitor_operations_async import MonitorOperations -from ._refresh_set_password_operations_async import RefreshSetPasswordOperations -from ._tag_rule_operations_async import TagRuleOperations -from ._single_sign_on_configuration_operations_async import SingleSignOnConfigurationOperations - -__all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', - 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', -] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py deleted file mode 100644 index ab42f19d5cd..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_api_key_operations_async.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ApiKeyOperations: - """ApiKeyOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogApiKeyListResponse"]: - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore - - async def get_default_key( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogApiKey": - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - async def set_default_key( - self, - resource_group_name: str, - monitor_name: str, - key: str, - created_by: Optional[str] = None, - name: Optional[str] = None, - created: Optional[str] = None, - **kwargs - ) -> None: - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param key: The value of the API key. - :type key: str - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param created: The time of creation of the API key. - :type created: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogApiKey(created_by=created_by, name=name, key=key, created=created) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py deleted file mode 100644 index f219da6c04b..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_host_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class HostOperations: - """HostOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogHostListResponse"]: - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py deleted file mode 100644 index dc1dd4956fa..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_linked_resource_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class LinkedResourceOperations: - """LinkedResourceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.LinkedResourceListResponse"]: - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py deleted file mode 100644 index 8b7176e59b4..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitor_operations_async.py +++ /dev/null @@ -1,588 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MonitorOperations: - """MonitorOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: - """List all monitors under the specified subscription. - - List all monitors under the specified subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.DatadogMonitorResourceListResponse"]: - """List all monitors under the specified resource group. - - List all monitors under the specified resource group. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore - - async def get( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogMonitorResource": - """Get the properties of a specific monitor resource. - - Get the properties of a specific monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, - **kwargs - ) -> "models.DatadogMonitorResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResource(tags=tags, location=location, type_identity_type=type, provisioning_state=provisioning_state, monitoring_status=monitoring_status, marketplace_subscription_status=marketplace_subscription_status, datadog_organization_properties=datadog_organization_properties, user_info=user_info, name_sku_name=name) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResource') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def begin_create( - self, - resource_group_name: str, - monitor_name: str, - location: str, - tags: Optional[Dict[str, str]] = None, - type: Optional[Union[str, "models.ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "models.ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["models.DatadogOrganizationProperties"] = None, - user_info: Optional["models.UserInfo"] = None, - name: Optional[str] = None, - **kwargs - ) -> AsyncLROPoller["models.DatadogMonitorResource"]: - """Create a monitor resource. - - Create a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param location: - :type location: str - :param tags: Dictionary of :code:``. - :type tags: dict[str, str] - :param type: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - monitor_name: str, - tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "models.MonitoringStatus"]] = None, - **kwargs - ) -> "models.DatadogMonitorResource": - """Update a monitor resource. - - Update a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param tags: The new tags of the monitor resource. - :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResourceUpdateParameters') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete a monitor resource. - - Delete a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py deleted file mode 100644 index 50b609ec8b3..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_monitored_resource_operations_async.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MonitoredResourceOperations: - """MonitoredResourceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["models.MonitoredResourceListResponse"]: - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py b/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py deleted file mode 100644 index d57e456daab..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/aio/operations_async/_refresh_set_password_operations_async.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RefreshSetPasswordOperations: - """RefreshSetPasswordOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "models.DatadogSetPasswordLink": - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py index b284d0dec46..68e79e98bcc 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/__init__.py @@ -25,18 +25,27 @@ from ._models_py3 import DatadogSingleSignOnProperties from ._models_py3 import DatadogSingleSignOnResource from ._models_py3 import DatadogSingleSignOnResourceListResponse - from ._models_py3 import ErrorResponseBody + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse from ._models_py3 import FilteringTag + from ._models_py3 import IdentityProperties from ._models_py3 import LinkedResource from ._models_py3 import LinkedResourceListResponse + from ._models_py3 import LogRules + from ._models_py3 import MetricRules + from ._models_py3 import MonitorProperties + from ._models_py3 import MonitorUpdateProperties from ._models_py3 import MonitoredResource from ._models_py3 import MonitoredResourceListResponse from ._models_py3 import MonitoringTagRules from ._models_py3 import MonitoringTagRulesListResponse + from ._models_py3 import MonitoringTagRulesProperties from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import OperationResult - from ._models_py3 import ResourceProviderDefaultErrorResponse + from ._models_py3 import ResourceSku + from ._models_py3 import SystemData from ._models_py3 import UserInfo except (SyntaxError, ImportError): from ._models import DatadogAgreementProperties # type: ignore @@ -57,21 +66,31 @@ from ._models import DatadogSingleSignOnProperties # type: ignore from ._models import DatadogSingleSignOnResource # type: ignore from ._models import DatadogSingleSignOnResourceListResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import FilteringTag # type: ignore + from ._models import IdentityProperties # type: ignore from ._models import LinkedResource # type: ignore from ._models import LinkedResourceListResponse # type: ignore + from ._models import LogRules # type: ignore + from ._models import MetricRules # type: ignore + from ._models import MonitorProperties # type: ignore + from ._models import MonitorUpdateProperties # type: ignore from ._models import MonitoredResource # type: ignore from ._models import MonitoredResourceListResponse # type: ignore from ._models import MonitoringTagRules # type: ignore from ._models import MonitoringTagRulesListResponse # type: ignore + from ._models import MonitoringTagRulesProperties # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore from ._models import OperationResult # type: ignore - from ._models import ResourceProviderDefaultErrorResponse # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import SystemData # type: ignore from ._models import UserInfo # type: ignore from ._microsoft_datadog_client_enums import ( + CreatedByType, LiftrResourceCategories, ManagedIdentityTypes, MarketplaceSubscriptionStatus, @@ -82,6 +101,9 @@ ) __all__ = [ + 'DatadogAgreementProperties', + 'DatadogAgreementResource', + 'DatadogAgreementResourceListResponse', 'DatadogApiKey', 'DatadogApiKeyListResponse', 'DatadogHost', @@ -97,19 +119,29 @@ 'DatadogSingleSignOnProperties', 'DatadogSingleSignOnResource', 'DatadogSingleSignOnResourceListResponse', - 'ErrorResponseBody', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'FilteringTag', + 'IdentityProperties', 'LinkedResource', 'LinkedResourceListResponse', + 'LogRules', + 'MetricRules', + 'MonitorProperties', + 'MonitorUpdateProperties', 'MonitoredResource', 'MonitoredResourceListResponse', 'MonitoringTagRules', 'MonitoringTagRulesListResponse', + 'MonitoringTagRulesProperties', 'OperationDisplay', 'OperationListResult', 'OperationResult', - 'ResourceProviderDefaultErrorResponse', + 'ResourceSku', + 'SystemData', 'UserInfo', + 'CreatedByType', 'LiftrResourceCategories', 'ManagedIdentityTypes', 'MarketplaceSubscriptionStatus', diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py index 7e344646af0..eba8198b7a4 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_microsoft_datadog_client_enums.py @@ -26,12 +26,23 @@ def __getattr__(cls, name): raise AttributeError(name) +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + class LiftrResourceCategories(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNKNOWN = "Unknown" MONITOR_LOGS = "MonitorLogs" class ManagedIdentityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Identity type + """ SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" @@ -41,8 +52,10 @@ class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str time, the resource will go in Suspended state. """ + PROVISIONING = "Provisioning" ACTIVE = "Active" SUSPENDED = "Suspended" + UNSUBSCRIBED = "Unsubscribed" class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying if the resource monitoring is enabled or disabled. diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py index a9e68644d9e..02652c08a90 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models.py @@ -71,12 +71,15 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype type: str :param properties: Represents the properties of the resource. :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -84,6 +87,7 @@ class DatadogAgreementResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -95,6 +99,7 @@ def __init__( self.name = None self.type = None self.properties = kwargs.get('properties', None) + self.system_data = None class DatadogAgreementResourceListResponse(msrest.serialization.Model): @@ -320,39 +325,18 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type_identity_type: Possible values include: "SystemAssigned", "UserAssigned". - :type type_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { @@ -360,29 +344,19 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -393,19 +367,12 @@ def __init__( self.id = None self.name = None self.type = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + self.identity = kwargs.get('identity', None) self.tags = kwargs.get('tags', None) self.location = kwargs['location'] - self.principal_id = None - self.tenant_id = None - self.type_identity_type = kwargs.get('type_identity_type', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.monitoring_status = kwargs.get('monitoring_status', None) - self.marketplace_subscription_status = kwargs.get('marketplace_subscription_status', None) - self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) - self.user_info = kwargs.get('user_info', None) - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = kwargs.get('name_sku_name', None) + self.system_data = None class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -434,16 +401,16 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( @@ -451,12 +418,12 @@ def __init__( **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) self.tags = kwargs.get('tags', None) - self.monitoring_status = kwargs.get('monitoring_status', None) class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -469,6 +436,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -483,6 +456,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -495,6 +471,9 @@ def __init__( self.id = None self.linking_auth_code = kwargs.get('linking_auth_code', None) self.linking_client_id = kwargs.get('linking_client_id', None) + self.redirect_uri = kwargs.get('redirect_uri', None) + self.api_key = kwargs.get('api_key', None) + self.application_key = kwargs.get('application_key', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) @@ -520,16 +499,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -540,9 +529,10 @@ def __init__( **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) self.single_sign_on_state = kwargs.get('single_sign_on_state', None) self.enterprise_app_id = kwargs.get('enterprise_app_id', None) - self.single_sign_on_url = kwargs.get('single_sign_on_url', None) + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -558,12 +548,15 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype type: str :param properties: :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -571,6 +564,7 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogSingleSignOnProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -582,6 +576,7 @@ def __init__( self.name = None self.type = None self.properties = kwargs.get('properties', None) + self.system_data = None class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): @@ -607,35 +602,98 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class ErrorResponseBody(msrest.serialization.Model): - """ErrorResponseBody. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~microsoft_datadog_client.models.ErrorResponseBody] + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft_datadog_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_datadog_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~microsoft_datadog_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class FilteringTag(msrest.serialization.Model): @@ -666,6 +724,40 @@ def __init__( self.action = kwargs.get('action', None) +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -708,6 +800,64 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = kwargs.get('send_aad_logs', None) + self.send_subscription_logs = kwargs.get('send_subscription_logs', None) + self.send_resource_logs = kwargs.get('send_resource_logs', None) + self.filtering_tags = kwargs.get('filtering_tags', None) + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = kwargs.get('filtering_tags', None) + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -779,44 +929,25 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. If empty, all resources will be captured. If only Exclude action is - specified, the rules will apply to the list of all available resources. If Include actions are - specified, the rules will only include resources with the associated tags. - :type filtering_tags_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -827,11 +958,8 @@ def __init__( self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = kwargs.get('filtering_tags_properties_metric_rules_filtering_tags', None) - self.send_aad_logs = kwargs.get('send_aad_logs', None) - self.send_subscription_logs = kwargs.get('send_subscription_logs', None) - self.send_resource_logs = kwargs.get('send_resource_logs', None) - self.filtering_tags_properties_log_rules_filtering_tags = kwargs.get('filtering_tags_properties_log_rules_filtering_tags', None) + self.properties = kwargs.get('properties', None) + self.system_data = None class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -857,6 +985,112 @@ def __init__( self.next_link = kwargs.get('next_link', None) +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.log_rules = kwargs.get('log_rules', None) + self.metric_rules = kwargs.get('metric_rules', None) + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'marketplace_subscription_status': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.monitoring_status = kwargs.get('monitoring_status', "Enabled") + self.marketplace_subscription_status = None + self.datadog_organization_properties = kwargs.get('datadog_organization_properties', None) + self.user_info = kwargs.get('user_info', None) + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = kwargs.get('monitoring_status', "Enabled") + + class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. @@ -938,27 +1172,74 @@ def __init__( self.is_data_action = kwargs.get('is_data_action', None) -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """ResourceProviderDefaultErrorResponse. +class ResourceSku(msrest.serialization.Model): + """ResourceSku. - :param error: - :type error: ~microsoft_datadog_client.models.ErrorResponseBody + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) class UserInfo(msrest.serialization.Model): - """UserInfo. + """User info. :param name: Name of the user. :type name: str diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py index 25bd10eff4a..c06931d8361 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/models/_models_py3.py @@ -85,12 +85,15 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype type: str :param properties: Represents the properties of the resource. :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -98,6 +101,7 @@ class DatadogAgreementResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogAgreementProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -111,6 +115,7 @@ def __init__( self.name = None self.type = None self.properties = properties + self.system_data = None class DatadogAgreementResourceListResponse(msrest.serialization.Model): @@ -365,39 +370,18 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str + :param sku: + :type sku: ~microsoft_datadog_client.models.ResourceSku + :param properties: Properties specific to the monitor resource. + :type properties: ~microsoft_datadog_client.models.MonitorProperties + :param identity: + :type identity: ~microsoft_datadog_client.models.IdentityProperties :param tags: A set of tags. Dictionary of :code:``. :type tags: dict[str, str] :param location: Required. :type location: str - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type_identity_type: Possible values include: "SystemAssigned", "UserAssigned". - :type type_identity_type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", - "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. Possible - values include: "Active", "Suspended". - :type marketplace_subscription_status: str or - ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: - ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or - ~microsoft_datadog_client.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - :param name_sku_name: Name of the SKU. - :type name_sku_name: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { @@ -405,62 +389,41 @@ class DatadogMonitorResource(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, - 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, - 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, - 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, - 'datadog_organization_properties': {'key': 'properties.datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, - 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, - 'name_sku_name': {'key': 'sku.name', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, *, location: str, + sku: Optional["ResourceSku"] = None, + properties: Optional["MonitorProperties"] = None, + identity: Optional["IdentityProperties"] = None, tags: Optional[Dict[str, str]] = None, - type_identity_type: Optional[Union[str, "ManagedIdentityTypes"]] = None, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, - marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, - datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, - user_info: Optional["UserInfo"] = None, - name_sku_name: Optional[str] = None, **kwargs ): super(DatadogMonitorResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.sku = sku + self.properties = properties + self.identity = identity self.tags = tags self.location = location - self.principal_id = None - self.tenant_id = None - self.type_identity_type = type_identity_type - self.provisioning_state = provisioning_state - self.monitoring_status = monitoring_status - self.marketplace_subscription_status = marketplace_subscription_status - self.datadog_organization_properties = datadog_organization_properties - self.user_info = user_info - self.liftr_resource_category = None - self.liftr_resource_preference = None - self.name_sku_name = name_sku_name + self.system_data = None class DatadogMonitorResourceListResponse(msrest.serialization.Model): @@ -492,32 +455,32 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. + :param properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties :param tags: A set of tags. The new tags of the monitor resource. :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MonitorUpdateProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, } def __init__( self, *, + properties: Optional["MonitorUpdateProperties"] = None, tags: Optional[Dict[str, str]] = None, - monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, **kwargs ): super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) + self.properties = properties self.tags = tags - self.monitoring_status = monitoring_status class DatadogOrganizationProperties(msrest.serialization.Model): - """DatadogOrganizationProperties. + """Datadog organization properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,6 +493,12 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :param linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :type linking_client_id: str + :param redirect_uri: The redirect uri for linking. + :type redirect_uri: str + :param api_key: Api key associated to the Datadog organization. + :type api_key: str + :param application_key: Application key associated to the Datadog organization. + :type application_key: str :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. :type enterprise_app_id: str """ @@ -544,6 +513,9 @@ class DatadogOrganizationProperties(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'linking_auth_code': {'key': 'linkingAuthCode', 'type': 'str'}, 'linking_client_id': {'key': 'linkingClientId', 'type': 'str'}, + 'redirect_uri': {'key': 'redirectUri', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'application_key': {'key': 'applicationKey', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, } @@ -552,6 +524,9 @@ def __init__( *, linking_auth_code: Optional[str] = None, linking_client_id: Optional[str] = None, + redirect_uri: Optional[str] = None, + api_key: Optional[str] = None, + application_key: Optional[str] = None, enterprise_app_id: Optional[str] = None, **kwargs ): @@ -560,6 +535,9 @@ def __init__( self.id = None self.linking_auth_code = linking_auth_code self.linking_client_id = linking_client_id + self.redirect_uri = redirect_uri + self.api_key = api_key + self.application_key = application_key self.enterprise_app_id = enterprise_app_id @@ -587,16 +565,26 @@ def __init__( class DatadogSingleSignOnProperties(msrest.serialization.Model): """DatadogSingleSignOnProperties. + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState :param single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. :type enterprise_app_id: str - :param single_sign_on_url: The login URL specific to this Datadog Organization. - :type single_sign_on_url: str + :ivar single_sign_on_url: The login URL specific to this Datadog Organization. + :vartype single_sign_on_url: str """ + _validation = { + 'single_sign_on_url': {'readonly': True}, + } + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, @@ -605,15 +593,16 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): def __init__( self, *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, - single_sign_on_url: Optional[str] = None, **kwargs ): super(DatadogSingleSignOnProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state self.single_sign_on_state = single_sign_on_state self.enterprise_app_id = enterprise_app_id - self.single_sign_on_url = single_sign_on_url + self.single_sign_on_url = None class DatadogSingleSignOnResource(msrest.serialization.Model): @@ -629,12 +618,15 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype type: str :param properties: :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -642,6 +634,7 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'DatadogSingleSignOnProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -655,6 +648,7 @@ def __init__( self.name = None self.type = None self.properties = properties + self.system_data = None class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): @@ -683,40 +677,100 @@ def __init__( self.next_link = next_link -class ErrorResponseBody(msrest.serialization.Model): - """ErrorResponseBody. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~microsoft_datadog_client.models.ErrorResponseBody] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft_datadog_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~microsoft_datadog_client.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~microsoft_datadog_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["ErrorResponseBody"]] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class FilteringTag(msrest.serialization.Model): @@ -751,6 +805,42 @@ def __init__( self.action = action +class IdentityProperties(msrest.serialization.Model): + """IdentityProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The identity ID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityTypes"]] = None, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. @@ -798,6 +888,71 @@ def __init__( self.next_link = next_link +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :type send_aad_logs: bool + :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :type send_subscription_logs: bool + :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :type send_resource_logs: bool + :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, + 'send_resource_logs': {'key': 'sendResourceLogs', 'type': 'bool'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + send_aad_logs: Optional[bool] = None, + send_subscription_logs: Optional[bool] = None, + send_resource_logs: Optional[bool] = None, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = send_aad_logs + self.send_subscription_logs = send_subscription_logs + self.send_resource_logs = send_resource_logs + self.filtering_tags = filtering_tags + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = filtering_tags + + class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. @@ -878,65 +1033,39 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param filtering_tags_properties_metric_rules_filtering_tags: List of filtering tags to be used - for capturing metrics. If empty, all resources will be captured. If only Exclude action is - specified, the rules will apply to the list of all available resources. If Include actions are - specified, the rules will only include resources with the associated tags. - :type filtering_tags_properties_metric_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param filtering_tags_properties_log_rules_filtering_tags: List of filtering tags to be used - for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags_properties_log_rules_filtering_tags: - list[~microsoft_datadog_client.models.FilteringTag] + :param properties: Definition of the properties for a TagRules resource. + :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~microsoft_datadog_client.models.SystemData """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'filtering_tags_properties_metric_rules_filtering_tags': {'key': 'properties.metricRules.filteringTags', 'type': '[FilteringTag]'}, - 'send_aad_logs': {'key': 'properties.logRules.sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'properties.logRules.sendSubscriptionLogs', 'type': 'bool'}, - 'send_resource_logs': {'key': 'properties.logRules.sendResourceLogs', 'type': 'bool'}, - 'filtering_tags_properties_log_rules_filtering_tags': {'key': 'properties.logRules.filteringTags', 'type': '[FilteringTag]'}, + 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, *, - filtering_tags_properties_metric_rules_filtering_tags: Optional[List["FilteringTag"]] = None, - send_aad_logs: Optional[bool] = None, - send_subscription_logs: Optional[bool] = None, - send_resource_logs: Optional[bool] = None, - filtering_tags_properties_log_rules_filtering_tags: Optional[List["FilteringTag"]] = None, + properties: Optional["MonitoringTagRulesProperties"] = None, **kwargs ): super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None self.type = None - self.filtering_tags_properties_metric_rules_filtering_tags = filtering_tags_properties_metric_rules_filtering_tags - self.send_aad_logs = send_aad_logs - self.send_subscription_logs = send_subscription_logs - self.send_resource_logs = send_resource_logs - self.filtering_tags_properties_log_rules_filtering_tags = filtering_tags_properties_log_rules_filtering_tags + self.properties = properties + self.system_data = None class MonitoringTagRulesListResponse(msrest.serialization.Model): @@ -965,6 +1094,123 @@ def __init__( self.next_link = next_link +class MonitoringTagRulesProperties(msrest.serialization.Model): + """Definition of the properties for a TagRules resource. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param log_rules: Set of rules for sending logs for the Monitor resource. + :type log_rules: ~microsoft_datadog_client.models.LogRules + :param metric_rules: Set of rules for sending metrics for the Monitor resource. + :type metric_rules: ~microsoft_datadog_client.models.MetricRules + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + log_rules: Optional["LogRules"] = None, + metric_rules: Optional["MetricRules"] = None, + **kwargs + ): + super(MonitoringTagRulesProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.log_rules = log_rules + self.metric_rules = metric_rules + + +class MonitorProperties(msrest.serialization.Model): + """Properties specific to the monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". + :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of + the resource. If payment is not made in time, the resource will go in Suspended state. Possible + values include: "Provisioning", "Active", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus + :param datadog_organization_properties: Datadog organization properties. + :type datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :param user_info: User info. + :type user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype liftr_resource_category: str or + ~microsoft_datadog_client.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + """ + + _validation = { + 'marketplace_subscription_status': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'datadog_organization_properties': {'key': 'datadogOrganizationProperties', 'type': 'DatadogOrganizationProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", + datadog_organization_properties: Optional["DatadogOrganizationProperties"] = None, + user_info: Optional["UserInfo"] = None, + **kwargs + ): + super(MonitorProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + self.monitoring_status = monitoring_status + self.marketplace_subscription_status = None + self.datadog_organization_properties = datadog_organization_properties + self.user_info = user_info + self.liftr_resource_category = None + self.liftr_resource_preference = None + + +class MonitorUpdateProperties(msrest.serialization.Model): + """The set of properties that can be update in a PATCH request to a monitor resource. + + :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ + + _attribute_map = { + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", + **kwargs + ): + super(MonitorUpdateProperties, self).__init__(**kwargs) + self.monitoring_status = monitoring_status + + class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. @@ -1058,29 +1304,83 @@ def __init__( self.is_data_action = is_data_action -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """ResourceProviderDefaultErrorResponse. +class ResourceSku(msrest.serialization.Model): + """ResourceSku. - :param error: - :type error: ~microsoft_datadog_client.models.ErrorResponseBody + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the SKU. + :type name: str """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, *, - error: Optional["ErrorResponseBody"] = None, + name: str, **kwargs ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = error + super(ResourceSku, self).__init__(**kwargs) + self.name = name + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at class UserInfo(msrest.serialization.Model): - """UserInfo. + """User info. :param name: Name of the user. :type name: str diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py index c7b486bf932..b2edc8eaf2d 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/__init__.py @@ -7,24 +7,15 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations -from ._api_key_operations import ApiKeyOperations -from ._host_operations import HostOperations -from ._linked_resource_operations import LinkedResourceOperations -from ._monitored_resource_operations import MonitoredResourceOperations -from ._operation_operations import OperationOperations -from ._monitor_operations import MonitorOperations -from ._refresh_set_password_operations import RefreshSetPasswordOperations -from ._tag_rule_operations import TagRuleOperations -from ._single_sign_on_configuration_operations import SingleSignOnConfigurationOperations +from ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations __all__ = [ - 'ApiKeyOperations', - 'HostOperations', - 'LinkedResourceOperations', - 'MonitoredResourceOperations', - 'OperationOperations', - 'MonitorOperations', - 'RefreshSetPasswordOperations', - 'TagRuleOperations', - 'SingleSignOnConfigurationOperations', + 'MarketplaceAgreementsOperations', + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnConfigurationsOperations', ] diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py deleted file mode 100644 index 1c688a2ea92..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_api_key_operations.py +++ /dev/null @@ -1,261 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApiKeyOperations(object): - """ApiKeyOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogApiKeyListResponse"] - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore - - def get_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogApiKey" - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - def set_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - key, # type: str - created_by=None, # type: Optional[str] - name=None, # type: Optional[str] - created=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param key: The value of the API key. - :type key: str - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param created: The time of creation of the API key. - :type created: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogApiKey(created_by=created_by, name=name, key=key, created=created) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py deleted file mode 100644 index 2e8a47a760a..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_host_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class HostOperations(object): - """HostOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogHostListResponse"] - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py deleted file mode 100644 index bb4d552082a..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_linked_resource_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class LinkedResourceOperations(object): - """LinkedResourceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.LinkedResourceListResponse"] - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py index 6877b189cdf..87cf37fcaf5 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_marketplace_agreements_operations.py @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -76,7 +76,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -104,7 +104,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -115,9 +115,9 @@ def get_next(next_link=None): ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements'} # type: ignore - def create( + def create_or_update( self, - properties=None, # type: Optional["models.DatadogAgreementProperties"] + body=None, # type: Optional["models.DatadogAgreementResource"] **kwargs # type: Any ): # type: (...) -> "models.DatadogAgreementResource" @@ -125,8 +125,8 @@ def create( Create Datadog marketplace agreement in the subscription. - :param properties: Represents the properties of the resource. - :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogAgreementResource :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogAgreementResource, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.DatadogAgreementResource @@ -137,20 +137,20 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - body = models.DatadogAgreementResource(properties=properties) + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -169,7 +169,7 @@ def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) @@ -178,4 +178,4 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py deleted file mode 100644 index 7fb70f7eb58..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitor_operations.py +++ /dev/null @@ -1,600 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class MonitorOperations(object): - """MonitorOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] - """List all monitors under the specified subscription. - - List all monitors under the specified subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] - """List all monitors under the specified resource group. - - List all monitors under the specified resource group. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore - - def get( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - """Get the properties of a specific monitor resource. - - Get the properties of a specific monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def _create_initial( - self, - resource_group_name, # type: str - monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResource(tags=tags, location=location, type_identity_type=type, provisioning_state=provisioning_state, monitoring_status=monitoring_status, marketplace_subscription_status=marketplace_subscription_status, datadog_organization_properties=datadog_organization_properties, user_info=user_info, name_sku_name=name) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResource') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def begin_create( - self, - resource_group_name, # type: str - monitor_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - type=None, # type: Optional[Union[str, "models.ManagedIdentityTypes"]] - provisioning_state=None, # type: Optional[Union[str, "models.ProvisioningState"]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - marketplace_subscription_status=None, # type: Optional[Union[str, "models.MarketplaceSubscriptionStatus"]] - datadog_organization_properties=None, # type: Optional["models.DatadogOrganizationProperties"] - user_info=None, # type: Optional["models.UserInfo"] - name=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DatadogMonitorResource"] - """Create a monitor resource. - - Create a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param location: - :type location: str - :param tags: Dictionary of :code:``. - :type tags: dict[str, str] - :param type: - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes - :param provisioning_state: - :type provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :param marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of - the resource. If payment is not made in time, the resource will go in Suspended state. - :type marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: - :type datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: - :type user_info: ~microsoft_datadog_client.models.UserInfo - :param name: Name of the SKU. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - location=location, - tags=tags, - type=type, - provisioning_state=provisioning_state, - monitoring_status=monitoring_status, - marketplace_subscription_status=marketplace_subscription_status, - datadog_organization_properties=datadog_organization_properties, - user_info=user_info, - name=name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - monitor_name, # type: str - tags=None, # type: Optional[Dict[str, str]] - monitoring_status=None, # type: Optional[Union[str, "models.MonitoringStatus"]] - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogMonitorResource" - """Update a monitor resource. - - Update a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param tags: The new tags of the monitor resource. - :type tags: dict[str, str] - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogMonitorResource, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogMonitorResourceUpdateParameters(tags=tags, monitoring_status=monitoring_status) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogMonitorResourceUpdateParameters') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Delete a monitor resource. - - Delete a monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - monitor_name=monitor_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py deleted file mode 100644 index 8e982bdeda7..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitored_resource_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class MonitoredResourceOperations(object): - """MonitoredResourceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.MonitoredResourceListResponse"] - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py new file mode 100644 index 00000000000..248c7a30a26 --- /dev/null +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_monitors_operations.py @@ -0,0 +1,1082 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MonitorsOperations(object): + """MonitorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~microsoft_datadog_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_api_keys( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogApiKeyListResponse"] + """List the api keys for a given monitor resource. + + List the api keys for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKeyListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_api_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + + def get_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogApiKey" + """Get the default api key. + + Get the default api key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogApiKey, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogApiKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogApiKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogApiKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + def set_default_key( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogApiKey"] + **kwargs # type: Any + ): + # type: (...) -> None + """Set the default api key. + + Set the default api key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogApiKey + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.set_default_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogApiKey') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + def list_hosts( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogHostListResponse"] + """List the hosts for a given monitor resource. + + List the hosts for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogHostListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogHostListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_hosts.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + + def list_linked_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.LinkedResourceListResponse"] + """List all Azure resources associated to the same Datadog organization as the target resource. + + List all Azure resources associated to the same Datadog organization as the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_linked_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + + def list_monitored_resources( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.MonitoredResourceListResponse"] + """List the resources currently being monitored by the Datadog monitor resource. + + List the resources currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_monitored_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] + """List all monitors under the specified subscription. + + List all monitors under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatadogMonitorResourceListResponse"] + """List all monitors under the specified resource group. + + List all monitors under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore + + def get( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + """Get the properties of a specific monitor resource. + + Get the properties of a specific monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DatadogMonitorResource"] + """Create a monitor resource. + + Create a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + monitor_name, # type: str + body=None, # type: Optional["models.DatadogMonitorResourceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogMonitorResource" + """Update a monitor resource. + + Update a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param body: + :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogMonitorResource, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogMonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogMonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a monitor resource. + + Delete a monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + def refresh_set_password_link( + self, + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DatadogSetPasswordLink" + """Refresh the set password link and return a latest one. + + Refresh the set password link and return a latest one. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatadogSetPasswordLink, or the result of cls(response) + :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.refresh_set_password_link.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py similarity index 87% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py index 1c90d2b4cbd..8cc38ea3a6b 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operation_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +class Operations(object): + """Operations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -50,9 +50,9 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["models.OperationListResult"] - """List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + """List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - List all operations provided by Microsoft.Datadog for the 2020-02-01-preview api version. + List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) @@ -60,14 +60,17 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL @@ -97,7 +100,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py deleted file mode 100644 index 2406fedbd38..00000000000 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_refresh_set_password_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class RefreshSetPasswordOperations(object): - """RefreshSetPasswordOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DatadogSetPasswordLink" - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSetPasswordLink"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py similarity index 81% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py index 6b60e79a7a7..6f2e25ce942 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configuration_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_single_sign_on_configurations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class SingleSignOnConfigurationOperations(object): - """SingleSignOnConfigurationOperations operations. +class SingleSignOnConfigurationsOperations(object): + """SingleSignOnConfigurationsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -58,8 +58,7 @@ def list( List the single sign-on configurations for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str @@ -69,21 +68,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResourceListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -112,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -128,23 +130,24 @@ def _create_or_update_initial( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> "models.DatadogSingleSignOnResource" cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.DatadogSingleSignOnResource(properties=properties) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -157,22 +160,21 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'DatadogSingleSignOnResource') + if body is not None: + body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -192,7 +194,7 @@ def begin_create_or_update( resource_group_name, # type: str monitor_name, # type: str configuration_name, # type: str - properties=None, # type: Optional["models.DatadogSingleSignOnProperties"] + body=None, # type: Optional["models.DatadogSingleSignOnResource"] **kwargs # type: Any ): # type: (...) -> LROPoller["models.DatadogSingleSignOnResource"] @@ -200,15 +202,14 @@ def begin_create_or_update( Configures single-sign-on for this resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :param body: + :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -231,7 +232,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, - properties=properties, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -246,7 +247,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), + 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -272,12 +280,11 @@ def get( Gets the datadog single sign-on resource for the given Monitor. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param configuration_name: + :param configuration_name: Configuration name. :type configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DatadogSingleSignOnResource, or the result of cls(response) @@ -285,15 +292,18 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DatadogSingleSignOnResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), } @@ -305,7 +315,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -313,7 +323,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) diff --git a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py similarity index 73% rename from src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py rename to src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py index d30ab42567d..a9fb453770f 100644 --- a/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rule_operations.py +++ b/src/datadog/azext_datadog/vendored_sdks/datadog/operations/_tag_rules_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,13 +18,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class TagRuleOperations(object): - """TagRuleOperations operations. +class TagRulesOperations(object): + """TagRulesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -56,8 +56,7 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str @@ -67,21 +66,24 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRulesListResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -110,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -126,11 +128,7 @@ def create_or_update( resource_group_name, # type: str monitor_name, # type: str rule_set_name, # type: str - filtering_tags=None, # type: Optional[List["models.FilteringTag"]] - send_aad_logs=None, # type: Optional[bool] - send_subscription_logs=None, # type: Optional[bool] - send_resource_logs=None, # type: Optional[bool] - log_rules_filtering_tags=None, # type: Optional[List["models.FilteringTag"]] + body=None, # type: Optional["models.MonitoringTagRules"] **kwargs # type: Any ): # type: (...) -> "models.MonitoringTagRules" @@ -138,50 +136,33 @@ def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str - :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all - resources will be captured. If only Exclude action is specified, the rules will apply to the - list of all available resources. If Include actions are specified, the rules will only include - resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the - Monitor resource. - :type send_resource_logs: bool - :param log_rules_filtering_tags: List of filtering tags to be used for capturing logs. This - only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be - captured. If only Exclude action is specified, the rules will apply to the list of all - available resources. If Include actions are specified, the rules will only include resources - with the associated tags. - :type log_rules_filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :param body: + :type body: ~microsoft_datadog_client.models.MonitoringTagRules :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) :rtype: ~microsoft_datadog_client.models.MonitoringTagRules :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - - _body = models.MonitoringTagRules(filtering_tags_properties_metric_rules_filtering_tags=filtering_tags, send_aad_logs=send_aad_logs, send_subscription_logs=send_subscription_logs, send_resource_logs=send_resource_logs, filtering_tags_properties_log_rules_filtering_tags=log_rules_filtering_tags) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -194,22 +175,21 @@ def create_or_update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'MonitoringTagRules') + if body is not None: + body_content = self._serialize.body(body, 'MonitoringTagRules') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -232,12 +212,11 @@ def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param monitor_name: Monitor resource name. :type monitor_name: str - :param rule_set_name: + :param rule_set_name: Rule set name. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MonitoringTagRules, or the result of cls(response) @@ -245,15 +224,18 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.MonitoringTagRules"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), } @@ -265,7 +247,7 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -273,7 +255,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) diff --git a/src/datadog/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..bf88a30b107 --- /dev/null +++ b/src/datadog/report.md @@ -0,0 +1,371 @@ +# 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 monitor|Monitors|[commands](#CommandsInMonitors)| +|az datadog tag-rule|TagRules|[commands](#CommandsInTagRules)| +|az datadog sso-config|SingleSignOnConfigurations|[commands](#CommandsInSingleSignOnConfigurations)| + +## COMMANDS +### 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](#MarketplaceAgreementsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersMarketplaceAgreementsCreateOrUpdate#Create)|[Example](#ExamplesMarketplaceAgreementsCreateOrUpdate#Create)| +|[az datadog marketplace-agreement update](#MarketplaceAgreementsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersMarketplaceAgreementsCreateOrUpdate#Update)|Not Found| + +### 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)| +|[az datadog monitor get-default-key](#MonitorsGetDefaultKey)|GetDefaultKey|[Parameters](#ParametersMonitorsGetDefaultKey)|[Example](#ExamplesMonitorsGetDefaultKey)| +|[az datadog monitor list-api-key](#MonitorsListApiKeys)|ListApiKeys|[Parameters](#ParametersMonitorsListApiKeys)|[Example](#ExamplesMonitorsListApiKeys)| +|[az datadog monitor list-host](#MonitorsListHosts)|ListHosts|[Parameters](#ParametersMonitorsListHosts)|[Example](#ExamplesMonitorsListHosts)| +|[az datadog monitor list-linked-resource](#MonitorsListLinkedResources)|ListLinkedResources|[Parameters](#ParametersMonitorsListLinkedResources)|[Example](#ExamplesMonitorsListLinkedResources)| +|[az datadog monitor list-monitored-resource](#MonitorsListMonitoredResources)|ListMonitoredResources|[Parameters](#ParametersMonitorsListMonitoredResources)|[Example](#ExamplesMonitorsListMonitoredResources)| +|[az datadog monitor refresh-set-password-link](#MonitorsRefreshSetPasswordLink)|RefreshSetPasswordLink|[Parameters](#ParametersMonitorsRefreshSetPasswordLink)|[Example](#ExamplesMonitorsRefreshSetPasswordLink)| +|[az datadog monitor set-default-key](#MonitorsSetDefaultKey)|SetDefaultKey|[Parameters](#ParametersMonitorsSetDefaultKey)|[Example](#ExamplesMonitorsSetDefaultKey)| + +### 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 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| + +#### Command `az datadog marketplace-agreement update` + +##### 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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor get-default-key` + +##### Example +``` +az datadog monitor get-default-key --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor list-api-key` + +##### Example +``` +az datadog monitor list-api-key --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor list-host` + +##### Example +``` +az datadog monitor list-host --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor list-linked-resource` + +##### Example +``` +az datadog monitor list-linked-resource --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor list-monitored-resource` + +##### Example +``` +az datadog monitor list-monitored-resource --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor refresh-set-password-link` + +##### Example +``` +az datadog monitor refresh-set-password-link --name "myMonitor" --resource-group "myResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| + +#### Command `az datadog monitor set-default-key` + +##### Example +``` +az datadog monitor 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. The name is case insensitive.|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 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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|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. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string|Rule set name|rule_set_name|ruleSetName| +|**--provisioning-state**|choice||provisioning_state|provisioningState| +|**--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. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--monitor-name**|string|Monitor resource name|monitor_name|monitorName| +|**--rule-set-name**|string|Rule set name|rule_set_name|ruleSetName| +|**--provisioning-state**|choice||provisioning_state|provisioningState| +|**--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