google-cloud-pubsub-v1 0.1.0 → 0.3.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.
@@ -0,0 +1,52 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module PubSub
24
+ module V1
25
+ module SchemaService
26
+ # Credentials for the SchemaService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/pubsub"
31
+ ]
32
+ self.env_vars = [
33
+ "PUBSUB_CREDENTIALS",
34
+ "PUBSUB_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS",
36
+ "GOOGLE_CLOUD_KEYFILE",
37
+ "GCLOUD_KEYFILE",
38
+ "PUBSUB_CREDENTIALS_JSON",
39
+ "PUBSUB_KEYFILE_JSON",
40
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
41
+ "GOOGLE_CLOUD_KEYFILE_JSON",
42
+ "GCLOUD_KEYFILE_JSON"
43
+ ]
44
+ self.paths = [
45
+ "~/.config/google_cloud/application_default_credentials.json"
46
+ ]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,64 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module PubSub
23
+ module V1
24
+ module SchemaService
25
+ # Path helper methods for the SchemaService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Project resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}`
33
+ #
34
+ # @param project [String]
35
+ #
36
+ # @return [::String]
37
+ def project_path project:
38
+ "projects/#{project}"
39
+ end
40
+
41
+ ##
42
+ # Create a fully-qualified Schema resource string.
43
+ #
44
+ # The resource will be in the following format:
45
+ #
46
+ # `projects/{project}/schemas/{schema}`
47
+ #
48
+ # @param project [String]
49
+ # @param schema [String]
50
+ #
51
+ # @return [::String]
52
+ def schema_path project:, schema:
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+
55
+ "projects/#{project}/schemas/#{schema}"
56
+ end
57
+
58
+ extend self
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -72,7 +72,7 @@ module Google
72
72
  initial_delay: 0.1,
73
73
  max_delay: 60.0,
74
74
  multiplier: 1.3,
75
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
75
+ retry_codes: [2, 10, 14]
76
76
  }
77
77
 
78
78
  default_config.rpcs.get_subscription.timeout = 60.0
@@ -80,7 +80,7 @@ module Google
80
80
  initial_delay: 0.1,
81
81
  max_delay: 60.0,
82
82
  multiplier: 1.3,
83
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
83
+ retry_codes: [2, 10, 14]
84
84
  }
85
85
 
86
86
  default_config.rpcs.update_subscription.timeout = 60.0
@@ -88,7 +88,7 @@ module Google
88
88
  initial_delay: 0.1,
89
89
  max_delay: 60.0,
90
90
  multiplier: 1.3,
91
- retry_codes: ["UNAVAILABLE"]
91
+ retry_codes: [14]
92
92
  }
93
93
 
94
94
  default_config.rpcs.list_subscriptions.timeout = 60.0
@@ -96,7 +96,7 @@ module Google
96
96
  initial_delay: 0.1,
97
97
  max_delay: 60.0,
98
98
  multiplier: 1.3,
99
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
99
+ retry_codes: [2, 10, 14]
100
100
  }
101
101
 
102
102
  default_config.rpcs.delete_subscription.timeout = 60.0
@@ -104,7 +104,7 @@ module Google
104
104
  initial_delay: 0.1,
105
105
  max_delay: 60.0,
106
106
  multiplier: 1.3,
107
- retry_codes: ["UNAVAILABLE"]
107
+ retry_codes: [14]
108
108
  }
109
109
 
110
110
  default_config.rpcs.modify_ack_deadline.timeout = 60.0
@@ -112,7 +112,7 @@ module Google
112
112
  initial_delay: 0.1,
113
113
  max_delay: 60.0,
114
114
  multiplier: 1.3,
115
- retry_codes: ["UNAVAILABLE"]
115
+ retry_codes: [14]
116
116
  }
117
117
 
118
118
  default_config.rpcs.acknowledge.timeout = 60.0
@@ -120,7 +120,7 @@ module Google
120
120
  initial_delay: 0.1,
121
121
  max_delay: 60.0,
122
122
  multiplier: 1.3,
123
- retry_codes: ["UNAVAILABLE"]
123
+ retry_codes: [14]
124
124
  }
125
125
 
126
126
  default_config.rpcs.pull.timeout = 60.0
@@ -128,7 +128,7 @@ module Google
128
128
  initial_delay: 0.1,
129
129
  max_delay: 60.0,
130
130
  multiplier: 1.3,
131
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
131
+ retry_codes: [2, 10, 14]
132
132
  }
133
133
 
134
134
  default_config.rpcs.streaming_pull.timeout = 900.0
@@ -136,7 +136,7 @@ module Google
136
136
  initial_delay: 0.1,
137
137
  max_delay: 60.0,
138
138
  multiplier: 1.3,
139
- retry_codes: ["DEADLINE_EXCEEDED", "RESOURCE_EXHAUSTED", "ABORTED", "INTERNAL", "UNAVAILABLE"]
139
+ retry_codes: [4, 8, 10, 13, 14]
140
140
  }
141
141
 
142
142
  default_config.rpcs.modify_push_config.timeout = 60.0
@@ -144,7 +144,7 @@ module Google
144
144
  initial_delay: 0.1,
145
145
  max_delay: 60.0,
146
146
  multiplier: 1.3,
147
- retry_codes: ["UNAVAILABLE"]
147
+ retry_codes: [14]
148
148
  }
149
149
 
150
150
  default_config.rpcs.get_snapshot.timeout = 60.0
@@ -152,7 +152,7 @@ module Google
152
152
  initial_delay: 0.1,
153
153
  max_delay: 60.0,
154
154
  multiplier: 1.3,
155
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
155
+ retry_codes: [2, 10, 14]
156
156
  }
157
157
 
158
158
  default_config.rpcs.list_snapshots.timeout = 60.0
@@ -160,7 +160,7 @@ module Google
160
160
  initial_delay: 0.1,
161
161
  max_delay: 60.0,
162
162
  multiplier: 1.3,
163
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
163
+ retry_codes: [2, 10, 14]
164
164
  }
165
165
 
166
166
  default_config.rpcs.create_snapshot.timeout = 60.0
@@ -168,7 +168,7 @@ module Google
168
168
  initial_delay: 0.1,
169
169
  max_delay: 60.0,
170
170
  multiplier: 1.3,
171
- retry_codes: ["UNAVAILABLE"]
171
+ retry_codes: [14]
172
172
  }
173
173
 
174
174
  default_config.rpcs.update_snapshot.timeout = 60.0
@@ -176,7 +176,7 @@ module Google
176
176
  initial_delay: 0.1,
177
177
  max_delay: 60.0,
178
178
  multiplier: 1.3,
179
- retry_codes: ["UNAVAILABLE"]
179
+ retry_codes: [14]
180
180
  }
181
181
 
182
182
  default_config.rpcs.delete_snapshot.timeout = 60.0
@@ -184,7 +184,7 @@ module Google
184
184
  initial_delay: 0.1,
185
185
  max_delay: 60.0,
186
186
  multiplier: 1.3,
187
- retry_codes: ["UNAVAILABLE"]
187
+ retry_codes: [14]
188
188
  }
189
189
 
190
190
  default_config.rpcs.seek.timeout = 60.0
@@ -192,7 +192,7 @@ module Google
192
192
  initial_delay: 0.1,
193
193
  max_delay: 60.0,
194
194
  multiplier: 1.3,
195
- retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
195
+ retry_codes: [2, 10, 14]
196
196
  }
197
197
 
198
198
  default_config
@@ -256,7 +256,13 @@ module Google
256
256
 
257
257
  # Create credentials
258
258
  credentials = @config.credentials
259
- credentials ||= Credentials.default scope: @config.scope
259
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
260
+ # but only if the default endpoint does not have a region prefix.
261
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
262
+ @config.endpoint == Client.configure.endpoint &&
263
+ !@config.endpoint.split(".").first.include?("-")
264
+ credentials ||= Credentials.default scope: @config.scope,
265
+ enable_self_signed_jwt: enable_self_signed_jwt
260
266
  if credentials.is_a?(String) || credentials.is_a?(Hash)
261
267
  credentials = Credentials.new credentials, scope: @config.scope
262
268
  end
@@ -275,19 +281,17 @@ module Google
275
281
  # Service calls
276
282
 
277
283
  ##
278
- # Creates a subscription to a given topic. See the
279
- # <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
280
- # resource name rules</a>.
284
+ # Creates a subscription to a given topic. See the [resource name rules]
285
+ # (https://cloud.google.com/pubsub/docs/admin#resource_names).
281
286
  # If the subscription already exists, returns `ALREADY_EXISTS`.
