Sha256: eb8343af30d277320431c184929c1bc0ae196dce3266e8da20cb02ca75d4cd41

Contents?: true

Size: 1.73 KB

Versions: 68

Compression:

Stored size: 1.73 KB

Contents

module SOULs
  class Pubsub < Thor
    desc "create_subscription", "Create Google Cloud PubSub Subscription"
    method_option :topic_name,
                  default: "send-user-mailer",
                  aliases: "--topic_name",
                  desc: "Google Cloud Pubsub Topic Name"
    method_option :endpoint,
                  default: "https:://test.com",
                  aliases: "--endpoint",
                  desc: "Google Cloud Pubsub Push Subscription Endpoint"
    def create_subscription
      project_id = SOULs.configuration.project_id
      service_account = "#{SOULs.configuration.app}@#{project_id}.iam.gserviceaccount.com"
      system(
        "gcloud pubsub subscriptions create #{options[:topic_name]}-sub \
            --topic #{options[:topic_name]} \
            --topic-project #{project_id} \
            --push-auth-service-account #{service_account} \
            --push-endpoint #{options[:endpoint]} \
            --expiration-period never"
      )
    end

    desc "subscription_list", "Show Google Cloud Pubsub Subscription List"
    def subscription_list
      system("gcloud pubsub subscriptions list")
    end

    desc "update_subscription", "Update Google Cloud Pubsub Subscription Endpoint"
    method_option :topic_name,
                  default: "send-user-mailer",
                  aliases: "--topic_name",
                  desc: "Google Cloud Pubsub Topic Name"
    method_option :endpoint,
                  default: "https:://test.com",
                  aliases: "--endpoint",
                  desc: "Google Cloud Pubsub Push Subscription Endpoint"
    def update_subscription
      system("gcloud pubsub subscriptions update #{options[:topic_name]}-sub --push-endpoint #{options[:endpoint]} ")
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
souls-4.1.2 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.1.1 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.1.0 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.0.3 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.0.2 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.0.1 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-4.0.0 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.8 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.7 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.6 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.5 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.4 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.3 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.2 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.1 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-3.0.0 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-2.0.4 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-2.0.3 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-2.0.2 lib/souls/cli/gcloud/pubsub/subscriptions.rb
souls-2.0.1 lib/souls/cli/gcloud/pubsub/subscriptions.rb