// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.workloads.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Specifies the Linux operating system settings on the virtual machine. &lt;br&gt;&lt;br&gt;For a list of supported
 * Linux distributions, see [Linux on Azure-Endorsed
 * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros).
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "osType")
@JsonTypeName("Linux")
@Fluent
public final class LinuxConfiguration extends OSConfiguration {
    /*
     * Specifies whether password authentication should be disabled.
     */
    @JsonProperty(value = "disablePasswordAuthentication")
    private Boolean disablePasswordAuthentication;

    /*
     * Specifies the ssh key configuration for a Linux OS. (This property is deprecated, please use 'sshKeyPair'
     * instead)
     */
    @JsonProperty(value = "ssh")
    private SshConfiguration ssh;

    /*
     * The SSH Key-pair used to authenticate with the VM's.
     */
    @JsonProperty(value = "sshKeyPair")
    private SshKeyPair sshKeyPair;

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

    /**
     * Get the disablePasswordAuthentication property: Specifies whether password authentication should be disabled.
     *
     * @return the disablePasswordAuthentication value.
     */
    public Boolean disablePasswordAuthentication() {
        return this.disablePasswordAuthentication;
    }

    /**
     * Set the disablePasswordAuthentication property: Specifies whether password authentication should be disabled.
     *
     * @param disablePasswordAuthentication the disablePasswordAuthentication value to set.
     * @return the LinuxConfiguration object itself.
     */
    public LinuxConfiguration withDisablePasswordAuthentication(Boolean disablePasswordAuthentication) {
        this.disablePasswordAuthentication = disablePasswordAuthentication;
        return this;
    }

    /**
     * Get the ssh property: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, please
     * use 'sshKeyPair' instead).
     *
     * @return the ssh value.
     */
    public SshConfiguration ssh() {
        return this.ssh;
    }

    /**
     * Set the ssh property: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, please
     * use 'sshKeyPair' instead).
     *
     * @param ssh the ssh value to set.
     * @return the LinuxConfiguration object itself.
     */
    public LinuxConfiguration withSsh(SshConfiguration ssh) {
        this.ssh = ssh;
        return this;
    }

    /**
     * Get the sshKeyPair property: The SSH Key-pair used to authenticate with the VM's.
     *
     * @return the sshKeyPair value.
     */
    public SshKeyPair sshKeyPair() {
        return this.sshKeyPair;
    }

    /**
     * Set the sshKeyPair property: The SSH Key-pair used to authenticate with the VM's.
     *
     * @param sshKeyPair the sshKeyPair value to set.
     * @return the LinuxConfiguration object itself.
     */
    public LinuxConfiguration withSshKeyPair(SshKeyPair sshKeyPair) {
        this.sshKeyPair = sshKeyPair;
        return this;
    }

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