google-cloud-pubsub-v1 0.2.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,7 @@ module Google
82
82
  parent_config = while namespace.any?
83
83
  parent_name = namespace.join "::"
84
84
  parent_const = const_get parent_name
85
- break parent_const.configure if parent_const&.respond_to? :configure
85
+ break parent_const.configure if parent_const.respond_to? :configure
86
86
  namespace.pop
87
87
  end
88
88
  default_config = Client::Configuration.new parent_config
@@ -148,8 +148,14 @@ module Google
148
148
 
149
149
  # Create credentials
150
150
  credentials = @config.credentials
151
- credentials ||= Credentials.default scope: @config.scope
152
- if credentials.is_a?(String) || credentials.is_a?(Hash)
151
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
154
+ @config.endpoint == Client.configure.endpoint &&
155
+ !@config.endpoint.split(".").first.include?("-")
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
153
159
  credentials = Credentials.new credentials, scope: @config.scope
154
160
  end
155
161
  @quota_project_id = @config.quota_project
@@ -481,7 +487,7 @@ module Google
481
487
  config_attr :scope, nil, ::String, ::Array, nil
482
488
  config_attr :lib_name, nil, ::String, nil
483
489
  config_attr :lib_version, nil, ::String, nil
484
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
490
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
485
491
  config_attr :interceptors, nil, ::Array, nil
486
492
  config_attr :timeout, nil, ::Numeric, nil
487
493
  config_attr :metadata, nil, ::Hash, nil
@@ -502,7 +508,7 @@ module Google
502
508
  def rpcs
503
509
  @rpcs ||= begin
504
510
  parent_rpcs = nil
505
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
511
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
506
512
  Rpcs.new parent_rpcs
507
513
  end
508
514
  end
@@ -543,11 +549,11 @@ module Google
543
549
 
544
550
  # @private
545
551
  def initialize parent_rpcs = nil
546
- set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
552
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
547
553
  @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
548
- get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
554
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
549
555
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
550
- test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
556
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
551
557
  @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
552
558
 
553
559
  yield self if block_given?
@@ -61,81 +61,54 @@ module Google
61
61
  parent_config = while namespace.any?
62
62
  parent_name = namespace.join "::"
63
63
  parent_const = const_get parent_name
64
- break parent_const.configure if parent_const&.respond_to? :configure
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
65
  namespace.pop
66
66
  end
67
67
  default_config = Client::Configuration.new parent_config
68
68
 
69
69
  default_config.rpcs.create_topic.timeout = 60.0
70
70
  default_config.rpcs.create_topic.retry_policy = {
71
- initial_delay: 0.1,
72
- max_delay: 60.0,
73
- multiplier: 1.3,
74
- retry_codes: [14]
71
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
75
72
  }
76
73
 
77
74
  default_config.rpcs.update_topic.timeout = 60.0
78
75
  default_config.rpcs.update_topic.retry_policy = {
79
- initial_delay: 0.1,
80
- max_delay: 60.0,
81
- multiplier: 1.3,
82
- retry_codes: [14]
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
83
77
  }
84
78
 
85
79
  default_config.rpcs.publish.timeout = 60.0
86
80
  default_config.rpcs.publish.retry_policy = {
87
- initial_delay: 0.1,
88
- max_delay: 60.0,
89
- multiplier: 1.3,
90
- retry_codes: [10, 1, 13, 8, 2, 14, 4]
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [10, 1, 13, 8, 2, 14, 4]
91
82
  }
92
83
 
93
84
  default_config.rpcs.get_topic.timeout = 60.0
94
85
  default_config.rpcs.get_topic.retry_policy = {
95
- initial_delay: 0.1,
96
- max_delay: 60.0,
97
- multiplier: 1.3,
98
- retry_codes: [2, 10, 14]
86
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
99
87
  }
100
88
 
101
89
  default_config.rpcs.list_topics.timeout = 60.0
102
90
  default_config.rpcs.list_topics.retry_policy = {
103
- initial_delay: 0.1,
104
- max_delay: 60.0,
105
- multiplier: 1.3,
106
- retry_codes: [2, 10, 14]
91
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
107
92
  }
108
93
 
109
94
  default_config.rpcs.list_topic_subscriptions.timeout = 60.0
110
95
  default_config.rpcs.list_topic_subscriptions.retry_policy = {
111
- initial_delay: 0.1,
112
- max_delay: 60.0,
113
- multiplier: 1.3,
114
- retry_codes: [2, 10, 14]
96
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
115
97
  }
