use of com.microsoft.azure.management.compute.SshConfiguration in project azure-sdk-for-java by Azure.
the class VirtualMachineScaleSetImpl method withSsh.
@Override
public VirtualMachineScaleSetImpl withSsh(String publicKeyData) {
VirtualMachineScaleSetOSProfile osProfile = this.inner().virtualMachineProfile().osProfile();
if (osProfile.linuxConfiguration().ssh() == null) {
SshConfiguration sshConfiguration = new SshConfiguration();
sshConfiguration.withPublicKeys(new ArrayList<SshPublicKey>());
osProfile.linuxConfiguration().withSsh(sshConfiguration);
}
SshPublicKey sshPublicKey = new SshPublicKey();
sshPublicKey.withKeyData(publicKeyData);
sshPublicKey.withPath("/home/" + osProfile.adminUsername() + "/.ssh/authorized_keys");
osProfile.linuxConfiguration().ssh().publicKeys().add(sshPublicKey);
return this;
}
use of com.microsoft.azure.management.compute.SshConfiguration in project azure-sdk-for-java by Azure.
the class VirtualMachineImpl method withSsh.
// Virtual machine optional fluent methods
//
@Override
public VirtualMachineImpl withSsh(String publicKeyData) {
OSProfile osProfile = this.inner().osProfile();
if (osProfile.linuxConfiguration().ssh() == null) {
SshConfiguration sshConfiguration = new SshConfiguration();
sshConfiguration.withPublicKeys(new ArrayList<SshPublicKey>());
osProfile.linuxConfiguration().withSsh(sshConfiguration);
}
SshPublicKey sshPublicKey = new SshPublicKey();
sshPublicKey.withKeyData(publicKeyData);
sshPublicKey.withPath("/home/" + osProfile.adminUsername() + "/.ssh/authorized_keys");
osProfile.linuxConfiguration().ssh().publicKeys().add(sshPublicKey);
return this;
}
Aggregations