All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.securityinsights.models.AutomationRuleBooleanCondition Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.0
Show newest version
// 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.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;

/**
 * The AutomationRuleBooleanCondition model.
 */
@Fluent
public final class AutomationRuleBooleanCondition implements JsonSerializable {
    /*
     * The operator property.
     */
    private AutomationRuleBooleanConditionSupportedOperator operator;

    /*
     * The innerConditions property.
     */
    private List innerConditions;

    /**
     * Creates an instance of AutomationRuleBooleanCondition class.
     */
    public AutomationRuleBooleanCondition() {
    }

    /**
     * Get the operator property: The operator property.
     * 
     * @return the operator value.
     */
    public AutomationRuleBooleanConditionSupportedOperator operator() {
        return this.operator;
    }

    /**
     * Set the operator property: The operator property.
     * 
     * @param operator the operator value to set.
     * @return the AutomationRuleBooleanCondition object itself.
     */
    public AutomationRuleBooleanCondition withOperator(AutomationRuleBooleanConditionSupportedOperator operator) {
        this.operator = operator;
        return this;
    }

    /**
     * Get the innerConditions property: The innerConditions property.
     * 
     * @return the innerConditions value.
     */
    public List innerConditions() {
        return this.innerConditions;
    }

    /**
     * Set the innerConditions property: The innerConditions property.
     * 
     * @param innerConditions the innerConditions value to set.
     * @return the AutomationRuleBooleanCondition object itself.
     */
    public AutomationRuleBooleanCondition withInnerConditions(List innerConditions) {
        this.innerConditions = innerConditions;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerConditions() != null) {
            innerConditions().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString());
        jsonWriter.writeArrayField("innerConditions", this.innerConditions,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AutomationRuleBooleanCondition from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AutomationRuleBooleanCondition 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 AutomationRuleBooleanCondition.
     */
    public static AutomationRuleBooleanCondition fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AutomationRuleBooleanCondition deserializedAutomationRuleBooleanCondition
                = new AutomationRuleBooleanCondition();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("operator".equals(fieldName)) {
                    deserializedAutomationRuleBooleanCondition.operator
                        = AutomationRuleBooleanConditionSupportedOperator.fromString(reader.getString());
                } else if ("innerConditions".equals(fieldName)) {
                    List innerConditions
                        = reader.readArray(reader1 -> AutomationRuleCondition.fromJson(reader1));
                    deserializedAutomationRuleBooleanCondition.innerConditions = innerConditions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomationRuleBooleanCondition;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy