google-cloud-pubsub-v1 0.1.0

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.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-pubsub-v1.rb +21 -0
  7. data/lib/google/cloud/pubsub/v1.rb +37 -0
  8. data/lib/google/cloud/pubsub/v1/iam_policy.rb +72 -0
  9. data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +562 -0
  10. data/lib/google/cloud/pubsub/v1/iam_policy/credentials.rb +52 -0
  11. data/lib/google/cloud/pubsub/v1/publisher.rb +50 -0
  12. data/lib/google/cloud/pubsub/v1/publisher/client.rb +1093 -0
  13. data/lib/google/cloud/pubsub/v1/publisher/credentials.rb +52 -0
  14. data/lib/google/cloud/pubsub/v1/publisher/helpers.rb +23 -0
  15. data/lib/google/cloud/pubsub/v1/publisher/paths.rb +98 -0
  16. data/lib/google/cloud/pubsub/v1/subscriber.rb +51 -0
  17. data/lib/google/cloud/pubsub/v1/subscriber/client.rb +1861 -0
  18. data/lib/google/cloud/pubsub/v1/subscriber/credentials.rb +52 -0
  19. data/lib/google/cloud/pubsub/v1/subscriber/helpers.rb +23 -0
  20. data/lib/google/cloud/pubsub/v1/subscriber/paths.rb +115 -0
  21. data/lib/google/cloud/pubsub/v1/version.rb +28 -0
  22. data/lib/google/iam/v1/iam_policy_services_pb.rb +81 -0
  23. data/lib/google/pubsub/v1/pubsub_pb.rb +269 -0
  24. data/lib/google/pubsub/v1/pubsub_services_pb.rb +213 -0
  25. data/proto_docs/README.md +4 -0
  26. data/proto_docs/google/api/field_behavior.rb +59 -0
  27. data/proto_docs/google/api/resource.rb +247 -0
  28. data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
  29. data/proto_docs/google/iam/v1/options.rb +40 -0
  30. data/proto_docs/google/iam/v1/policy.rb +248 -0
  31. data/proto_docs/google/protobuf/duration.rb +98 -0
  32. data/proto_docs/google/protobuf/empty.rb +36 -0
  33. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  34. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  35. data/proto_docs/google/pubsub/v1/pubsub.rb +1023 -0
  36. data/proto_docs/google/type/expr.rb +52 -0
  37. metadata +238 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/pubsub/v1"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/pubsub/v1/publisher"
20
+ require "google/cloud/pubsub/v1/subscriber"
21
+ require "google/cloud/pubsub/v1/iam_policy"
22
+ require "google/cloud/pubsub/v1/version"
23
+
24
+ module Google
25
+ module Cloud
26
+ module PubSub
27
+ ##
28
+ # To load this package, including all its services, and instantiate a client:
29
+ #
30
+ # require "google/cloud/pubsub/v1"
31
+ # client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
32
+ #
33
+ module V1
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/pubsub/v1/version"
24
+
25
+ require "google/cloud/pubsub/v1/iam_policy/credentials"
26
+ require "google/cloud/pubsub/v1/iam_policy/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module PubSub
31
+ module V1
32
+ ##
33
+ # ## API Overview
34
+ #
35
+ # Manages Identity and Access Management (IAM) policies.
36
+ #
37
+ # Any implementation of an API that offers access control features
38
+ # implements the google.iam.v1.IAMPolicy interface.
39
+ #
40
+ # ## Data model
41
+ #
42
+ # Access control is applied when a principal (user or service account), takes
43
+ # some action on a resource exposed by a service. Resources, identified by
44
+ # URI-like names, are the unit of access control specification. Service
45
+ # implementations can choose the granularity of access control and the
46
+ # supported permissions for their resources.
47
+ # For example one database service may allow access control to be
48
+ # specified only at the Table level, whereas another might allow access control
49
+ # to also be specified at the Column level.
50
+ #
51
+ # ## Policy Structure
52
+ #
53
+ # See google.iam.v1.Policy
54
+ #
55
+ # This is intentionally not a CRUD style API because access control policies
56
+ # are created and deleted implicitly with the resources to which they are
57
+ # attached.
58
+ #
59
+ # To load this service and instantiate a client:
60
+ #
61
+ # require "google/cloud/pubsub/v1/iam_policy"
62
+ # client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new
63
+ #
64
+ module IAMPolicy
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ helper_path = ::File.join __dir__, "iam_policy", "helpers.rb"
72
+ require "google/cloud/pubsub/v1/iam_policy/helpers" if ::File.file? helper_path
@@ -0,0 +1,562 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/iam/v1/iam_policy_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module PubSub
25
+ module V1
26
+ module IAMPolicy
27
+ ##
28
+ # Client for the IAMPolicy service.
29
+ #
30
+ # ## API Overview
31
+ #
32
+ # Manages Identity and Access Management (IAM) policies.
33
+ #
34
+ # Any implementation of an API that offers access control features
35
+ # implements the google.iam.v1.IAMPolicy interface.
36
+ #
37
+ # ## Data model
38
+ #
39
+ # Access control is applied when a principal (user or service account), takes
40
+ # some action on a resource exposed by a service. Resources, identified by
41
+ # URI-like names, are the unit of access control specification. Service
42
+ # implementations can choose the granularity of access control and the
43
+ # supported permissions for their resources.
44
+ # For example one database service may allow access control to be
45
+ # specified only at the Table level, whereas another might allow access control
46
+ # to also be specified at the Column level.
47
+ #
48
+ # ## Policy Structure
49
+ #
50
+ # See google.iam.v1.Policy
51
+ #
52
+ # This is intentionally not a CRUD style API because access control policies
53
+ # are created and deleted implicitly with the resources to which they are
54
+ # attached.
55
+ #
56
+ class Client
57
+ # @private
58
+ attr_reader :iam_policy_stub
59
+
60
+ ##
61
+ # Configure the IAMPolicy Client class.
62
+ #
63
+ # See {::Google::Cloud::PubSub::V1::IAMPolicy::Client::Configuration}
64
+ # for a description of the configuration fields.
65
+ #
66
+ # ## Example
67
+ #
68
+ # To modify the configuration for all IAMPolicy clients:
69
+ #
70
+ # ::Google::Cloud::PubSub::V1::IAMPolicy::Client.configure do |config|
71
+ # config.timeout = 10.0
72
+ # end
73
+ #
74
+ # @yield [config] Configure the Client client.
75
+ # @yieldparam config [Client::Configuration]
76
+ #
77
+ # @return [Client::Configuration]
78
+ #
79
+ def self.configure
80
+ @configure ||= begin
81
+ namespace = ["Google", "Cloud", "PubSub", "V1"]
82
+ parent_config = while namespace.any?
83
+ parent_name = namespace.join "::"
84
+ parent_const = const_get parent_name
85
+ break parent_const.configure if parent_const&.respond_to? :configure
86
+ namespace.pop
87
+ end
88
+ default_config = Client::Configuration.new parent_config
89
+
90
+ default_config
91
+ end
92
+ yield @configure if block_given?
93
+ @configure
94
+ end
95
+
96
+ ##
97
+ # Configure the IAMPolicy Client instance.
98
+ #
99
+ # The configuration is set to the derived mode, meaning that values can be changed,
100
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
101
+ # should be made on {Client.configure}.
102
+ #
103
+ # See {::Google::Cloud::PubSub::V1::IAMPolicy::Client::Configuration}
104
+ # for a description of the configuration fields.
105
+ #
106
+ # @yield [config] Configure the Client client.
107
+ # @yieldparam config [Client::Configuration]
108
+ #
109
+ # @return [Client::Configuration]
110
+ #
111
+ def configure
112
+ yield @config if block_given?
113
+ @config
114
+ end
115
+
116
+ ##
117
+ # Create a new IAMPolicy client object.
118
+ #
119
+ # ## Examples
120
+ #
121
+ # To create a new IAMPolicy client with the default
122
+ # configuration:
123
+ #
124
+ # client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new
125
+ #
126
+ # To create a new IAMPolicy client with a custom
127
+ # configuration:
128
+ #
129
+ # client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new do |config|
130
+ # config.timeout = 10.0
131
+ # end
132
+ #
133
+ # @yield [config] Configure the IAMPolicy client.
134
+ # @yieldparam config [Client::Configuration]
135
+ #
136
+ def initialize
137
+ # These require statements are intentionally placed here to initialize
138
+ # the gRPC module only when it's required.
139
+ # See https://github.com/googleapis/toolkit/issues/446
140
+ require "gapic/grpc"
141
+ require "google/iam/v1/iam_policy_services_pb"
142
+
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ credentials ||= Credentials.default scope: @config.scope
152
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
153
+ credentials = Credentials.new credentials, scope: @config.scope
154
+ end
155
+ @quota_project_id = @config.quota_project
156
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
+
158
+ @iam_policy_stub = ::Gapic::ServiceStub.new(
159
+ ::Google::Iam::V1::IAMPolicy::Stub,
160
+ credentials: credentials,
161
+ endpoint: @config.endpoint,
162
+ channel_args: @config.channel_args,
163
+ interceptors: @config.interceptors
164
+ )
165
+ end
166
+
167
+ # Service calls
168
+
169
+ ##
170
+ # Sets the access control policy on the specified resource. Replaces any
171
+ # existing policy.
172
+ #
173
+ # @overload set_iam_policy(request, options = nil)
174
+ # Pass arguments to `set_iam_policy` via a request object, either of type
175
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
176
+ #
177
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
178
+ # A request object representing the call parameters. Required. To specify no
179
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
180
+ # @param options [::Gapic::CallOptions, ::Hash]
181
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
182
+ #
183
+ # @overload set_iam_policy(resource: nil, policy: nil)
184
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
185
+ # least one keyword argument is required. To specify no parameters, or to keep all
186
+ # the default parameter values, pass an empty Hash as a request object (see above).
187
+ #
188
+ # @param resource [::String]
189
+ # REQUIRED: The resource for which the policy is being specified.
190
+ # See the operation documentation for the appropriate value for this field.
191
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
192
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
193
+ # the policy is limited to a few 10s of KB. An empty policy is a
194
+ # valid policy but certain Cloud Platform services (such as Projects)
195
+ # might reject them.
196
+ #
197
+ # @yield [response, operation] Access the result along with the RPC operation
198
+ # @yieldparam response [::Google::Iam::V1::Policy]
199
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
200
+ #
201
+ # @return [::Google::Iam::V1::Policy]
202
+ #
203
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
204
+ #
205
+ def set_iam_policy request, options = nil
206
+ raise ::ArgumentError, "request must be provided" if request.nil?
207
+
208
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
209
+
210
+ # Converts hash and nil to an options object
211
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
212
+
213
+ # Customize the options with defaults
214
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
215
+
216
+ # Set x-goog-api-client and x-goog-user-project headers
217
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
218
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
219
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
220
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
221
+
222
+ header_params = {
223
+ "resource" => request.resource
224
+ }
225
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
226
+ metadata[:"x-goog-request-params"] ||= request_params_header
227
+
228
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
229
+ metadata: metadata,
230
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
231
+ options.apply_defaults metadata: @config.metadata,
232
+ retry_policy: @config.retry_policy
233
+
234
+ @iam_policy_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
235
+ yield response, operation if block_given?
236
+ return response
237
+ end
238
+ rescue ::GRPC::BadStatus => e
239
+ raise ::Google::Cloud::Error.from_error(e)
240
+ end
241
+
242
+ ##
243
+ # Gets the access control policy for a resource.
244
+ # Returns an empty policy if the resource exists and does not have a policy
245
+ # set.
246
+ #
247
+ # @overload get_iam_policy(request, options = nil)
248
+ # Pass arguments to `get_iam_policy` via a request object, either of type
249
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
250
+ #
251
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
252
+ # A request object representing the call parameters. Required. To specify no
253
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
254
+ # @param options [::Gapic::CallOptions, ::Hash]
255
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
256
+ #
257
+ # @overload get_iam_policy(resource: nil, options: nil)
258
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
259
+ # least one keyword argument is required. To specify no parameters, or to keep all
260
+ # the default parameter values, pass an empty Hash as a request object (see above).
261
+ #
262
+ # @param resource [::String]
263
+ # REQUIRED: The resource for which the policy is being requested.
264
+ # See the operation documentation for the appropriate value for this field.
265
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
266
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
267
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
268
+ #
269
+ # @yield [response, operation] Access the result along with the RPC operation
270
+ # @yieldparam response [::Google::Iam::V1::Policy]
271
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
272
+ #
273
+ # @return [::Google::Iam::V1::Policy]
274
+ #
275
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
276
+ #
277
+ def get_iam_policy request, options = nil
278
+ raise ::ArgumentError, "request must be provided" if request.nil?
279
+
280
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
281
+
282
+ # Converts hash and nil to an options object
283
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
284
+
285
+ # Customize the options with defaults
286
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
287
+
288
+ # Set x-goog-api-client and x-goog-user-project headers
289
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
290
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
291
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
292
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
293
+
294
+ header_params = {
295
+ "resource" => request.resource
296
+ }
297
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
298
+ metadata[:"x-goog-request-params"] ||= request_params_header
299
+
300
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
301
+ metadata: metadata,
302
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
303
+ options.apply_defaults metadata: @config.metadata,
304
+ retry_policy: @config.retry_policy
305
+
306
+ @iam_policy_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
307
+ yield response, operation if block_given?
308
+ return response
309
+ end
310
+ rescue ::GRPC::BadStatus => e
311
+ raise ::Google::Cloud::Error.from_error(e)
312
+ end
313
+
314
+ ##
315
+ # Returns permissions that a caller has on the specified resource.
316
+ # If the resource does not exist, this will return an empty set of
317
+ # permissions, not a NOT_FOUND error.
318
+ #
319
+ # Note: This operation is designed to be used for building permission-aware
320
+ # UIs and command-line tools, not for authorization checking. This operation
321
+ # may "fail open" without warning.
322
+ #
323
+ # @overload test_iam_permissions(request, options = nil)
324
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
325
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
326
+ #
327
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
328
+ # A request object representing the call parameters. Required. To specify no
329
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
330
+ # @param options [::Gapic::CallOptions, ::Hash]
331
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
332
+ #
333
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
334
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
335
+ # least one keyword argument is required. To specify no parameters, or to keep all
336
+ # the default parameter values, pass an empty Hash as a request object (see above).
337
+ #
338
+ # @param resource [::String]
339
+ # REQUIRED: The resource for which the policy detail is being requested.
340
+ # See the operation documentation for the appropriate value for this field.
341
+ # @param permissions [::Array<::String>]
342
+ # The set of permissions to check for the `resource`. Permissions with
343
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
344
+ # information see
345
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
346
+ #
347
+ # @yield [response, operation] Access the result along with the RPC operation
348
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
349
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
350
+ #
351
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
352
+ #
353
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
354
+ #
355
+ def test_iam_permissions request, options = nil
356
+ raise ::ArgumentError, "request must be provided" if request.nil?
357
+
358
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
359
+
360
+ # Converts hash and nil to an options object
361
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
362
+
363
+ # Customize the options with defaults
364
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
365
+
366
+ # Set x-goog-api-client and x-goog-user-project headers
367
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
368
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
369
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
370
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
371
+
372
+ header_params = {
373
+ "resource" => request.resource
374
+ }
375
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
376
+ metadata[:"x-goog-request-params"] ||= request_params_header
377
+
378
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
379
+ metadata: metadata,
380
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
381
+ options.apply_defaults metadata: @config.metadata,
382
+ retry_policy: @config.retry_policy
383
+
384
+ @iam_policy_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
385
+ yield response, operation if block_given?
386
+ return response
387
+ end
388
+ rescue ::GRPC::BadStatus => e
389
+ raise ::Google::Cloud::Error.from_error(e)
390
+ end
391
+
392
+ ##
393
+ # Configuration class for the IAMPolicy API.
394
+ #
395
+ # This class represents the configuration for IAMPolicy,
396
+ # providing control over timeouts, retry behavior, logging, transport
397
+ # parameters, and other low-level controls. Certain parameters can also be
398
+ # applied individually to specific RPCs. See
399
+ # {::Google::Cloud::PubSub::V1::IAMPolicy::Client::Configuration::Rpcs}
400
+ # for a list of RPCs that can be configured independently.
401
+ #
402
+ # Configuration can be applied globally to all clients, or to a single client
403
+ # on construction.
404
+ #
405
+ # # Examples
406
+ #
407
+ # To modify the global config, setting the timeout for set_iam_policy
408
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
409
+ #
410
+ # ::Google::Cloud::PubSub::V1::IAMPolicy::Client.configure do |config|
411
+ # config.timeout = 10.0
412
+ # config.rpcs.set_iam_policy.timeout = 20.0
413
+ # end
414
+ #
415
+ # To apply the above configuration only to a new client:
416
+ #
417
+ # client = ::Google::Cloud::PubSub::V1::IAMPolicy::Client.new do |config|
418
+ # config.timeout = 10.0
419
+ # config.rpcs.set_iam_policy.timeout = 20.0
420
+ # end
421
+ #
422
+ # @!attribute [rw] endpoint
423
+ # The hostname or hostname:port of the service endpoint.
424
+ # Defaults to `"pubsub.googleapis.com"`.
425
+ # @return [::String]
426
+ # @!attribute [rw] credentials
427
+ # Credentials to send with calls. You may provide any of the following types:
428
+ # * (`String`) The path to a service account key file in JSON format
429
+ # * (`Hash`) A service account key as a Hash
430
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
431
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
432
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
433
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
434
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
435
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
436
+ # * (`nil`) indicating no credentials
437
+ # @return [::Object]
438
+ # @!attribute [rw] scope
439
+ # The OAuth scopes
440
+ # @return [::Array<::String>]
441
+ # @!attribute [rw] lib_name
442
+ # The library name as recorded in instrumentation and logging
443
+ # @return [::String]
444
+ # @!attribute [rw] lib_version
445
+ # The library version as recorded in instrumentation and logging
446
+ # @return [::String]
447
+ # @!attribute [rw] channel_args
448
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
449
+ # `GRPC::Core::Channel` object is provided as the credential.
450
+ # @return [::Hash]
451
+ # @!attribute [rw] interceptors
452
+ # An array of interceptors that are run before calls are executed.
453
+ # @return [::Array<::GRPC::ClientInterceptor>]
454
+ # @!attribute [rw] timeout
455
+ # The call timeout in seconds.
456
+ # @return [::Numeric]
457
+ # @!attribute [rw] metadata
458
+ # Additional gRPC headers to be sent with the call.
459
+ # @return [::Hash{::Symbol=>::String}]
460
+ # @!attribute [rw] retry_policy
461
+ # The retry policy. The value is a hash with the following keys:
462
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
463
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
464
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
465
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
466
+ # trigger a retry.
467
+ # @return [::Hash]
468
+ # @!attribute [rw] quota_project
469
+ # A separate project against which to charge quota.
470
+ # @return [::String]
471
+ #
472
+ class Configuration
473
+ extend ::Gapic::Config
474
+
475
+ config_attr :endpoint, "pubsub.googleapis.com", ::String
476
+ config_attr :credentials, nil do |value|
477
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
478
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
479
+ allowed.any? { |klass| klass === value }
480
+ end
481
+ config_attr :scope, nil, ::String, ::Array, nil
482
+ config_attr :lib_name, nil, ::String, nil
483
+ config_attr :lib_version, nil, ::String, nil
484
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
485
+ config_attr :interceptors, nil, ::Array, nil
486
+ config_attr :timeout, nil, ::Numeric, nil
487
+ config_attr :metadata, nil, ::Hash, nil
488
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
489
+ config_attr :quota_project, nil, ::String, nil
490
+
491
+ # @private
492
+ def initialize parent_config = nil
493
+ @parent_config = parent_config unless parent_config.nil?
494
+
495
+ yield self if block_given?
496
+ end
497
+
498
+ ##
499
+ # Configurations for individual RPCs
500
+ # @return [Rpcs]
501
+ #
502
+ def rpcs
503
+ @rpcs ||= begin
504
+ parent_rpcs = nil
505
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
506
+ Rpcs.new parent_rpcs
507
+ end
508
+ end
509
+
510
+ ##
511
+ # Configuration RPC class for the IAMPolicy API.
512
+ #
513
+ # Includes fields providing the configuration for each RPC in this service.
514
+ # Each configuration object is of type `Gapic::Config::Method` and includes
515
+ # the following configuration fields:
516
+ #
517
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
518
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
519
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
520
+ # include the following keys:
521
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
522
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
523
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
524
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
525
+ # trigger a retry.
526
+ #
527
+ class Rpcs
528
+ ##
529
+ # RPC-specific configuration for `set_iam_policy`
530
+ # @return [::Gapic::Config::Method]
531
+ #
532
+ attr_reader :set_iam_policy
533
+ ##
534
+ # RPC-specific configuration for `get_iam_policy`
535
+ # @return [::Gapic::Config::Method]
536
+ #
537
+ attr_reader :get_iam_policy
538
+ ##
539
+ # RPC-specific configuration for `test_iam_permissions`
540
+ # @return [::Gapic::Config::Method]
541
+ #
542
+ attr_reader :test_iam_permissions
543
+
544
+ # @private
545
+ def initialize parent_rpcs = nil
546
+ set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
547
+ @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
549
+ @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
551
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
552
+
553
+ yield self if block_given?
554
+ end
555
+ end
556
+ end
557
+ end
558
+ end
559
+ end
560
+ end
561
+ end
562
+ end