# 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
from . import outputs
from ._inputs import *

__all__ = ['GlobalCluster']


class GlobalCluster(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 database_name: Optional[pulumi.Input[str]] = None,
                 deletion_protection: Optional[pulumi.Input[bool]] = None,
                 engine: Optional[pulumi.Input[str]] = None,
                 engine_version: Optional[pulumi.Input[str]] = None,
                 force_destroy: Optional[pulumi.Input[bool]] = None,
                 global_cluster_identifier: Optional[pulumi.Input[str]] = None,
                 source_db_cluster_identifier: Optional[pulumi.Input[str]] = None,
                 storage_encrypted: Optional[pulumi.Input[bool]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages an RDS Global Cluster, which is an Aurora global database spread across multiple regions. The global database contains a single primary cluster with read-write capability, and a read-only secondary cluster that receives data from the primary cluster through high-speed replication performed by the Aurora storage subsystem.

        More information about Aurora global databases can be found in the [Aurora User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html#aurora-global-database-creating).

        ## Example Usage
        ### New Global Cluster

        ```python
        import pulumi
        import pulumi_aws as aws
        import pulumi_pulumi as pulumi

        primary = pulumi.providers.Aws("primary", region="us-east-2")
        secondary = pulumi.providers.Aws("secondary", region="us-west-2")
        example = aws.rds.GlobalCluster("example", global_cluster_identifier="example",
        opts=ResourceOptions(provider=aws["primary"]))
        primary_cluster = aws.rds.Cluster("primaryCluster", global_cluster_identifier=example.id,
        opts=ResourceOptions(provider=aws["primary"]))
        primary_cluster_instance = aws.rds.ClusterInstance("primaryClusterInstance", cluster_identifier=primary_cluster.id,
        opts=ResourceOptions(provider=aws["primary"]))
        secondary_cluster = aws.rds.Cluster("secondaryCluster", global_cluster_identifier=example.id,
        opts=ResourceOptions(provider=aws["secondary"],
            depends_on=[primary_cluster_instance]))
        secondary_cluster_instance = aws.rds.ClusterInstance("secondaryClusterInstance", cluster_identifier=secondary_cluster.id,
        opts=ResourceOptions(provider=aws["secondary"]))
        ```
        ### New Global Cluster From Existing DB Cluster

        ```python
        import pulumi
        import pulumi_aws as aws

        # ... other configuration ...
        example_cluster = aws.rds.Cluster("exampleCluster")
        example_global_cluster = aws.rds.GlobalCluster("exampleGlobalCluster",
            force_destroy=True,
            global_cluster_identifier="example",
            source_db_cluster_identifier=example_cluster.arn)
        ```

        ## Import

        `aws_rds_global_cluster` can be imported by using the RDS Global Cluster identifier, e.g.

        ```sh
         $ pulumi import aws:rds/globalCluster:GlobalCluster example example
        ```

         Certain resource arguments, like `force_destroy`, only exist within Terraform. If the argument is set in the Terraform configuration on an imported resource, Terraform will show a difference on the first plan after import to update the state value. This change is safe to apply immediately so the state matches the desired configuration. Certain resource arguments, like `source_db_cluster_identifier`, do not have an API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](/docs/configuration/resources.html#ignore_changes) to hide the difference, e.g. hcl resource "aws_rds_global_cluster" "example" {

        # ... other configuration ...

        # There is no API for reading source_db_cluster_identifier

         lifecycle {

         ignore_changes = [source_db_cluster_identifier]

         } }

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] database_name: Name for an automatically created database on cluster creation.
        :param pulumi.Input[bool] deletion_protection: If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
        :param pulumi.Input[str] engine_version: Engine version of the Aurora global database.
               * **NOTE:** When the engine is set to `aurora-mysql`, an engine version compatible with global database is required. The earliest available version is `5.7.mysql_aurora.2.06.0`.
        :param pulumi.Input[bool] force_destroy: Enable to remove DB Cluster members from Global Cluster on destroy. Required with `source_db_cluster_identifier`.
        :param pulumi.Input[str] global_cluster_identifier: The global cluster identifier.
        """
        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__['database_name'] = database_name
            __props__['deletion_protection'] = deletion_protection
            __props__['engine'] = engine
            __props__['engine_version'] = engine_version
            __props__['force_destroy'] = force_destroy
            if global_cluster_identifier is None:
                raise TypeError("Missing required property 'global_cluster_identifier'")
            __props__['global_cluster_identifier'] = global_cluster_identifier
            __props__['source_db_cluster_identifier'] = source_db_cluster_identifier
            __props__['storage_encrypted'] = storage_encrypted
            __props__['arn'] = None
            __props__['global_cluster_members'] = None
            __props__['global_cluster_resource_id'] = None
        super(GlobalCluster, __self__).__init__(
            'aws:rds/globalCluster:GlobalCluster',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            arn: Optional[pulumi.Input[str]] = None,
            database_name: Optional[pulumi.Input[str]] = None,
            deletion_protection: Optional[pulumi.Input[bool]] = None,
            engine: Optional[pulumi.Input[str]] = None,
            engine_version: Optional[pulumi.Input[str]] = None,
            force_destroy: Optional[pulumi.Input[bool]] = None,
            global_cluster_identifier: Optional[pulumi.Input[str]] = None,
            global_cluster_members: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['GlobalClusterGlobalClusterMemberArgs']]]]] = None,
            global_cluster_resource_id: Optional[pulumi.Input[str]] = None,
            source_db_cluster_identifier: Optional[pulumi.Input[str]] = None,
            storage_encrypted: Optional[pulumi.Input[bool]] = None) -> 'GlobalCluster':
        """
        Get an existing GlobalCluster 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] arn: RDS Global Cluster Amazon Resource Name (ARN)
        :param pulumi.Input[str] database_name: Name for an automatically created database on cluster creation.
        :param pulumi.Input[bool] deletion_protection: If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
        :param pulumi.Input[str] engine_version: Engine version of the Aurora global database.
               * **NOTE:** When the engine is set to `aurora-mysql`, an engine version compatible with global database is required. The earliest available version is `5.7.mysql_aurora.2.06.0`.
        :param pulumi.Input[bool] force_destroy: Enable to remove DB Cluster members from Global Cluster on destroy. Required with `source_db_cluster_identifier`.
        :param pulumi.Input[str] global_cluster_identifier: The global cluster identifier.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['GlobalClusterGlobalClusterMemberArgs']]]] global_cluster_members: Set of objects containing Global Cluster members.
        :param pulumi.Input[str] global_cluster_resource_id: AWS Region-unique, immutable identifier for the global database cluster. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB cluster is accessed
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["arn"] = arn
        __props__["database_name"] = database_name
        __props__["deletion_protection"] = deletion_protection
        __props__["engine"] = engine
        __props__["engine_version"] = engine_version
        __props__["force_destroy"] = force_destroy
        __props__["global_cluster_identifier"] = global_cluster_identifier
        __props__["global_cluster_members"] = global_cluster_members
        __props__["global_cluster_resource_id"] = global_cluster_resource_id
        __props__["source_db_cluster_identifier"] = source_db_cluster_identifier
        __props__["storage_encrypted"] = storage_encrypted
        return GlobalCluster(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def arn(self) -> pulumi.Output[str]:
        """
        RDS Global Cluster Amazon Resource Name (ARN)
        """
        return pulumi.get(self, "arn")

    @property
    @pulumi.getter(name="databaseName")
    def database_name(self) -> pulumi.Output[Optional[str]]:
        """
        Name for an automatically created database on cluster creation.
        """
        return pulumi.get(self, "database_name")

    @property
    @pulumi.getter(name="deletionProtection")
    def deletion_protection(self) -> pulumi.Output[Optional[bool]]:
        """
        If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to `true`. The default is `false`.
        """
        return pulumi.get(self, "deletion_protection")

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

    @property
    @pulumi.getter(name="engineVersion")
    def engine_version(self) -> pulumi.Output[str]:
        """
        Engine version of the Aurora global database.
        * **NOTE:** When the engine is set to `aurora-mysql`, an engine version compatible with global database is required. The earliest available version is `5.7.mysql_aurora.2.06.0`.
        """
        return pulumi.get(self, "engine_version")

    @property
    @pulumi.getter(name="forceDestroy")
    def force_destroy(self) -> pulumi.Output[Optional[bool]]:
        """
        Enable to remove DB Cluster members from Global Cluster on destroy. Required with `source_db_cluster_identifier`.
        """
        return pulumi.get(self, "force_destroy")

    @property
    @pulumi.getter(name="globalClusterIdentifier")
    def global_cluster_identifier(self) -> pulumi.Output[str]:
        """
        The global cluster identifier.
        """
        return pulumi.get(self, "global_cluster_identifier")

    @property
    @pulumi.getter(name="globalClusterMembers")
    def global_cluster_members(self) -> pulumi.Output[Sequence['outputs.GlobalClusterGlobalClusterMember']]:
        """
        Set of objects containing Global Cluster members.
        """
        return pulumi.get(self, "global_cluster_members")

    @property
    @pulumi.getter(name="globalClusterResourceId")
    def global_cluster_resource_id(self) -> pulumi.Output[str]:
        """
        AWS Region-unique, immutable identifier for the global database cluster. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB cluster is accessed
        """
        return pulumi.get(self, "global_cluster_resource_id")

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

    @property
    @pulumi.getter(name="storageEncrypted")
    def storage_encrypted(self) -> pulumi.Output[bool]:
        return pulumi.get(self, "storage_encrypted")

    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

