# 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__ = ['Cluster']


class Cluster(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 broker_node_group_info: Optional[pulumi.Input[pulumi.InputType['ClusterBrokerNodeGroupInfoArgs']]] = None,
                 client_authentication: Optional[pulumi.Input[pulumi.InputType['ClusterClientAuthenticationArgs']]] = None,
                 cluster_name: Optional[pulumi.Input[str]] = None,
                 configuration_info: Optional[pulumi.Input[pulumi.InputType['ClusterConfigurationInfoArgs']]] = None,
                 encryption_info: Optional[pulumi.Input[pulumi.InputType['ClusterEncryptionInfoArgs']]] = None,
                 enhanced_monitoring: Optional[pulumi.Input[str]] = None,
                 kafka_version: Optional[pulumi.Input[str]] = None,
                 logging_info: Optional[pulumi.Input[pulumi.InputType['ClusterLoggingInfoArgs']]] = None,
                 number_of_broker_nodes: Optional[pulumi.Input[int]] = None,
                 open_monitoring: Optional[pulumi.Input[pulumi.InputType['ClusterOpenMonitoringArgs']]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages AWS Managed Streaming for Kafka cluster

        ## Example Usage

        ```python
        import pulumi
        import pulumi_aws as aws

        vpc = aws.ec2.Vpc("vpc", cidr_block="192.168.0.0/22")
        azs = aws.get_availability_zones(state="available")
        subnet_az1 = aws.ec2.Subnet("subnetAz1",
            availability_zone=azs.names[0],
            cidr_block="192.168.0.0/24",
            vpc_id=vpc.id)
        subnet_az2 = aws.ec2.Subnet("subnetAz2",
            availability_zone=azs.names[1],
            cidr_block="192.168.1.0/24",
            vpc_id=vpc.id)
        subnet_az3 = aws.ec2.Subnet("subnetAz3",
            availability_zone=azs.names[2],
            cidr_block="192.168.2.0/24",
            vpc_id=vpc.id)
        sg = aws.ec2.SecurityGroup("sg", vpc_id=vpc.id)
        kms = aws.kms.Key("kms", description="example")
        test = aws.cloudwatch.LogGroup("test")
        bucket = aws.s3.Bucket("bucket", acl="private")
        firehose_role = aws.iam.Role("firehoseRole", assume_role_policy=\"\"\"{
        "Version": "2012-10-17",
        "Statement": [
          {
            "Action": "sts:AssumeRole",
            "Principal": {
              "Service": "firehose.amazonaws.com"
            },
            "Effect": "Allow",
            "Sid": ""
          }
          ]
        }
        \"\"\")
        test_stream = aws.kinesis.FirehoseDeliveryStream("testStream",
            destination="s3",
            s3_configuration=aws.kinesis.FirehoseDeliveryStreamS3ConfigurationArgs(
                role_arn=firehose_role.arn,
                bucket_arn=bucket.arn,
            ),
            tags={
                "LogDeliveryEnabled": "placeholder",
            })
        example = aws.msk.Cluster("example",
            kafka_version="2.4.1",
            number_of_broker_nodes=3,
            broker_node_group_info=aws.msk.ClusterBrokerNodeGroupInfoArgs(
                instance_type="kafka.m5.large",
                ebs_volume_size=1000,
                client_subnets=[
                    subnet_az1.id,
                    subnet_az2.id,
                    subnet_az3.id,
                ],
                security_groups=[sg.id],
            ),
            encryption_info=aws.msk.ClusterEncryptionInfoArgs(
                encryption_at_rest_kms_key_arn=kms.arn,
            ),
            open_monitoring=aws.msk.ClusterOpenMonitoringArgs(
                prometheus=aws.msk.ClusterOpenMonitoringPrometheusArgs(
                    jmx_exporter=aws.msk.ClusterOpenMonitoringPrometheusJmxExporterArgs(
                        enabled_in_broker=True,
                    ),
                    node_exporter=aws.msk.ClusterOpenMonitoringPrometheusNodeExporterArgs(
                        enabled_in_broker=True,
                    ),
                ),
            ),
            logging_info=aws.msk.ClusterLoggingInfoArgs(
                broker_logs=aws.msk.ClusterLoggingInfoBrokerLogsArgs(
                    cloudwatch_logs=aws.msk.ClusterLoggingInfoBrokerLogsCloudwatchLogsArgs(
                        enabled=True,
                        log_group=test.name,
                    ),
                    firehose=aws.msk.ClusterLoggingInfoBrokerLogsFirehoseArgs(
                        enabled=True,
                        delivery_stream=test_stream.name,
                    ),
                    s3=aws.msk.ClusterLoggingInfoBrokerLogsS3Args(
                        enabled=True,
                        bucket=bucket.id,
                        prefix="logs/msk-",
                    ),
                ),
            ),
            tags={
                "foo": "bar",
            })
        pulumi.export("zookeeperConnectString", example.zookeeper_connect_string)
        pulumi.export("bootstrapBrokersTls", example.bootstrap_brokers_tls)
        ```

        ## Import

        MSK clusters can be imported using the cluster `arn`, e.g.

        ```sh
         $ pulumi import aws:msk/cluster:Cluster example arn:aws:kafka:us-west-2:123456789012:cluster/example/279c0212-d057-4dba-9aa9-1c4e5a25bfc7-3
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[pulumi.InputType['ClusterBrokerNodeGroupInfoArgs']] broker_node_group_info: Configuration block for the broker nodes of the Kafka cluster.
        :param pulumi.Input[pulumi.InputType['ClusterClientAuthenticationArgs']] client_authentication: Configuration block for specifying a client authentication. See below.
        :param pulumi.Input[str] cluster_name: Name of the MSK cluster.
        :param pulumi.Input[pulumi.InputType['ClusterConfigurationInfoArgs']] configuration_info: Configuration block for specifying a MSK Configuration to attach to Kafka brokers. See below.
        :param pulumi.Input[pulumi.InputType['ClusterEncryptionInfoArgs']] encryption_info: Configuration block for specifying encryption. See below.
        :param pulumi.Input[str] enhanced_monitoring: Specify the desired enhanced MSK CloudWatch monitoring level.  See [Monitoring Amazon MSK with Amazon CloudWatch](https://docs.aws.amazon.com/msk/latest/developerguide/monitoring.html)
        :param pulumi.Input[str] kafka_version: Specify the desired Kafka software version.
        :param pulumi.Input[pulumi.InputType['ClusterLoggingInfoArgs']] logging_info: Configuration block for streaming broker logs to Cloudwatch/S3/Kinesis Firehose. See below.
        :param pulumi.Input[int] number_of_broker_nodes: The desired total number of broker nodes in the kafka cluster.  It must be a multiple of the number of specified client subnets.
        :param pulumi.Input[pulumi.InputType['ClusterOpenMonitoringArgs']] open_monitoring: Configuration block for JMX and Node monitoring for the MSK cluster. See below.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the resource
        """
        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()

            if broker_node_group_info is None:
                raise TypeError("Missing required property 'broker_node_group_info'")
            __props__['broker_node_group_info'] = broker_node_group_info
            __props__['client_authentication'] = client_authentication
            __props__['cluster_name'] = cluster_name
            __props__['configuration_info'] = configuration_info
            __props__['encryption_info'] = encryption_info
            __props__['enhanced_monitoring'] = enhanced_monitoring
            if kafka_version is None:
                raise TypeError("Missing required property 'kafka_version'")
            __props__['kafka_version'] = kafka_version
            __props__['logging_info'] = logging_info
            if number_of_broker_nodes is None:
                raise TypeError("Missing required property 'number_of_broker_nodes'")
            __props__['number_of_broker_nodes'] = number_of_broker_nodes
            __props__['open_monitoring'] = open_monitoring
            __props__['tags'] = tags
            __props__['arn'] = None
            __props__['bootstrap_brokers'] = None
            __props__['bootstrap_brokers_sasl_scram'] = None
            __props__['bootstrap_brokers_tls'] = None
            __props__['current_version'] = None
            __props__['zookeeper_connect_string'] = None
        super(Cluster, __self__).__init__(
            'aws:msk/cluster:Cluster',
            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,
            bootstrap_brokers: Optional[pulumi.Input[str]] = None,
            bootstrap_brokers_sasl_scram: Optional[pulumi.Input[str]] = None,
            bootstrap_brokers_tls: Optional[pulumi.Input[str]] = None,
            broker_node_group_info: Optional[pulumi.Input[pulumi.InputType['ClusterBrokerNodeGroupInfoArgs']]] = None,
            client_authentication: Optional[pulumi.Input[pulumi.InputType['ClusterClientAuthenticationArgs']]] = None,
            cluster_name: Optional[pulumi.Input[str]] = None,
            configuration_info: Optional[pulumi.Input[pulumi.InputType['ClusterConfigurationInfoArgs']]] = None,
            current_version: Optional[pulumi.Input[str]] = None,
            encryption_info: Optional[pulumi.Input[pulumi.InputType['ClusterEncryptionInfoArgs']]] = None,
            enhanced_monitoring: Optional[pulumi.Input[str]] = None,
            kafka_version: Optional[pulumi.Input[str]] = None,
            logging_info: Optional[pulumi.Input[pulumi.InputType['ClusterLoggingInfoArgs']]] = None,
            number_of_broker_nodes: Optional[pulumi.Input[int]] = None,
            open_monitoring: Optional[pulumi.Input[pulumi.InputType['ClusterOpenMonitoringArgs']]] = None,
            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            zookeeper_connect_string: Optional[pulumi.Input[str]] = None) -> 'Cluster':
        """
        Get an existing Cluster 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: Amazon Resource Name (ARN) of the MSK Configuration to use in the cluster.
        :param pulumi.Input[str] bootstrap_brokers: A comma separated list of one or more hostname:port pairs of kafka brokers suitable to boostrap connectivity to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `PLAINTEXT` or `TLS_PLAINTEXT`.
        :param pulumi.Input[str] bootstrap_brokers_sasl_scram: A comma separated list of one or more DNS names (or IPs) and TLS port pairs kafka brokers suitable to boostrap connectivity using SASL/SCRAM to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `TLS_PLAINTEXT` or `TLS` and `client_authentication` is set to `sasl`.
        :param pulumi.Input[str] bootstrap_brokers_tls: A comma separated list of one or more DNS names (or IPs) and TLS port pairs kafka brokers suitable to boostrap connectivity to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `TLS_PLAINTEXT` or `TLS`.
        :param pulumi.Input[pulumi.InputType['ClusterBrokerNodeGroupInfoArgs']] broker_node_group_info: Configuration block for the broker nodes of the Kafka cluster.
        :param pulumi.Input[pulumi.InputType['ClusterClientAuthenticationArgs']] client_authentication: Configuration block for specifying a client authentication. See below.
        :param pulumi.Input[str] cluster_name: Name of the MSK cluster.
        :param pulumi.Input[pulumi.InputType['ClusterConfigurationInfoArgs']] configuration_info: Configuration block for specifying a MSK Configuration to attach to Kafka brokers. See below.
        :param pulumi.Input[str] current_version: Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH`
               * `encryption_info.0.encryption_at_rest_kms_key_arn` - The ARN of the KMS key used for encryption at rest of the broker data volumes.
        :param pulumi.Input[pulumi.InputType['ClusterEncryptionInfoArgs']] encryption_info: Configuration block for specifying encryption. See below.
        :param pulumi.Input[str] enhanced_monitoring: Specify the desired enhanced MSK CloudWatch monitoring level.  See [Monitoring Amazon MSK with Amazon CloudWatch](https://docs.aws.amazon.com/msk/latest/developerguide/monitoring.html)
        :param pulumi.Input[str] kafka_version: Specify the desired Kafka software version.
        :param pulumi.Input[pulumi.InputType['ClusterLoggingInfoArgs']] logging_info: Configuration block for streaming broker logs to Cloudwatch/S3/Kinesis Firehose. See below.
        :param pulumi.Input[int] number_of_broker_nodes: The desired total number of broker nodes in the kafka cluster.  It must be a multiple of the number of specified client subnets.
        :param pulumi.Input[pulumi.InputType['ClusterOpenMonitoringArgs']] open_monitoring: Configuration block for JMX and Node monitoring for the MSK cluster. See below.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the resource
        :param pulumi.Input[str] zookeeper_connect_string: A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["arn"] = arn
        __props__["bootstrap_brokers"] = bootstrap_brokers
        __props__["bootstrap_brokers_sasl_scram"] = bootstrap_brokers_sasl_scram
        __props__["bootstrap_brokers_tls"] = bootstrap_brokers_tls
        __props__["broker_node_group_info"] = broker_node_group_info
        __props__["client_authentication"] = client_authentication
        __props__["cluster_name"] = cluster_name
        __props__["configuration_info"] = configuration_info
        __props__["current_version"] = current_version
        __props__["encryption_info"] = encryption_info
        __props__["enhanced_monitoring"] = enhanced_monitoring
        __props__["kafka_version"] = kafka_version
        __props__["logging_info"] = logging_info
        __props__["number_of_broker_nodes"] = number_of_broker_nodes
        __props__["open_monitoring"] = open_monitoring
        __props__["tags"] = tags
        __props__["zookeeper_connect_string"] = zookeeper_connect_string
        return Cluster(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def arn(self) -> pulumi.Output[str]:
        """
        Amazon Resource Name (ARN) of the MSK Configuration to use in the cluster.
        """
        return pulumi.get(self, "arn")

    @property
    @pulumi.getter(name="bootstrapBrokers")
    def bootstrap_brokers(self) -> pulumi.Output[str]:
        """
        A comma separated list of one or more hostname:port pairs of kafka brokers suitable to boostrap connectivity to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `PLAINTEXT` or `TLS_PLAINTEXT`.
        """
        return pulumi.get(self, "bootstrap_brokers")

    @property
    @pulumi.getter(name="bootstrapBrokersSaslScram")
    def bootstrap_brokers_sasl_scram(self) -> pulumi.Output[str]:
        """
        A comma separated list of one or more DNS names (or IPs) and TLS port pairs kafka brokers suitable to boostrap connectivity using SASL/SCRAM to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `TLS_PLAINTEXT` or `TLS` and `client_authentication` is set to `sasl`.
        """
        return pulumi.get(self, "bootstrap_brokers_sasl_scram")

    @property
    @pulumi.getter(name="bootstrapBrokersTls")
    def bootstrap_brokers_tls(self) -> pulumi.Output[str]:
        """
        A comma separated list of one or more DNS names (or IPs) and TLS port pairs kafka brokers suitable to boostrap connectivity to the kafka cluster. Only contains value if `client_broker` encryption in transit is set to `TLS_PLAINTEXT` or `TLS`.
        """
        return pulumi.get(self, "bootstrap_brokers_tls")

    @property
    @pulumi.getter(name="brokerNodeGroupInfo")
    def broker_node_group_info(self) -> pulumi.Output['outputs.ClusterBrokerNodeGroupInfo']:
        """
        Configuration block for the broker nodes of the Kafka cluster.
        """
        return pulumi.get(self, "broker_node_group_info")

    @property
    @pulumi.getter(name="clientAuthentication")
    def client_authentication(self) -> pulumi.Output[Optional['outputs.ClusterClientAuthentication']]:
        """
        Configuration block for specifying a client authentication. See below.
        """
        return pulumi.get(self, "client_authentication")

    @property
    @pulumi.getter(name="clusterName")
    def cluster_name(self) -> pulumi.Output[str]:
        """
        Name of the MSK cluster.
        """
        return pulumi.get(self, "cluster_name")

    @property
    @pulumi.getter(name="configurationInfo")
    def configuration_info(self) -> pulumi.Output[Optional['outputs.ClusterConfigurationInfo']]:
        """
        Configuration block for specifying a MSK Configuration to attach to Kafka brokers. See below.
        """
        return pulumi.get(self, "configuration_info")

    @property
    @pulumi.getter(name="currentVersion")
    def current_version(self) -> pulumi.Output[str]:
        """
        Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH`
        * `encryption_info.0.encryption_at_rest_kms_key_arn` - The ARN of the KMS key used for encryption at rest of the broker data volumes.
        """
        return pulumi.get(self, "current_version")

    @property
    @pulumi.getter(name="encryptionInfo")
    def encryption_info(self) -> pulumi.Output[Optional['outputs.ClusterEncryptionInfo']]:
        """
        Configuration block for specifying encryption. See below.
        """
        return pulumi.get(self, "encryption_info")

    @property
    @pulumi.getter(name="enhancedMonitoring")
    def enhanced_monitoring(self) -> pulumi.Output[Optional[str]]:
        """
        Specify the desired enhanced MSK CloudWatch monitoring level.  See [Monitoring Amazon MSK with Amazon CloudWatch](https://docs.aws.amazon.com/msk/latest/developerguide/monitoring.html)
        """
        return pulumi.get(self, "enhanced_monitoring")

    @property
    @pulumi.getter(name="kafkaVersion")
    def kafka_version(self) -> pulumi.Output[str]:
        """
        Specify the desired Kafka software version.
        """
        return pulumi.get(self, "kafka_version")

    @property
    @pulumi.getter(name="loggingInfo")
    def logging_info(self) -> pulumi.Output[Optional['outputs.ClusterLoggingInfo']]:
        """
        Configuration block for streaming broker logs to Cloudwatch/S3/Kinesis Firehose. See below.
        """
        return pulumi.get(self, "logging_info")

    @property
    @pulumi.getter(name="numberOfBrokerNodes")
    def number_of_broker_nodes(self) -> pulumi.Output[int]:
        """
        The desired total number of broker nodes in the kafka cluster.  It must be a multiple of the number of specified client subnets.
        """
        return pulumi.get(self, "number_of_broker_nodes")

    @property
    @pulumi.getter(name="openMonitoring")
    def open_monitoring(self) -> pulumi.Output[Optional['outputs.ClusterOpenMonitoring']]:
        """
        Configuration block for JMX and Node monitoring for the MSK cluster. See below.
        """
        return pulumi.get(self, "open_monitoring")

    @property
    @pulumi.getter
    def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
        """
        A map of tags to assign to the resource
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter(name="zookeeperConnectString")
    def zookeeper_connect_string(self) -> pulumi.Output[str]:
        """
        A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster.
        """
        return pulumi.get(self, "zookeeper_connect_string")

    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

