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

package com.azure.resourcemanager.security.models;

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

/**
 * AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more
 * details, refer to &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html"&gt;Creating an
 * IAM User in Your AWS Account (write only)&lt;/a&gt;.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType")
@JsonTypeName("awsCreds")
@Fluent
public final class AwsCredsAuthenticationDetailsProperties extends AuthenticationDetailsProperties {
    /*
     * The ID of the cloud account
     */
    @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY)
    private String accountId;

    /*
     * Public key element of the AWS credential object (write only)
     */
    @JsonProperty(value = "awsAccessKeyId", required = true)
    private String awsAccessKeyId;

    /*
     * Secret key element of the AWS credential object (write only)
     */
    @JsonProperty(value = "awsSecretAccessKey", required = true)
    private String awsSecretAccessKey;

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

    /**
     * Get the accountId property: The ID of the cloud account.
     *
     * @return the accountId value.
     */
    public String accountId() {
        return this.accountId;
    }

    /**
     * Get the awsAccessKeyId property: Public key element of the AWS credential object (write only).
     *
     * @return the awsAccessKeyId value.
     */
    public String awsAccessKeyId() {
        return this.awsAccessKeyId;
    }

    /**
     * Set the awsAccessKeyId property: Public key element of the AWS credential object (write only).
     *
     * @param awsAccessKeyId the awsAccessKeyId value to set.
     * @return the AwsCredsAuthenticationDetailsProperties object itself.
     */
    public AwsCredsAuthenticationDetailsProperties withAwsAccessKeyId(String awsAccessKeyId) {
        this.awsAccessKeyId = awsAccessKeyId;
        return this;
    }

    /**
     * Get the awsSecretAccessKey property: Secret key element of the AWS credential object (write only).
     *
     * @return the awsSecretAccessKey value.
     */
    public String awsSecretAccessKey() {
        return this.awsSecretAccessKey;
    }

    /**
     * Set the awsSecretAccessKey property: Secret key element of the AWS credential object (write only).
     *
     * @param awsSecretAccessKey the awsSecretAccessKey value to set.
     * @return the AwsCredsAuthenticationDetailsProperties object itself.
     */
    public AwsCredsAuthenticationDetailsProperties withAwsSecretAccessKey(String awsSecretAccessKey) {
        this.awsSecretAccessKey = awsSecretAccessKey;
        return this;
    }

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

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