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

package com.azure.resourcemanager.networkcloud.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** SshPublicKey represents the public key used to authenticate with a resource through SSH. */
@Fluent
public final class SshPublicKey {
    /*
     * The SSH public key data.
     */
    @JsonProperty(value = "keyData", required = true)
    private String keyData;

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

    /**
     * Get the keyData property: The SSH public key data.
     *
     * @return the keyData value.
     */
    public String keyData() {
        return this.keyData;
    }

    /**
     * Set the keyData property: The SSH public key data.
     *
     * @param keyData the keyData value to set.
     * @return the SshPublicKey object itself.
     */
    public SshPublicKey withKeyData(String keyData) {
        this.keyData = keyData;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (keyData() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property keyData in model SshPublicKey"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SshPublicKey.class);
}
