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 monitor/resource-manager] Add Multi Resource Alert changes for Metric Alert API #2432

Merged
merged 2 commits into from
Oct 4, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type")
@JsonTypeName("Action")
@JsonSubTypes({
@JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class)
@JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class),
@JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction", value = LogToMetricAction.class)
})
public class Action {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* 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.
*/

package com.microsoft.azure.management.monitor;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Specifies the criteria for converting log to metric.
*/
public class Criteria {
/**
* Name of the metric.
*/
@JsonProperty(value = "metricName", required = true)
private String metricName;

/**
* List of Dimensions for creating metric.
*/
@JsonProperty(value = "dimensions")
private List<Dimension> dimensions;

/**
* Get name of the metric.
*
* @return the metricName value
*/
public String metricName() {
return this.metricName;
}

/**
* Set name of the metric.
*
* @param metricName the metricName value to set
* @return the Criteria object itself.
*/
public Criteria withMetricName(String metricName) {
this.metricName = metricName;
return this;
}

/**
* Get list of Dimensions for creating metric.
*
* @return the dimensions value
*/
public List<Dimension> dimensions() {
return this.dimensions;
}

/**
* Set list of Dimensions for creating metric.
*
* @param dimensions the dimensions value to set
* @return the Criteria object itself.
*/
public Criteria withDimensions(List<Dimension> dimensions) {
this.dimensions = dimensions;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/**
* 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.
*/

package com.microsoft.azure.management.monitor;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Specifies the criteria for converting log to metric.
*/
public class Dimension {
/**
* Name of the dimension.
*/
@JsonProperty(value = "name", required = true)
private String name;

/**
* Operator for dimension values.
*/
@JsonProperty(value = "operator", required = true)
private String operator;

/**
* List of dimension values.
*/
@JsonProperty(value = "values", required = true)
private List<String> values;

/**
* Creates an instance of Dimension class.
* @param name name of the dimension.
* @param values list of dimension values.
*/
public Dimension() {
operator = "Include";
}

/**
* Get name of the dimension.
*
* @return the name value
*/
public String name() {
return this.name;
}

/**
* Set name of the dimension.
*
* @param name the name value to set
* @return the Dimension object itself.
*/
public Dimension withName(String name) {
this.name = name;
return this;
}

/**
* Get operator for dimension values.
*
* @return the operator value
*/
public String operator() {
return this.operator;
}

/**
* Set operator for dimension values.
*
* @param operator the operator value to set
* @return the Dimension object itself.
*/
public Dimension withOperator(String operator) {
this.operator = operator;
return this;
}

/**
* Get list of dimension values.
*
* @return the values value
*/
public List<String> values() {
return this.values;
}

/**
* Set list of dimension values.
*
* @param values the values value to set
* @return the Dimension object itself.
*/
public Dimension withValues(List<String> values) {
this.values = values;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* 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.
*/

package com.microsoft.azure.management.monitor;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
* Specifiy action need to be taken when rule type is converting log to metric.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type")
@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction")
public class LogToMetricAction extends Action {
/**
* Severity of the alert.
*/
@JsonProperty(value = "criteria", required = true)
private Criteria criteria;

/**
* Get severity of the alert.
*
* @return the criteria value
*/
public Criteria criteria() {
return this.criteria;
}

/**
* Set severity of the alert.
*
* @param criteria the criteria value to set
* @return the LogToMetricAction object itself.
*/
public LogToMetricAction withCriteria(Criteria criteria) {
this.criteria = criteria;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type")
@JsonTypeName("MetricAlertCriteria")
@JsonSubTypes({
@JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", value = MetricAlertSingleResourceMultipleMetricCriteria.class)
@JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", value = MetricAlertSingleResourceMultipleMetricCriteria.class),
@JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", value = MetricAlertMultipleResourceMultipleMetricCriteria.class)
})
public class MetricAlertCriteria {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* 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.
*/

package com.microsoft.azure.management.monitor;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
* Speficies the metric alert criteria for multiple resource that has multiple
* metric criteria.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type")
@JsonTypeName("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
public class MetricAlertMultipleResourceMultipleMetricCriteria extends MetricAlertCriteria {
/**
* the list of multiple metric criteria for this 'all of' operation.
*/
@JsonProperty(value = "allOf")
private List<MultiMetricCriteria> allOf;

/**
* Get the list of multiple metric criteria for this 'all of' operation.
*
* @return the allOf value
*/
public List<MultiMetricCriteria> allOf() {
return this.allOf;
}

/**
* Set the list of multiple metric criteria for this 'all of' operation.
*
* @param allOf the allOf value to set
* @return the MetricAlertMultipleResourceMultipleMetricCriteria object itself.
*/
public MetricAlertMultipleResourceMultipleMetricCriteria withAllOf(List<MultiMetricCriteria> allOf) {
this.allOf = allOf;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ public class MetricAlertResourcePatch {
@JsonProperty(value = "properties.windowSize", required = true)
private Period windowSize;

/**
* the resource type of the target resource(s) on which the alert is
* created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*/
@JsonProperty(value = "properties.targetResourceType")
private String targetResourceType;

/**
* the region of the target resource(s) on which the alert is
* created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*/
@JsonProperty(value = "properties.targetResourceRegion")
private String targetResourceRegion;

/**
* defines the specific alert criteria information.
*/
Expand Down Expand Up @@ -231,6 +245,46 @@ public MetricAlertResourcePatch withWindowSize(Period windowSize) {
return this;
}

/**
* Get the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*
* @return the targetResourceType value
*/
public String targetResourceType() {
return this.targetResourceType;
}

/**
* Set the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*
* @param targetResourceType the targetResourceType value to set
* @return the MetricAlertResourcePatch object itself.
*/
public MetricAlertResourcePatch withTargetResourceType(String targetResourceType) {
this.targetResourceType = targetResourceType;
return this;
}

/**
* Get the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*
* @return the targetResourceRegion value
*/
public String targetResourceRegion() {
return this.targetResourceRegion;
}

/**
* Set the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
*
* @param targetResourceRegion the targetResourceRegion value to set
* @return the MetricAlertResourcePatch object itself.
*/
public MetricAlertResourcePatch withTargetResourceRegion(String targetResourceRegion) {
this.targetResourceRegion = targetResourceRegion;
return this;
}

/**
* Get defines the specific alert criteria information.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
* Criterion to filter metrics.
*/
public class MetricCriteria {
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType")
@JsonTypeName("StaticThresholdCriterion")
public class MetricCriteria extends MultiMetricCriteria {
/**
* Name of the criteria.
*/
Expand Down
Loading