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

com.azure.resourcemanager.recoveryservicesdatareplication.models.HyperVMigrateFabricModelCustomProperties 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.recoveryservicesdatareplication.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * HyperV migrate fabric model custom properties.
 */
@Fluent
public final class HyperVMigrateFabricModelCustomProperties extends FabricModelCustomProperties {
    /*
     * Gets or sets the instance type.
     */
    private String instanceType = "HyperVMigrate";

    /*
     * Gets or sets the ARM Id of the HyperV site.
     */
    private String hyperVSiteId;

    /*
     * Gets or sets the fabric resource Id.
     */
    private String fabricResourceId;

    /*
     * Gets or sets the fabric container Id.
     */
    private String fabricContainerId;

    /*
     * Gets or sets the migration solution ARM Id.
     */
    private String migrationSolutionId;

    /*
     * Gets or sets the migration hub Uri.
     */
    private String migrationHubUri;

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

    /**
     * Get the instanceType property: Gets or sets the instance type.
     * 
     * @return the instanceType value.
     */
    @Override
    public String instanceType() {
        return this.instanceType;
    }

    /**
     * Get the hyperVSiteId property: Gets or sets the ARM Id of the HyperV site.
     * 
     * @return the hyperVSiteId value.
     */
    public String hyperVSiteId() {
        return this.hyperVSiteId;
    }

    /**
     * Set the hyperVSiteId property: Gets or sets the ARM Id of the HyperV site.
     * 
     * @param hyperVSiteId the hyperVSiteId value to set.
     * @return the HyperVMigrateFabricModelCustomProperties object itself.
     */
    public HyperVMigrateFabricModelCustomProperties withHyperVSiteId(String hyperVSiteId) {
        this.hyperVSiteId = hyperVSiteId;
        return this;
    }

    /**
     * Get the fabricResourceId property: Gets or sets the fabric resource Id.
     * 
     * @return the fabricResourceId value.
     */
    public String fabricResourceId() {
        return this.fabricResourceId;
    }

    /**
     * Get the fabricContainerId property: Gets or sets the fabric container Id.
     * 
     * @return the fabricContainerId value.
     */
    public String fabricContainerId() {
        return this.fabricContainerId;
    }

    /**
     * Get the migrationSolutionId property: Gets or sets the migration solution ARM Id.
     * 
     * @return the migrationSolutionId value.
     */
    public String migrationSolutionId() {
        return this.migrationSolutionId;
    }

    /**
     * Set the migrationSolutionId property: Gets or sets the migration solution ARM Id.
     * 
     * @param migrationSolutionId the migrationSolutionId value to set.
     * @return the HyperVMigrateFabricModelCustomProperties object itself.
     */
    public HyperVMigrateFabricModelCustomProperties withMigrationSolutionId(String migrationSolutionId) {
        this.migrationSolutionId = migrationSolutionId;
        return this;
    }

    /**
     * Get the migrationHubUri property: Gets or sets the migration hub Uri.
     * 
     * @return the migrationHubUri value.
     */
    public String migrationHubUri() {
        return this.migrationHubUri;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (hyperVSiteId() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property hyperVSiteId in model HyperVMigrateFabricModelCustomProperties"));
        }
        if (migrationSolutionId() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property migrationSolutionId in model HyperVMigrateFabricModelCustomProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(HyperVMigrateFabricModelCustomProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("hyperVSiteId", this.hyperVSiteId);
        jsonWriter.writeStringField("migrationSolutionId", this.migrationSolutionId);
        jsonWriter.writeStringField("instanceType", this.instanceType);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of HyperVMigrateFabricModelCustomProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of HyperVMigrateFabricModelCustomProperties if the JsonReader was pointing to an instance of
     * it, or null if it was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the HyperVMigrateFabricModelCustomProperties.
     */
    public static HyperVMigrateFabricModelCustomProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            HyperVMigrateFabricModelCustomProperties deserializedHyperVMigrateFabricModelCustomProperties
                = new HyperVMigrateFabricModelCustomProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("hyperVSiteId".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.hyperVSiteId = reader.getString();
                } else if ("migrationSolutionId".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.migrationSolutionId = reader.getString();
                } else if ("instanceType".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.instanceType = reader.getString();
                } else if ("fabricResourceId".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.fabricResourceId = reader.getString();
                } else if ("fabricContainerId".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.fabricContainerId = reader.getString();
                } else if ("migrationHubUri".equals(fieldName)) {
                    deserializedHyperVMigrateFabricModelCustomProperties.migrationHubUri = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedHyperVMigrateFabricModelCustomProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy