Skip to content

Commit b11b6da

Browse files
sicoyleyaron2
andauthored
feat: add binding metadata files plus fixes (#3950)
Signed-off-by: Samantha Coyle <[email protected]> Co-authored-by: Yaron Schneider <[email protected]>
1 parent 42b3cee commit b11b6da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1730
-64
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: bindings
4+
name: alicloud.dingtalk.webhook
5+
version: v1
6+
status: alpha
7+
title: "AliCloud DingTalk Webhook"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/alicloud-dingtalk/
11+
binding:
12+
output: true
13+
input: true
14+
operations:
15+
- name: create
16+
description: "Send a message to DingTalk webhook"
17+
- name: read
18+
description: "Receive messages from DingTalk webhook"
19+
metadata:
20+
- name: id
21+
required: true
22+
description: "The webhook ID"
23+
example: "your-webhook-id"
24+
- name: url
25+
required: true
26+
description: "The webhook URL"
27+
example: '"https://oapi.dingtalk.com/robot/send?access_token=your-token"'
28+
- name: secret
29+
required: false
30+
description: "The webhook secret for signature verification"
31+
example: "your-webhook-secret"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: bindings
4+
name: alicloud.oss
5+
version: v1
6+
status: alpha
7+
title: "AliCloud Object Storage Service (OSS)"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/oss/
11+
binding:
12+
output: true
13+
input: false
14+
operations:
15+
- name: create
16+
description: "Upload file to OSS"
17+
authenticationProfiles:
18+
- title: "AliCloud Access Key Authentication"
19+
description: |
20+
Authenticate using AliCloud access key credentials.
21+
metadata:
22+
- name: accessKeyID
23+
required: false
24+
description: "The AliCloud access key ID"
25+
example: '"your-access-key-id"'
26+
sensitive: true
27+
- name: accessKeySecret
28+
required: false
29+
sensitive: true
30+
description: "The AliCloud access key secret"
31+
example: '"your-access-key-secret"'
32+
- name: accessKey
33+
required: false
34+
description: "The AliCloud access key"
35+
example: "access-key"
36+
metadata:
37+
- name: endpoint
38+
required: true
39+
description: "The OSS endpoint"
40+
example: "https://oss-cn-hangzhou.aliyuncs.com"
41+
- name: bucket
42+
required: true
43+
description: "The OSS bucket name"
44+
example: "your-bucket-name"
45+
- name: objectKey
46+
required: true
47+
description: "The object key in the bucket"
48+
example: "path/to/file.txt"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: bindings
4+
name: alicloud.sls
5+
version: v1
6+
status: alpha
7+
title: "AliCloud Simple Log Storage (SLS)"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/alicloudsls/
11+
binding:
12+
output: true
13+
input: false
14+
operations:
15+
- name: create
16+
description: "Send logs to SLS"
17+
authenticationProfiles:
18+
- title: "Access Key Authentication"
19+
description: |
20+
Authenticate using AliCloud access key credentials.
21+
metadata:
22+
- name: accessKeyID
23+
required: false
24+
sensitive: true
25+
description: "The AliCloud access key ID"
26+
example: "your-access-key-id"
27+
- name: accessKeySecret
28+
required: false
29+
sensitive: true
30+
description: "The AliCloud access key secret"
31+
example: "your-access-key-secret"
32+
metadata:
33+
- name: endpoint
34+
required: true
35+
description: "The SLS endpoint"
36+
example: "https://your-project.cn-hangzhou.log.aliyuncs.com"
37+
- name: project
38+
required: true
39+
description: "The SLS project name"
40+
example: '"your-project-name"'
41+
- name: logstore
42+
required: true
43+
description: "The SLS logstore name"
44+
example: "your-logstore-name"
45+
- name: topic
46+
required: true
47+
description: "The SLS topic name"
48+
example: "your-topic-name"
49+
- name: source
50+
required: true
51+
description: "The SLS source name"
52+
example: "your-source-name"

bindings/alicloud/sls/sls.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func NewAliCloudSlsLogstorage(logger logger.Logger) bindings.OutputBinding {
6060

6161
func (s *AliCloudSlsLogstorage) Invoke(ctx context.Context, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error) {
6262
// verify the metadata property
63+
// TODO: move these to the struct with proper tags
6364
if logProject := req.Metadata["project"]; logProject == "" {
6465
return nil, errors.New("SLS binding error: project property not supplied")
6566
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
# yaml-language-server: $schema=../../../component-metadata-schema.json
3+
schemaVersion: v1
4+
type: bindings
5+
name: alicloud.tablestore
6+
version: v1
7+
status: stable
8+
title: "AliCloud Table Store"
9+
urls:
10+
- title: Reference
11+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/alicloudtablestore/
12+
binding:
13+
output: true
14+
input: false
15+
operations:
16+
- name: create
17+
description: "Write data to Table Store"
18+
authenticationProfiles:
19+
- title: "Access Key Authentication"
20+
description: |
21+
Authenticate using AliCloud access key credentials.
22+
metadata:
23+
- name: accessKeyID
24+
required: true
25+
description: "The AliCloud access key ID"
26+
example: "access-key-id"
27+
- name: accessKeySecret
28+
required: true
29+
sensitive: true
30+
description: "The AliCloud access key secret"
31+
example: "access-key-secret"
32+
- name: accessKey
33+
required: true
34+
description: "The AliCloud access key"
35+
example: "access-key"
36+
metadata:
37+
- name: endpoint
38+
required: true
39+
description: "The Table Store endpoint"
40+
example: '"https://your-instance.cn-hangzhou.ots.aliyuncs.com"'
41+
- name: instanceName
42+
required: true
43+
description: "The Table Store instance name"
44+
example: "instance-name"
45+
- name: tableName
46+
required: true
47+
description: "The table name to write to"
48+
example: "table-name"

bindings/alicloud/tablestore/tablestore.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (s *AliCloudTableStore) get(req *bindings.InvokeRequest, resp *bindings.Inv
137137
pkNames := strings.Split(req.Metadata[primaryKeys], ",")
138138
pks := make([]*tablestore.PrimaryKeyColumn, len(pkNames))
139139

140-
data := make(map[string]interface{})
140+
data := make(map[string]any)
141141
err := json.Unmarshal(req.Data, &data)
142142
if err != nil {
143143
return err
@@ -313,7 +313,7 @@ func (s *AliCloudTableStore) unmarshal(pks []*tablestore.PrimaryKeyColumn, colum
313313
return nil, nil
314314
}
315315

316-
data := make(map[string]interface{})
316+
data := make(map[string]any)
317317

318318
for _, pk := range pks {
319319
data[pk.ColumnName] = pk.Value

bindings/apns/apns.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
kitmd "github.com/dapr/kit/metadata"
3434
)
3535

36+
// TODO: these should be configured in the metadata.yaml file and be part of the metadata struct with proper json tags.
3637
const (
3738
collapseIDKey = "apns-collapse-id"
3839
developmentKey = "development"
@@ -67,6 +68,7 @@ type APNS struct {
6768
authorizationBuilder *authorizationBuilder
6869
}
6970

71+
// TODO: use proper tags
7072
type APNSmetadata struct {
7173
Development bool `mapstructure:"development"`
7274
KeyID string `mapstructure:"key-id"`

bindings/apns/metadata.yaml

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: bindings
4+
name: apns
5+
version: v1
6+
status: alpha
7+
title: "Apple Push Notification Service (APNS)"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/apns/
11+
binding:
12+
output: true
13+
input: false
14+
operations:
15+
- name: create
16+
description: "Send push notification via APNS"
17+
authenticationProfiles:
18+
- title: "APNS Key Authentication"
19+
description: |
20+
Authenticate using APNS key credentials.
21+
metadata:
22+
- name: key-id
23+
required: true
24+
description: "The APNS key ID"
25+
example: "ABC123DEF4"
26+
- name: team-id
27+
required: true
28+
description: "The APNS team ID"
29+
example: "DEF123GHI4"
30+
- name: private-key
31+
required: true
32+
sensitive: true
33+
description: "The APNS private key (P8 file content)"
34+
metadata:
35+
- name: development
36+
type: boolean
37+
required: false
38+
description: "The APNS environment is development or not"
39+
example: true
40+
default: false

bindings/aws/dynamodb/dynamodb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type DynamoDB struct {
3636
logger logger.Logger
3737
}
3838

39+
// TODO: the metadata fields need updating to use the builtin aws auth provider fully and reflect in metadata.yaml
3940
type dynamoDBMetadata struct {
4041
Region string `json:"region" mapstructure:"region"`
4142
Endpoint string `json:"endpoint" mapstructure:"endpoint"`
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# yaml-language-server: $schema=../../../component-metadata-schema.json
2+
schemaVersion: v1
3+
type: bindings
4+
name: aws.dynamodb
5+
version: v1
6+
status: stable
7+
title: "AWS DynamoDB"
8+
urls:
9+
- title: Reference
10+
url: https://docs.dapr.io/reference/components-reference/supported-bindings/dynamodb/
11+
binding:
12+
output: true
13+
input: false
14+
operations:
15+
- name: create
16+
description: "Write item to DynamoDB table"
17+
authenticationProfiles:
18+
- title: "AWS Access Key Authentication"
19+
description: |
20+
Authenticate using AWS access key credentials.
21+
metadata:
22+
- name: accessKey
23+
required: true
24+
description: "The AWS access key"
25+
example: "AKIAIOSFODNN7EXAMPLE"
26+
- name: secretKey
27+
required: true
28+
sensitive: true
29+
description: "The AWS secret key"
30+
example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
31+
- name: sessionToken
32+
required: false
33+
sensitive: true
34+
description: "The AWS session token"
35+
example: "TOKEN"
36+
- name: region
37+
required: true
38+
description: "The AWS region"
39+
example: "us-east-1"
40+
metadata:
41+
- name: table
42+
required: true
43+
description: "The DynamoDB table name"
44+
example: "my-table"
45+
- name: endpoint
46+
required: false
47+
description: "The DynamoDB endpoint URL"
48+
example: "http://localhost:8000"

0 commit comments

Comments
 (0)