com.microsoft.azure.management.monitor.implementation.MetricDynamicAlertConditionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-monitor Show documentation
Show all versions of azure-mgmt-monitor Show documentation
This package contains Microsoft Azure Monitor SDK. This package has been deprecated. A replacement package com.azure.resourcemanager:azure-resourcemanager-monitor is available as of 31-March-2022. We strongly encourage you to upgrade to continue receiving updates. See Migration Guide https://aka.ms/java-track2-migration-guide for guidance on upgrading. Refer to our deprecation policy https://azure.github.io/azure-sdk/policies_support.html for more details.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.monitor.implementation;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.monitor.DynamicMetricCriteria;
import com.microsoft.azure.management.monitor.DynamicThresholdFailingPeriods;
import com.microsoft.azure.management.monitor.DynamicThresholdOperator;
import com.microsoft.azure.management.monitor.DynamicThresholdSensitivity;
import com.microsoft.azure.management.monitor.MetricAlert;
import com.microsoft.azure.management.monitor.MetricAlertRuleTimeAggregation;
import com.microsoft.azure.management.monitor.MetricDynamicAlertCondition;
import org.joda.time.DateTime;
import java.util.ArrayList;
@LangDefinition
class MetricDynamicAlertConditionImpl
extends MetricAlertConditionBaseImpl
implements
MetricDynamicAlertCondition,
MetricDynamicAlertCondition.DefinitionStages,
MetricDynamicAlertCondition.DefinitionStages.Blank.MetricName,
MetricDynamicAlertCondition.DefinitionStages.WithCriteriaOperator,
MetricDynamicAlertCondition.DefinitionStages.WithFailingPeriods,
MetricDynamicAlertCondition.DefinitionStages.WithConditionAttach,
MetricDynamicAlertCondition.UpdateDefinitionStages,
MetricDynamicAlertCondition.UpdateDefinitionStages.Blank.MetricName,
MetricDynamicAlertCondition.UpdateDefinitionStages.WithCriteriaOperator,
MetricDynamicAlertCondition.UpdateDefinitionStages.WithFailingPeriods,
MetricDynamicAlertCondition.UpdateDefinitionStages.WithConditionAttach,
MetricDynamicAlertCondition.UpdateStages {
MetricDynamicAlertConditionImpl(String name, DynamicMetricCriteria innerObject, MetricAlertImpl parent) {
super(name, innerObject, parent);
}
@Override
public DynamicThresholdOperator condition() {
return DynamicThresholdOperator.fromString(this.inner().operator().toString());
}
@Override
public DynamicThresholdSensitivity alertSensitivity() {
return DynamicThresholdSensitivity.fromString(this.inner().alertSensitivity().toString());
}
@Override
public DynamicThresholdFailingPeriods failingPeriods() {
return this.inner().failingPeriods();
}
@Override
public DateTime ignoreDataBefore() {
return this.inner().ignoreDataBefore();
}
@Override
public MetricAlertImpl attach() {
this.inner().withDimensions(new ArrayList<>(this.dimensions.values()));
return this.parent().withDynamicAlertCriteria(this);
}
@Override
public MetricDynamicAlertConditionImpl withCondition(MetricAlertRuleTimeAggregation timeAggregation, DynamicThresholdOperator condition, DynamicThresholdSensitivity alertSensitivity) {
this.inner().withOperator(condition);
this.inner().withTimeAggregation(timeAggregation);
this.inner().withAlertSensitivity(alertSensitivity);
return this;
}
@Override
public MetricDynamicAlertConditionImpl withFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) {
if (failingPeriods.minFailingPeriodsToAlert() > failingPeriods.numberOfEvaluationPeriods()) {
throw new IllegalArgumentException("The number of evaluation periods should be greater than or equal to the number of failing periods");
}
this.inner().withFailingPeriods(failingPeriods);
return this;
}
@Override
public MetricDynamicAlertConditionImpl withIgnoreDataBefore(DateTime date) {
this.inner().withIgnoreDataBefore(date);
return this;
}
@Override
public MetricDynamicAlertConditionImpl withoutIgnoreDataBefore() {
this.inner().withIgnoreDataBefore(null);
return this;
}
}