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

com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.

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.resourcemanager.hdinsight.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 ssh username, password, and ssh public key.
 */
@Fluent
public final class LinuxOperatingSystemProfile implements JsonSerializable {
    /*
     * The username.
     */
    private String username;

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

    /*
     * The SSH profile.
     */
    private SshProfile sshProfile;

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

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

    /**
     * Set the username property: The username.
     * 
     * @param username the username value to set.
     * @return the LinuxOperatingSystemProfile object itself.
     */
    public LinuxOperatingSystemProfile withUsername(String username) {
        this.username = username;
        return this;
    }

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

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

    /**
     * Get the sshProfile property: The SSH profile.
     * 
     * @return the sshProfile value.
     */
    public SshProfile sshProfile() {
        return this.sshProfile;
    }

    /**
     * Set the sshProfile property: The SSH profile.
     * 
     * @param sshProfile the sshProfile value to set.
     * @return the LinuxOperatingSystemProfile object itself.
     */
    public LinuxOperatingSystemProfile withSshProfile(SshProfile sshProfile) {
        this.sshProfile = sshProfile;
        return this;
    }

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

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

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

                if ("username".equals(fieldName)) {
                    deserializedLinuxOperatingSystemProfile.username = reader.getString();
                } else if ("password".equals(fieldName)) {
                    deserializedLinuxOperatingSystemProfile.password = reader.getString();
                } else if ("sshProfile".equals(fieldName)) {
                    deserializedLinuxOperatingSystemProfile.sshProfile = SshProfile.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLinuxOperatingSystemProfile;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy