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

com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentRequestProperties 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.security.fluent.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 properties of custom entity store assignment request.
 */
@Fluent
public final class CustomEntityStoreAssignmentRequestProperties
    implements JsonSerializable {
    /*
     * The principal assigned with entity store. If not provided, will use caller principal. Format of principal is:
     * [AAD type]=[PrincipalObjectId];[TenantId]
     */
    private String principal;

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

    /**
     * Get the principal property: The principal assigned with entity store. If not provided, will use caller principal.
     * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId].
     * 
     * @return the principal value.
     */
    public String principal() {
        return this.principal;
    }

    /**
     * Set the principal property: The principal assigned with entity store. If not provided, will use caller principal.
     * Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId].
     * 
     * @param principal the principal value to set.
     * @return the CustomEntityStoreAssignmentRequestProperties object itself.
     */
    public CustomEntityStoreAssignmentRequestProperties withPrincipal(String principal) {
        this.principal = principal;
        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("principal", this.principal);
        return jsonWriter.writeEndObject();
    }

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

                if ("principal".equals(fieldName)) {
                    deserializedCustomEntityStoreAssignmentRequestProperties.principal = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCustomEntityStoreAssignmentRequestProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy