From f89c5afdce26983f78b53b429518d7973dc3c518 Mon Sep 17 00:00:00 2001 From: "Alessandro (Ale) Segala" <43508+ItalyPaleAle@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:15:48 -0700 Subject: [PATCH 1/3] Metadata: add other built-in properties for pubsub (#3009) Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> --- .build-tools/pkg/metadataschema/validators.go | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.build-tools/pkg/metadataschema/validators.go b/.build-tools/pkg/metadataschema/validators.go index 88b026e690..77fd894875 100644 --- a/.build-tools/pkg/metadataschema/validators.go +++ b/.build-tools/pkg/metadataschema/validators.go @@ -153,6 +153,46 @@ func (c *ComponentMetadata) AppendBuiltin() error { URL: "https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-namespace/", }, }, + Metadata{ + Name: "allowedTopics", + Type: "string", + Description: "A comma-separated list of allowed topics for all applications. If empty (default) apps can publish and subscribe to all topics, notwithstanding `publishingScopes` and `subscriptionScopes`.", + Example: `"app1=topic1;app2=topic2,topic3"`, + URL: &URL{ + Title: "Documentation", + URL: "https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/", + }, + }, + Metadata{ + Name: "publishingScopes", + Type: "string", + Description: "A semicolon-separated list of applications and comma-separated topic lists, allowing that app to publish to that list of topics. If empty (default), apps can publish to all topics.", + Example: `"app1=topic1;app2=topic2,topic3;app3="`, + URL: &URL{ + Title: "Documentation", + URL: "https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/", + }, + }, + Metadata{ + Name: "subscriptionScopes", + Type: "string", + Description: "A semicolon-separated list of applications and comma-separated topic lists, allowing that app to subscribe to that list of topics. If empty (default), apps can subscribe to all topics.", + Example: `"app1=topic1;app2=topic2,topic3"`, + URL: &URL{ + Title: "Documentation", + URL: "https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/", + }, + }, + Metadata{ + Name: "protectedTopics", + Type: "string", + Description: `A comma-separated list of topics marked as "protected" for all applications. If a topic is marked as protected then an application must be explicitly granted publish or subscribe permissions through 'publishingScopes' or 'subscriptionScopes' to publish or subscribe to it.`, + Example: `"topic1,topic2"`, + URL: &URL{ + Title: "Documentation", + URL: "https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-scopes/", + }, + }, ) case mdutils.BindingType: if c.Binding != nil { @@ -176,7 +216,7 @@ func (c *ComponentMetadata) AppendBuiltin() error { Name: bindingDirectionMetadataKey, Type: "string", Description: "Indicates the direction of the binding component.", - Example: `"`+direction+`"`, + Example: `"` + direction + `"`, URL: &URL{ Title: "Documentation", URL: "https://docs.dapr.io/reference/api/bindings_api/#binding-direction-optional", From c75005582b3fbee6a00b82fade2a8a0300af41f7 Mon Sep 17 00:00:00 2001 From: "Alessandro (Ale) Segala" <43508+ItalyPaleAle@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:02:39 -0700 Subject: [PATCH 2/3] Add metadata.yaml for in-memory state store (#2991) Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> Co-authored-by: Bernd Verst --- pubsub/in-memory/metadata.yaml | 4 ++-- state/in-memory/metadata.yaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 state/in-memory/metadata.yaml diff --git a/pubsub/in-memory/metadata.yaml b/pubsub/in-memory/metadata.yaml index ff9b77dc89..94383c6571 100644 --- a/pubsub/in-memory/metadata.yaml +++ b/pubsub/in-memory/metadata.yaml @@ -3,8 +3,8 @@ schemaVersion: v1 type: pubsub name: in-memory version: v1 -status: beta -title: "In-Memory" +status: stable +title: "In-memory" urls: - title: Reference url: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-inmemory/ diff --git a/state/in-memory/metadata.yaml b/state/in-memory/metadata.yaml new file mode 100644 index 0000000000..1036664e2c --- /dev/null +++ b/state/in-memory/metadata.yaml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=../../component-metadata-schema.json +schemaVersion: v1 +type: state +name: in-memory +version: v1 +status: stable +title: "In-memory" +urls: + - title: Reference + url: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-inmemory/ +metadata: [] \ No newline at end of file From 06ab704e1142ee269e8c442f1af2c52c76a83b01 Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Tue, 25 Jul 2023 11:00:41 -0700 Subject: [PATCH 3/3] Update pubsub/pulsar/pulsar_test.go Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com> Signed-off-by: Yaron Schneider --- pubsub/pulsar/pulsar_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubsub/pulsar/pulsar_test.go b/pubsub/pulsar/pulsar_test.go index 28c5ce413f..7a9cacd2bc 100644 --- a/pubsub/pulsar/pulsar_test.go +++ b/pubsub/pulsar/pulsar_test.go @@ -89,7 +89,7 @@ func TestParsePulsarSchemaMetadata(t *testing.T) { } meta, err := parsePulsarMetadata(m) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "a", meta.Host) assert.Len(t, meta.internalTopicSchemas, 2) assert.Equal(t, "1", meta.internalTopicSchemas["obiwan"].value)