Skip to content

Commit

Permalink
Merge branch 'master' into comp-md-bindings.gcp.bucket-2573
Browse files Browse the repository at this point in the history
  • Loading branch information
robertojrojas authored Aug 2, 2023
2 parents b6f9f9f + 566c7fd commit b9ea272
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 4 deletions.
15 changes: 14 additions & 1 deletion bindings/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"math"
"net/url"
"reflect"
"strconv"
"sync"
Expand Down Expand Up @@ -464,8 +465,20 @@ func (r *RabbitMQ) handleMessage(ctx context.Context, handler bindings.Handler,
r.logger.Info("Input binding channel closed")
return
}

metadata := make(map[string]string, len(d.Headers))
// Passthrough any custom metadata to the handler.
for k, v := range d.Headers {
if s, ok := v.(string); ok {
// Escape the key and value to ensure they are valid URL query parameters.
// This is necessary for them to be sent as HTTP Metadata.
metadata[url.QueryEscape(k)] = url.QueryEscape(s)
}
}

_, err := handler(ctx, &bindings.ReadResponse{
Data: d.Body,
Data: d.Body,
Metadata: metadata,
})
if err != nil {
ch.Nack(d.DeliveryTag, false, true)
Expand Down
8 changes: 5 additions & 3 deletions state/aws/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ type StateStore struct {
}

type dynamoDBMetadata struct {
// Ignored by metadata parser because included in built-in authentication profile
AccessKey string `json:"accessKey" mapstructure:"accessKey" mdignore:"true"`
SecretKey string `json:"secretKey" mapstructure:"secretKey" mdignore:"true"`
SessionToken string `json:"sessionToken" mapstructure:"sessionToken" mdignore:"true"`

Region string `json:"region"`
Endpoint string `json:"endpoint"`
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
SessionToken string `json:"sessionToken"`
Table string `json:"table"`
TTLAttributeName string `json:"ttlAttributeName"`
PartitionKey string `json:"partitionKey"`
Expand Down
59 changes: 59 additions & 0 deletions state/aws/dynamodb/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# yaml-language-server: $schema=../../../component-metadata-schema.json
schemaVersion: v1
type: state
name: aws.dynamodb
version: v1
status: stable
title: "AWS DynamoDB"
urls:
- title: Reference
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-dynamodb/
capabilities:
- crud
- transactional
- etag
- ttl
- actorStateStore
builtinAuthenticationProfiles:
- name: "aws"
metadata:
- name: table
required: true
description: |
The name of the DynamoDB table to use.
example: '"Contracts"'
type: string
- name: region
required: false
description: |
The AWS region to use. Ensure that DynamoDB is available in that region.
See the `Amazon DynamoDB endpoints and quotas` documentation.
url:
title: Amazon DynamoDB endpoints and quotas
url: https://docs.aws.amazon.com/general/latest/gr/ddb.html
example: '"us-east-1"'
type: string
- name: endpoint
required: false
description: |
AWS endpoint for the component to use. Only used for local development.
The endpoint is not necessary when running against production AWS.
example: '"http://localhost:4566"'
type: string
- name: ttlAttributeName
required: false
description: |
The table attribute name which should be used for TTL.
example: '"expiresAt"'
type: string
- name: partitionKey
required: false
description: |
The table primary key or partition key attribute name.
This field is used to replace the default primary key attribute name "key".
url:
title: More details
url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-dynamodb/#partition-keys
example: '"ContractID"'
type: string

0 comments on commit b9ea272

Please sign in to comment.