Skip to content

Instantly share code, notes, and snippets.

View qgadrian's full-sized avatar
🛰️

Adrián Q qgadrian

🛰️
View GitHub Profile
@qgadrian
qgadrian / gist:77d292044a5c837baff2c6fd77de6b2b
Last active March 3, 2017 15:22
google cloud profile installations
for bash users
source '#{staged_path}/#{token}/path.bash.inc'
source '#{staged_path}/#{token}/completion.bash.inc'
for zsh users
source '#{staged_path}/#{token}/path.zsh.inc'
source '#{staged_path}/#{token}/completion.zsh.inc'
for fish users
set fish_user_paths #{staged_path}/#{token}/bin
set -x MANPATH #{staged_path}/#{token}/help/man /usr/local/share/man /usr/share/man /opt/x11/share/man
Run fish_update_completions to generate completions for fish based on the man pages
alias GoogleApi.PubSub.V1.Model
data = Base.encode64(“pub sub test message”)
message = %Model.PubsubMessage{data: data}
publish_request = %Model.PublishRequest{messages: [message]}
alias GoogleApi.PubSub.V1.Api.Projects
topics = Projects.pubsub_projects_topics_list(client, “my_google_project”)
alias GoogleApi.PubSub.V1.Api.Projects
{:ok, topic} = Projects.pubsub_projects_topics_create(
client, “my_gcloud_project”, “test_topic”, [body: %{}])
{:ok, token} = Goth.Token.for_scope(“https://www.googleapis.com/auth/pubsub")
client = token |> Map.get(:token) |> GoogleApi.PubSub.V1.Connection.new()
{:ok, token} = Goth.Token.for_scope(“https://www.googleapis.com/auth/pubsub")
client = token |> Map.get(:token) |> GoogleApi.PubSub.V1.Connection.new()
config :goth,
json: File.read!("apps/my_app/priv/static/gcloud_creds.json")
{:google_api_pub_sub, “~> 0.0.1”},
{:goth, “~> 0.4.0”}
alias GoogleApi.PubSub.V1.Api.Projects
Projects.pubsub_projects_topics_publish(
client, “my_google_project”, “test_topic”, [body: publish_request])
alias GoogleApi.PubSub.V1.Api.Projects
pull_request = %GoogleApi.PubSub.V1.Model.PullRequest{maxMessages: 10}
Projects.pubsub_projects_subscriptions_pull(client, “my_google_project”, “test_subscription”, [body: pull_request])