# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables

__all__ = ['AccessKey']


class AccessKey(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 pgp_key: Optional[pulumi.Input[str]] = None,
                 status: Optional[pulumi.Input[str]] = None,
                 user: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_aws as aws

        lb_user = aws.iam.User("lbUser", path="/system/")
        lb_access_key = aws.iam.AccessKey("lbAccessKey",
            user=lb_user.name,
            pgp_key="keybase:some_person_that_exists")
        lb_ro = aws.iam.UserPolicy("lbRo",
            user=lb_user.name,
            policy=\"\"\"{
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": [
                "ec2:Describe*"
              ],
              "Effect": "Allow",
              "Resource": "*"
            }
          ]
        }
        \"\"\")
        pulumi.export("secret", lb_access_key.encrypted_secret)
        ```

        ```python
        import pulumi
        import pulumi_aws as aws

        test_user = aws.iam.User("testUser", path="/test/")
        test_access_key = aws.iam.AccessKey("testAccessKey", user=test_user.name)
        pulumi.export("awsIamSmtpPasswordV4", test_access_key.ses_smtp_password_v4)
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] pgp_key: Either a base-64 encoded PGP public key, or a
               keybase username in the form `keybase:some_person_that_exists`, for use
               in the `encrypted_secret` output attribute.
        :param pulumi.Input[str] status: The access key status to apply. Defaults to `Active`.
               Valid values are `Active` and `Inactive`.
        :param pulumi.Input[str] user: The IAM user to associate with this access key.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['pgp_key'] = pgp_key
            __props__['status'] = status
            if user is None:
                raise TypeError("Missing required property 'user'")
            __props__['user'] = user
            __props__['encrypted_secret'] = None
            __props__['key_fingerprint'] = None
            __props__['secret'] = None
            __props__['ses_smtp_password_v4'] = None
        super(AccessKey, __self__).__init__(
            'aws:iam/accessKey:AccessKey',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            encrypted_secret: Optional[pulumi.Input[str]] = None,
            key_fingerprint: Optional[pulumi.Input[str]] = None,
            pgp_key: Optional[pulumi.Input[str]] = None,
            secret: Optional[pulumi.Input[str]] = None,
            ses_smtp_password_v4: Optional[pulumi.Input[str]] = None,
            status: Optional[pulumi.Input[str]] = None,
            user: Optional[pulumi.Input[str]] = None) -> 'AccessKey':
        """
        Get an existing AccessKey resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] key_fingerprint: The fingerprint of the PGP key used to encrypt
               the secret
        :param pulumi.Input[str] pgp_key: Either a base-64 encoded PGP public key, or a
               keybase username in the form `keybase:some_person_that_exists`, for use
               in the `encrypted_secret` output attribute.
        :param pulumi.Input[str] secret: The secret access key. Note that this will be written
               to the state file. If you use this, please protect your backend state file
               judiciously. Alternatively, you may supply a `pgp_key` instead, which will
               prevent the secret from being stored in plaintext, at the cost of preventing
               the use of the secret key in automation.
        :param pulumi.Input[str] ses_smtp_password_v4: The secret access key converted into an SES SMTP
               password by applying [AWS's documented Sigv4 conversion
               algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert).
               As SigV4 is region specific, valid Provider regions are `ap-south-1`, `ap-southeast-2`, `eu-central-1`, `eu-west-1`, `us-east-1` and `us-west-2`. See current [AWS SES regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#ses_region)
        :param pulumi.Input[str] status: The access key status to apply. Defaults to `Active`.
               Valid values are `Active` and `Inactive`.
        :param pulumi.Input[str] user: The IAM user to associate with this access key.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["encrypted_secret"] = encrypted_secret
        __props__["key_fingerprint"] = key_fingerprint
        __props__["pgp_key"] = pgp_key
        __props__["secret"] = secret
        __props__["ses_smtp_password_v4"] = ses_smtp_password_v4
        __props__["status"] = status
        __props__["user"] = user
        return AccessKey(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="encryptedSecret")
    def encrypted_secret(self) -> pulumi.Output[str]:
        return pulumi.get(self, "encrypted_secret")

    @property
    @pulumi.getter(name="keyFingerprint")
    def key_fingerprint(self) -> pulumi.Output[str]:
        """
        The fingerprint of the PGP key used to encrypt
        the secret
        """
        return pulumi.get(self, "key_fingerprint")

    @property
    @pulumi.getter(name="pgpKey")
    def pgp_key(self) -> pulumi.Output[Optional[str]]:
        """
        Either a base-64 encoded PGP public key, or a
        keybase username in the form `keybase:some_person_that_exists`, for use
        in the `encrypted_secret` output attribute.
        """
        return pulumi.get(self, "pgp_key")

    @property
    @pulumi.getter
    def secret(self) -> pulumi.Output[str]:
        """
        The secret access key. Note that this will be written
        to the state file. If you use this, please protect your backend state file
        judiciously. Alternatively, you may supply a `pgp_key` instead, which will
        prevent the secret from being stored in plaintext, at the cost of preventing
        the use of the secret key in automation.
        """
        return pulumi.get(self, "secret")

    @property
    @pulumi.getter(name="sesSmtpPasswordV4")
    def ses_smtp_password_v4(self) -> pulumi.Output[str]:
        """
        The secret access key converted into an SES SMTP
        password by applying [AWS's documented Sigv4 conversion
        algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert).
        As SigV4 is region specific, valid Provider regions are `ap-south-1`, `ap-southeast-2`, `eu-central-1`, `eu-west-1`, `us-east-1` and `us-west-2`. See current [AWS SES regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#ses_region)
        """
        return pulumi.get(self, "ses_smtp_password_v4")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[str]:
        """
        The access key status to apply. Defaults to `Active`.
        Valid values are `Active` and `Inactive`.
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter
    def user(self) -> pulumi.Output[str]:
        """
        The IAM user to associate with this access key.
        """
        return pulumi.get(self, "user")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

