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

com.azure.resourcemanager.dataprotection.models.DppIdentityDetails Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2024-04.

The 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.dataprotection.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.Map;

/**
 * DppIdentityDetails
 * 
 * Identity details.
 */
@Fluent
public final class DppIdentityDetails implements JsonSerializable {
    /*
     * The object ID of the service principal object for the managed identity that is used to grant role-based access to
     * an Azure resource.
     */
    private String principalId;

    /*
     * A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member.
     */
    private String tenantId;

    /*
     * The identityType which can be either SystemAssigned, UserAssigned, 'SystemAssigned,UserAssigned' or None
     */
    private String type;

    /*
     * Gets or sets the user assigned identities.
     */
    private Map userAssignedIdentities;

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

    /**
     * Get the principalId property: The object ID of the service principal object for the managed identity that is used
     * to grant role-based access to an Azure resource.
     * 
     * @return the principalId value.
     */
    public String principalId() {
        return this.principalId;
    }

    /**
     * Get the tenantId property: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the
     * resource is now a member.
     * 
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Get the type property: The identityType which can be either SystemAssigned, UserAssigned,
     * 'SystemAssigned,UserAssigned' or None.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: The identityType which can be either SystemAssigned, UserAssigned,
     * 'SystemAssigned,UserAssigned' or None.
     * 
     * @param type the type value to set.
     * @return the DppIdentityDetails object itself.
     */
    public DppIdentityDetails withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the userAssignedIdentities property: Gets or sets the user assigned identities.
     * 
     * @return the userAssignedIdentities value.
     */
    public Map userAssignedIdentities() {
        return this.userAssignedIdentities;
    }

    /**
     * Set the userAssignedIdentities property: Gets or sets the user assigned identities.
     * 
     * @param userAssignedIdentities the userAssignedIdentities value to set.
     * @return the DppIdentityDetails object itself.
     */
    public DppIdentityDetails withUserAssignedIdentities(Map userAssignedIdentities) {
        this.userAssignedIdentities = userAssignedIdentities;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (userAssignedIdentities() != null) {
            userAssignedIdentities().values().forEach(e -> {
                if (e != null) {
                    e.validate();
                }
            });
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("principalId".equals(fieldName)) {
                    deserializedDppIdentityDetails.principalId = reader.getString();
                } else if ("tenantId".equals(fieldName)) {
                    deserializedDppIdentityDetails.tenantId = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedDppIdentityDetails.type = reader.getString();
                } else if ("userAssignedIdentities".equals(fieldName)) {
                    Map userAssignedIdentities
                        = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1));
                    deserializedDppIdentityDetails.userAssignedIdentities = userAssignedIdentities;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDppIdentityDetails;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy