PrometheusRule Class

  • java.lang.Object
    • com.azure.resourcemanager.alertsmanagement.models.PrometheusRule

Implements

public final class PrometheusRule
implements JsonSerializable<PrometheusRule>

The PrometheusRule model.

Constructor Summary

Constructor Description
PrometheusRule()

Creates an instance of PrometheusRule class.

Method Summary

Modifier and Type Method and Description
List<PrometheusRuleGroupAction> actions()

Get the actions property: The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

String alert()

Get the alert property: the name of the alert rule.

Map<String,String> annotations()

Get the annotations property: annotations for rule group.

Boolean enabled()

Get the enabled property: the flag that indicates whether the Prometheus rule is enabled.

String expression()

Get the expression property: the expression to run for the rule.

String forProperty()

Get the forProperty property: the amount of time alert must be active before firing.

static PrometheusRule fromJson(JsonReader jsonReader)

Reads an instance of PrometheusRule from the JsonReader.

Map<String,String> labels()

Get the labels property: labels for rule group.

String record()

Get the record property: the name of the recording rule.

PrometheusRuleResolveConfiguration resolveConfiguration()

Get the resolveConfiguration property: defines the configuration for resolving fired alerts.

Integer severity()

Get the severity property: the severity of the alerts fired by the rule.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

PrometheusRule withActions(List<PrometheusRuleGroupAction> actions)

Set the actions property: The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

PrometheusRule withAlert(String alert)

Set the alert property: the name of the alert rule.

PrometheusRule withAnnotations(Map<String,String> annotations)

Set the annotations property: annotations for rule group.

PrometheusRule withEnabled(Boolean enabled)

Set the enabled property: the flag that indicates whether the Prometheus rule is enabled.

PrometheusRule withExpression(String expression)

Set the expression property: the expression to run for the rule.

PrometheusRule withForProperty(String forProperty)

Set the forProperty property: the amount of time alert must be active before firing.

PrometheusRule withLabels(Map<String,String> labels)

Set the labels property: labels for rule group.

PrometheusRule withRecord(String record)

Set the record property: the name of the recording rule.

PrometheusRule withResolveConfiguration(PrometheusRuleResolveConfiguration resolveConfiguration)

Set the resolveConfiguration property: defines the configuration for resolving fired alerts.

PrometheusRule withSeverity(Integer severity)

Set the severity property: the severity of the alerts fired by the rule.

Methods inherited from java.lang.Object

Constructor Details

PrometheusRule

public PrometheusRule()

Creates an instance of PrometheusRule class.

Method Details

actions

public List<PrometheusRuleGroupAction> actions()

Get the actions property: The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts.

Returns:

the actions value.

alert

public String alert()

Get the alert property: the name of the alert rule.

Returns:

the alert value.

annotations

public Map<String,String> annotations()

Get the annotations property: annotations for rule group. Only relevant for alerts.

Returns:

the annotations value.

enabled

public Boolean enabled()

Get the enabled property: the flag that indicates whether the Prometheus rule is enabled.

Returns:

the enabled value.

expression

public String expression()

Get the expression property: the expression to run for the rule.

Returns:

the expression value.

forProperty

public String forProperty()

Get the forProperty property: the amount of time alert must be active before firing. Only relevant for alerts.

Returns:

the forProperty value.

fromJson

public static PrometheusRule fromJson(JsonReader jsonReader)

Reads an instance of PrometheusRule from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of PrometheusRule if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

labels

public Map<String,String> labels()

Get the labels property: labels for rule group. Only relevant for alerts.

Returns:

the labels value.

record

public String record()

Get the record property: the name of the recording rule.

Returns:

the record value.

resolveConfiguration

public PrometheusRuleResolveConfiguration resolveConfiguration()

Get the resolveConfiguration property: defines the configuration for resolving fired alerts. Only relevant for alerts.

Returns:

the resolveConfiguration value.

severity

public Integer severity()

Get the severity property: the severity of the alerts fired by the rule. Only relevant for alerts.

Returns:

the severity value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withActions

public PrometheusRule withActions(List<PrometheusRuleGroupAction> actions)

Set the actions property: The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts.

Parameters:

actions - the actions value to set.

Returns:

the PrometheusRule object itself.

withAlert

public PrometheusRule withAlert(String alert)

Set the alert property: the name of the alert rule.

Parameters:

alert - the alert value to set.

Returns:

the PrometheusRule object itself.

withAnnotations

public PrometheusRule withAnnotations(Map<String,String> annotations)

Set the annotations property: annotations for rule group. Only relevant for alerts.

Parameters:

annotations - the annotations value to set.

Returns:

the PrometheusRule object itself.

withEnabled

public PrometheusRule withEnabled(Boolean enabled)

Set the enabled property: the flag that indicates whether the Prometheus rule is enabled.

Parameters:

enabled - the enabled value to set.

Returns:

the PrometheusRule object itself.

withExpression

public PrometheusRule withExpression(String expression)

Set the expression property: the expression to run for the rule.

Parameters:

expression - the expression value to set.

Returns:

the PrometheusRule object itself.

withForProperty

public PrometheusRule withForProperty(String forProperty)

Set the forProperty property: the amount of time alert must be active before firing. Only relevant for alerts.

Parameters:

forProperty - the forProperty value to set.

Returns:

the PrometheusRule object itself.

withLabels

public PrometheusRule withLabels(Map<String,String> labels)

Set the labels property: labels for rule group. Only relevant for alerts.

Parameters:

labels - the labels value to set.

Returns:

the PrometheusRule object itself.

withRecord

public PrometheusRule withRecord(String record)

Set the record property: the name of the recording rule.

Parameters:

record - the record value to set.

Returns:

the PrometheusRule object itself.

withResolveConfiguration

public PrometheusRule withResolveConfiguration(PrometheusRuleResolveConfiguration resolveConfiguration)

Set the resolveConfiguration property: defines the configuration for resolving fired alerts. Only relevant for alerts.

Parameters:

resolveConfiguration - the resolveConfiguration value to set.

Returns:

the PrometheusRule object itself.

withSeverity

public PrometheusRule withSeverity(Integer severity)

Set the severity property: the severity of the alerts fired by the rule. Only relevant for alerts.

Parameters:

severity - the severity value to set.

Returns:

the PrometheusRule object itself.

Applies to