// 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 assume role, the role enables delegating access to your AWS resources. The role is
 * composed of role Amazon Resource Name (ARN) and external ID. For more details, refer to &lt;a
 * href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html"&gt;Creating a Role to Delegate
 * Permissions to an IAM User (write only)&lt;/a&gt;.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType")
@JsonTypeName("awsAssumeRole")
@Fluent
public final class AwAssumeRoleAuthenticationDetailsProperties extends AuthenticationDetailsProperties {
    /*
     * The ID of the cloud account
     */
    @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY)
    private String accountId;

    /*
     * Assumed role ID is an identifier that you can use to create temporary security credentials.
     */
    @JsonProperty(value = "awsAssumeRoleArn", required = true)
    private String awsAssumeRoleArn;

    /*
     * A unique identifier that is required when you assume a role in another account.
     */
    @JsonProperty(value = "awsExternalId", required = true)
    private String awsExternalId;

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

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

    /**
     * Get the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security
     * credentials.
     *
     * @return the awsAssumeRoleArn value.
     */
    public String awsAssumeRoleArn() {
        return this.awsAssumeRoleArn;
    }

    /**
     * Set the awsAssumeRoleArn property: Assumed role ID is an identifier that you can use to create temporary security
     * credentials.
     *
     * @param awsAssumeRoleArn the awsAssumeRoleArn value to set.
     * @return the AwAssumeRoleAuthenticationDetailsProperties object itself.
     */
    public AwAssumeRoleAuthenticationDetailsProperties withAwsAssumeRoleArn(String awsAssumeRoleArn) {
        this.awsAssumeRoleArn = awsAssumeRoleArn;
        return this;
    }

    /**
     * Get the awsExternalId property: A unique identifier that is required when you assume a role in another account.
     *
     * @return the awsExternalId value.
     */
    public String awsExternalId() {
        return this.awsExternalId;
    }

    /**
     * Set the awsExternalId property: A unique identifier that is required when you assume a role in another account.
     *
     * @param awsExternalId the awsExternalId value to set.
     * @return the AwAssumeRoleAuthenticationDetailsProperties object itself.
     */
    public AwAssumeRoleAuthenticationDetailsProperties withAwsExternalId(String awsExternalId) {
        this.awsExternalId = awsExternalId;
        return this;
    }

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

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