com.azure.resourcemanager.security.models.AutomationRuleSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// 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.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set
* will be evaluated as 'true', will the event trigger the defined actions.
*/
@Fluent
public final class AutomationRuleSet implements JsonSerializable {
/*
* The rules property.
*/
private List rules;
/**
* Creates an instance of AutomationRuleSet class.
*/
public AutomationRuleSet() {
}
/**
* Get the rules property: The rules property.
*
* @return the rules value.
*/
public List rules() {
return this.rules;
}
/**
* Set the rules property: The rules property.
*
* @param rules the rules value to set.
* @return the AutomationRuleSet object itself.
*/
public AutomationRuleSet withRules(List rules) {
this.rules = rules;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (rules() != null) {
rules().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("rules", this.rules, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutomationRuleSet from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutomationRuleSet if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the AutomationRuleSet.
*/
public static AutomationRuleSet fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutomationRuleSet deserializedAutomationRuleSet = new AutomationRuleSet();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("rules".equals(fieldName)) {
List rules
= reader.readArray(reader1 -> AutomationTriggeringRule.fromJson(reader1));
deserializedAutomationRuleSet.rules = rules;
} else {
reader.skipChildren();
}
}
return deserializedAutomationRuleSet;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy