From 159ed42fc782cd8438e9223b7131d8a81d308eb1 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Thu, 4 Feb 2021 20:56:51 -0800 Subject: [PATCH 01/13] Add copy button --- daprdocs/assets/scss/_code.scss | 48 ++++++++++++++++-- daprdocs/layouts/partials/hooks/body-end.html | 4 +- daprdocs/static/js/copy-code-button.js | 49 +++++++++++++++++++ 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 daprdocs/static/js/copy-code-button.js diff --git a/daprdocs/assets/scss/_code.scss b/daprdocs/assets/scss/_code.scss index e986bca01..1c20542c6 100644 --- a/daprdocs/assets/scss/_code.scss +++ b/daprdocs/assets/scss/_code.scss @@ -1,14 +1,53 @@ // Code formatting. +.copy-code-button { + color: #272822; + background-color: #FFF; + border-color: #0D2192; + border: 2px solid; + border-radius: 3px 3px 0px 0px; + + /* right-align */ + display: block; + margin-left: auto; + margin-right: 0; + + margin-bottom: -2px; + padding: 3px 8px; + font-size: 0.8em; +} + +.copy-code-button:hover { + cursor: pointer; + background-color: #F2F2F2; +} + +.copy-code-button:focus { + /* Avoid an ugly focus outline on click in Chrome, + but darken the button for accessibility. + See https://stackoverflow.com/a/25298082/1481479 */ + background-color: #E6E6E6; + outline: 0; +} + +.copy-code-button:active { + background-color: #D9D9D9; +} + +.highlight pre { + /* Avoid pushing up the copy buttons. */ + margin: 0; +} + .td-content { // Highlighted code. .highlight { @extend .card; - margin: 2rem 0; - padding: 0; + margin: 0rem 0; + padding: 0rem; - max-width: 80%; + max-width: 100%; pre { margin: 0; @@ -37,7 +76,8 @@ word-wrap: normal; background-color: $gray-100; padding: $spacer; - + + max-width: 100%; > code { background-color: inherit !important; diff --git a/daprdocs/layouts/partials/hooks/body-end.html b/daprdocs/layouts/partials/hooks/body-end.html index 278f120d4..2d5af7014 100644 --- a/daprdocs/layouts/partials/hooks/body-end.html +++ b/daprdocs/layouts/partials/hooks/body-end.html @@ -14,4 +14,6 @@ debug: false, }); -{{ end }} \ No newline at end of file +{{ end }} + + \ No newline at end of file diff --git a/daprdocs/static/js/copy-code-button.js b/daprdocs/static/js/copy-code-button.js new file mode 100644 index 000000000..579d25148 --- /dev/null +++ b/daprdocs/static/js/copy-code-button.js @@ -0,0 +1,49 @@ +function addCopyButtons(clipboard) { + document.querySelectorAll('pre > code').forEach(function(codeBlock) { + var button = document.createElement('button'); + button.className = 'copy-code-button'; + button.type = 'button'; + button.innerText = 'Copy'; + + button.addEventListener('click', function() { + clipboard.writeText(codeBlock.textContent).then( + function() { + button.blur(); + + button.innerText = 'Copied!'; + setTimeout(function() { + button.innerText = 'Copy'; + }, 2000); + }, + function(error) { + button.innerText = 'Error'; + console.error(error); + } + ); + }); + + var pre = codeBlock.parentNode; + if (pre.parentNode.classList.contains('highlight')) { + var highlight = pre.parentNode; + highlight.parentNode.insertBefore(button, highlight); + } else { + pre.parentNode.insertBefore(button, pre); + } + }); +} + +if (navigator && navigator.clipboard) { + addCopyButtons(navigator.clipboard); +} else { + var script = document.createElement('script'); + script.src = + 'https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.7.0/clipboard-polyfill.promise.js'; + script.integrity = 'sha256-waClS2re9NUbXRsryKoof+F9qc1gjjIhc2eT7ZbIv94='; + script.crossOrigin = 'anonymous'; + + script.onload = function() { + addCopyButtons(clipboard); + }; + + document.body.appendChild(script); +} From 852f43a44d60eaba58b2dd38706fc88c6c004e1c Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Thu, 4 Feb 2021 21:20:01 -0800 Subject: [PATCH 02/13] Add blank search page to disable docsy search --- daprdocs/assets/js/search.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 daprdocs/assets/js/search.js diff --git a/daprdocs/assets/js/search.js b/daprdocs/assets/js/search.js new file mode 100644 index 000000000..844c89006 --- /dev/null +++ b/daprdocs/assets/js/search.js @@ -0,0 +1 @@ +// Intentionally blank \ No newline at end of file From 713075b5da65be6020dbc01b80321e86c3d1c45d Mon Sep 17 00:00:00 2001 From: Patrick de Mooij Date: Mon, 8 Feb 2021 16:37:39 +0100 Subject: [PATCH 03/13] fixed typo in Service invocation overview (#1170) --- .../service-invocation/service-invocation-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/service-invocation/service-invocation-overview.md b/daprdocs/content/en/developing-applications/building-blocks/service-invocation/service-invocation-overview.md index 324fc3711..08716e04d 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/service-invocation/service-invocation-overview.md +++ b/daprdocs/content/en/developing-applications/building-blocks/service-invocation/service-invocation-overview.md @@ -108,7 +108,7 @@ The diagram below shows sequence 1-7 again on a local machine showing the API ca 4. The Node.js app's sidecar forwards the request to the Node.js app. The Node.js app performs its business logic, logging the incoming message and then persist the order ID into Redis (not shown in the diagram) 5. The Node.js app sends a response to the Python app through the Node.js sidecar. 6. Dapr forwards the response to the Python Dapr sidecar -7. The Python app receives the resposne. +7. The Python app receives the response. ## Next steps From f4a46c981a99cc6c8bafdaa51076b06cc772568b Mon Sep 17 00:00:00 2001 From: Ori Zohar Date: Mon, 8 Feb 2021 15:58:00 -0800 Subject: [PATCH 04/13] Update _index.md --- .../building-blocks/observability/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/observability/_index.md b/daprdocs/content/en/developing-applications/building-blocks/observability/_index.md index eb6891d61..3ac52e0fd 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/observability/_index.md +++ b/daprdocs/content/en/developing-applications/building-blocks/observability/_index.md @@ -6,4 +6,4 @@ weight: 60 description: See and measure the message calls across components and networked services --- -This section includes guides for developers in the context of observability. See other sections for a [general overview of the observability concept]({{< ref observability >}}) in Dapr and for [operations guidance on monitoring]({{< ref monitoring >}}). +This section includes guides for developers in the context of observability. See other sections for a [general overview of the observability concept]({{< ref observability-concept >}}) in Dapr and for [operations guidance on monitoring]({{< ref monitoring >}}). From a242b7a16af1310a5cb8f1725350cc25e6c2c1a4 Mon Sep 17 00:00:00 2001 From: yaron2 Date: Mon, 8 Feb 2021 17:14:14 -0800 Subject: [PATCH 05/13] add kafka max message size and partition key data --- .../supported-bindings/kafka.md | 8 ++++--- .../supported-pubsub/setup-apache-kafka.md | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/kafka.md b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/kafka.md index 4c845a8e1..b0cc5cc8e 100644 --- a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/kafka.md +++ b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/kafka.md @@ -27,10 +27,12 @@ spec: value: topic3 - name: authRequired # Required. default: "true" value: "false" - - name: saslUsername # Optional. + - name: saslUsername # Optional. value: "user" - - name: saslPassword # Optional. + - name: saslPassword # Optional. value: "password" + - name: maxMessageBytes # Optional. + value: 1024 ``` - `topics` is a comma separated string of topics for an input binding. @@ -39,7 +41,7 @@ spec: - `publishTopic` is the topic to publish for an output binding. - `authRequired` determines whether to use SASL authentication or not. - `saslUsername` is the SASL username for authentication. Only used if `authRequired` is set to - `"true"`. -- `saslPassword` is the SASL password for authentication. Only used if `authRequired` is set to - `"true"`. +- `maxMessageBytes` is the maximum message size allowed for a single Kafka message. Default is 1024. {{% alert title="Warning" color="warning" %}} The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}). diff --git a/daprdocs/content/en/operations/components/setup-pubsub/supported-pubsub/setup-apache-kafka.md b/daprdocs/content/en/operations/components/setup-pubsub/supported-pubsub/setup-apache-kafka.md index 0e75d4451..e2907b6ce 100644 --- a/daprdocs/content/en/operations/components/setup-pubsub/supported-pubsub/setup-apache-kafka.md +++ b/daprdocs/content/en/operations/components/setup-pubsub/supported-pubsub/setup-apache-kafka.md @@ -28,6 +28,8 @@ spec: value: "adminuser" - name: saslPassword value: "KeFg23!" + - name: maxMessageBytes + value: 1024 ``` {{% alert title="Warning" color="warning" %}} @@ -42,7 +44,27 @@ The above example uses secrets as plain strings. It is recommended to use a secr | authRequired | N | Enable authentication on the Kafka broker. Defaults to `"false"`. |`"true"`, `"false"` | saslUsername | N | Username used for authentication. Only required if authRequired is set to true. | `"adminuser"` | saslPassword | N | Password used for authentication. Can be `secretKeyRef` to use a secret reference. Only required if authRequired is set to true. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}) | `""`, `"KeFg23!"` +| maxMessageBytes | N | The maximum message size allowed for a single Kafka message. Default is 1024. | `2048` +## Per-call metadata fields + +### Partition Key + +When invoking the Kafka pub/sub, its possible to provide an optional partition key by using the `metadata` query param in the request url. + +The param name is `partitionKey`. + +Example: + +```shell +curl -X POST http://localhost:3500/v1.0/publish/myKafka/myTopic?metadata.partitionKey=key1 \ + -H "Content-Type: application/json" \ + -d '{ + "data": { + "message": "Hi" + } + }' +``` ## Create a Kafka instance {{< tabs "Self-Hosted" "Kubernetes">}} From 1009cfdccaa048226f22768b4373ff5a91214d98 Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Wed, 10 Feb 2021 09:13:43 -0800 Subject: [PATCH 06/13] Add alicloud oss output binding (#1180) * add alicloud oss output binding * split alicloud oss to alibaba cloud section * typo * remove redundant text * Update to new format * Update yaml Co-authored-by: Aaron Crawfis --- .../supported-bindings/_index.md | 6 + .../supported-bindings/alicloudoss.md | 106 ++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 daprdocs/content/en/operations/components/setup-bindings/supported-bindings/alicloudoss.md diff --git a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/_index.md b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/_index.md index 79429ce92..a224d1c86 100644 --- a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/_index.md +++ b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/_index.md @@ -28,6 +28,12 @@ Every binding has its own unique set of properties. Click the name link to see t | [Twitter]({{< ref twitter.md >}}) | ✅ | ✅ | Alpha | | [SendGrid]({{< ref sendgrid.md >}}) | | ✅ | Alpha | +### Alibaba Cloud + +| Name | Input
Binding | Output
Binding | Status | +|------|:----------------:|:-----------------:|--------| +| [Alibaba Cloud OSS]({{< ref alicloudoss.md >}}) | | ✅ | Alpha | + ### Amazon Web Services (AWS) | Name | Input
Binding | Output
Binding | Status | diff --git a/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/alicloudoss.md b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/alicloudoss.md new file mode 100644 index 000000000..2ac58b0a0 --- /dev/null +++ b/daprdocs/content/en/operations/components/setup-bindings/supported-bindings/alicloudoss.md @@ -0,0 +1,106 @@ +--- +type: docs +title: "Alibaba Cloud Object Storage Service binding spec" +linkTitle: "Alibaba Cloud Object Storage" +description: "Detailed documentation on the Alibaba Cloud Object Storage binding component" +--- + +## Component format + +To setup an Alibaba Cloud Object Storage binding create a component of type `bindings.alicloud.oss`. See [this guide]({{< ref "howto-bindings.md#1-create-a-binding" >}}) on how to create and apply a secretstore configuration. See this guide on [referencing secrets]({{< ref component-secrets.md >}}) to retrieve and use the secret with Dapr components. + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: alicloudobjectstorage + namespace: default +spec: + type: bindings.alicloud.oss + version: v1 + metadata: + - name: endpoint + value: "[endpoint]" + - name: accessKeyID + value: "[key-id]" + - name: accessKey + value: "[access-key]" + - name: bucket + value: "[bucket]" +``` + +{{% alert title="Warning" color="warning" %}} +The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}). +{{% /alert %}} + +## Spec metadata fields + +| Field | Required | Details | Example | +|---------------|----------|---------|---------| +| `endpoint` | Y | Alicloud OSS endpoint. | https://oss-cn-hangzhou.aliyuncs.com +| `accessKeyID` | Y | Access key ID credential. | +| `accessKey` | Y | Access key credential. | +| `bucket` | Y | Name of the storage bucket. | + +## Output operations + +The following operations are supported as within the output binding: + +### Create object + +To perform a create object operation, invoke the binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "create", + "data": "YOUR_CONTENT" +} +``` + +{{% alert title="Note" color="primary" %}} +By default, a random UUID is auto-generated as the object key. See below for Metadata support to set the key for the object. +{{% /alert %}} + +#### Example + +**Saving to a random generated UUID file** + +```bash +curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:/v1.0/bindings/ +``` + +
+ +**Saving to a specific file** + +```bash +curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"key\": \"my-key\" } }" http://localhost:/v1.0/bindings/ +``` + +{{% alert title="Note" color="primary" %}} +Windows CMD requires escaping the `"` character. +{{% /alert %}} + +## Metadata information + +### Object key + +By default, the Alicloud OSS output binding will auto-generate a UUID as the object key. +You can set the key with the following metadata: + +```json +{ + "data": "file content", + "metadata": { + "key": "my-key" + }, + "operation": "create" +} +``` + +## Related links + +- [Bindings building block]({{< ref bindings >}}) +- [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}}) +- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}}) +- [Bindings API reference]({{< ref bindings_api.md >}}) From 4122aedfb8d5fbd2912e4c7e3f9f0deab1d3cfd3 Mon Sep 17 00:00:00 2001 From: Ori Zohar Date: Thu, 11 Feb 2021 13:30:13 -0800 Subject: [PATCH 07/13] Updating nav bar --- daprdocs/config.toml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/daprdocs/config.toml b/daprdocs/config.toml index 7dda6bf8a..b49dd3b4d 100644 --- a/daprdocs/config.toml +++ b/daprdocs/config.toml @@ -52,25 +52,21 @@ id = "UA-149338238-3" # Top Nav Bar [[menu.main]] - name = "Home" + name = "Homepage" weight = 40 url = "https://dapr.io" [[menu.main]] - name = "About" + name = "GitHub" weight = 50 - url = "https://dapr.io/#about" -[[menu.main]] - name = "Download" - weight = 60 - url = "https://dapr.io/#download" + url = "https://github.com/dapr" [[menu.main]] name = "Blog" - weight = 70 + weight = 60 url = "https://blog.dapr.io/posts" [[menu.main]] - name = "Community" - weight = 80 - url = "https://dapr.io/#community" + name = "Discord" + weight = 70 + url = "https://aka.ms/dapr-discord" [params] copyright = "Dapr" From 1d4237b07b643d635376853bd89cee459a9b2a6b Mon Sep 17 00:00:00 2001 From: Ori Zohar Date: Thu, 11 Feb 2021 13:45:27 -0800 Subject: [PATCH 08/13] Adding community link to nav bar --- daprdocs/config.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daprdocs/config.toml b/daprdocs/config.toml index b49dd3b4d..bcfe88298 100644 --- a/daprdocs/config.toml +++ b/daprdocs/config.toml @@ -67,6 +67,10 @@ id = "UA-149338238-3" name = "Discord" weight = 70 url = "https://aka.ms/dapr-discord" +[[menu.main]] + name = "Community" + weight = 80 + url = "https://github.com/dapr/community/blob/master/README.md" [params] copyright = "Dapr" From cec451a4229317fca47ed317a22404079148cde4 Mon Sep 17 00:00:00 2001 From: Mukundan Sundararajan Date: Thu, 11 Feb 2021 14:17:23 -0800 Subject: [PATCH 09/13] Fix intellij docs --- .../developing-applications/ides/intellij.md | 50 +++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/daprdocs/content/en/developing-applications/ides/intellij.md b/daprdocs/content/en/developing-applications/ides/intellij.md index 2239a816a..d5854d087 100644 --- a/daprdocs/content/en/developing-applications/ides/intellij.md +++ b/daprdocs/content/en/developing-applications/ides/intellij.md @@ -25,7 +25,44 @@ Let's get started! First, quit IntelliJ. -Create or edit the file in `$HOME/.IdeaIC2019.3/config/tools/External\ Tools.xml` (change IntelliJ version in path if needed) to add a new `` entry: +### IntelliJ configuration file location + +{{< tabs Windows Linux MacOS >}} + +{{% codetab %}} +For versions [2020.1](https://www.jetbrains.com/help/idea/2020.1/tuning-the-ide.html#config-directory) and above the configuration files for tools should be located in: +```powershell +%USERPROFILE%\AppData\Roaming\JetBrains\IntelliJIdea2020.1\tools\ +``` +{{% /codetab %}} + + +{{% codetab %}} +For versions [2020.1](https://www.jetbrains.com/help/idea/2020.1/tuning-the-ide.html#config-directory) and above the configuration files for tools should be located in: + ```shell + $HOME/.config/JetBrains/IntelliJIdea2020.1/tools/ + ``` +{{% /codetab %}} + + +{{% codetab %}} +For versions [2020.1](https://www.jetbrains.com/help/idea/2020.1/tuning-the-ide.html#config-directory) and above the configuration files for tools should be located in: + +```shell +~/Library/Application Support/JetBrains/IntelliJIdea2020.1/tools/ +``` +{{% /codetab %}} + + +{{< /tabs >}} + +> The configuration file location is different for version 2019.3 or prior. See [here](https://www.jetbrains.com/help/idea/2019.3/tuning-the-ide.html#config-directory) for more details. + +Change the version in the path if needed. + +Create or edit the file in `/tools/External\ Tools.xml` (change IntelliJ version in path if needed). The `` is OS dependennt as seen above. + +Add a new `` entry: ```xml @@ -34,7 +71,8 @@ Create or edit the file in `$HOME/.IdeaIC2019.3/config/tools/External\ Tools.xml -