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

com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.resourcemanager.mongocluster.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.List;

/**
 * The updatable properties of the MongoCluster.
 */
@Fluent
public final class MongoClusterUpdateProperties implements JsonSerializable {
    /*
     * The local administrator properties for the mongo cluster.
     */
    private AdministratorProperties administrator;

    /*
     * The Mongo DB server version. Defaults to the latest available version if not specified.
     */
    private String serverVersion;

    /*
     * Whether or not public endpoint access is allowed for this mongo cluster.
     */
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * The high availability properties of the mongo cluster.
     */
    private HighAvailabilityProperties highAvailability;

    /*
     * The storage properties of the mongo cluster.
     */
    private StorageProperties storage;

    /*
     * The sharding properties of the mongo cluster.
     */
    private ShardingProperties sharding;

    /*
     * The compute properties of the mongo cluster.
     */
    private ComputeProperties compute;

    /*
     * The backup properties of the mongo cluster.
     */
    private BackupProperties backup;

    /*
     * List of private endpoint connections.
     */
    private List previewFeatures;

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

    /**
     * Get the administrator property: The local administrator properties for the mongo cluster.
     * 
     * @return the administrator value.
     */
    public AdministratorProperties administrator() {
        return this.administrator;
    }

    /**
     * Set the administrator property: The local administrator properties for the mongo cluster.
     * 
     * @param administrator the administrator value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withAdministrator(AdministratorProperties administrator) {
        this.administrator = administrator;
        return this;
    }

    /**
     * Get the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not
     * specified.
     * 
     * @return the serverVersion value.
     */
    public String serverVersion() {
        return this.serverVersion;
    }

    /**
     * Set the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not
     * specified.
     * 
     * @param serverVersion the serverVersion value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withServerVersion(String serverVersion) {
        this.serverVersion = serverVersion;
        return this;
    }

    /**
     * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.publicNetworkAccess;
    }

    /**
     * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

    /**
     * Get the highAvailability property: The high availability properties of the mongo cluster.
     * 
     * @return the highAvailability value.
     */
    public HighAvailabilityProperties highAvailability() {
        return this.highAvailability;
    }

    /**
     * Set the highAvailability property: The high availability properties of the mongo cluster.
     * 
     * @param highAvailability the highAvailability value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withHighAvailability(HighAvailabilityProperties highAvailability) {
        this.highAvailability = highAvailability;
        return this;
    }

    /**
     * Get the storage property: The storage properties of the mongo cluster.
     * 
     * @return the storage value.
     */
    public StorageProperties storage() {
        return this.storage;
    }

    /**
     * Set the storage property: The storage properties of the mongo cluster.
     * 
     * @param storage the storage value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withStorage(StorageProperties storage) {
        this.storage = storage;
        return this;
    }

    /**
     * Get the sharding property: The sharding properties of the mongo cluster.
     * 
     * @return the sharding value.
     */
    public ShardingProperties sharding() {
        return this.sharding;
    }

    /**
     * Set the sharding property: The sharding properties of the mongo cluster.
     * 
     * @param sharding the sharding value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withSharding(ShardingProperties sharding) {
        this.sharding = sharding;
        return this;
    }

    /**
     * Get the compute property: The compute properties of the mongo cluster.
     * 
     * @return the compute value.
     */
    public ComputeProperties compute() {
        return this.compute;
    }

    /**
     * Set the compute property: The compute properties of the mongo cluster.
     * 
     * @param compute the compute value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withCompute(ComputeProperties compute) {
        this.compute = compute;
        return this;
    }

    /**
     * Get the backup property: The backup properties of the mongo cluster.
     * 
     * @return the backup value.
     */
    public BackupProperties backup() {
        return this.backup;
    }

    /**
     * Set the backup property: The backup properties of the mongo cluster.
     * 
     * @param backup the backup value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withBackup(BackupProperties backup) {
        this.backup = backup;
        return this;
    }

    /**
     * Get the previewFeatures property: List of private endpoint connections.
     * 
     * @return the previewFeatures value.
     */
    public List previewFeatures() {
        return this.previewFeatures;
    }

    /**
     * Set the previewFeatures property: List of private endpoint connections.
     * 
     * @param previewFeatures the previewFeatures value to set.
     * @return the MongoClusterUpdateProperties object itself.
     */
    public MongoClusterUpdateProperties withPreviewFeatures(List previewFeatures) {
        this.previewFeatures = previewFeatures;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (administrator() != null) {
            administrator().validate();
        }
        if (highAvailability() != null) {
            highAvailability().validate();
        }
        if (storage() != null) {
            storage().validate();
        }
        if (sharding() != null) {
            sharding().validate();
        }
        if (compute() != null) {
            compute().validate();
        }
        if (backup() != null) {
            backup().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("administrator", this.administrator);
        jsonWriter.writeStringField("serverVersion", this.serverVersion);
        jsonWriter.writeStringField("publicNetworkAccess",
            this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString());
        jsonWriter.writeJsonField("highAvailability", this.highAvailability);
        jsonWriter.writeJsonField("storage", this.storage);
        jsonWriter.writeJsonField("sharding", this.sharding);
        jsonWriter.writeJsonField("compute", this.compute);
        jsonWriter.writeJsonField("backup", this.backup);
        jsonWriter.writeArrayField("previewFeatures", this.previewFeatures,
            (writer, element) -> writer.writeString(element == null ? null : element.toString()));
        return jsonWriter.writeEndObject();
    }

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

                if ("administrator".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.administrator = AdministratorProperties.fromJson(reader);
                } else if ("serverVersion".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.serverVersion = reader.getString();
                } else if ("publicNetworkAccess".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.publicNetworkAccess
                        = PublicNetworkAccess.fromString(reader.getString());
                } else if ("highAvailability".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.highAvailability
                        = HighAvailabilityProperties.fromJson(reader);
                } else if ("storage".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.storage = StorageProperties.fromJson(reader);
                } else if ("sharding".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.sharding = ShardingProperties.fromJson(reader);
                } else if ("compute".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.compute = ComputeProperties.fromJson(reader);
                } else if ("backup".equals(fieldName)) {
                    deserializedMongoClusterUpdateProperties.backup = BackupProperties.fromJson(reader);
                } else if ("previewFeatures".equals(fieldName)) {
                    List previewFeatures
                        = reader.readArray(reader1 -> PreviewFeature.fromString(reader1.getString()));
                    deserializedMongoClusterUpdateProperties.previewFeatures = previewFeatures;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMongoClusterUpdateProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy