Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def addon_put(cmd, cluster_subscription, cluster_resource_group_name, cluster_na
if getattr(mc.azure_monitor_profile.metrics, "enabled", None) is False:
mc.azure_monitor_profile.metrics.enabled = True
try:
client.begin_create_or_update(cluster_resource_group_name, cluster_name, mc)
poller = client.begin_create_or_update(cluster_resource_group_name, cluster_name, mc)
poller.result()
except Exception as e:
raise UnknownError(e)
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ def link_grafana_instance(cmd, raw_parameters, azure_monitor_workspace_resource_
}
}
try:
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
roleAssignmentResourceId,
GRAFANA_ROLE_ASSIGNMENT_API,
association_body
)
poller.result()
except HttpResponseError as e:
# If already exists (RoleAssignmentExists), warn and continue, else print error
if e.error and e.error.code == "RoleAssignmentExists":
Expand Down Expand Up @@ -109,11 +110,12 @@ def link_grafana_instance(cmd, raw_parameters, azure_monitor_workspace_resource_
targetGrafanaArmPayload["properties"]["grafanaIntegrations"]["azureMonitorWorkspaceIntegrations"].append({
"azureMonitorWorkspaceResourceId": azure_monitor_workspace_resource_id
})
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
grafana_resource_id,
GRAFANA_API,
targetGrafanaArmPayload
)
poller.result()
except CLIError as e:
raise CLIError(e)
return GrafanaLink.SUCCESS
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ def create_default_mac(cmd, cluster_subscription, cluster_region):
else:
resource_groups.create_or_update(default_resource_group_name, {"location": default_mac_region})
try:
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
azure_monitor_workspace_resource_id,
MAC_API,
{
"location": default_mac_region,
"properties": {}
}
)
poller.result()
return azure_monitor_workspace_resource_id, default_mac_region
except Exception as e:
raise CLIError(e)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def create_dce(cmd, cluster_subscription, cluster_resource_group_name, cluster_n
from azure.cli.command_modules.acs._client_factory import get_resources_client
resources = get_resources_client(cmd.cli_ctx, cluster_subscription)
try:
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
dce_resource_id,
DC_API,
{
Expand All @@ -30,6 +30,7 @@ def create_dce(cmd, cluster_subscription, cluster_resource_group_name, cluster_n
"properties": {}
}
)
poller.result()
return dce_resource_id
except Exception as error:
raise CLIError(error)
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ def create_dcr(cmd, mac_region, azure_monitor_workspace_resource_id, cluster_sub
}
}
try:
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
dcr_resource_id,
DC_API,
dcr_creation_body
)
poller.result()
return dcr_resource_id
except Exception as error:
raise CLIError(error)
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ def create_dcra(cmd, cluster_region, cluster_subscription, cluster_resource_grou
from azure.cli.command_modules.acs._client_factory import get_resources_client
resources = get_resources_client(cmd.cli_ctx, cluster_subscription)
try:
resources.begin_create_or_update_by_id(
poller = resources.begin_create_or_update_by_id(
f"{cluster_resource_id}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{dcra_name}",
DC_API,
association_body
)
poller.result()
return dcra_resource_id
except Exception as error:
raise CLIError(error)
Loading