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

com.azure.resourcemanager.mongocluster.models.AdministratorProperties 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;

/**
 * The local administrator login properties.
 */
@Fluent
public final class AdministratorProperties implements JsonSerializable {
    /*
     * The administrator user name.
     */
    private String userName;

    /*
     * The administrator password.
     */
    private String password;

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

    /**
     * Get the userName property: The administrator user name.
     * 
     * @return the userName value.
     */
    public String userName() {
        return this.userName;
    }

    /**
     * Set the userName property: The administrator user name.
     * 
     * @param userName the userName value to set.
     * @return the AdministratorProperties object itself.
     */
    public AdministratorProperties withUserName(String userName) {
        this.userName = userName;
        return this;
    }

    /**
     * Get the password property: The administrator password.
     * 
     * @return the password value.
     */
    public String password() {
        return this.password;
    }

    /**
     * Set the password property: The administrator password.
     * 
     * @param password the password value to set.
     * @return the AdministratorProperties object itself.
     */
    public AdministratorProperties withPassword(String password) {
        this.password = password;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

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

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

                if ("userName".equals(fieldName)) {
                    deserializedAdministratorProperties.userName = reader.getString();
                } else if ("password".equals(fieldName)) {
                    deserializedAdministratorProperties.password = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAdministratorProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy