{"id":20617116,"url":"https://github.com/k-yomo/pubsub_cli","last_synced_at":"2025-04-15T08:57:00.898Z","repository":{"id":37890001,"uuid":"212133597","full_name":"k-yomo/pubsub_cli","owner":"k-yomo","description":"super handy google cloud Pub/Sub CLI","archived":false,"fork":false,"pushed_at":"2025-02-17T00:56:12.000Z","size":420,"stargazers_count":37,"open_issues_count":9,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T08:56:53.424Z","etag":null,"topics":["cloud-pubsub","emulator","gcp","pubsub","pubsub-cli"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k-yomo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-01T15:36:26.000Z","updated_at":"2024-11-30T07:26:06.000Z","dependencies_parsed_at":"2024-06-19T04:07:51.706Z","dependency_job_id":"b4ad5f09-93ee-4008-9309-1af6ab47614a","html_url":"https://github.com/k-yomo/pubsub_cli","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yomo%2Fpubsub_cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yomo%2Fpubsub_cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yomo%2Fpubsub_cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yomo%2Fpubsub_cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k-yomo","download_url":"https://codeload.github.com/k-yomo/pubsub_cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249040047,"owners_count":21202813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-pubsub","emulator","gcp","pubsub","pubsub-cli"],"created_at":"2024-11-16T11:22:14.965Z","updated_at":"2025-04-15T08:57:00.877Z","avatar_url":"https://github.com/k-yomo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pubsub_cli\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n![Main Workflow](https://github.com/k-yomo/pubsub_cli/workflows/Test/badge.svg)\n[![codecov](https://codecov.io/gh/k-yomo/pubsub_cli/branch/master/graph/badge.svg)](https://codecov.io/gh/k-yomo/pubsub_cli)\n[![Go Report Card](https://goreportcard.com/badge/k-yomo/pubsub_cli)](https://goreportcard.com/report/k-yomo/pubsub_cli)\n\npubsub_cli is a super handy Pub/Sub CLI which lets you publish / subscribe Pub/Sub message right away!\n\n## Installation\n### CLI\n#### Homebrew\n```\n$ brew tap k-yomo/pubsub_cli\n$ brew install pubsub_cli \n```\n\n#### Go \n```\n$ go install github.com/k-yomo/pubsub_cli\n```\n\n### Pub/Sub Emulator\n- If you want to use pubsub_cli for Pub/Sub Emulator, make sure the emulator is running before executing commands.\n```\n$ gcloud beta emulators pubsub start --host-port=0.0.0.0:8085\n```\n \n## Usage\n\n```\nUsage:\n  pubsub_cli [command]\n\nAvailable Commands:\n  help                Help about any command\n  publish             publish Pub/Sub message\n  subscribe           subscribe Pub/Sub topics\n  create_topic        create Pub/Sub topic\n  create_subscription create Pub/Sub subscription\n  register_push       register Pub/Sub push endpoint\n  connect             connect remote topics to local topics\n\nFlags:\n  -c, --cred-file string   gcp credential file path (You can also set 'GOOGLE_APPLICATION_CREDENTIALS' to env variable)\n      --help               help for pubsub_cli\n  -h, --host string        emulator host (You can also set 'PUBSUB_EMULATOR_HOST' to env variable)\n  -p, --project string     gcp project id (You can also set 'GCP_PROJECT_ID' to env variable)\n```\n※ When both of --host and --cred-file are set, emulator host will be prioritised for safety purpose.\n\n## Auth\nYou need to be authenticated to execute pubsub_cli commands for real GCP Project. Recommended ways are described below.\n\n1. use your own credential by execution `gcloud auth application-default login`\n2. use service account's credentials json by setting option `--cred-file` or env variable `GOOGLE_APPLICATION_CREDENTIALS`\n\nFor more detail and about the other ways to authenticate, please refer to [official doc](https://cloud.google.com/docs/authentication#oauth-2.0-clients).\n\n## Examples\n### Publish\n```\n$ gcloud auth application-default login\n$ pubsub_cli publish test_topic '{\"key\":\"value\"}' -a key=value -p your_gcp_project\n```\n\n- publish a message to the topic (create if not exist)\n```\n$ pubsub_cli publish new_topic '{\"topic\":\"will be created\"}' --create-if-not-exist -p your_gcp_project\n```\n\n### Subscribe\n- subscribe topics\n```\n$ pubsub_cli subscribe test_topic another_topic -c credentials.json -p your_gcp_project\n```\n\n- subscribe all\n```\n$ pubsub_cli subscribe all -c credentials.json -p your_gcp_project\n```\n\n### Create topic\n```\n$ pubsub_cli create_topic topic_1 topic_2 --host=localhost:8085 -p emulator\n```\n\n### Create Subscription\n```\n$ pubsub_cli cs test_topic test_topic_sub --create-if-not-exist -h localhost:8085 -p emulator\n```\n\n### Register Push Endpoint\n```\n$ pubsub_cli register_push test_topic http://localhost:1323/subscribe -h localhost:8085 -p emulator\n```\n\n### Connects Remote Topic with Local Topic\n`connect` command is useful to register push subscriptions with local endpoint for real topics on GCP.\n\n- connect topics\n```\n$ pubsub_cli connect your_gcp_project topic1 topic2 -host localhost:8085 -p emulator\n```\n\n- connect all\n```\n$ pubsub_cli connect your_gcp_project all -h localhost:8085 -p emulator\n```\n\n## Note\n- Created topics won't be deleted automatically. \n- Unused subscriptions will be deleted in 24 hours.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yomo%2Fpubsub_cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk-yomo%2Fpubsub_cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yomo%2Fpubsub_cli/lists"}