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

com.azure.ai.metricsadvisor.implementation.models.MongoDBParameterPatch Maven / Gradle / Ivy

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.ai.metricsadvisor.implementation.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;

/**
 * The MongoDBParameterPatch model.
 */
@Fluent
public final class MongoDBParameterPatch implements JsonSerializable {
    /*
     * The connection string of this MongoDB
     */
    private String connectionString;

    /*
     * A database name in this MongoDB
     */
    private String database;

    /*
     * The script to query this database
     */
    private String command;

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

    /**
     * Get the connectionString property: The connection string of this MongoDB.
     * 
     * @return the connectionString value.
     */
    public String getConnectionString() {
        return this.connectionString;
    }

    /**
     * Set the connectionString property: The connection string of this MongoDB.
     * 
     * @param connectionString the connectionString value to set.
     * @return the MongoDBParameterPatch object itself.
     */
    public MongoDBParameterPatch setConnectionString(String connectionString) {
        this.connectionString = connectionString;
        return this;
    }

    /**
     * Get the database property: A database name in this MongoDB.
     * 
     * @return the database value.
     */
    public String getDatabase() {
        return this.database;
    }

    /**
     * Set the database property: A database name in this MongoDB.
     * 
     * @param database the database value to set.
     * @return the MongoDBParameterPatch object itself.
     */
    public MongoDBParameterPatch setDatabase(String database) {
        this.database = database;
        return this;
    }

    /**
     * Get the command property: The script to query this database.
     * 
     * @return the command value.
     */
    public String getCommand() {
        return this.command;
    }

    /**
     * Set the command property: The script to query this database.
     * 
     * @param command the command value to set.
     * @return the MongoDBParameterPatch object itself.
     */
    public MongoDBParameterPatch setCommand(String command) {
        this.command = command;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("connectionString", this.connectionString);
        jsonWriter.writeStringField("database", this.database);
        jsonWriter.writeStringField("command", this.command);
        return jsonWriter.writeEndObject();
    }

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

                if ("connectionString".equals(fieldName)) {
                    deserializedMongoDBParameterPatch.connectionString = reader.getString();
                } else if ("database".equals(fieldName)) {
                    deserializedMongoDBParameterPatch.database = reader.getString();
                } else if ("command".equals(fieldName)) {
                    deserializedMongoDBParameterPatch.command = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMongoDBParameterPatch;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy