# Apache Cassandra

Type: `state.cassandra`

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-cassandra/

## Example

```
apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
  name: <name>
spec:
  type: state.cassandra
  version: v1
  metadata:
    # The password of the user.
    - name: password
      value: "password"
    # The username of the database user.
    - name: username
      value: "admin"
    # Comma separated list of the hosts.
    - name: hosts
      value: "cassandra.cassandra.svc.cluster.local,other.cassandra.example.tld"
    # The consistency value to use. (Optional)
    #- name: consistency
    #  value: "All"
    # Enables host verification. Secures the traffic between client server with TLS. (Optional)
    #- name: enableHostVerification
    #  value: "false"
    # Prefix added to keys in the state store. (Optional)
    #- name: keyPrefix
    #  value: "appid"
    # The Cassandra keyspace to use. (Optional)
    #- name: keyspace
    #  value: "dapr"
    # Port for communication. (Optional)
    #- name: port
    #  value: "9042"
    # The proto version for the client. (Optional)
    #- name: protoVersion
    #  value: "4"
    # The replication factor for the calls. (Optional)
    #- name: replicationFactor
    #  value: "1"
    # The name of the table to use. (Optional)
    #- name: table
    #  value: "items"

```

## Authentication profiles

Available authentication profiles:

- Username and password

### Username and password

Authenticate using username and password.

#### `password` (string)

**Required** - The password of the user.

Example value: `password`

#### `username` (string)

**Required** - The username of the database user.

Example value: `admin`

## Metadata

### `hosts` (string)

**Required** - Comma separated list of the hosts.

Example value: `cassandra.cassandra.svc.cluster.local,other.cassandra.example.tld`

### `consistency` (string)

The consistency value to use.

Default value: `All`

Example value: `Three`

Allowed values:

- Any

- One

- Two

- Three

- Quorum

- All

- LocalQuorum

- EachQuorum

- LocalOne

### `enableHostVerification` (bool)

Enables host verification. Secures the traffic between client server with TLS.

Default value: `false`

Example value: `true`

### `keyPrefix` (string)

Prefix added to keys in the state store.

Default value: `appid`

Example value: `appid`

Allowed values:

- appid

- name

- none

Documentation: https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state/

### `keyspace` (string)

The Cassandra keyspace to use.

Default value: `dapr`

Example value: `alt`

### `port` (number)

Port for communication.

Default value: `9042`

Example value: `8080`

### `protoVersion` (number)

The proto version for the client.

Default value: `4`

Example value: `3`

### `replicationFactor` (number)

The replication factor for the calls.

Default value: `1`

Example value: `3`

### `table` (string)

The name of the table to use.

Default value: `items`

Example value: `orders`
