# 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 pulumi
import pulumi.runtime

class Keypair(pulumi.CustomResource):
    """
    Manages a V2 keypair resource within OpenStack.
    
    ~> **Important Security Notice** The private key generated by this resource will
    be stored *unencrypted* in your Terraform state file. **Use of this resource
    for production deployments is *not* recommended**. Instead, generate
    a private key file outside of Terraform and distribute it securely
    to the system where Terraform will be run.
    """
    def __init__(__self__, __name__, __opts__=None, name=None, public_key=None, region=None, value_specs=None):
        """Create a Keypair resource with the given unique name, props, and options."""
        if not __name__:
            raise TypeError('Missing resource name argument (for URN creation)')
        if not isinstance(__name__, basestring):
            raise TypeError('Expected resource name to be a string')
        if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')

        __props__ = dict()

        if name and not isinstance(name, basestring):
            raise TypeError('Expected property name to be a basestring')
        __self__.name = name
        """
        A unique name for the keypair. Changing this creates a new
        keypair.
        """
        __props__['name'] = name

        if public_key and not isinstance(public_key, basestring):
            raise TypeError('Expected property public_key to be a basestring')
        __self__.public_key = public_key
        """
        A pregenerated OpenSSH-formatted public key.
        Changing this creates a new keypair. If a public key is not specified, then
        a public/private key pair will be automatically generated. If a pair is
        created, then destroying this resource means you will lose access to that
        keypair forever.
        """
        __props__['publicKey'] = public_key

        if region and not isinstance(region, basestring):
            raise TypeError('Expected property region to be a basestring')
        __self__.region = region
        """
        The region in which to obtain the V2 Compute client.
        Keypairs are associated with accounts, but a Compute client is needed to
        create one. If omitted, the `region` argument of the provider is used.
        Changing this creates a new keypair.
        """
        __props__['region'] = region

        if value_specs and not isinstance(value_specs, dict):
            raise TypeError('Expected property value_specs to be a dict')
        __self__.value_specs = value_specs
        """
        Map of additional options.
        """
        __props__['valueSpecs'] = value_specs

        __self__.fingerprint = pulumi.runtime.UNKNOWN
        """
        The fingerprint of the public key.
        """
        __self__.private_key = pulumi.runtime.UNKNOWN
        """
        The generated private key when no public key is specified.
        """

        super(Keypair, __self__).__init__(
            'openstack:compute/keypair:Keypair',
            __name__,
            __props__,
            __opts__)

    def set_outputs(self, outs):
        if 'fingerprint' in outs:
            self.fingerprint = outs['fingerprint']
        if 'name' in outs:
            self.name = outs['name']
        if 'privateKey' in outs:
            self.private_key = outs['privateKey']
        if 'publicKey' in outs:
            self.public_key = outs['publicKey']
        if 'region' in outs:
            self.region = outs['region']
        if 'valueSpecs' in outs:
            self.value_specs = outs['valueSpecs']