116
98
 
117
99
  default_config.rpcs.list_topic_snapshots.timeout = 60.0
118
100
  default_config.rpcs.list_topic_snapshots.retry_policy = {
119
- initial_delay: 0.1,
120
- max_delay: 60.0,
121
- multiplier: 1.3,
122
- retry_codes: [2, 10, 14]
101
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
123
102
  }
124
103
 
125
104
  default_config.rpcs.delete_topic.timeout = 60.0
126
105
  default_config.rpcs.delete_topic.retry_policy = {
127
- initial_delay: 0.1,
128
- max_delay: 60.0,
129
- multiplier: 1.3,
130
- retry_codes: [14]
106
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
131
107
  }
132
108
 
133
109
  default_config.rpcs.detach_subscription.timeout = 60.0
134
110
  default_config.rpcs.detach_subscription.retry_policy = {
135
- initial_delay: 0.1,
136
- max_delay: 60.0,
137
- multiplier: 1.3,
138
- retry_codes: [14]
111
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
139
112
  }
140
113
 
141
114
  default_config
@@ -199,8 +172,14 @@ module Google
199
172
 
200
173
  # Create credentials
201
174
  credentials = @config.credentials
202
- credentials ||= Credentials.default scope: @config.scope
203
- if credentials.is_a?(String) || credentials.is_a?(Hash)
175
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
176
+ # but only if the default endpoint does not have a region prefix.
177
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
178
+ @config.endpoint == Client.configure.endpoint &&
179
+ !@config.endpoint.split(".").first.include?("-")
180
+ credentials ||= Credentials.default scope: @config.scope,
181
+ enable_self_signed_jwt: enable_self_signed_jwt
182
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
204
183
  credentials = Credentials.new credentials, scope: @config.scope
205
184
  end
206
185
  @quota_project_id = @config.quota_project
@@ -257,8 +236,6 @@ module Google
257
236
  # The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
258
237
  # @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
259
238
  # Settings for validating messages published against a schema.
260
- #
261
- # EXPERIMENTAL: Schema support is in development and may not work yet.
262
239
  # @param satisfies_pzs [::Boolean]
263
240
  # Reserved for future use. This field is set only in responses from the
264
241
  # server; it is ignored if it is set in any requests.
@@ -975,7 +952,7 @@ module Google
975
952
  config_attr :scope, nil, ::String, ::Array, nil
976
953
  config_attr :lib_name, nil, ::String, nil
977
954
  config_attr :lib_version, nil, ::String, nil
978
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
955
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
979
956
  config_attr :interceptors, nil, ::Array, nil
980
957
  config_attr :timeout, nil, ::Numeric, nil
981
958
  config_attr :metadata, nil, ::Hash, nil
@@ -996,7 +973,7 @@ module Google
996
973
  def rpcs
997
974
  @rpcs ||= begin
998
975
  parent_rpcs = nil
999
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
976
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1000
977
  Rpcs.new parent_rpcs
1001
978
  end
1002
979
  end
@@ -1067,23 +1044,23 @@ module Google
1067
1044
 
1068
1045
  # @private
1069
1046
  def initialize parent_rpcs = nil
1070
- create_topic_config = parent_rpcs&.create_topic if parent_rpcs&.respond_to? :create_topic
1047
+ create_topic_config = parent_rpcs.create_topic if parent_rpcs.respond_to? :create_topic
1071
1048
  @create_topic = ::Gapic::Config::Method.new create_topic_config
1072
- update_topic_config = parent_rpcs&.update_topic if parent_rpcs&.respond_to? :update_topic
1049
+ update_topic_config = parent_rpcs.update_topic if parent_rpcs.respond_to? :update_topic
1073
1050
  @update_topic = ::Gapic::Config::Method.new update_topic_config
1074
- publish_config = parent_rpcs&.publish if parent_rpcs&.respond_to? :publish
1051
+ publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
1075
1052
  @publish = ::Gapic::Config::Method.new publish_config
1076
- get_topic_config = parent_rpcs&.get_topic if parent_rpcs&.respond_to? :get_topic
1053
+ get_topic_config = parent_rpcs.get_topic if parent_rpcs.respond_to? :get_topic
1077
1054
  @get_topic = ::Gapic::Config::Method.new get_topic_config
1078
- list_topics_config = parent_rpcs&.list_topics if parent_rpcs&.respond_to? :list_topics
1055
+ list_topics_config = parent_rpcs.list_topics if parent_rpcs.respond_to? :list_topics
1079
1056
  @list_topics = ::Gapic::Config::Method.new list_topics_config
1080
- list_topic_subscriptions_config = parent_rpcs&.list_topic_subscriptions if parent_rpcs&.respond_to? :list_topic_subscriptions
1057
+ list_topic_subscriptions_config = parent_rpcs.list_topic_subscriptions if parent_rpcs.respond_to? :list_topic_subscriptions
1081
1058
  @list_topic_subscriptions = ::Gapic::Config::Method.new list_topic_subscriptions_config
1082
- list_topic_snapshots_config = parent_rpcs&.list_topic_snapshots if parent_rpcs&.respond_to? :list_topic_snapshots
1059
+ list_topic_snapshots_config = parent_rpcs.list_topic_snapshots if parent_rpcs.respond_to? :list_topic_snapshots
1083
1060
  @list_topic_snapshots = ::Gapic::Config::Method.new list_topic_snapshots_config
1084
- delete_topic_config = parent_rpcs&.delete_topic if parent_rpcs&.respond_to? :delete_topic
1061
+ delete_topic_config = parent_rpcs.delete_topic if parent_rpcs.respond_to? :delete_topic
1085
1062
  @delete_topic = ::Gapic::Config::Method.new delete_topic_config
1086
- detach_subscription_config = parent_rpcs&.detach_subscription if parent_rpcs&.respond_to? :detach_subscription
1063
+ detach_subscription_config = parent_rpcs.detach_subscription if parent_rpcs.respond_to? :detach_subscription
1087
1064
  @detach_subscription = ::Gapic::Config::Method.new detach_subscription_config
1088
1065
 
1089
1066
  yield self if block_given?
@@ -96,7 +96,7 @@ module Google
96
96
 
97
97
  "projects/#{project}/topics/#{topic}"
98
98
  end),
99
- "" => (proc do
99
+ "" => (proc do
100
100
  "_deleted-topic_"
101
101
  end)
102
102
  }
@@ -31,6 +31,8 @@ module Google
31
31
  module PubSub
32
32
  module V1
33
33
  ##
34
+ # Service for doing schema-related operations.
35
+ #
34
36
  # To load this service and instantiate a client:
35
37
  #
36
38
  # require "google/cloud/pubsub/v1/schema_service"
@@ -27,6 +27,8 @@ module Google
27
27
  ##
28
28
  # Client for the SchemaService service.
29
29
  #
30
+ # Service for doing schema-related operations.
31
+ #
30
32
  class Client
31
33
  include Paths
32
34
 
@@ -58,7 +60,7 @@ module Google
58
60
  parent_config = while namespace.any?
59
61
  parent_name = namespace.join "::"
60
62
  parent_const = const_get parent_name
61
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
62
64
  namespace.pop
63
65
  end
64
66
  default_config = Client::Configuration.new parent_config
@@ -124,8 +126,14 @@ module Google
124
126
 
125
127
  # Create credentials
126
128
  credentials = @config.credentials
127
- credentials ||= Credentials.default scope: @config.scope
128
- if credentials.is_a?(String) || credentials.is_a?(Hash)
129
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
+ @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
129
137
  credentials = Credentials.new credentials, scope: @config.scope
130
138
  end
131
139
  @quota_project_id = @config.quota_project
@@ -675,7 +683,7 @@ module Google
675
683
  config_attr :scope, nil, ::String, ::Array, nil
676
684
  config_attr :lib_name, nil, ::String, nil
677
685
  config_attr :lib_version, nil, ::String, nil
678
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
686
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
679
687
  config_attr :interceptors, nil, ::Array, nil
680
688
  config_attr :timeout, nil, ::Numeric, nil
681
689
  config_attr :metadata, nil, ::Hash, nil
@@ -696,7 +704,7 @@ module Google
696
704
  def rpcs
697
705
  @rpcs ||= begin
698
706
  parent_rpcs = nil
699
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
707
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
700
708
  Rpcs.new parent_rpcs
701
709
  end
702
710
  end
@@ -752,17 +760,17 @@ module Google
752
760
 
753
761
  # @private
754
762
  def initialize parent_rpcs = nil
755
- create_schema_config = parent_rpcs&.create_schema if parent_rpcs&.respond_to? :create_schema
763
+ create_schema_config = parent_rpcs.create_schema if parent_rpcs.respond_to? :create_schema
756
764
  @create_schema = ::Gapic::Config::Method.new create_schema_config
757
- get_schema_config = parent_rpcs&.get_schema if parent_rpcs&.respond_to? :get_schema
765
+ get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
758
766
  @get_schema = ::Gapic::Config::Method.new get_schema_config
759
- list_schemas_config = parent_rpcs&.list_schemas if parent_rpcs&.respond_to? :list_schemas
767
+ list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
760
768
  @list_schemas = ::Gapic::Config::Method.new list_schemas_config
761
- delete_schema_config = parent_rpcs&.delete_schema if parent_rpcs&.respond_to? :delete_schema
769
+ delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
762
770
  @delete_schema = ::Gapic::Config::Method.new delete_schema_config
763
- validate_schema_config = parent_rpcs&.validate_schema if parent_rpcs&.respond_to? :validate_schema
771
+ validate_schema_config = parent_rpcs.validate_schema if parent_rpcs.respond_to? :validate_schema
764
772
  @validate_schema = ::Gapic::Config::Method.new validate_schema_config
765
- validate_message_config = parent_rpcs&.validate_message if parent_rpcs&.respond_to? :validate_message
773
+ validate_message_config = parent_rpcs.validate_message if parent_rpcs.respond_to? :validate_message
766
774
  @validate_message = ::Gapic::Config::Method.new validate_message_config
767
775
 
768
776
  yield self if block_given?
@@ -62,137 +62,89 @@ module Google
62
62
  parent_config = while namespace.any?
63
63
  parent_name = namespace.join "::"
64
64
  parent_const = const_get parent_name
65
- break parent_const.configure if parent_const&.respond_to? :configure
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
66
  namespace.pop
67
67
  end
68
68
  default_config = Client::Configuration.new parent_config
69
69
 
70
70
  default_config.rpcs.create_subscription.timeout = 60.0
71
71
  default_config.rpcs.create_subscription.retry_policy = {
72
- initial_delay: 0.1,
73
- max_delay: 60.0,
74
- multiplier: 1.3,
75
- retry_codes: [2, 10, 14]
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
76
73
  }
77
74
 
78
75
  default_config.rpcs.get_subscription.timeout = 60.0
79
76
  default_config.rpcs.get_subscription.retry_policy = {
80
- initial_delay: 0.1,
81
- max_delay: 60.0,
82
- multiplier: 1.3,
83
- retry_codes: [2, 10, 14]
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
84
78
  }
85
79
 
86
80
  default_config.rpcs.update_subscription.timeout = 60.0
87
81
  default_config.rpcs.update_subscription.retry_policy = {
88
- initial_delay: 0.1,
89
- max_delay: 60.0,
90
- multiplier: 1.3,
91
- retry_codes: [14]
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
92
83
  }
93
84
 
94
85
  default_config.rpcs.list_subscriptions.timeout = 60.0
95
86
  default_config.rpcs.list_subscriptions.retry_policy = {
96
- initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [2, 10, 14]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
100
88
  }
101
89
 
102
90
  default_config.rpcs.delete_subscription.timeout = 60.0
103
91
  default_config.rpcs.delete_subscription.retry_policy = {
104
- initial_delay: 0.1,
105
- max_delay: 60.0,
106
- multiplier: 1.3,
107
- retry_codes: [14]
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
108
93
  }
109
94
 
110
95
  default_config.rpcs.modify_ack_deadline.timeout = 60.0
111
96
  default_config.rpcs.modify_ack_deadline.retry_policy = {
112
- initial_delay: 0.1,
113
- max_delay: 60.0,
114
- multiplier: 1.3,
115
- retry_codes: [14]
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
116
98
  }
117
99
 
118
100
  default_config.rpcs.acknowledge.timeout = 60.0
119
101
  default_config.rpcs.acknowledge.retry_policy = {
120
- initial_delay: 0.1,
121
- max_delay: 60.0,
122
- multiplier: 1.3,
123
- retry_codes: [14]
102
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
124
103
  }
125
104
 
126
105
  default_config.rpcs.pull.timeout = 60.0
127
106
  default_config.rpcs.pull.retry_policy = {
128
- initial_delay: 0.1,
129
- max_delay: 60.0,
130
- multiplier: 1.3,
131
- retry_codes: [2, 10, 14]
107
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
132
108
  }
133
109
 
134
110
  default_config.rpcs.streaming_pull.timeout = 900.0
135
111
  default_config.rpcs.streaming_pull.retry_policy = {
136
- initial_delay: 0.1,
137
- max_delay: 60.0,
138
- multiplier: 1.3,
139
- retry_codes: [4, 8, 10, 13, 14]
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 8, 10, 13, 14]
140
113
  }
141
114
 
142
115
  default_config.rpcs.modify_push_config.timeout = 60.0
143
116
  default_config.rpcs.modify_push_config.retry_policy = {
144
- initial_delay: 0.1,
145
- max_delay: 60.0,
146
- multiplier: 1.3,
147
- retry_codes: [14]
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
148
118
  }
149
119
 
150
120
  default_config.rpcs.get_snapshot.timeout = 60.0
151
121
  default_config.rpcs.get_snapshot.retry_policy = {
152
- initial_delay: 0.1,
153
- max_delay: 60.0,
154
- multiplier: 1.3,
155
- retry_codes: [2, 10, 14]
122
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
156
123
  }
157
124
 
158
125
  default_config.rpcs.list_snapshots.timeout = 60.0
159
126
  default_config.rpcs.list_snapshots.retry_policy = {
160
- initial_delay: 0.1,
161
- max_delay: 60.0,
162
- multiplier: 1.3,
163
- retry_codes: [2, 10, 14]
127
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
164
128
  }
165
129
 
166
130
  default_config.rpcs.create_snapshot.timeout = 60.0
167
131
  default_config.rpcs.create_snapshot.retry_policy = {
168
- initial_delay: 0.1,
169
- max_delay: 60.0,
170
- multiplier: 1.3,
171
- retry_codes: [14]
132
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
172
133
  }
173
134
 
174
135
  default_config.rpcs.update_snapshot.timeout = 60.0
175
136
  default_config.rpcs.update_snapshot.retry_policy = {
176
- initial_delay: 0.1,
177
- max_delay: 60.0,
178
- multiplier: 1.3,
179
- retry_codes: [14]
137
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
180
138
  }
181
139
 
182
140
  default_config.rpcs.delete_snapshot.timeout = 60.0
183
141
  default_config.rpcs.delete_snapshot.retry_policy = {
184
- initial_delay: 0.1,
185
- max_delay: 60.0,
186
- multiplier: 1.3,
187
- retry_codes: [14]
142
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
188
143
  }
189
144
 
190
145
  default_config.rpcs.seek.timeout = 60.0
191
146
  default_config.rpcs.seek.retry_policy = {
192
- initial_delay: 0.1,
193
- max_delay: 60.0,
194
- multiplier: 1.3,
195
- retry_codes: [2, 10, 14]
147
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
196
148
  }
197
149
 
198
150
  default_config
@@ -256,8 +208,14 @@ module Google
256
208
 
257
209
  # Create credentials
258
210
  credentials = @config.credentials
259
- credentials ||= Credentials.default scope: @config.scope
260
- if credentials.is_a?(String) || credentials.is_a?(Hash)
211
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
212
+ # but only if the default endpoint does not have a region prefix.
213
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
214
+ @config.endpoint == Client.configure.endpoint &&
215
+ !@config.endpoint.split(".").first.include?("-")
216
+ credentials ||= Credentials.default scope: @config.scope,
217
+ enable_self_signed_jwt: enable_self_signed_jwt
218
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
261
219
  credentials = Credentials.new credentials, scope: @config.scope
262
220
  end
263
221
  @quota_project_id = @config.quota_project
@@ -1677,7 +1635,7 @@ module Google
1677
1635
  config_attr :scope, nil, ::String, ::Array, nil
1678
1636
  config_attr :lib_name, nil, ::String, nil
1679
1637
  config_attr :lib_version, nil, ::String, nil
1680
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1638
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1681
1639
  config_attr :interceptors, nil, ::Array, nil
1682
1640
  config_attr :timeout, nil, ::Numeric, nil
1683
1641
  config_attr :metadata, nil, ::Hash, nil
@@ -1698,7 +1656,7 @@ module Google
1698
1656
  def rpcs
1699
1657
  @rpcs ||= begin
1700
1658
  parent_rpcs = nil
1701
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1659
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1702
1660
  Rpcs.new parent_rpcs
1703
1661
  end
1704
1662
  end
@@ -1804,37 +1762,37 @@ module Google
1804
1762
 
1805
1763
  # @private
