# 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 User(pulumi.CustomResource):
    """
    Creates a new Google SQL User on a Google SQL User Instance. For more information, see the [official documentation](https://cloud.google.com/sql/), or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/users).
    
    ~> **Note:** All arguments including the username and password will be stored in the raw state as plain-text.
    [Read more about sensitive data in state](/docs/state/sensitive-data.html). Passwords will not be retrieved when running
    "terraform import".
    """
    def __init__(__self__, __name__, __opts__=None, host=None, instance=None, name=None, password=None, project=None):
        """Create a User 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 host and not isinstance(host, basestring):
            raise TypeError('Expected property host to be a basestring')
        __self__.host = host
        """
        The host the user can connect from. This is only supported
        for first generation SQL instances. Don't set this field for second generation
        SQL instances. Can be an IP address. Changing this forces a new resource to be created.
        """
        __props__['host'] = host

        if not instance:
            raise TypeError('Missing required property instance')
        elif not isinstance(instance, basestring):
            raise TypeError('Expected property instance to be a basestring')
        __self__.instance = instance
        """
        The name of the Cloud SQL instance. Changing this
        forces a new resource to be created.
        """
        __props__['instance'] = instance

        if name and not isinstance(name, basestring):
            raise TypeError('Expected property name to be a basestring')
        __self__.name = name
        """
        The name of the user. Changing this forces a new resource
        to be created.
        """
        __props__['name'] = name

        if password and not isinstance(password, basestring):
            raise TypeError('Expected property password to be a basestring')
        __self__.password = password
        """
        The password for the user. Can be updated.
        """
        __props__['password'] = password

        if project and not isinstance(project, basestring):
            raise TypeError('Expected property project to be a basestring')
        __self__.project = project
        """
        The ID of the project in which the resource belongs. If it
        is not provided, the provider project is used.
        """
        __props__['project'] = project

        super(User, __self__).__init__(
            'gcp:sql/user:User',
            __name__,
            __props__,
            __opts__)

    def set_outputs(self, outs):
        if 'host' in outs:
            self.host = outs['host']
        if 'instance' in outs:
            self.instance = outs['instance']
        if 'name' in outs:
            self.name = outs['name']
        if 'password' in outs:
            self.password = outs['password']
        if 'project' in outs:
            self.project = outs['project']
