Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

retrypolicy attribute added #438

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/resources/google_pubsub_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ Properties that can be accessed from the `google_pubsub_subscription` resource:

* `max_delivery_attempts`: The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.

* `retry_policy`: A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message

* `minimum_backoff`: The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

* `maximum_backoff`: The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

* `enable_message_ordering`: If `true`, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order.


Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_pubsub_subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ See [google_pubsub_subscription.md](google_pubsub_subscription.md) for more deta
* `expiration_policies`: an array of `google_pubsub_subscription` expiration_policy
* `filters`: an array of `google_pubsub_subscription` filter
* `dead_letter_policies`: an array of `google_pubsub_subscription` dead_letter_policy
* `retry_policies`: an array of `google_pubsub_subscription` retry_policy
* `enable_message_orderings`: an array of `google_pubsub_subscription` enable_message_ordering

## Filter Criteria
Expand Down
37 changes: 37 additions & 0 deletions libraries/google/pubsub/property/subscription_retry_policy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Pubsub
module Property
class SubscriptionRetryPolicy
attr_reader :minimum_backoff

attr_reader :maximum_backoff

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@minimum_backoff = args['minimumBackoff']
@maximum_backoff = args['maximumBackoff']
end

def to_s
"#{@parent_identifier} SubscriptionRetryPolicy"
end
end
end
end
end
3 changes: 3 additions & 0 deletions libraries/google_pubsub_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
require 'google/pubsub/property/subscription_expiration_policy'
require 'google/pubsub/property/subscription_push_config'
require 'google/pubsub/property/subscription_push_config_oidc_token'
require 'google/pubsub/property/subscription_retry_policy'

# A provider to manage Cloud Pub/Sub resources.
class PubsubSubscription < GcpResourceBase
Expand All @@ -36,6 +37,7 @@ class PubsubSubscription < GcpResourceBase
attr_reader :expiration_policy
attr_reader :filter
attr_reader :dead_letter_policy
attr_reader :retry_policy
attr_reader :enable_message_ordering

def initialize(params)
Expand All @@ -56,6 +58,7 @@ def parse
@expiration_policy = GoogleInSpec::Pubsub::Property::SubscriptionExpirationPolicy.new(@fetched['expirationPolicy'], to_s)
@filter = @fetched['filter']
@dead_letter_policy = GoogleInSpec::Pubsub::Property::SubscriptionDeadLetterPolicy.new(@fetched['deadLetterPolicy'], to_s)
@retry_policy = GoogleInSpec::Pubsub::Property::SubscriptionRetryPolicy.new(@fetched['retryPolicy'], to_s)
@enable_message_ordering = @fetched['enableMessageOrdering']
end

Expand Down
2 changes: 2 additions & 0 deletions libraries/google_pubsub_subscriptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PubsubSubscriptions < GcpResourceBase
filter_table_config.add(:expiration_policies, field: :expiration_policy)
filter_table_config.add(:filters, field: :filter)
filter_table_config.add(:dead_letter_policies, field: :dead_letter_policy)
filter_table_config.add(:retry_policies, field: :retry_policy)
filter_table_config.add(:enable_message_orderings, field: :enable_message_ordering)

filter_table_config.connect(self, :table)
Expand Down Expand Up @@ -83,6 +84,7 @@ def transformers
'expirationPolicy' => ->(obj) { return :expiration_policy, GoogleInSpec::Pubsub::Property::SubscriptionExpirationPolicy.new(obj['expirationPolicy'], to_s) },
'filter' => ->(obj) { return :filter, obj['filter'] },
'deadLetterPolicy' => ->(obj) { return :dead_letter_policy, GoogleInSpec::Pubsub::Property::SubscriptionDeadLetterPolicy.new(obj['deadLetterPolicy'], to_s) },
'retryPolicy' => ->(obj) { return :retry_policy, GoogleInSpec::Pubsub::Property::SubscriptionRetryPolicy.new(obj['retryPolicy'], to_s) },
'enableMessageOrdering' => ->(obj) { return :enable_message_ordering, obj['enableMessageOrdering'] },
}
end
Expand Down