diff --git a/docs/resources/google_pubsub_subscription.md b/docs/resources/google_pubsub_subscription.md index 5f6dae910..d11f30b9b 100644 --- a/docs/resources/google_pubsub_subscription.md +++ b/docs/resources/google_pubsub_subscription.md @@ -24,8 +24,12 @@ Properties that can be accessed from the `google_pubsub_subscription` resource: * `topic`: A reference to a Topic resource. + * `labels`: A set of key/value label pairs to assign to this Subscription. + * `push_config`: If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. * `pushEndpoint`: A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push". + * `attributes`: Endpoint configuration attributes. Every endpoint has a set of API supported attributes that can be used to control different aspects of the message delivery. The currently supported attribute is x-goog-version, which you can use to change the format of the pushed message. This attribute indicates the version of the data expected by the endpoint. This controls the shape of the pushed message (i.e., its fields and metadata). The endpoint version is based on the version of the Pub/Sub API. If not present during the subscriptions.create call, it will default to the version of the API used to make such call. If not present during a subscriptions.modifyPushConfig call, its value will not be changed. subscriptions.get calls will always return a valid version, even if the subscription was created without this attribute. The possible values for this attribute are: - v1beta1: uses the push format defined in the v1beta1 Pub/Sub API. - v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API. + * `ack_deadline_seconds`: This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. diff --git a/docs/resources/google_pubsub_subscriptions.md b/docs/resources/google_pubsub_subscriptions.md index 5bc3dba41..4492fd202 100644 --- a/docs/resources/google_pubsub_subscriptions.md +++ b/docs/resources/google_pubsub_subscriptions.md @@ -25,6 +25,7 @@ Properties that can be accessed from the `google_pubsub_subscriptions` resource: See [google_pubsub_subscription.md](google_pubsub_subscription.md) for more detailed information * `names`: an array of `google_pubsub_subscription` name * `topics`: an array of `google_pubsub_subscription` topic + * `labels`: an array of `google_pubsub_subscription` labels * `push_configs`: an array of `google_pubsub_subscription` push_config * `ack_deadline_seconds`: an array of `google_pubsub_subscription` ack_deadline_seconds diff --git a/docs/resources/google_pubsub_topic.md b/docs/resources/google_pubsub_topic.md index 31de8cfaf..854a072c6 100644 --- a/docs/resources/google_pubsub_topic.md +++ b/docs/resources/google_pubsub_topic.md @@ -21,3 +21,5 @@ end Properties that can be accessed from the `google_pubsub_topic` resource: * `name`: Name of the topic. + + * `labels`: A set of key/value label pairs to assign to this Topic. diff --git a/docs/resources/google_pubsub_topics.md b/docs/resources/google_pubsub_topics.md index a553261b9..05c9a12ee 100644 --- a/docs/resources/google_pubsub_topics.md +++ b/docs/resources/google_pubsub_topics.md @@ -28,6 +28,7 @@ Properties that can be accessed from the `google_pubsub_topics` resource: See [google_pubsub_topic.md](google_pubsub_topic.md) for more detailed information * `names`: an array of `google_pubsub_topic` name + * `labels`: an array of `google_pubsub_topic` labels ## Filter Criteria This resource supports all of the above properties as filter criteria, which can be used diff --git a/libraries/google/pubsub/property/subscription_push_config.rb b/libraries/google/pubsub/property/subscription_push_config.rb index 90695d1e6..22a06e45b 100644 --- a/libraries/google/pubsub/property/subscription_push_config.rb +++ b/libraries/google/pubsub/property/subscription_push_config.rb @@ -19,9 +19,12 @@ module Property class SubscriptionPushConfig attr_reader :push_endpoint + attr_reader :attributes + def initialize(args = nil) return if args.nil? @push_endpoint = args['pushEndpoint'] + @attributes = args['attributes'] end end end diff --git a/libraries/google_pubsub_subscription.rb b/libraries/google_pubsub_subscription.rb index 6a02a71f8..ba05ccd76 100644 --- a/libraries/google_pubsub_subscription.rb +++ b/libraries/google_pubsub_subscription.rb @@ -24,6 +24,7 @@ class Subscription < GcpResourceBase attr_reader :name attr_reader :topic + attr_reader :labels attr_reader :push_config attr_reader :ack_deadline_seconds def base @@ -43,6 +44,7 @@ def initialize(params) def parse @name = name_from_self_link(@fetched['name']) @topic = @fetched['topic'] + @labels = @fetched['labels'] @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(@fetched['pushConfig']) @ack_deadline_seconds = @fetched['ackDeadlineSeconds'] end diff --git a/libraries/google_pubsub_subscriptions.rb b/libraries/google_pubsub_subscriptions.rb index be1bff1a9..594df3404 100644 --- a/libraries/google_pubsub_subscriptions.rb +++ b/libraries/google_pubsub_subscriptions.rb @@ -25,6 +25,7 @@ class Subscriptions < GcpResourceBase filter_table_config.add(:names, field: :name) filter_table_config.add(:topics, field: :topic) + filter_table_config.add(:labels, field: :labels) filter_table_config.add(:push_configs, field: :push_config) filter_table_config.add(:ack_deadline_seconds, field: :ack_deadline_seconds) @@ -76,6 +77,7 @@ def transformers { 'name' => ->(obj) { return :name, name_from_self_link(obj['name']) }, 'topic' => ->(obj) { return :topic, obj['topic'] }, + 'labels' => ->(obj) { return :labels, obj['labels'] }, 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(obj['pushConfig']) }, 'ackDeadlineSeconds' => ->(obj) { return :ack_deadline_seconds, obj['ackDeadlineSeconds'] }, } diff --git a/libraries/google_pubsub_topic.rb b/libraries/google_pubsub_topic.rb index 163cddfcf..6b86accc9 100644 --- a/libraries/google_pubsub_topic.rb +++ b/libraries/google_pubsub_topic.rb @@ -22,6 +22,7 @@ class Topic < GcpResourceBase supports platform: 'gcp' attr_reader :name + attr_reader :labels def base 'https://pubsub.googleapis.com/v1/' end @@ -38,6 +39,7 @@ def initialize(params) def parse @name = name_from_self_link(@fetched['name']) + @labels = @fetched['labels'] end # Handles parsing RFC3339 time string diff --git a/libraries/google_pubsub_topics.rb b/libraries/google_pubsub_topics.rb index 8399223b5..54c4240d4 100644 --- a/libraries/google_pubsub_topics.rb +++ b/libraries/google_pubsub_topics.rb @@ -24,6 +24,7 @@ class Topics < GcpResourceBase filter_table_config = FilterTable.create filter_table_config.add(:names, field: :name) + filter_table_config.add(:labels, field: :labels) filter_table_config.connect(self, :table) @@ -72,6 +73,7 @@ def transform(key, value) def transformers { 'name' => ->(obj) { return :name, name_from_self_link(obj['name']) }, + 'labels' => ->(obj) { return :labels, obj['labels'] }, } end