GCP Pub/Sub binding spec

Detailed documentation on the GCP Pub/Sub binding component

Component format

To setup GCP Pub/Sub binding create a component of type bindings.gcp.pubsub. See this guide on how to create and apply a binding configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: bindings.gcp.pubsub
  7. version: v1
  8. metadata:
  9. - name: topic
  10. value: "topic1"
  11. - name: subscription
  12. value: "subscription1"
  13. - name: type
  14. value: "service_account"
  15. - name: project_id
  16. value: "project_111"
  17. - name: private_key_id
  18. value: "*************"
  19. - name: client_email
  20. value: "name@domain.com"
  21. - name: client_id
  22. value: "1111111111111111"
  23. - name: auth_uri
  24. value: "https://accounts.google.com/o/oauth2/auth"
  25. - name: token_uri
  26. value: "https://oauth2.googleapis.com/token"
  27. - name: auth_provider_x509_cert_url
  28. value: "https://www.googleapis.com/oauth2/v1/certs"
  29. - name: client_x509_cert_url
  30. value: "https://www.googleapis.com/robot/v1/metadata/x509/<project-name>.iam.gserviceaccount.com"
  31. - name: private_key
  32. value: "PRIVATE KEY"
  33. - name: direction
  34. value: "input, output"

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredBinding supportDetailsExample
topicYOutputGCP Pub/Sub topic name“topic1”
subscriptionNGCP Pub/Sub subscription name“name1”
typeYOutputGCP credentials typeservice_account
project_idYOutputGCP project idprojectId
private_key_idNOutputGCP private key id“privateKeyId”
private_keyYOutputGCP credentials private key. Replace with x509 cert12345-12345
client_emailYOutputGCP client email“client@email.com”
client_idNOutputGCP client id0123456789-0123456789
auth_uriNOutputGoogle account OAuth endpointhttps://accounts.google.com/o/oauth2/auth
token_uriNOutputGoogle account token urihttps://oauth2.googleapis.com/token
auth_provider_x509_cert_urlNOutputGCP credentials cert urlhttps://www.googleapis.com/oauth2/v1/certs
client_x509_cert_urlNOutputGCP credentials project x509 cert urlhttps://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com
directionNInput/OutputThe direction of the binding.“input”, “output”, “input, output”

Binding support

This component supports both input and output binding interfaces.

This component supports output binding with the following operations:

  • create

Last modified October 11, 2024: Fixed typo (#4389) (fe17926)