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

com.azure.resourcemanager.hybridcompute.models.MachineUpdate Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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.hybridcompute.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.fluent.models.MachineUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Describes a hybrid machine Update.
 */
@Fluent
public final class MachineUpdate extends ResourceUpdate {
    /*
     * Identity for the resource.
     */
    private Identity identity;

    /*
     * Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc.
     */
    private ArcKindEnum kind;

    /*
     * Hybrid Compute Machine properties
     */
    private MachineUpdateProperties innerProperties;

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

    /**
     * Get the identity property: Identity for the resource.
     * 
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Identity for the resource.
     * 
     * @param identity the identity value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the kind property: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware
     * etc.
     * 
     * @return the kind value.
     */
    public ArcKindEnum kind() {
        return this.kind;
    }

    /**
     * Set the kind property: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware
     * etc.
     * 
     * @param kind the kind value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withKind(ArcKindEnum kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the innerProperties property: Hybrid Compute Machine properties.
     * 
     * @return the innerProperties value.
     */
    private MachineUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public MachineUpdate withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the locationData property: Metadata pertaining to the geographic location of the resource.
     * 
     * @return the locationData value.
     */
    public LocationData locationData() {
        return this.innerProperties() == null ? null : this.innerProperties().locationData();
    }

    /**
     * Set the locationData property: Metadata pertaining to the geographic location of the resource.
     * 
     * @param locationData the locationData value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withLocationData(LocationData locationData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withLocationData(locationData);
        return this;
    }

    /**
     * Get the osProfile property: Specifies the operating system settings for the hybrid machine.
     * 
     * @return the osProfile value.
     */
    public OSProfile osProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().osProfile();
    }

    /**
     * Set the osProfile property: Specifies the operating system settings for the hybrid machine.
     * 
     * @param osProfile the osProfile value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withOsProfile(OSProfile osProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withOsProfile(osProfile);
        return this;
    }

    /**
     * Get the cloudMetadata property: The metadata of the cloud environment (Azure/GCP/AWS/OCI...).
     * 
     * @return the cloudMetadata value.
     */
    public CloudMetadata cloudMetadata() {
        return this.innerProperties() == null ? null : this.innerProperties().cloudMetadata();
    }

    /**
     * Set the cloudMetadata property: The metadata of the cloud environment (Azure/GCP/AWS/OCI...).
     * 
     * @param cloudMetadata the cloudMetadata value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withCloudMetadata(CloudMetadata cloudMetadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withCloudMetadata(cloudMetadata);
        return this;
    }

    /**
     * Get the agentUpgrade property: The info of the machine w.r.t Agent Upgrade.
     * 
     * @return the agentUpgrade value.
     */
    public AgentUpgrade agentUpgrade() {
        return this.innerProperties() == null ? null : this.innerProperties().agentUpgrade();
    }

    /**
     * Set the agentUpgrade property: The info of the machine w.r.t Agent Upgrade.
     * 
     * @param agentUpgrade the agentUpgrade value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withAgentUpgrade(AgentUpgrade agentUpgrade) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withAgentUpgrade(agentUpgrade);
        return this;
    }

    /**
     * Get the parentClusterResourceId property: The resource id of the parent cluster (Azure HCI) this machine is
     * assigned to, if any.
     * 
     * @return the parentClusterResourceId value.
     */
    public String parentClusterResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().parentClusterResourceId();
    }

    /**
     * Set the parentClusterResourceId property: The resource id of the parent cluster (Azure HCI) this machine is
     * assigned to, if any.
     * 
     * @param parentClusterResourceId the parentClusterResourceId value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withParentClusterResourceId(String parentClusterResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withParentClusterResourceId(parentClusterResourceId);
        return this;
    }

    /**
     * Get the privateLinkScopeResourceId property: The resource id of the private link scope this machine is assigned
     * to, if any.
     * 
     * @return the privateLinkScopeResourceId value.
     */
    public String privateLinkScopeResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().privateLinkScopeResourceId();
    }

    /**
     * Set the privateLinkScopeResourceId property: The resource id of the private link scope this machine is assigned
     * to, if any.
     * 
     * @param privateLinkScopeResourceId the privateLinkScopeResourceId value to set.
     * @return the MachineUpdate object itself.
     */
    public MachineUpdate withPrivateLinkScopeResourceId(String privateLinkScopeResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineUpdateProperties();
        }
        this.innerProperties().withPrivateLinkScopeResourceId(privateLinkScopeResourceId);
        return this;
    }

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

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

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

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedMachineUpdate.withTags(tags);
                } else if ("identity".equals(fieldName)) {
                    deserializedMachineUpdate.identity = Identity.fromJson(reader);
                } else if ("kind".equals(fieldName)) {
                    deserializedMachineUpdate.kind = ArcKindEnum.fromString(reader.getString());
                } else if ("properties".equals(fieldName)) {
                    deserializedMachineUpdate.innerProperties = MachineUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMachineUpdate;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy