Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR datadog] Web ant94 2021 02 01 - resolve conflict in service branch #1990

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/datadog/azext_datadog/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.17.0"
"azext.minCliCoreVersion": "2.15.0"
}
23 changes: 10 additions & 13 deletions src/datadog/azext_datadog/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

helps['datadog terms'] = """
type: group
short-summary: Manage marketplace agreements with datadog
short-summary: Manage marketplace agreement with datadog
"""

helps['datadog terms 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
"""
Expand Down Expand Up @@ -126,14 +126,11 @@
examples:
- name: Monitors_Create
text: |-
az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" \
--tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" \
--type "SystemAssigned" --sku-name "payg_v2_Monthly"
- name: Monitors creation with linking to Datadogo organization.
text: |-
az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" \
--datadog-organization-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" \
email-address="[email protected]" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "Linked"
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="[email protected]" phone-number="123-456-7890" --name "free_Monthly" --tags \
Environment="Dev" --resource-group "myResourceGroup"
"""

helps['datadog monitor update'] = """
Expand All @@ -142,8 +139,8 @@
examples:
- name: Monitors_Update
text: |-
az datadog monitor update --name "myMonitor" --tags Environment="Dev" --monitoring-status "Disabled" \
--resource-group "myResourceGroup"
az datadog monitor update --monitor-name "myMonitor" --tags Environment="Dev" --resource-group \
"myResourceGroup"
"""

helps['datadog monitor delete'] = """
Expand Down
12 changes: 4 additions & 8 deletions src/datadog/azext_datadog/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ 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), required=False,
validator=get_default_location_from_resource_group)
Expand All @@ -58,16 +57,13 @@ def load_arguments(self, _):
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.', arg_group='Sku')
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('monitor_name', type=str, help='Monitor resource name', id_part='name')
c.argument('tags', tags_type)
c.argument('monitoring_status', type=str, help='Flag specifying if the resource monitoring is enabled or '
'disabled. Allowed values: "Enabled", "Disabled".')
c.argument('sku_name', type=str, help='Name of the SKU.', arg_group='Sku')
c.argument('name', type=str, help='Name of the SKU.', arg_group='Sku')

with self.argument_context('datadog monitor delete') as c:
c.argument('resource_group_name', resource_group_name_type)
Expand Down
4 changes: 2 additions & 2 deletions src/datadog/azext_datadog/generated/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_command_table(self, _):
'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:
client_factory=cf_marketplace_agreement) as g:
g.custom_command('list', 'datadog_terms_list')
g.custom_command('create', 'datadog_terms_create')
g.custom_command('update', 'datadog_terms_update')
Expand Down Expand Up @@ -69,5 +69,5 @@ def load_command_table(self, _):
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'):
with self.command_group('datadog', is_experimental=True):
pass
67 changes: 18 additions & 49 deletions src/datadog/azext_datadog/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@
# 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):
return client.list()


def datadog_marketplace_agreement_create(client,
properties=None):
body = {}
body['properties'] = properties
return client.create_or_update(body=body)


def datadog_terms_create(client,
properties=None):
body = {}
Expand Down Expand Up @@ -53,16 +45,15 @@ 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,
tags=None,
location=None,
type_=None,
datadog_organization_properties=None,
user_info=None,
sku_name=None,
name=None,
no_wait=False):
body = {}
body['tags'] = tags
Expand All @@ -74,63 +65,41 @@ def datadog_monitor_create(cmd,
body['properties']['datadog_organization_properties'] = datadog_organization_properties
body['properties']['user_info'] = user_info
body['sku'] = {}
body['sku']['name'] = sku_name
poller = sdk_no_wait(no_wait,
client.begin_create,
resource_group_name=resource_group_name,
monitor_name=monitor_name,
body=body)
result = poller.result()
if result and result.identity and result.identity.principal_id:
scrope = '/subscriptions/' + result.id.split('/')[2]
create_role_assignment(cmd, role='43d0d8ad-25c7-4714-9337-8ba259a9fe05',
assignee_object_id=result.identity.principal_id,
scope=scrope, assignee_principal_type='ServicePrincipal')
return poller
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,
sku_name=None,
name=None,
no_wait=False):
body = {}
body['tags'] = tags
if monitoring_status is not None:
body['properties'] = {}
body['properties']['monitoring_status'] = monitoring_status
if sku_name is not None:
body['sku'] = {}
body['sku']['name'] = sku_name
body['sku'] = {}
body['sku']['name'] = name
body['properties'] = {}
body['properties']['monitoring_status'] = "Enabled"
return sdk_no_wait(no_wait,
client.begin_update,
resource_group_name=resource_group_name,
monitor_name=monitor_name,
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.identity.principal_id:
delete_role_assignments(cmd, ids=[i.get('id')])
break
return poller
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,
Expand Down
Loading