282
287
  # If the corresponding topic doesn't exist, returns `NOT_FOUND`.
283
288
  #
284
289
  # If the name is not provided in the request, the server will assign a random
285
290
  # name for this subscription on the same project as the topic, conforming
286
- # to the
287
- # [resource name
288
- # format](https://cloud.google.com/pubsub/docs/admin#resource_names). The
289
- # generated name is populated in the returned Subscription object. Note that
290
- # for REST API requests, you must specify a name in the request.
291
+ # to the [resource name format]
292
+ # (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
293
+ # name is populated in the returned Subscription object. Note that for REST
294
+ # API requests, you must specify a name in the request.
291
295
  #
292
296
  # @overload create_subscription(request, options = nil)
293
297
  # Pass arguments to `create_subscription` via a request object, either of type
@@ -344,10 +348,8 @@ module Google
344
348
  # Indicates whether to retain acknowledged messages. If true, then
345
349
  # messages are not expunged from the subscription's backlog, even if they are
346
350
  # acknowledged, until they fall out of the `message_retention_duration`
347
- # window. This must be true if you would like to
348
- # <a
349
- # href="https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time">
350
- # Seek to a timestamp</a>.
351
+ # window. This must be true if you would like to [Seek to a timestamp]
352
+ # (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
351
353
  # @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
352
354
  # How long to retain unacknowledged messages in the subscription's backlog,
353
355
  # from the moment a message is published.
@@ -363,9 +365,6 @@ module Google
363
365
  # will be delivered to the subscribers in the order in which they
364
366
  # are received by the Pub/Sub system. Otherwise, they may be delivered in
365
367
  # any order.
366
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
367
- # API might be changed in backward-incompatible ways and is not recommended
368
- # for production use. It is not subject to any SLA or deprecation policy.
369
368
  # @param expiration_policy [::Google::Cloud::PubSub::V1::ExpirationPolicy, ::Hash]
370
369
  # A policy that specifies the conditions for this subscription's expiration.
371
370
  # A subscription is considered active as long as any connected subscriber is
@@ -1179,12 +1178,11 @@ module Google
1179
1178
  end
1180
1179
 
1181
1180
  ##
1182
- # Lists the existing snapshots. Snapshots are used in
1183
- # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1184
- # operations, which allow
1185
- # you to manage message acknowledgments in bulk. That is, you can set the
1186
- # acknowledgment state of messages in an existing subscription to the state
1187
- # captured by a snapshot.
1181
+ # Lists the existing snapshots. Snapshots are used in [Seek](
1182
+ # https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1183
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1184
+ # the acknowledgment state of messages in an existing subscription to the
1185
+ # state captured by a snapshot.
1188
1186
  #
1189
1187
  # @overload list_snapshots(request, options = nil)
1190
1188
  # Pass arguments to `list_snapshots` via a request object, either of type
@@ -1259,21 +1257,19 @@ module Google
1259
1257
 
1260
1258
  ##
1261
1259
  # Creates a snapshot from the requested subscription. Snapshots are used in
1262
- # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1263
- # operations, which allow
1264
- # you to manage message acknowledgments in bulk. That is, you can set the
1265
- # acknowledgment state of messages in an existing subscription to the state
1266
- # captured by a snapshot.
1267
- # <br><br>If the snapshot already exists, returns `ALREADY_EXISTS`.
1260
+ # [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
1261
+ # which allow you to manage message acknowledgments in bulk. That is, you can
1262
+ # set the acknowledgment state of messages in an existing subscription to the
1263
+ # state captured by a snapshot.
1264
+ # If the snapshot already exists, returns `ALREADY_EXISTS`.
1268
1265
  # If the requested subscription doesn't exist, returns `NOT_FOUND`.
1269
1266
  # If the backlog in the subscription is too old -- and the resulting snapshot
1270
1267
  # would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
1271
1268
  # See also the `Snapshot.expire_time` field. If the name is not provided in
1272
1269
  # the request, the server will assign a random
1273
1270
  # name for this snapshot on the same project as the subscription, conforming
1274
- # to the
1275
- # [resource name
1276
- # format](https://cloud.google.com/pubsub/docs/admin#resource_names). The
1271
+ # to the [resource name format]
1272
+ # (https://cloud.google.com/pubsub/docs/admin#resource_names). The
1277
1273
  # generated name is populated in the returned Snapshot object. Note that for
1278
1274
  # REST API requests, you must specify a name in the request.
1279
1275
  #
@@ -1433,12 +1429,11 @@ module Google
1433
1429
  end
1434
1430
 
1435
1431
  ##
1436
- # Removes an existing snapshot. Snapshots are used in
1437
- # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1438
- # operations, which allow
1439
- # you to manage message acknowledgments in bulk. That is, you can set the
1440
- # acknowledgment state of messages in an existing subscription to the state
1441
- # captured by a snapshot.<br><br>
1432
+ # Removes an existing snapshot. Snapshots are used in [Seek]
1433
+ # (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1434
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1435
+ # the acknowledgment state of messages in an existing subscription to the
1436
+ # state captured by a snapshot.
1442
1437
  # When the snapshot is deleted, all messages retained in the snapshot
1443
1438
  # are immediately dropped. After a snapshot is deleted, a new one may be
1444
1439
  # created with the same name, but the new one has no association with the old
@@ -1510,13 +1505,12 @@ module Google
1510
1505
 
1511
1506
  ##
1512
1507
  # Seeks an existing subscription to a point in time or to a given snapshot,
1513
- # whichever is provided in the request. Snapshots are used in
1514
- # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1515
- # operations, which allow
1516
- # you to manage message acknowledgments in bulk. That is, you can set the
1517
- # acknowledgment state of messages in an existing subscription to the state
1518
- # captured by a snapshot. Note that both the subscription and the snapshot
1519
- # must be on the same topic.
1508
+ # whichever is provided in the request. Snapshots are used in [Seek]
1509
+ # (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1510
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1511
+ # the acknowledgment state of messages in an existing subscription to the
1512
+ # state captured by a snapshot. Note that both the subscription and the
1513
+ # snapshot must be on the same topic.
1520
1514
  #
1521
1515
  # @overload seek(request, options = nil)
1522
1516
  # Pass arguments to `seek` via a request object, either of type
@@ -1682,7 +1676,7 @@ module Google
1682
1676
 
1683
1677
  config_attr :endpoint, "pubsub.googleapis.com", ::String
1684
1678
  config_attr :credentials, nil do |value|
1685
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1679
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1686
1680
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1687
1681
  allowed.any? { |klass| klass === value }
1688
1682
  end
@@ -1722,7 +1716,7 @@ module Google
1722
1716
  # Each configuration object is of type `Gapic::Config::Method` and includes
1723
1717
  # the following configuration fields:
1724
1718
  #
1725
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1719
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1726
1720
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1727
1721
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1728
1722
  # include the following keys:
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module PubSub
23
23
  module V1
24
- VERSION = "0.1.0"
24
+ VERSION = "0.3.0"
25
25
  end
26
26
  end
27
27
  end
@@ -59,11 +59,11 @@ module Google
59
59
 
60
60
  # Sets the access control policy on the specified resource. Replaces any
61
61
  # existing policy.
62
- rpc :SetIamPolicy, SetIamPolicyRequest, Policy
62
+ rpc :SetIamPolicy, ::Google::Iam::V1::SetIamPolicyRequest, ::Google::Iam::V1::Policy
63
63
  # Gets the access control policy for a resource.
64
64
  # Returns an empty policy if the resource exists and does not have a policy
65
65
  # set.
66
- rpc :GetIamPolicy, GetIamPolicyRequest, Policy
66
+ rpc :GetIamPolicy, ::Google::Iam::V1::GetIamPolicyRequest, ::Google::Iam::V1::Policy
67
67
  # Returns permissions that a caller has on the specified resource.
68
68
  # If the resource does not exist, this will return an empty set of
69
69
  # permissions, not a NOT_FOUND error.
@@ -71,7 +71,7 @@ module Google
71
71
  # Note: This operation is designed to be used for building permission-aware
72
72
  # UIs and command-line tools, not for authorization checking. This operation
73
73
  # may "fail open" without warning.
74
- rpc :TestIamPermissions, TestIamPermissionsRequest, TestIamPermissionsResponse
74
+ rpc :TestIamPermissions, ::Google::Iam::V1::TestIamPermissionsRequest, ::Google::Iam::V1::TestIamPermissionsResponse
75
75
  end
76
76
 
77
77
  Stub = Service.rpc_stub_class