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

com.azure.resourcemanager.azurestackhci.models.ClusterPatch Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management 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.azurestackhci.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 com.azure.resourcemanager.azurestackhci.fluent.models.ClusterPatchProperties;
import com.azure.resourcemanager.azurestackhci.fluent.models.ManagedServiceIdentity;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;

/**
 * Cluster details to update.
 */
@Fluent
public final class ClusterPatch implements JsonSerializable {
    /*
     * Resource tags.
     */
    private Map tags;

    /*
     * Identity of Cluster resource
     */
    private ManagedServiceIdentity innerIdentity;

    /*
     * Cluster properties.
     */
    private ClusterPatchProperties innerProperties;

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

    /**
     * Get the tags property: Resource tags.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     * 
     * @param tags the tags value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the innerIdentity property: Identity of Cluster resource.
     * 
     * @return the innerIdentity value.
     */
    private ManagedServiceIdentity innerIdentity() {
        return this.innerIdentity;
    }

    /**
     * Get the innerProperties property: Cluster properties.
     * 
     * @return the innerProperties value.
     */
    private ClusterPatchProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the principalId property: The service principal ID of the system assigned identity. This property will only
     * be provided for a system assigned identity.
     * 
     * @return the principalId value.
     */
    public UUID principalId() {
        return this.innerIdentity() == null ? null : this.innerIdentity().principalId();
    }

    /**
     * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for
     * a system assigned identity.
     * 
     * @return the tenantId value.
     */
    public UUID tenantId() {
        return this.innerIdentity() == null ? null : this.innerIdentity().tenantId();
    }

    /**
     * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are
     * allowed).
     * 
     * @return the type value.
     */
    public ManagedServiceIdentityType type() {
        return this.innerIdentity() == null ? null : this.innerIdentity().type();
    }

    /**
     * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are
     * allowed).
     * 
     * @param type the type value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withType(ManagedServiceIdentityType type) {
        if (this.innerIdentity() == null) {
            this.innerIdentity = new ManagedServiceIdentity();
        }
        this.innerIdentity().withType(type);
        return this;
    }

    /**
     * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The
     * userAssignedIdentities dictionary keys will be ARM resource ids in the form:
     * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     * The dictionary values can be empty objects ({}) in requests.
     * 
     * @return the userAssignedIdentities value.
     */
    public Map userAssignedIdentities() {
        return this.innerIdentity() == null ? null : this.innerIdentity().userAssignedIdentities();
    }

    /**
     * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The
     * userAssignedIdentities dictionary keys will be ARM resource ids in the form:
     * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     * The dictionary values can be empty objects ({}) in requests.
     * 
     * @param userAssignedIdentities the userAssignedIdentities value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withUserAssignedIdentities(Map userAssignedIdentities) {
        if (this.innerIdentity() == null) {
            this.innerIdentity = new ManagedServiceIdentity();
        }
        this.innerIdentity().withUserAssignedIdentities(userAssignedIdentities);
        return this;
    }

    /**
     * Get the cloudManagementEndpoint property: Endpoint configured for management from the Azure portal.
     * 
     * @return the cloudManagementEndpoint value.
     */
    public String cloudManagementEndpoint() {
        return this.innerProperties() == null ? null : this.innerProperties().cloudManagementEndpoint();
    }

    /**
     * Set the cloudManagementEndpoint property: Endpoint configured for management from the Azure portal.
     * 
     * @param cloudManagementEndpoint the cloudManagementEndpoint value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withCloudManagementEndpoint(String cloudManagementEndpoint) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterPatchProperties();
        }
        this.innerProperties().withCloudManagementEndpoint(cloudManagementEndpoint);
        return this;
    }

    /**
     * Get the aadClientId property: App id of cluster AAD identity.
     * 
     * @return the aadClientId value.
     */
    public String aadClientId() {
        return this.innerProperties() == null ? null : this.innerProperties().aadClientId();
    }

    /**
     * Set the aadClientId property: App id of cluster AAD identity.
     * 
     * @param aadClientId the aadClientId value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withAadClientId(String aadClientId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterPatchProperties();
        }
        this.innerProperties().withAadClientId(aadClientId);
        return this;
    }

    /**
     * Get the aadTenantId property: Tenant id of cluster AAD identity.
     * 
     * @return the aadTenantId value.
     */
    public String aadTenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().aadTenantId();
    }

    /**
     * Set the aadTenantId property: Tenant id of cluster AAD identity.
     * 
     * @param aadTenantId the aadTenantId value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withAadTenantId(String aadTenantId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterPatchProperties();
        }
        this.innerProperties().withAadTenantId(aadTenantId);
        return this;
    }

    /**
     * Get the desiredProperties property: Desired properties of the cluster.
     * 
     * @return the desiredProperties value.
     */
    public ClusterDesiredProperties desiredProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().desiredProperties();
    }

    /**
     * Set the desiredProperties property: Desired properties of the cluster.
     * 
     * @param desiredProperties the desiredProperties value to set.
     * @return the ClusterPatch object itself.
     */
    public ClusterPatch withDesiredProperties(ClusterDesiredProperties desiredProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterPatchProperties();
        }
        this.innerProperties().withDesiredProperties(desiredProperties);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("identity", this.innerIdentity);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedClusterPatch.tags = tags;
                } else if ("identity".equals(fieldName)) {
                    deserializedClusterPatch.innerIdentity = ManagedServiceIdentity.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedClusterPatch.innerProperties = ClusterPatchProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedClusterPatch;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy