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

com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole 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.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;

/**
 * Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles on
 * the subscription.
 */
@Fluent
public final class SecurityContactPropertiesNotificationsByRole
    implements JsonSerializable {
    /*
     * Defines whether to send email notifications from AMicrosoft Defender for Cloud to persons with specific RBAC
     * roles on the subscription.
     */
    private State state;

    /*
     * Defines which RBAC roles will get email notifications from Microsoft Defender for Cloud. List of allowed RBAC
     * roles:
     */
    private List roles;

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

    /**
     * Get the state property: Defines whether to send email notifications from AMicrosoft Defender for Cloud to persons
     * with specific RBAC roles on the subscription.
     * 
     * @return the state value.
     */
    public State state() {
        return this.state;
    }

    /**
     * Set the state property: Defines whether to send email notifications from AMicrosoft Defender for Cloud to persons
     * with specific RBAC roles on the subscription.
     * 
     * @param state the state value to set.
     * @return the SecurityContactPropertiesNotificationsByRole object itself.
     */
    public SecurityContactPropertiesNotificationsByRole withState(State state) {
        this.state = state;
        return this;
    }

    /**
     * Get the roles property: Defines which RBAC roles will get email notifications from Microsoft Defender for Cloud.
     * List of allowed RBAC roles:.
     * 
     * @return the roles value.
     */
    public List roles() {
        return this.roles;
    }

    /**
     * Set the roles property: Defines which RBAC roles will get email notifications from Microsoft Defender for Cloud.
     * List of allowed RBAC roles:.
     * 
     * @param roles the roles value to set.
     * @return the SecurityContactPropertiesNotificationsByRole object itself.
     */
    public SecurityContactPropertiesNotificationsByRole withRoles(List roles) {
        this.roles = roles;
        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.writeStringField("state", this.state == null ? null : this.state.toString());
        jsonWriter.writeArrayField("roles", this.roles,
            (writer, element) -> writer.writeString(element == null ? null : element.toString()));
        return jsonWriter.writeEndObject();
    }

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

                if ("state".equals(fieldName)) {
                    deserializedSecurityContactPropertiesNotificationsByRole.state
                        = State.fromString(reader.getString());
                } else if ("roles".equals(fieldName)) {
                    List roles
                        = reader.readArray(reader1 -> SecurityContactRole.fromString(reader1.getString()));
                    deserializedSecurityContactPropertiesNotificationsByRole.roles = roles;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecurityContactPropertiesNotificationsByRole;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy