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

com.azure.resourcemanager.search.models.EncryptionWithCmk Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Cognitive Search Management SDK. For documentation on how to use this package, please see https://aka.ms/azure-sdk-java-mgmt

There is a newer version: 2.45.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.search.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;

/**
 * Describes a policy that determines how resources within the search service are to be encrypted with customer=managed
 * keys.
 */
@Fluent
public final class EncryptionWithCmk implements JsonSerializable {
    /*
     * Describes how a search service should enforce having one or more non-customer-encrypted resources.
     */
    private SearchEncryptionWithCmk enforcement;

    /*
     * Describes whether the search service is compliant or not with respect to having non-customer-encrypted resources.
     * If a service has more than one non-customer-encrypted resource and 'Enforcement' is 'enabled' then the service
     * will be marked as 'nonCompliant'.
     */
    private SearchEncryptionComplianceStatus encryptionComplianceStatus;

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

    /**
     * Get the enforcement property: Describes how a search service should enforce having one or more
     * non-customer-encrypted resources.
     * 
     * @return the enforcement value.
     */
    public SearchEncryptionWithCmk enforcement() {
        return this.enforcement;
    }

    /**
     * Set the enforcement property: Describes how a search service should enforce having one or more
     * non-customer-encrypted resources.
     * 
     * @param enforcement the enforcement value to set.
     * @return the EncryptionWithCmk object itself.
     */
    public EncryptionWithCmk withEnforcement(SearchEncryptionWithCmk enforcement) {
        this.enforcement = enforcement;
        return this;
    }

    /**
     * Get the encryptionComplianceStatus property: Describes whether the search service is compliant or not with
     * respect to having non-customer-encrypted resources. If a service has more than one non-customer-encrypted
     * resource and 'Enforcement' is 'enabled' then the service will be marked as 'nonCompliant'.
     * 
     * @return the encryptionComplianceStatus value.
     */
    public SearchEncryptionComplianceStatus encryptionComplianceStatus() {
        return this.encryptionComplianceStatus;
    }

    /**
     * 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("enforcement", this.enforcement == null ? null : this.enforcement.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("enforcement".equals(fieldName)) {
                    deserializedEncryptionWithCmk.enforcement = SearchEncryptionWithCmk.fromString(reader.getString());
                } else if ("encryptionComplianceStatus".equals(fieldName)) {
                    deserializedEncryptionWithCmk.encryptionComplianceStatus
                        = SearchEncryptionComplianceStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEncryptionWithCmk;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy