com.azure.resourcemanager.security.fluent.models.AutomationProperties 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.AutomationAction;
import com.azure.resourcemanager.security.models.AutomationScope;
import com.azure.resourcemanager.security.models.AutomationSource;
import java.io.IOException;
import java.util.List;
/**
* A set of properties that defines the behavior of the automation configuration. To learn more about the supported
* security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas.
*/
@Fluent
public final class AutomationProperties implements JsonSerializable {
/*
* The security automation description.
*/
private String description;
/*
* Indicates whether the security automation is enabled.
*/
private Boolean isEnabled;
/*
* A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription
* itself or a resource group under that subscription. The automation will only apply on defined scopes.
*/
private List scopes;
/*
* A collection of the source event types which evaluate the security automation set of rules.
*/
private List sources;
/*
* A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule
* set, are true.
*/
private List actions;
/**
* Creates an instance of AutomationProperties class.
*/
public AutomationProperties() {
}
/**
* Get the description property: The security automation description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: The security automation description.
*
* @param description the description value to set.
* @return the AutomationProperties object itself.
*/
public AutomationProperties withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the isEnabled property: Indicates whether the security automation is enabled.
*
* @return the isEnabled value.
*/
public Boolean isEnabled() {
return this.isEnabled;
}
/**
* Set the isEnabled property: Indicates whether the security automation is enabled.
*
* @param isEnabled the isEnabled value to set.
* @return the AutomationProperties object itself.
*/
public AutomationProperties withIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* Get the scopes property: A collection of scopes on which the security automations logic is applied. Supported
* scopes are the subscription itself or a resource group under that subscription. The automation will only apply on
* defined scopes.
*
* @return the scopes value.
*/
public List scopes() {
return this.scopes;
}
/**
* Set the scopes property: A collection of scopes on which the security automations logic is applied. Supported
* scopes are the subscription itself or a resource group under that subscription. The automation will only apply on
* defined scopes.
*
* @param scopes the scopes value to set.
* @return the AutomationProperties object itself.
*/
public AutomationProperties withScopes(List scopes) {
this.scopes = scopes;
return this;
}
/**
* Get the sources property: A collection of the source event types which evaluate the security automation set of
* rules.
*
* @return the sources value.
*/
public List sources() {
return this.sources;
}
/**
* Set the sources property: A collection of the source event types which evaluate the security automation set of
* rules.
*
* @param sources the sources value to set.
* @return the AutomationProperties object itself.
*/
public AutomationProperties withSources(List sources) {
this.sources = sources;
return this;
}
/**
* Get the actions property: A collection of the actions which are triggered if all the configured rules
* evaluations, within at least one rule set, are true.
*
* @return the actions value.
*/
public List actions() {
return this.actions;
}
/**
* Set the actions property: A collection of the actions which are triggered if all the configured rules
* evaluations, within at least one rule set, are true.
*
* @param actions the actions value to set.
* @return the AutomationProperties object itself.
*/
public AutomationProperties withActions(List actions) {
this.actions = actions;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (scopes() != null) {
scopes().forEach(e -> e.validate());
}
if (sources() != null) {
sources().forEach(e -> e.validate());
}
if (actions() != null) {
actions().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
jsonWriter.writeArrayField("scopes", this.scopes, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("sources", this.sources, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutomationProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutomationProperties 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 AutomationProperties.
*/
public static AutomationProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutomationProperties deserializedAutomationProperties = new AutomationProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("description".equals(fieldName)) {
deserializedAutomationProperties.description = reader.getString();
} else if ("isEnabled".equals(fieldName)) {
deserializedAutomationProperties.isEnabled = reader.getNullable(JsonReader::getBoolean);
} else if ("scopes".equals(fieldName)) {
List scopes = reader.readArray(reader1 -> AutomationScope.fromJson(reader1));
deserializedAutomationProperties.scopes = scopes;
} else if ("sources".equals(fieldName)) {
List sources = reader.readArray(reader1 -> AutomationSource.fromJson(reader1));
deserializedAutomationProperties.sources = sources;
} else if ("actions".equals(fieldName)) {
List actions = reader.readArray(reader1 -> AutomationAction.fromJson(reader1));
deserializedAutomationProperties.actions = actions;
} else {
reader.skipChildren();
}
}
return deserializedAutomationProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy