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

com.azure.resourcemanager.recoveryservices.models.SecuritySettings 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.recoveryservices.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;

/**
 * Security Settings of the vault.
 */
@Fluent
public final class SecuritySettings implements JsonSerializable {
    /*
     * Immutability Settings of a vault
     */
    private ImmutabilitySettings immutabilitySettings;

    /*
     * Soft delete Settings of a vault
     */
    private SoftDeleteSettings softDeleteSettings;

    /*
     * MUA Settings of a vault
     */
    private MultiUserAuthorization multiUserAuthorization;

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

    /**
     * Get the immutabilitySettings property: Immutability Settings of a vault.
     * 
     * @return the immutabilitySettings value.
     */
    public ImmutabilitySettings immutabilitySettings() {
        return this.immutabilitySettings;
    }

    /**
     * Set the immutabilitySettings property: Immutability Settings of a vault.
     * 
     * @param immutabilitySettings the immutabilitySettings value to set.
     * @return the SecuritySettings object itself.
     */
    public SecuritySettings withImmutabilitySettings(ImmutabilitySettings immutabilitySettings) {
        this.immutabilitySettings = immutabilitySettings;
        return this;
    }

    /**
     * Get the softDeleteSettings property: Soft delete Settings of a vault.
     * 
     * @return the softDeleteSettings value.
     */
    public SoftDeleteSettings softDeleteSettings() {
        return this.softDeleteSettings;
    }

    /**
     * Set the softDeleteSettings property: Soft delete Settings of a vault.
     * 
     * @param softDeleteSettings the softDeleteSettings value to set.
     * @return the SecuritySettings object itself.
     */
    public SecuritySettings withSoftDeleteSettings(SoftDeleteSettings softDeleteSettings) {
        this.softDeleteSettings = softDeleteSettings;
        return this;
    }

    /**
     * Get the multiUserAuthorization property: MUA Settings of a vault.
     * 
     * @return the multiUserAuthorization value.
     */
    public MultiUserAuthorization multiUserAuthorization() {
        return this.multiUserAuthorization;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("immutabilitySettings", this.immutabilitySettings);
        jsonWriter.writeJsonField("softDeleteSettings", this.softDeleteSettings);
        return jsonWriter.writeEndObject();
    }

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

                if ("immutabilitySettings".equals(fieldName)) {
                    deserializedSecuritySettings.immutabilitySettings = ImmutabilitySettings.fromJson(reader);
                } else if ("softDeleteSettings".equals(fieldName)) {
                    deserializedSecuritySettings.softDeleteSettings = SoftDeleteSettings.fromJson(reader);
                } else if ("multiUserAuthorization".equals(fieldName)) {
                    deserializedSecuritySettings.multiUserAuthorization
                        = MultiUserAuthorization.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecuritySettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy