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

com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayValuesCondition 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-2022-09.

The 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 AutomationRulePropertyArrayValuesCondition model.
 */
@Fluent
public final class AutomationRulePropertyArrayValuesCondition
    implements JsonSerializable {
    /*
     * The arrayType property.
     */
    private AutomationRulePropertyArrayConditionSupportedArrayType arrayType;

    /*
     * The arrayConditionType property.
     */
    private AutomationRulePropertyArrayConditionSupportedArrayConditionType arrayConditionType;

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

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

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

    /**
     * Set the arrayType property: The arrayType property.
     * 
     * @param arrayType the arrayType value to set.
     * @return the AutomationRulePropertyArrayValuesCondition object itself.
     */
    public AutomationRulePropertyArrayValuesCondition
        withArrayType(AutomationRulePropertyArrayConditionSupportedArrayType arrayType) {
        this.arrayType = arrayType;
        return this;
    }

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

    /**
     * Set the arrayConditionType property: The arrayConditionType property.
     * 
     * @param arrayConditionType the arrayConditionType value to set.
     * @return the AutomationRulePropertyArrayValuesCondition object itself.
     */
    public AutomationRulePropertyArrayValuesCondition
        withArrayConditionType(AutomationRulePropertyArrayConditionSupportedArrayConditionType arrayConditionType) {
        this.arrayConditionType = arrayConditionType;
        return this;
    }

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

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

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

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

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

                if ("arrayType".equals(fieldName)) {
                    deserializedAutomationRulePropertyArrayValuesCondition.arrayType
                        = AutomationRulePropertyArrayConditionSupportedArrayType.fromString(reader.getString());
                } else if ("arrayConditionType".equals(fieldName)) {
                    deserializedAutomationRulePropertyArrayValuesCondition.arrayConditionType
                        = AutomationRulePropertyArrayConditionSupportedArrayConditionType
                            .fromString(reader.getString());
                } else if ("itemConditions".equals(fieldName)) {
                    List itemConditions
                        = reader.readArray(reader1 -> AutomationRuleCondition.fromJson(reader1));
                    deserializedAutomationRulePropertyArrayValuesCondition.itemConditions = itemConditions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAutomationRulePropertyArrayValuesCondition;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy