Skip to content

Commit 5f9743e

Browse files
sicoyleyaron2
authored andcommitted
feat: add state component registrations (#3951)
Signed-off-by: Samantha Coyle <[email protected]> Co-authored-by: Yaron Schneider <[email protected]> Signed-off-by: swatimodi-scout <[email protected]>
1 parent eaf31b0 commit 5f9743e

File tree

23 files changed

+845
-26
lines changed

23 files changed

+845
-26
lines changed

conversation/echo/metadata.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: conversation
4+
name: echo
5+
version: v1
6+
status: alpha
7+
title: "Echo"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-conversation/echo/
11+
metadata: []

state/aerospike/aerospike.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import (
3434
)
3535

3636
type aerospikeMetadata struct {
37-
Hosts string
38-
Namespace string
39-
Set string // optional
37+
Hosts string `json:"hosts"`
38+
Namespace string `json:"namespace"`
39+
Set string `json:"set"` // optional
4040
}
4141

4242
var (

state/aerospike/metadata.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: state
4+
name: aerospike
5+
version: v1
6+
status: alpha
7+
title: "Aerospike"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-aerospike/
11+
metadata:
12+
- name: hosts
13+
type: string
14+
required: true
15+
description: Comma-separated list of Aerospike hosts.
16+
example: "localhost:3000,aerospike:3000"
17+
- name: namespace
18+
type: string
19+
required: true
20+
description: The Aerospike namespace.
21+
example: "test"
22+
- name: set
23+
type: string
24+
required: false
25+
description: The Aerospike set name.
26+
example: "dapr-state"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: state
4+
name: alicloud.tablestore
5+
version: v1
6+
status: alpha
7+
title: "AliCloud TableStore"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/
11+
authenticationProfiles:
12+
- title: "Access Key Authentication"
13+
description: "Authenticate using an access key"
14+
metadata:
15+
- name: accessKeyID
16+
type: string
17+
required: true
18+
description: The access key ID of the AliCloud TableStore instance.
19+
example: "my_access_key_id"
20+
- name: accessKey
21+
type: string
22+
required: true
23+
description: The access key of the AliCloud TableStore instance.
24+
example: "my_access_key"
25+
metadata:
26+
- name: endpoint
27+
type: string
28+
required: true
29+
description: The endpoint of the AliCloud TableStore instance.
30+
example: "https://tablestore.aliyuncs.com"
31+
- name: instanceName
32+
type: string
33+
required: true
34+
description: The name of the AliCloud TableStore instance.
35+
example: "my_instance"
36+
- name: tableName
37+
type: string
38+
required: true
39+
description: The name of the table to use.
40+
example: "my_table"

state/couchbase/couchbase.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ type Couchbase struct {
5757
}
5858

5959
type couchbaseMetadata struct {
60-
CouchbaseURL string
61-
Username string
62-
Password string
63-
BucketName string
64-
NumReplicasDurableReplication uint
65-
NumReplicasDurablePersistence uint
60+
CouchbaseURL string `json:"couchbaseURL"`
61+
Username string `json:"username"`
62+
Password string `json:"password"`
63+
BucketName string `json:"bucketName"`
64+
NumReplicasDurableReplication uint `json:"numReplicasDurableReplication"`
65+
NumReplicasDurablePersistence uint `json:"numReplicasDurablePersistence"`
6666
}
6767

6868
// NewCouchbaseStateStore returns a new couchbase state store.

state/couchbase/metadata.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: state
4+
name: couchbase
5+
version: v1
6+
status: alpha
7+
title: "Couchbase"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-couchbase/
11+
authenticationProfiles:
12+
- title: "Connection String"
13+
description: "Connect to Couchbase using a connection string."
14+
metadata:
15+
- name: couchbaseURL
16+
type: string
17+
required: true
18+
description: The Couchbase connection string.
19+
example: "couchbase://localhost"
20+
- name: username
21+
type: string
22+
required: true
23+
- name: password
24+
type: string
25+
required: true
26+
- name: bucketName
27+
type: string
28+
required: true
29+
description: The Couchbase bucket name.
30+
example: "default"
31+
metadata:
32+
- name: numReplicasDurableReplication
33+
type: integer
34+
required: false
35+
description: The number of replicas for durable replication.
36+
example: 1
37+
default: 0
38+
- name: numReplicasDurablePersistence
39+
type: integer
40+
required: false
41+
description: The number of replicas for durable persistence.
42+
example: 1
43+
default: 0

state/etcd/etcd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (e *Etcd) ParseClientFromConfig(etcdConfig *etcdConfig) (*clientv3.Client,
123123

124124
config := clientv3.Config{
125125
Endpoints: endpoints,
126-
DialTimeout: 5 * time.Second,
126+
DialTimeout: 5 * time.Second, // TODO: make this configurable
127127
TLS: tlsConfig,
128128
}
129129
client, err := clientv3.New(config)

state/etcd/metadata.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: state
4+
name: etcd
5+
version: v1
6+
status: alpha
7+
title: "etcd"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-etcd/
11+
authenticationProfiles:
12+
- title: "TLS Authentication"
13+
description: "Connect to etcd using TLS encryption with certificates."
14+
metadata:
15+
- name: tlsEnable
16+
type: string
17+
required: true
18+
description: Enable TLS authentication.
19+
example: "true"
20+
- name: ca
21+
type: string
22+
required: true
23+
description: CA certificate for TLS verification.
24+
example: |
25+
-----BEGIN CERTIFICATE-----
26+
XXX
27+
-----END CERTIFICATE-----
28+
- name: cert
29+
type: string
30+
required: true
31+
description: Client certificate for TLS authentication.
32+
example: |
33+
-----BEGIN CERTIFICATE-----
34+
XXX
35+
-----END CERTIFICATE-----
36+
- name: key
37+
type: string
38+
required: true
39+
description: Client private key for TLS authentication.
40+
example: |
41+
-----BEGIN PRIVATE KEY-----
42+
XXX
43+
-----END PRIVATE KEY-----
44+
metadata:
45+
- name: endpoints
46+
type: string
47+
required: true
48+
description: Comma-separated list of etcd endpoints.
49+
example: "localhost:2379"
50+
- name: keyPrefixPath
51+
type: string
52+
required: false
53+
description: The key prefix path to use.
54+
example: "my_key_prefix_path"
55+
default: ""
56+
- name: maxTxnOps
57+
type: integer
58+
required: false
59+
description: Maximum number of operations allowed in a transaction.
60+
example: 128
61+
default: 128

state/gcp/firestore/firestore.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ type Firestore struct {
4747
}
4848

4949
type firestoreMetadata struct {
50+
// TODO: update these to use camel case instead in future
51+
52+
// TODO: rm type field? It's stable component but this field is NOT used anywhere except in tests.
5053
Type string `json:"type"`
5154
ProjectID string `json:"project_id" mapstructure:"project_id"`
5255
PrivateKeyID string `json:"private_key_id" mapstructure:"private_key_id"`
@@ -219,7 +222,7 @@ func (f *Firestore) Close() error {
219222
return nil
220223
}
221224

222-
func getGCPClient(ctx context.Context, metadata *firestoreMetadata, l logger.Logger) (*datastore.Client, error) {
225+
func getGCPClient(_ context.Context, metadata *firestoreMetadata, l logger.Logger) (*datastore.Client, error) {
223226
var gcpClient *datastore.Client
224227
var err error
225228

state/gcp/firestore/metadata.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: state
4+
name: gcp.firestore
5+
version: v1
6+
status: stable
7+
title: "GCP Firestore"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-firestore/
11+
authenticationProfiles:
12+
- title: "Service Account Authentication"
13+
description: "Authenticate using a GCP service account JSON key."
14+
metadata:
15+
- name: project_id
16+
type: string
17+
required: true
18+
description: The GCP project ID.
19+
example: "my-project"
20+
- name: private_key_id
21+
type: string
22+
required: true
23+
description: The private key ID from the service account JSON.
24+
example: "abc123def456"
25+
- name: private_key
26+
type: string
27+
required: true
28+
description: The private key from the service account JSON.
29+
example: |
30+
-----BEGIN PRIVATE KEY-----
31+
XXX
32+
-----END PRIVATE KEY-----
33+
- name: client_email
34+
type: string
35+
required: true
36+
description: The client email from the service account JSON.
37+
example: "[email protected]"
38+
- name: client_id
39+
type: string
40+
required: true
41+
description: The client ID from the service account JSON.
42+
example: "123456789012345678901"
43+
- name: auth_uri
44+
type: string
45+
required: true
46+
description: The authentication URI from the service account JSON.
47+
example: "https://accounts.google.com/o/oauth2/auth"
48+
- name: token_uri
49+
type: string
50+
required: true
51+
description: The token URI from the service account JSON.
52+
example: "https://oauth2.googleapis.com/token"
53+
- name: auth_provider_x509_cert_url
54+
type: string
55+
required: true
56+
description: The auth provider certificate URL from the service account JSON.
57+
example: "https://www.googleapis.com/oauth2/v1/certs"
58+
- name: client_x509_cert_url
59+
type: string
60+
required: true
61+
description: The client certificate URL from the service account JSON.
62+
example: "https://www.googleapis.com/robot/v1/metadata/x509/firestore%40my-project.iam.gserviceaccount.com"
63+
- title: "Implicit Credentials"
64+
description: "Authenticate using implicit credentials (Application Default Credentials) for local development."
65+
metadata:
66+
- name: project_id
67+
type: string
68+
required: true
69+
description: The GCP project ID.
70+
example: "my-project"
71+
- name: endpoint
72+
type: string
73+
required: false
74+
description: The Firestore endpoint URL (for custom endpoints or emulator).
75+
example: "https://firestore.googleapis.com"
76+
metadata:
77+
- name: entity_kind
78+
type: string
79+
required: false
80+
description: The entity kind (collection name) for storing state data.
81+
example: "dapr-state"
82+
default: "DaprState"
83+
- name: type
84+
type: string
85+
required: false
86+
description: The type of service account.
87+
example: "service_account"
88+
- name: connectionEndpoint
89+
type: string
90+
required: false
91+
description: The Firestore connection endpoint.
92+
example: "https://firestore.googleapis.com"
93+
- name: noIndex
94+
type: bool
95+
required: false
96+
description: Whether to disable indexing for the entity.
97+
example: false
98+
default: false

0 commit comments

Comments
 (0)