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

com.azure.resourcemanager.monitor.models.Actions Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Monitor SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.46.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.monitor.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;
import java.util.Map;

/**
 * Actions to invoke when the alert fires.
 */
@Fluent
public final class Actions implements JsonSerializable {
    /*
     * Action Group resource Ids to invoke when the alert fires.
     */
    private List actionGroups;

    /*
     * The properties of an alert payload.
     */
    private Map customProperties;

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

    /**
     * Get the actionGroups property: Action Group resource Ids to invoke when the alert fires.
     * 
     * @return the actionGroups value.
     */
    public List actionGroups() {
        return this.actionGroups;
    }

    /**
     * Set the actionGroups property: Action Group resource Ids to invoke when the alert fires.
     * 
     * @param actionGroups the actionGroups value to set.
     * @return the Actions object itself.
     */
    public Actions withActionGroups(List actionGroups) {
        this.actionGroups = actionGroups;
        return this;
    }

    /**
     * Get the customProperties property: The properties of an alert payload.
     * 
     * @return the customProperties value.
     */
    public Map customProperties() {
        return this.customProperties;
    }

    /**
     * Set the customProperties property: The properties of an alert payload.
     * 
     * @param customProperties the customProperties value to set.
     * @return the Actions object itself.
     */
    public Actions withCustomProperties(Map customProperties) {
        this.customProperties = customProperties;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

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

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

                if ("actionGroups".equals(fieldName)) {
                    List actionGroups = reader.readArray(reader1 -> reader1.getString());
                    deserializedActions.actionGroups = actionGroups;
                } else if ("customProperties".equals(fieldName)) {
                    Map customProperties = reader.readMap(reader1 -> reader1.getString());
                    deserializedActions.customProperties = customProperties;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedActions;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy