![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.fluent.models.AutomationRuleProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2021-09.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.securityinsights.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction;
import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic;
import com.azure.resourcemanager.securityinsights.models.ClientInfo;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
/**
* Automation rule properties.
*/
@Fluent
public final class AutomationRuleProperties implements JsonSerializable {
/*
* The display name of the automation rule.
*/
private String displayName;
/*
* The order of execution of the automation rule.
*/
private int order;
/*
* Describes automation rule triggering logic.
*/
private AutomationRuleTriggeringLogic triggeringLogic;
/*
* The actions to execute when the automation rule is triggered.
*/
private List actions;
/*
* The last time the automation rule was updated.
*/
private OffsetDateTime lastModifiedTimeUtc;
/*
* The time the automation rule was created.
*/
private OffsetDateTime createdTimeUtc;
/*
* Information on the client (user or application) that made some action
*/
private ClientInfo lastModifiedBy;
/*
* Information on the client (user or application) that made some action
*/
private ClientInfo createdBy;
/**
* Creates an instance of AutomationRuleProperties class.
*/
public AutomationRuleProperties() {
}
/**
* Get the displayName property: The display name of the automation rule.
*
* @return the displayName value.
*/
public String displayName() {
return this.displayName;
}
/**
* Set the displayName property: The display name of the automation rule.
*
* @param displayName the displayName value to set.
* @return the AutomationRuleProperties object itself.
*/
public AutomationRuleProperties withDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get the order property: The order of execution of the automation rule.
*
* @return the order value.
*/
public int order() {
return this.order;
}
/**
* Set the order property: The order of execution of the automation rule.
*
* @param order the order value to set.
* @return the AutomationRuleProperties object itself.
*/
public AutomationRuleProperties withOrder(int order) {
this.order = order;
return this;
}
/**
* Get the triggeringLogic property: Describes automation rule triggering logic.
*
* @return the triggeringLogic value.
*/
public AutomationRuleTriggeringLogic triggeringLogic() {
return this.triggeringLogic;
}
/**
* Set the triggeringLogic property: Describes automation rule triggering logic.
*
* @param triggeringLogic the triggeringLogic value to set.
* @return the AutomationRuleProperties object itself.
*/
public AutomationRuleProperties withTriggeringLogic(AutomationRuleTriggeringLogic triggeringLogic) {
this.triggeringLogic = triggeringLogic;
return this;
}
/**
* Get the actions property: The actions to execute when the automation rule is triggered.
*
* @return the actions value.
*/
public List actions() {
return this.actions;
}
/**
* Set the actions property: The actions to execute when the automation rule is triggered.
*
* @param actions the actions value to set.
* @return the AutomationRuleProperties object itself.
*/
public AutomationRuleProperties withActions(List actions) {
this.actions = actions;
return this;
}
/**
* Get the lastModifiedTimeUtc property: The last time the automation rule was updated.
*
* @return the lastModifiedTimeUtc value.
*/
public OffsetDateTime lastModifiedTimeUtc() {
return this.lastModifiedTimeUtc;
}
/**
* Get the createdTimeUtc property: The time the automation rule was created.
*
* @return the createdTimeUtc value.
*/
public OffsetDateTime createdTimeUtc() {
return this.createdTimeUtc;
}
/**
* Get the lastModifiedBy property: Information on the client (user or application) that made some action.
*
* @return the lastModifiedBy value.
*/
public ClientInfo lastModifiedBy() {
return this.lastModifiedBy;
}
/**
* Get the createdBy property: Information on the client (user or application) that made some action.
*
* @return the createdBy value.
*/
public ClientInfo createdBy() {
return this.createdBy;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (displayName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property displayName in model AutomationRuleProperties"));
}
if (triggeringLogic() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property triggeringLogic in model AutomationRuleProperties"));
} else {
triggeringLogic().validate();
}
if (actions() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property actions in model AutomationRuleProperties"));
} else {
actions().forEach(e -> e.validate());
}
if (lastModifiedBy() != null) {
lastModifiedBy().validate();
}
if (createdBy() != null) {
createdBy().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(AutomationRuleProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("displayName", this.displayName);
jsonWriter.writeIntField("order", this.order);
jsonWriter.writeJsonField("triggeringLogic", this.triggeringLogic);
jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutomationRuleProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutomationRuleProperties 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 AutomationRuleProperties.
*/
public static AutomationRuleProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutomationRuleProperties deserializedAutomationRuleProperties = new AutomationRuleProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("displayName".equals(fieldName)) {
deserializedAutomationRuleProperties.displayName = reader.getString();
} else if ("order".equals(fieldName)) {
deserializedAutomationRuleProperties.order = reader.getInt();
} else if ("triggeringLogic".equals(fieldName)) {
deserializedAutomationRuleProperties.triggeringLogic
= AutomationRuleTriggeringLogic.fromJson(reader);
} else if ("actions".equals(fieldName)) {
List actions
= reader.readArray(reader1 -> AutomationRuleAction.fromJson(reader1));
deserializedAutomationRuleProperties.actions = actions;
} else if ("lastModifiedTimeUtc".equals(fieldName)) {
deserializedAutomationRuleProperties.lastModifiedTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("createdTimeUtc".equals(fieldName)) {
deserializedAutomationRuleProperties.createdTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedBy".equals(fieldName)) {
deserializedAutomationRuleProperties.lastModifiedBy = ClientInfo.fromJson(reader);
} else if ("createdBy".equals(fieldName)) {
deserializedAutomationRuleProperties.createdBy = ClientInfo.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedAutomationRuleProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy