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

Commit

Permalink
Add oidcToken field to pubsub subscription
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
tmshn authored and modular-magician committed Aug 12, 2019
1 parent 8a07614 commit 73b2b9e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/google_pubsub_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Properties that can be accessed from the `google_pubsub_subscription` resource:

* `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.

* `oidc_token`: If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message.

* `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.

* `message_retention_duration`: How long to retain unacknowledged messages in the subscription's backlog, from the moment a message is published. If retainAckedMessages is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: `"600.5s"`.
Expand Down
4 changes: 4 additions & 0 deletions libraries/google/pubsub/property/subscription_push_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/pubsub/property/subscription_push_config_oidc_token'
module GoogleInSpec
module Pubsub
module Property
Expand All @@ -21,11 +22,14 @@ class SubscriptionPushConfig

attr_reader :attributes

attr_reader :oidc_token

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@push_endpoint = args['pushEndpoint']
@attributes = args['attributes']
@oidc_token = GoogleInSpec::Pubsub::Property::SubscriptionPushConfigOidcToken.new(args['oidcToken'], to_s)
end

def to_s
Expand Down
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 SubscriptionPushConfigOidcToken
attr_reader :service_account_email

attr_reader :audience

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@service_account_email = args['serviceAccountEmail']
@audience = args['audience']
end

def to_s
"#{@parent_identifier} SubscriptionPushConfigOidcToken"
end
end
end
end
end
1 change: 1 addition & 0 deletions libraries/google_pubsub_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require 'gcp_backend'
require 'google/pubsub/property/subscription_expiration_policy'
require 'google/pubsub/property/subscription_push_config'
require 'google/pubsub/property/subscription_push_config_oidc_token'

# A provider to manage Cloud Pub/Sub resources.
class Subscription < GcpResourceBase
Expand Down

0 comments on commit 73b2b9e

Please sign in to comment.