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


class CassandraTable(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 autoscale_settings: Optional[pulumi.Input[pulumi.InputType['CassandraTableAutoscaleSettingsArgs']]] = None,
                 cassandra_keyspace_id: Optional[pulumi.Input[str]] = None,
                 default_ttl: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 schema: Optional[pulumi.Input[pulumi.InputType['CassandraTableSchemaArgs']]] = None,
                 throughput: Optional[pulumi.Input[int]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages a Cassandra Table within a Cosmos DB Cassandra Keyspace.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example_resource_group = azure.core.get_resource_group(name="tflex-cosmosdb-account-rg")
        example_account = azure.cosmosdb.Account("exampleAccount",
            resource_group_name=example_resource_group.name,
            location=example_resource_group.location,
            offer_type="Standard",
            capabilities=[azure.cosmosdb.AccountCapabilityArgs(
                name="EnableCassandra",
            )],
            consistency_policy=azure.cosmosdb.AccountConsistencyPolicyArgs(
                consistency_level="Strong",
            ),
            geo_locations=[azure.cosmosdb.AccountGeoLocationArgs(
                location="West US",
                failover_priority=0,
            )])
        example_cassandra_keyspace = azure.cosmosdb.CassandraKeyspace("exampleCassandraKeyspace",
            resource_group_name=example_account.resource_group_name,
            account_name=example_account.name,
            throughput=400)
        example_cassandra_table = azure.cosmosdb.CassandraTable("exampleCassandraTable",
            cassandra_keyspace_id=example_cassandra_keyspace.id,
            schema=azure.cosmosdb.CassandraTableSchemaArgs(
                columns=[
                    azure.cosmosdb.CassandraTableSchemaColumnArgs(
                        name="test1",
                        type="ascii",
                    ),
                    azure.cosmosdb.CassandraTableSchemaColumnArgs(
                        name="test2",
                        type="int",
                    ),
                ],
                partition_keys=[azure.cosmosdb.CassandraTableSchemaPartitionKeyArgs(
                    name="test1",
                )],
            ))
        ```

        ## Import

        Cosmos Cassandra Table can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:cosmosdb/cassandraTable:CassandraTable ks1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/cassandraKeyspaces/ks1/tables/table1
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] cassandra_keyspace_id: The ID of the Cosmos DB Cassandra Keyspace to create the table within. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Cosmos DB Cassandra Table. Changing this forces a new resource to be created.
        :param pulumi.Input[pulumi.InputType['CassandraTableSchemaArgs']] schema: A `schema` block as defined below. Changing this forces a new resource to be created.
        """
        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__['autoscale_settings'] = autoscale_settings
            if cassandra_keyspace_id is None and not opts.urn:
                raise TypeError("Missing required property 'cassandra_keyspace_id'")
            __props__['cassandra_keyspace_id'] = cassandra_keyspace_id
            __props__['default_ttl'] = default_ttl
            __props__['name'] = name
            if schema is None and not opts.urn:
                raise TypeError("Missing required property 'schema'")
            __props__['schema'] = schema
            __props__['throughput'] = throughput
        super(CassandraTable, __self__).__init__(
            'azure:cosmosdb/cassandraTable:CassandraTable',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            autoscale_settings: Optional[pulumi.Input[pulumi.InputType['CassandraTableAutoscaleSettingsArgs']]] = None,
            cassandra_keyspace_id: Optional[pulumi.Input[str]] = None,
            default_ttl: Optional[pulumi.Input[int]] = None,
            name: Optional[pulumi.Input[str]] = None,
            schema: Optional[pulumi.Input[pulumi.InputType['CassandraTableSchemaArgs']]] = None,
            throughput: Optional[pulumi.Input[int]] = None) -> 'CassandraTable':
        """
        Get an existing CassandraTable 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] cassandra_keyspace_id: The ID of the Cosmos DB Cassandra Keyspace to create the table within. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Cosmos DB Cassandra Table. Changing this forces a new resource to be created.
        :param pulumi.Input[pulumi.InputType['CassandraTableSchemaArgs']] schema: A `schema` block as defined below. Changing this forces a new resource to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["autoscale_settings"] = autoscale_settings
        __props__["cassandra_keyspace_id"] = cassandra_keyspace_id
        __props__["default_ttl"] = default_ttl
        __props__["name"] = name
        __props__["schema"] = schema
        __props__["throughput"] = throughput
        return CassandraTable(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="autoscaleSettings")
    def autoscale_settings(self) -> pulumi.Output[Optional['outputs.CassandraTableAutoscaleSettings']]:
        return pulumi.get(self, "autoscale_settings")

    @property
    @pulumi.getter(name="cassandraKeyspaceId")
    def cassandra_keyspace_id(self) -> pulumi.Output[str]:
        """
        The ID of the Cosmos DB Cassandra Keyspace to create the table within. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "cassandra_keyspace_id")

    @property
    @pulumi.getter(name="defaultTtl")
    def default_ttl(self) -> pulumi.Output[int]:
        return pulumi.get(self, "default_ttl")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        Specifies the name of the Cosmos DB Cassandra Table. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def schema(self) -> pulumi.Output['outputs.CassandraTableSchema']:
        """
        A `schema` block as defined below. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "schema")

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

    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

