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

com.azure.resourcemanager.mongocluster.models.MongoClusterProperties 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 properties of a mongo cluster.
 */
@Fluent
public final class MongoClusterProperties implements JsonSerializable {
    /*
     * The mode to create a mongo cluster.
     */
    private CreateMode createMode;

    /*
     * The parameters to create a point-in-time restore mongo cluster.
     */
    private MongoClusterRestoreParameters restoreParameters;

    /*
     * The parameters to create a replica mongo cluster.
     */
    private MongoClusterReplicaParameters replicaParameters;

    /*
     * 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;

    /*
     * The default mongo connection string for the cluster.
     */
    private String connectionString;

    /*
     * The provisioning state of the mongo cluster.
     */
    private ProvisioningState provisioningState;

    /*
     * The status of the mongo cluster.
     */
    private MongoClusterStatus clusterStatus;

    /*
     * 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 privateEndpointConnections;

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

    /*
     * The replication properties for the mongo cluster
     */
    private ReplicationProperties replica;

    /*
     * The infrastructure version the cluster is provisioned on.
     */
    private String infrastructureVersion;

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

    /**
     * Get the createMode property: The mode to create a mongo cluster.
     * 
     * @return the createMode value.
     */
    public CreateMode createMode() {
        return this.createMode;
    }

    /**
     * Set the createMode property: The mode to create a mongo cluster.
     * 
     * @param createMode the createMode value to set.
     * @return the MongoClusterProperties object itself.
     */
    public MongoClusterProperties withCreateMode(CreateMode createMode) {
        this.createMode = createMode;
        return this;
    }

    /**
     * Get the restoreParameters property: The parameters to create a point-in-time restore mongo cluster.
     * 
     * @return the restoreParameters value.
     */
    public MongoClusterRestoreParameters restoreParameters() {
        return this.restoreParameters;
    }

    /**
     * Set the restoreParameters property: The parameters to create a point-in-time restore mongo cluster.
     * 
     * @param restoreParameters the restoreParameters value to set.
     * @return the MongoClusterProperties object itself.
     */
    public MongoClusterProperties withRestoreParameters(MongoClusterRestoreParameters restoreParameters) {
        this.restoreParameters = restoreParameters;
        return this;
    }

    /**
     * Get the replicaParameters property: The parameters to create a replica mongo cluster.
     * 
     * @return the replicaParameters value.
     */
    public MongoClusterReplicaParameters replicaParameters() {
        return this.replicaParameters;
    }

    /**
     * Set the replicaParameters property: The parameters to create a replica mongo cluster.
     * 
     * @param replicaParameters the replicaParameters value to set.
     * @return the MongoClusterProperties object itself.
     */
    public MongoClusterProperties withReplicaParameters(MongoClusterReplicaParameters replicaParameters) {
        this.replicaParameters = replicaParameters;
        return this;
    }

    /**
     * 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties withServerVersion(String serverVersion) {
        this.serverVersion = serverVersion;
        return this;
    }

    /**
     * Get the connectionString property: The default mongo connection string for the cluster.
     * 
     * @return the connectionString value.
     */
    public String connectionString() {
        return this.connectionString;
    }

    /**
     * Get the provisioningState property: The provisioning state of the mongo cluster.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the clusterStatus property: The status of the mongo cluster.
     * 
     * @return the clusterStatus value.
     */
    public MongoClusterStatus clusterStatus() {
        return this.clusterStatus;
    }

    /**
     * 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties withBackup(BackupProperties backup) {
        this.backup = backup;
        return this;
    }

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

    /**
     * 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 MongoClusterProperties object itself.
     */
    public MongoClusterProperties withPreviewFeatures(List previewFeatures) {
        this.previewFeatures = previewFeatures;
        return this;
    }

    /**
     * Get the replica property: The replication properties for the mongo cluster.
     * 
     * @return the replica value.
     */
    public ReplicationProperties replica() {
        return this.replica;
    }

    /**
     * Get the infrastructureVersion property: The infrastructure version the cluster is provisioned on.
     * 
     * @return the infrastructureVersion value.
     */
    public String infrastructureVersion() {
        return this.infrastructureVersion;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (restoreParameters() != null) {
            restoreParameters().validate();
        }
        if (replicaParameters() != null) {
            replicaParameters().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();
        }
        if (privateEndpointConnections() != null) {
            privateEndpointConnections().forEach(e -> e.validate());
        }
        if (replica() != null) {
            replica().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString());
        jsonWriter.writeJsonField("restoreParameters", this.restoreParameters);
        jsonWriter.writeJsonField("replicaParameters", this.replicaParameters);
        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 MongoClusterProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MongoClusterProperties 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 MongoClusterProperties.
     */
    public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MongoClusterProperties deserializedMongoClusterProperties = new MongoClusterProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("createMode".equals(fieldName)) {
                    deserializedMongoClusterProperties.createMode = CreateMode.fromString(reader.getString());
                } else if ("restoreParameters".equals(fieldName)) {
                    deserializedMongoClusterProperties.restoreParameters
                        = MongoClusterRestoreParameters.fromJson(reader);
                } else if ("replicaParameters".equals(fieldName)) {
                    deserializedMongoClusterProperties.replicaParameters
                        = MongoClusterReplicaParameters.fromJson(reader);
                } else if ("administrator".equals(fieldName)) {
                    deserializedMongoClusterProperties.administrator = AdministratorProperties.fromJson(reader);
                } else if ("serverVersion".equals(fieldName)) {
                    deserializedMongoClusterProperties.serverVersion = reader.getString();
                } else if ("connectionString".equals(fieldName)) {
                    deserializedMongoClusterProperties.connectionString = reader.getString();
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedMongoClusterProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("clusterStatus".equals(fieldName)) {
                    deserializedMongoClusterProperties.clusterStatus
                        = MongoClusterStatus.fromString(reader.getString());
                } else if ("publicNetworkAccess".equals(fieldName)) {
                    deserializedMongoClusterProperties.publicNetworkAccess
                        = PublicNetworkAccess.fromString(reader.getString());
                } else if ("highAvailability".equals(fieldName)) {
                    deserializedMongoClusterProperties.highAvailability = HighAvailabilityProperties.fromJson(reader);
                } else if ("storage".equals(fieldName)) {
                    deserializedMongoClusterProperties.storage = StorageProperties.fromJson(reader);
                } else if ("sharding".equals(fieldName)) {
                    deserializedMongoClusterProperties.sharding = ShardingProperties.fromJson(reader);
                } else if ("compute".equals(fieldName)) {
                    deserializedMongoClusterProperties.compute = ComputeProperties.fromJson(reader);
                } else if ("backup".equals(fieldName)) {
                    deserializedMongoClusterProperties.backup = BackupProperties.fromJson(reader);
                } else if ("privateEndpointConnections".equals(fieldName)) {
                    List privateEndpointConnections
                        = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1));
                    deserializedMongoClusterProperties.privateEndpointConnections = privateEndpointConnections;
                } else if ("previewFeatures".equals(fieldName)) {
                    List previewFeatures
                        = reader.readArray(reader1 -> PreviewFeature.fromString(reader1.getString()));
                    deserializedMongoClusterProperties.previewFeatures = previewFeatures;
                } else if ("replica".equals(fieldName)) {
                    deserializedMongoClusterProperties.replica = ReplicationProperties.fromJson(reader);
                } else if ("infrastructureVersion".equals(fieldName)) {
                    deserializedMongoClusterProperties.infrastructureVersion = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMongoClusterProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy