com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.security.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.RuleState;
import com.azure.resourcemanager.security.models.SuppressionAlertsScope;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* Describes the suppression rule.
*/
@Fluent
public final class AlertsSuppressionRuleInner extends ProxyResource {
/*
* describes AlertsSuppressionRule properties
*/
private AlertsSuppressionRuleProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of AlertsSuppressionRuleInner class.
*/
public AlertsSuppressionRuleInner() {
}
/**
* Get the innerProperties property: describes AlertsSuppressionRule properties.
*
* @return the innerProperties value.
*/
private AlertsSuppressionRuleProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'.
*
* @return the alertType value.
*/
public String alertType() {
return this.innerProperties() == null ? null : this.innerProperties().alertType();
}
/**
* Set the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'.
*
* @param alertType the alertType value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withAlertType(String alertType) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withAlertType(alertType);
return this;
}
/**
* Get the lastModifiedUtc property: The last time this rule was modified.
*
* @return the lastModifiedUtc value.
*/
public OffsetDateTime lastModifiedUtc() {
return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc();
}
/**
* Get the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null
* there will no expiration at all.
*
* @return the expirationDateUtc value.
*/
public OffsetDateTime expirationDateUtc() {
return this.innerProperties() == null ? null : this.innerProperties().expirationDateUtc();
}
/**
* Set the expirationDateUtc property: Expiration date of the rule, if value is not provided or provided as null
* there will no expiration at all.
*
* @param expirationDateUtc the expirationDateUtc value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withExpirationDateUtc(OffsetDateTime expirationDateUtc) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withExpirationDateUtc(expirationDateUtc);
return this;
}
/**
* Get the reason property: The reason for dismissing the alert.
*
* @return the reason value.
*/
public String reason() {
return this.innerProperties() == null ? null : this.innerProperties().reason();
}
/**
* Set the reason property: The reason for dismissing the alert.
*
* @param reason the reason value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withReason(String reason) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withReason(reason);
return this;
}
/**
* Get the state property: Possible states of the rule.
*
* @return the state value.
*/
public RuleState state() {
return this.innerProperties() == null ? null : this.innerProperties().state();
}
/**
* Set the state property: Possible states of the rule.
*
* @param state the state value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withState(RuleState state) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withState(state);
return this;
}
/**
* Get the comment property: Any comment regarding the rule.
*
* @return the comment value.
*/
public String comment() {
return this.innerProperties() == null ? null : this.innerProperties().comment();
}
/**
* Set the comment property: Any comment regarding the rule.
*
* @param comment the comment value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withComment(String comment) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withComment(comment);
return this;
}
/**
* Get the suppressionAlertsScope property: The suppression conditions.
*
* @return the suppressionAlertsScope value.
*/
public SuppressionAlertsScope suppressionAlertsScope() {
return this.innerProperties() == null ? null : this.innerProperties().suppressionAlertsScope();
}
/**
* Set the suppressionAlertsScope property: The suppression conditions.
*
* @param suppressionAlertsScope the suppressionAlertsScope value to set.
* @return the AlertsSuppressionRuleInner object itself.
*/
public AlertsSuppressionRuleInner withSuppressionAlertsScope(SuppressionAlertsScope suppressionAlertsScope) {
if (this.innerProperties() == null) {
this.innerProperties = new AlertsSuppressionRuleProperties();
}
this.innerProperties().withSuppressionAlertsScope(suppressionAlertsScope);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AlertsSuppressionRuleInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AlertsSuppressionRuleInner if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the AlertsSuppressionRuleInner.
*/
public static AlertsSuppressionRuleInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AlertsSuppressionRuleInner deserializedAlertsSuppressionRuleInner = new AlertsSuppressionRuleInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedAlertsSuppressionRuleInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedAlertsSuppressionRuleInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedAlertsSuppressionRuleInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedAlertsSuppressionRuleInner.innerProperties
= AlertsSuppressionRuleProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedAlertsSuppressionRuleInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy