All Projects → k-yomo → pubsub_cli

k-yomo / pubsub_cli

Licence: MIT license
super handy google cloud Pub/Sub CLI

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to pubsub cli

kane
Google Pub/Sub client for Elixir
Stars: ✭ 92 (+187.5%)
Mutual labels:  gcp, pubsub
gobroker
golang wrapper for all (to-be) kinds of message brokers
Stars: ✭ 15 (-53.12%)
Mutual labels:  pubsub, cloud-pubsub
shamash
Autoscaling for Google Cloud Dataproc
Stars: ✭ 31 (-3.12%)
Mutual labels:  gcp, pubsub
iris3
An upgraded and improved version of the Iris automatic GCP-labeling project
Stars: ✭ 38 (+18.75%)
Mutual labels:  gcp, pubsub
terraform-splunk-log-export
Deploy Google Cloud log export to Splunk using Terraform
Stars: ✭ 26 (-18.75%)
Mutual labels:  gcp, pubsub
serverless-ktp-ocr
Serverless Indonesian Identity E-KTP OCR with Google Cloud Platform (GCP) - Cloud Functions, Cloud Storage, and Cloud PubSub
Stars: ✭ 54 (+68.75%)
Mutual labels:  gcp, cloud-pubsub
opal
Policy and data administration, distribution, and real-time updates on top of Open Policy Agent
Stars: ✭ 459 (+1334.38%)
Mutual labels:  gcp, pubsub
windowed-observable
Messaging lib using a pub/sub observable scoped by namespaces.
Stars: ✭ 132 (+312.5%)
Mutual labels:  pubsub
cloud-pricing-api
GraphQL API for cloud pricing. Contains over 3M public prices from AWS, Azure and GCP. Self-updates prices via an automated weekly job.
Stars: ✭ 281 (+778.13%)
Mutual labels:  gcp
paving
Terraform templates for paving infrastructure to deploy the Pivotal Platform.
Stars: ✭ 43 (+34.38%)
Mutual labels:  gcp
infrakit.gcp
Infrakit plugins for Google Cloud Platform.
Stars: ✭ 12 (-62.5%)
Mutual labels:  gcp
tips
TiKV based Pub/Sub server
Stars: ✭ 31 (-3.12%)
Mutual labels:  pubsub
runiac
Run IaC Anywhere With Ease
Stars: ✭ 18 (-43.75%)
Mutual labels:  gcp
js-data-structures
🌿 Data structures for JavaScript
Stars: ✭ 56 (+75%)
Mutual labels:  pubsub
webping.cloud
Test your network latency to the nearest cloud provider in AWS, Azure, GCP, Alibaba Cloud, IBM Cloud, Oracle Cloud and DigitalOcean directly from your browser.
Stars: ✭ 60 (+87.5%)
Mutual labels:  gcp
qhub
🪴 Nebari - your open source data science platform
Stars: ✭ 175 (+446.88%)
Mutual labels:  gcp
Everything-Tech
A collection of online resources to help you on your Tech journey.
Stars: ✭ 396 (+1137.5%)
Mutual labels:  gcp
cli
The universal GraphQL API and CSPM tool for AWS, Azure, GCP, K8s, and tencent.
Stars: ✭ 811 (+2434.38%)
Mutual labels:  gcp
grucloud
Generate diagrams and code from cloud infrastructures: AWS, Azure,GCP, Kubernetes
Stars: ✭ 76 (+137.5%)
Mutual labels:  gcp
augle
Auth + Google = Augle
Stars: ✭ 22 (-31.25%)
Mutual labels:  gcp

pubsub_cli

License: MIT Main Workflow codecov Go Report Card

pubsub_cli is a super handy Pub/Sub CLI which lets you publish / subscribe Pub/Sub message right away!

Installation

CLI

Homebrew

$ brew tap k-yomo/pubsub_cli
$ brew install pubsub_cli 

Go

$ go install github.com/k-yomo/pubsub_cli

Pub/Sub Emulator

  • If you want to use pubsub_cli for Pub/Sub Emulator, make sure the emulator is running before executing commands.
$ gcloud beta emulators pubsub start --host-port=0.0.0.0:8085

Usage

Usage:
  pubsub_cli [command]

Available Commands:
  help                Help about any command
  publish             publish Pub/Sub message
  subscribe           subscribe Pub/Sub topics
  create_topic        create Pub/Sub topic
  create_subscription create Pub/Sub subscription
  register_push       register Pub/Sub push endpoint
  connect             connect remote topics to local topics

Flags:
  -c, --cred-file string   gcp credential file path (You can also set 'GOOGLE_APPLICATION_CREDENTIALS' to env variable)
      --help               help for pubsub_cli
  -h, --host string        emulator host (You can also set 'PUBSUB_EMULATOR_HOST' to env variable)
  -p, --project string     gcp project id (You can also set 'GCP_PROJECT_ID' to env variable)

※ When both of --host and --cred-file are set, emulator host will be prioritised for safety purpose.

Auth

You need to be authenticated to execute pubsub_cli commands for real GCP Project. Recommended ways are described below.

  1. use your own credential by execution gcloud auth application-default login
  2. use service account's credentials json by setting option --cred-file or env variable GOOGLE_APPLICATION_CREDENTIALS

For more detail and about the other ways to authenticate, please refer to official doc.

Examples

Publish

$ gcloud auth application-default login
$ pubsub_cli publish test_topic '{"key":"value"}' -a key=value -p your_gcp_project
  • publish a message to the topic (create if not exist)
$ pubsub_cli publish new_topic '{"topic":"will be created"}' --create-if-not-exist -p your_gcp_project

Subscribe

  • subscribe topics
$ pubsub_cli subscribe test_topic another_topic -c credentials.json -p your_gcp_project
  • subscribe all
$ pubsub_cli subscribe all -c credentials.json -p your_gcp_project

Create topic

$ pubsub_cli create_topic topic_1 topic_2 --host=localhost:8085 -p emulator

Create Subscription

$ pubsub_cli cs test_topic test_topic_sub --create-if-not-exist -h localhost:8085 -p emulator

Register Push Endpoint

$ pubsub_cli register_push test_topic http://localhost:1323/subscribe -h localhost:8085 -p emulator

Connects Remote Topic with Local Topic

connect command is useful to register push subscriptions with local endpoint for real topics on GCP.

  • connect topics
$ pubsub_cli connect your_gcp_project topic1 topic2 -host localhost:8085 -p emulator
  • connect all
$ pubsub_cli connect your_gcp_project all -h localhost:8085 -p emulator

Note

  • Created topics won't be deleted automatically.
  • Unused subscriptions will be deleted in 24 hours.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].