1806
1764
  def initialize parent_rpcs = nil
1807
- create_subscription_config = parent_rpcs&.create_subscription if parent_rpcs&.respond_to? :create_subscription
1765
+ create_subscription_config = parent_rpcs.create_subscription if parent_rpcs.respond_to? :create_subscription
1808
1766
  @create_subscription = ::Gapic::Config::Method.new create_subscription_config
1809
- get_subscription_config = parent_rpcs&.get_subscription if parent_rpcs&.respond_to? :get_subscription
1767
+ get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
1810
1768
  @get_subscription = ::Gapic::Config::Method.new get_subscription_config
1811
- update_subscription_config = parent_rpcs&.update_subscription if parent_rpcs&.respond_to? :update_subscription
1769
+ update_subscription_config = parent_rpcs.update_subscription if parent_rpcs.respond_to? :update_subscription
1812
1770
  @update_subscription = ::Gapic::Config::Method.new update_subscription_config
1813
- list_subscriptions_config = parent_rpcs&.list_subscriptions if parent_rpcs&.respond_to? :list_subscriptions
1771
+ list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
1814
1772
  @list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
1815
- delete_subscription_config = parent_rpcs&.delete_subscription if parent_rpcs&.respond_to? :delete_subscription
1773
+ delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
1816
1774
  @delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
1817
- modify_ack_deadline_config = parent_rpcs&.modify_ack_deadline if parent_rpcs&.respond_to? :modify_ack_deadline
1775
+ modify_ack_deadline_config = parent_rpcs.modify_ack_deadline if parent_rpcs.respond_to? :modify_ack_deadline
1818
1776
  @modify_ack_deadline = ::Gapic::Config::Method.new modify_ack_deadline_config
1819
- acknowledge_config = parent_rpcs&.acknowledge if parent_rpcs&.respond_to? :acknowledge
1777
+ acknowledge_config = parent_rpcs.acknowledge if parent_rpcs.respond_to? :acknowledge
1820
1778
  @acknowledge = ::Gapic::Config::Method.new acknowledge_config
1821
- pull_config = parent_rpcs&.pull if parent_rpcs&.respond_to? :pull
1779
+ pull_config = parent_rpcs.pull if parent_rpcs.respond_to? :pull
1822
1780
  @pull = ::Gapic::Config::Method.new pull_config
1823
- streaming_pull_config = parent_rpcs&.streaming_pull if parent_rpcs&.respond_to? :streaming_pull
1781
+ streaming_pull_config = parent_rpcs.streaming_pull if parent_rpcs.respond_to? :streaming_pull
1824
1782
  @streaming_pull = ::Gapic::Config::Method.new streaming_pull_config
1825
- modify_push_config_config = parent_rpcs&.modify_push_config if parent_rpcs&.respond_to? :modify_push_config
1783
+ modify_push_config_config = parent_rpcs.modify_push_config if parent_rpcs.respond_to? :modify_push_config
1826
1784
  @modify_push_config = ::Gapic::Config::Method.new modify_push_config_config
1827
- get_snapshot_config = parent_rpcs&.get_snapshot if parent_rpcs&.respond_to? :get_snapshot
1785
+ get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
1828
1786
  @get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
1829
- list_snapshots_config = parent_rpcs&.list_snapshots if parent_rpcs&.respond_to? :list_snapshots
1787
+ list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
1830
1788
  @list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
1831
- create_snapshot_config = parent_rpcs&.create_snapshot if parent_rpcs&.respond_to? :create_snapshot
1789
+ create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
1832
1790
  @create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
1833
- update_snapshot_config = parent_rpcs&.update_snapshot if parent_rpcs&.respond_to? :update_snapshot
1791
+ update_snapshot_config = parent_rpcs.update_snapshot if parent_rpcs.respond_to? :update_snapshot
1834
1792
  @update_snapshot = ::Gapic::Config::Method.new update_snapshot_config
1835
- delete_snapshot_config = parent_rpcs&.delete_snapshot if parent_rpcs&.respond_to? :delete_snapshot
1793
+ delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
1836
1794
  @delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
1837
- seek_config = parent_rpcs&.seek if parent_rpcs&.respond_to? :seek
1795
+ seek_config = parent_rpcs.seek if parent_rpcs.respond_to? :seek
1838
1796
  @seek = ::Gapic::Config::Method.new seek_config
1839
1797
 
1840
1798
  yield self if block_given?