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

com.azure.resourcemanager.security.models.SuppressionAlertsScope Maven / Gradle / Ivy

Go to download

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.

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.security.models;

import com.azure.core.annotation.Fluent;
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 java.io.IOException;
import java.util.List;

/**
 * The SuppressionAlertsScope model.
 */
@Fluent
public final class SuppressionAlertsScope implements JsonSerializable {
    /*
     * All the conditions inside need to be true in order to suppress the alert
     */
    private List allOf;

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

    /**
     * Get the allOf property: All the conditions inside need to be true in order to suppress the alert.
     * 
     * @return the allOf value.
     */
    public List allOf() {
        return this.allOf;
    }

    /**
     * Set the allOf property: All the conditions inside need to be true in order to suppress the alert.
     * 
     * @param allOf the allOf value to set.
     * @return the SuppressionAlertsScope object itself.
     */
    public SuppressionAlertsScope withAllOf(List allOf) {
        this.allOf = allOf;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (allOf() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property allOf in model SuppressionAlertsScope"));
        } else {
            allOf().forEach(e -> e.validate());
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SuppressionAlertsScope.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("allOf", this.allOf, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("allOf".equals(fieldName)) {
                    List allOf = reader.readArray(reader1 -> ScopeElement.fromJson(reader1));
                    deserializedSuppressionAlertsScope.allOf = allOf;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSuppressionAlertsScope;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy