Sha256: fdc0e438d1071873851756789c50336273e1d4010a4f7e861299a31ca5093164

Contents?: true

Size: 1.52 KB

Versions: 27

Compression:

Stored size: 1.52 KB

Contents

module Fog
  module Google
    class Pubsub
      class Real
        # Create a subscription resource on a topic.
        #
        # @param subscription_name [#to_s] name of the subscription to create.
        #   Note that it must follow the restrictions of subscription names;
        #   specifically it must be named within a project (e.g.
        #   "projects/my-project/subscriptions/my-subscripton")
        # @param topic [Topic, #to_s] topic instance or name of topic to create
        #   subscription on
        # @param push_config [Hash] configuration for a push config (if empty
        #   hash, then no push_config is created)
        # @param ack_deadline_seconds [Number] how long the service waits for
        #   an acknowledgement before redelivering the message; if nil then
        #   service default of 10 is used
        # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/create
        def create_subscription(subscription_name, topic, push_config = {}, ack_deadline_seconds = nil)
          subscription = ::Google::Apis::PubsubV1::Subscription.new(
            :topic => topic,
            :ack_deadline_seconds => ack_deadline_seconds,
            :push_config => push_config
          )

          @pubsub.create_subscription(subscription_name, subscription)
        end
      end

      class Mock
        def create_subscription(_subscription_name, _topic, _push_config = {}, _ack_deadline_seconds = nil)
          raise Fog::Errors::MockNotImplemented
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
gitlab-fog-google-1.14.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.13.0 lib/fog/google/requests/pubsub/create_subscription.rb
gitlab-fog-google-1.13.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.12.1 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.12.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.11.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.10.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.9.1 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.9.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.8.2 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.8.1 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.8.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.7.1 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.7.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.6.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.5.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.4.0 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.3.3 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.3.2 lib/fog/google/requests/pubsub/create_subscription.rb
fog-google-1.3.1 lib/fog/google/requests/pubsub/create_subscription.rb