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

com.azure.resourcemanager.monitor.fluent.models.ActionGroupResourceInner Maven / Gradle / Ivy

// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.monitor.models.ArmRoleReceiver;
import com.azure.resourcemanager.monitor.models.AutomationRunbookReceiver;
import com.azure.resourcemanager.monitor.models.AzureAppPushReceiver;
import com.azure.resourcemanager.monitor.models.AzureFunctionReceiver;
import com.azure.resourcemanager.monitor.models.EmailReceiver;
import com.azure.resourcemanager.monitor.models.EventHubReceiver;
import com.azure.resourcemanager.monitor.models.ItsmReceiver;
import com.azure.resourcemanager.monitor.models.LogicAppReceiver;
import com.azure.resourcemanager.monitor.models.SmsReceiver;
import com.azure.resourcemanager.monitor.models.VoiceReceiver;
import com.azure.resourcemanager.monitor.models.WebhookReceiver;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * An action group resource.
 */
@Fluent
public final class ActionGroupResourceInner extends Resource {
    /*
     * The action groups properties of the resource.
     */
    private ActionGroup innerProperties;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * The type of the resource.
     */
    private String type;

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

    /**
     * Get the innerProperties property: The action groups properties of the resource.
     * 
     * @return the innerProperties value.
     */
    private ActionGroup innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ActionGroupResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ActionGroupResourceInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the groupShortName property: The short name of the action group. This will be used in SMS messages.
     * 
     * @return the groupShortName value.
     */
    public String groupShortName() {
        return this.innerProperties() == null ? null : this.innerProperties().groupShortName();
    }

    /**
     * Set the groupShortName property: The short name of the action group. This will be used in SMS messages.
     * 
     * @param groupShortName the groupShortName value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withGroupShortName(String groupShortName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withGroupShortName(groupShortName);
        return this;
    }

    /**
     * Get the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then
     * none of its receivers will receive communications.
     * 
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.innerProperties() == null ? null : this.innerProperties().enabled();
    }

    /**
     * Set the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then
     * none of its receivers will receive communications.
     * 
     * @param enabled the enabled value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withEnabled(Boolean enabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withEnabled(enabled);
        return this;
    }

    /**
     * Get the emailReceivers property: The list of email receivers that are part of this action group.
     * 
     * @return the emailReceivers value.
     */
    public List emailReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().emailReceivers();
    }

    /**
     * Set the emailReceivers property: The list of email receivers that are part of this action group.
     * 
     * @param emailReceivers the emailReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withEmailReceivers(List emailReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withEmailReceivers(emailReceivers);
        return this;
    }

    /**
     * Get the smsReceivers property: The list of SMS receivers that are part of this action group.
     * 
     * @return the smsReceivers value.
     */
    public List smsReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().smsReceivers();
    }

    /**
     * Set the smsReceivers property: The list of SMS receivers that are part of this action group.
     * 
     * @param smsReceivers the smsReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withSmsReceivers(List smsReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withSmsReceivers(smsReceivers);
        return this;
    }

    /**
     * Get the webhookReceivers property: The list of webhook receivers that are part of this action group.
     * 
     * @return the webhookReceivers value.
     */
    public List webhookReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().webhookReceivers();
    }

    /**
     * Set the webhookReceivers property: The list of webhook receivers that are part of this action group.
     * 
     * @param webhookReceivers the webhookReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withWebhookReceivers(webhookReceivers);
        return this;
    }

    /**
     * Get the itsmReceivers property: The list of ITSM receivers that are part of this action group.
     * 
     * @return the itsmReceivers value.
     */
    public List itsmReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().itsmReceivers();
    }

    /**
     * Set the itsmReceivers property: The list of ITSM receivers that are part of this action group.
     * 
     * @param itsmReceivers the itsmReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withItsmReceivers(itsmReceivers);
        return this;
    }

    /**
     * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group.
     * 
     * @return the azureAppPushReceivers value.
     */
    public List azureAppPushReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().azureAppPushReceivers();
    }

    /**
     * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group.
     * 
     * @param azureAppPushReceivers the azureAppPushReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withAzureAppPushReceivers(azureAppPushReceivers);
        return this;
    }

    /**
     * Get the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action
     * group.
     * 
     * @return the automationRunbookReceivers value.
     */
    public List automationRunbookReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().automationRunbookReceivers();
    }

    /**
     * Set the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action
     * group.
     * 
     * @param automationRunbookReceivers the automationRunbookReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner
        withAutomationRunbookReceivers(List automationRunbookReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withAutomationRunbookReceivers(automationRunbookReceivers);
        return this;
    }

    /**
     * Get the voiceReceivers property: The list of voice receivers that are part of this action group.
     * 
     * @return the voiceReceivers value.
     */
    public List voiceReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().voiceReceivers();
    }

    /**
     * Set the voiceReceivers property: The list of voice receivers that are part of this action group.
     * 
     * @param voiceReceivers the voiceReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withVoiceReceivers(voiceReceivers);
        return this;
    }

    /**
     * Get the logicAppReceivers property: The list of logic app receivers that are part of this action group.
     * 
     * @return the logicAppReceivers value.
     */
    public List logicAppReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().logicAppReceivers();
    }

    /**
     * Set the logicAppReceivers property: The list of logic app receivers that are part of this action group.
     * 
     * @param logicAppReceivers the logicAppReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withLogicAppReceivers(logicAppReceivers);
        return this;
    }

    /**
     * Get the azureFunctionReceivers property: The list of azure function receivers that are part of this action group.
     * 
     * @return the azureFunctionReceivers value.
     */
    public List azureFunctionReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().azureFunctionReceivers();
    }

    /**
     * Set the azureFunctionReceivers property: The list of azure function receivers that are part of this action group.
     * 
     * @param azureFunctionReceivers the azureFunctionReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withAzureFunctionReceivers(azureFunctionReceivers);
        return this;
    }

    /**
     * Get the armRoleReceivers property: The list of ARM role receivers that are part of this action group. Roles are
     * Azure RBAC roles and only built-in roles are supported.
     * 
     * @return the armRoleReceivers value.
     */
    public List armRoleReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().armRoleReceivers();
    }

    /**
     * Set the armRoleReceivers property: The list of ARM role receivers that are part of this action group. Roles are
     * Azure RBAC roles and only built-in roles are supported.
     * 
     * @param armRoleReceivers the armRoleReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withArmRoleReceivers(armRoleReceivers);
        return this;
    }

    /**
     * Get the eventHubReceivers property: The list of event hub receivers that are part of this action group.
     * 
     * @return the eventHubReceivers value.
     */
    public List eventHubReceivers() {
        return this.innerProperties() == null ? null : this.innerProperties().eventHubReceivers();
    }

    /**
     * Set the eventHubReceivers property: The list of event hub receivers that are part of this action group.
     * 
     * @param eventHubReceivers the eventHubReceivers value to set.
     * @return the ActionGroupResourceInner object itself.
     */
    public ActionGroupResourceInner withEventHubReceivers(List eventHubReceivers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActionGroup();
        }
        this.innerProperties().withEventHubReceivers(eventHubReceivers);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedActionGroupResourceInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedActionGroupResourceInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedActionGroupResourceInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedActionGroupResourceInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedActionGroupResourceInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedActionGroupResourceInner.innerProperties = ActionGroup.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedActionGroupResourceInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy