
com.azure.resourcemanager.hdinsight.models.SshProfile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
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-2021-06.
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;
import java.util.List;
/**
* The list of SSH public keys.
*/
@Fluent
public final class SshProfile implements JsonSerializable {
/*
* The list of SSH public keys.
*/
private List publicKeys;
/**
* Creates an instance of SshProfile class.
*/
public SshProfile() {
}
/**
* Get the publicKeys property: The list of SSH public keys.
*
* @return the publicKeys value.
*/
public List publicKeys() {
return this.publicKeys;
}
/**
* Set the publicKeys property: The list of SSH public keys.
*
* @param publicKeys the publicKeys value to set.
* @return the SshProfile object itself.
*/
public SshProfile withPublicKeys(List publicKeys) {
this.publicKeys = publicKeys;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (publicKeys() != null) {
publicKeys().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("publicKeys", this.publicKeys, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SshProfile from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SshProfile 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 SshProfile.
*/
public static SshProfile fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SshProfile deserializedSshProfile = new SshProfile();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("publicKeys".equals(fieldName)) {
List publicKeys = reader.readArray(reader1 -> SshPublicKey.fromJson(reader1));
deserializedSshProfile.publicKeys = publicKeys;
} else {
reader.skipChildren();
}
}
return deserializedSshProfile;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy