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

CLI refresh for dynatrace #8201

Merged
merged 1 commit into from
Oct 28, 2024
Merged
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
4 changes: 4 additions & 0 deletions src/dynatrace/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.1.0
++++++
* Add: metrics enabled flag while creating tag rule

1.0.0
++++++
* Bump up `dynatrace` API version to `2023-04-27` as per https://github.com/Azure/azure-rest-api-specs/blob/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2023-04-27/dynatrace.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class Create(AAZCommand):
"""Create a tag rule

:example: Create tag-rule
az dynatrace monitor tag-rule create -g rg --monitor-name monitor -n default --log-rules "{send-aad-logs:enabled,send-subscription-logs:enabled,send-activity-logs:enabled,filtering-tags:[{name:env,value:prod,action:include},{name:env,value:dev,action:exclude}]}" --metric-rules "{filtering-tags:[{name:env,value:prod,action:include}]}"
az dynatrace monitor tag-rule create -g rg --monitor-name monitor -n default --log-rules "{send-aad-logs:enabled,send-subscription-logs:enabled,send-activity-logs:enabled,filtering-tags:[{name:env,value:prod,action:include},{name:env,value:dev,action:exclude}]}" --metric-rules "{sending-metrics:enabled,filtering-tags:[{name:env,value:prod,action:include}]}"
"""

_aaz_info = {
"version": "2021-09-01",
"version": "2023-04-27",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/dynatrace.observability/monitors/{}/tagrules/{}", "2021-09-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/dynatrace.observability/monitors/{}/tagrules/{}", "2023-04-27"],
]
}

Expand Down Expand Up @@ -103,6 +103,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["filtering-tags"],
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.",
)
metric_rules.sending_metrics = AAZStrArg(
options=["sending-metrics"],
help="Flag specifying if metrics from Azure resources should be sent for the Monitor resource.",
enum={"Disabled": "Disabled", "Enabled": "Enabled"},
)

filtering_tags = cls._args_schema.metric_rules.filtering_tags
filtering_tags.Element = AAZObjectArg()
Expand Down Expand Up @@ -225,7 +230,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-09-01",
"api-version", "2023-04-27",
required=True,
),
}
Expand Down Expand Up @@ -271,6 +276,7 @@ def content(self):
metric_rules = _builder.get(".properties.metricRules")
if metric_rules is not None:
metric_rules.set_prop("filteringTags", AAZListType, ".filtering_tags")
metric_rules.set_prop("sendingMetrics", AAZStrType, ".sending_metrics")

filtering_tags = _builder.get(".properties.metricRules.filteringTags")
if filtering_tags is not None:
Expand Down Expand Up @@ -322,6 +328,7 @@ def _build_schema_on_200_201(cls):
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
)

log_rules = cls._schema_on_200_201.properties.log_rules
Expand All @@ -346,6 +353,9 @@ def _build_schema_on_200_201(cls):
metric_rules.filtering_tags = AAZListType(
serialized_name="filteringTags",
)
metric_rules.sending_metrics = AAZStrType(
serialized_name="sendingMetrics",
)

filtering_tags = cls._schema_on_200_201.properties.metric_rules.filtering_tags
filtering_tags.Element = AAZObjectType()
Expand Down
Loading
Loading