google-cloud-pubsub-v1 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +66 -2
- data/lib/google/cloud/pubsub/v1.rb +5 -1
- data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +9 -3
- data/lib/google/cloud/pubsub/v1/publisher/client.rb +34 -23
- data/lib/google/cloud/pubsub/v1/publisher/paths.rb +17 -0
- data/lib/google/cloud/pubsub/v1/schema_service.rb +47 -0
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +783 -0
- data/lib/google/cloud/pubsub/v1/schema_service/credentials.rb +52 -0
- data/lib/google/cloud/pubsub/v1/schema_service/paths.rb +64 -0
- data/lib/google/cloud/pubsub/v1/subscriber/client.rb +56 -62
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/iam/v1/iam_policy_services_pb.rb +3 -3
- data/lib/google/pubsub/v1/pubsub_pb.rb +8 -0
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +60 -69
- data/lib/google/pubsub/v1/schema_pb.rb +95 -0
- data/lib/google/pubsub/v1/schema_services_pb.rb +58 -0
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/pubsub/v1/pubsub.rb +39 -24
- data/proto_docs/google/pubsub/v1/schema.rb +216 -0
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1169ab3a9717663570439add655702ae00f8c2ec7c01963653eaba6fd39a115c
|
4
|
+
data.tar.gz: e68f484c34ec235936781d3403b39884ea767676589ed8bac8c2a453e3130d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a88431f3dee93c73ccedf65909f586acb5454892a251003f9fb2d3d8b6b5720bc44c605516a239b547baade3c1f16248b9cd1d9d34a2aedcf434936a40830c
|
7
|
+
data.tar.gz: 3e71384de4d613a2ced8dd89e41fc860dddd51568fb7af23a74944f68320786c189c46c24dbe278f77c63c1427521988f1eca4a395246c3ae50157d117d52718
|
data/AUTHENTICATION.md
CHANGED
@@ -27,7 +27,7 @@ export PUBSUB_CREDENTIALS=path/to/keyfile.json
|
|
27
27
|
```ruby
|
28
28
|
require "google/cloud/pubsub/v1"
|
29
29
|
|
30
|
-
client = ::Google::Cloud::PubSub::V1::
|
30
|
+
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
31
31
|
```
|
32
32
|
|
33
33
|
## Credential Lookup
|
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
|
|
64
64
|
|
65
65
|
The environment variables that google-cloud-pubsub-v1
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
{::Google::Cloud::PubSub::V1::
|
67
|
+
{::Google::Cloud::PubSub::V1::SchemaService::Credentials}):
|
68
68
|
|
69
69
|
1. `PUBSUB_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
70
|
2. `PUBSUB_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -77,7 +77,7 @@ require "google/cloud/pubsub/v1"
|
|
77
77
|
|
78
78
|
ENV["PUBSUB_CREDENTIALS"] = "path/to/keyfile.json"
|
79
79
|
|
80
|
-
client = ::Google::Cloud::PubSub::V1::
|
80
|
+
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
81
81
|
```
|
82
82
|
|
83
83
|
### Configuration
|
@@ -88,7 +88,7 @@ environment variables. Either on an individual client initialization:
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/pubsub/v1"
|
90
90
|
|
91
|
-
client = ::Google::Cloud::PubSub::V1::
|
91
|
+
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
|
92
92
|
config.credentials = "path/to/keyfile.json"
|
93
93
|
end
|
94
94
|
```
|
@@ -98,11 +98,11 @@ Or configured globally for all clients:
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/pubsub/v1"
|
100
100
|
|
101
|
-
::Google::Cloud::PubSub::V1::
|
101
|
+
::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
|
102
102
|
config.credentials = "path/to/keyfile.json"
|
103
103
|
end
|
104
104
|
|
105
|
-
client = ::Google::Cloud::PubSub::V1::
|
105
|
+
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
106
106
|
```
|
107
107
|
|
108
108
|
### Cloud SDK
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@ Cloud Pub/Sub is a fully-managed real-time messaging service that allows you to
|
|
6
6
|
|
7
7
|
https://github.com/googleapis/google-cloud-ruby
|
8
8
|
|
9
|
+
This gem is a _versioned_ client. It provides basic client classes for a
|
10
|
+
specific version of the Cloud Pub/Sub V1 API. Most users should consider using
|
11
|
+
the main client gem,
|
12
|
+
[google-cloud-pubsub](https://rubygems.org/gems/google-cloud-pubsub).
|
13
|
+
See the section below titled *Which client should I use?* for more information.
|
14
|
+
|
9
15
|
## Installation
|
10
16
|
|
11
17
|
```
|
@@ -26,9 +32,9 @@ In order to use this library, you first need to go through the following steps:
|
|
26
32
|
```ruby
|
27
33
|
require "google/cloud/pubsub/v1"
|
28
34
|
|
29
|
-
client = ::Google::Cloud::PubSub::V1::
|
35
|
+
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
30
36
|
request = my_create_request
|
31
|
-
response = client.
|
37
|
+
response = client.create_schema request
|
32
38
|
```
|
33
39
|
|
34
40
|
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-pubsub-v1/latest)
|
@@ -73,3 +79,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
|
|
73
79
|
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
74
80
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
75
81
|
about the Ruby support schedule.
|
82
|
+
|
83
|
+
## Which client should I use?
|
84
|
+
|
85
|
+
Most modern Ruby client libraries for Google APIs come in two flavors: the main
|
86
|
+
client library with a name such as `google-cloud-pubsub`,
|
87
|
+
and lower-level _versioned_ client libraries with names such as
|
88
|
+
`google-cloud-pubsub-v1`.
|
89
|
+
_In most cases, you should install the main client._
|
90
|
+
|
91
|
+
### What's the difference between the main client and a versioned client?
|
92
|
+
|
93
|
+
A _versioned client_ provides a basic set of data types and client classes for
|
94
|
+
a _single version_ of a specific service. (That is, for a service with multiple
|
95
|
+
versions, there might be a separate versioned client for each service version.)
|
96
|
+
Most versioned clients are written and maintained by a code generator.
|
97
|
+
|
98
|
+
The _main client_ is designed to provide you with the _recommended_ client
|
99
|
+
interfaces for the service. There will be only one main client for any given
|
100
|
+
service, even a service with multiple versions. The main client includes
|
101
|
+
factory methods for constructing the client objects we recommend for most
|
102
|
+
users. In some cases, those will be classes provided by an underlying versioned
|
103
|
+
client; in other cases, they will be handwritten higher-level client objects
|
104
|
+
with additional capabilities, convenience methods, or best practices built in.
|
105
|
+
Generally, the main client will default to a recommended service version,
|
106
|
+
although in some cases you can override this if you need to talk to a specific
|
107
|
+
service version.
|
108
|
+
|
109
|
+
### Why would I want to use the main client?
|
110
|
+
|
111
|
+
We recommend that most users install the main client gem for a service. You can
|
112
|
+
identify this gem as the one _without_ a version in its name, e.g.
|
113
|
+
`google-cloud-pubsub`.
|
114
|
+
The main client is recommended because it will embody the best practices for
|
115
|
+
accessing the service, and may also provide more convenient interfaces or
|
116
|
+
tighter integration into frameworks and third-party libraries. In addition, the
|
117
|
+
documentation and samples published by Google will generally demonstrate use of
|
118
|
+
the main client.
|
119
|
+
|
120
|
+
### Why would I want to use a versioned client?
|
121
|
+
|
122
|
+
You can use a versioned client if you are content with a possibly lower-level
|
123
|
+
class interface, you explicitly want to avoid features provided by the main
|
124
|
+
client, or you want to access a specific service version not be covered by the
|
125
|
+
main client. You can identify versioned client gems because the service version
|
126
|
+
is part of the name, e.g. `google-cloud-pubsub-v1`.
|
127
|
+
|
128
|
+
### What about the google-apis-<name> clients?
|
129
|
+
|
130
|
+
Client library gems with names that begin with `google-apis-` are based on an
|
131
|
+
older code generation technology. They talk to a REST/JSON backend (whereas
|
132
|
+
most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
|
133
|
+
not offer the same performance, features, and ease of use provided by more
|
134
|
+
modern clients.
|
135
|
+
|
136
|
+
The `google-apis-` clients have wide coverage across Google services, so you
|
137
|
+
might need to use one if there is no modern client available for the service.
|
138
|
+
However, if a modern client is available, we generally recommend it over the
|
139
|
+
older `google-apis-` clients.
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
+
require "google/cloud/pubsub/v1/schema_service"
|
19
20
|
require "google/cloud/pubsub/v1/publisher"
|
20
21
|
require "google/cloud/pubsub/v1/subscriber"
|
21
22
|
require "google/cloud/pubsub/v1/iam_policy"
|
@@ -28,10 +29,13 @@ module Google
|
|
28
29
|
# To load this package, including all its services, and instantiate a client:
|
29
30
|
#
|
30
31
|
# require "google/cloud/pubsub/v1"
|
31
|
-
# client = ::Google::Cloud::PubSub::V1::
|
32
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
32
33
|
#
|
33
34
|
module V1
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
39
|
+
|
40
|
+
helper_path = ::File.join __dir__, "v1", "_helpers.rb"
|
41
|
+
require "google/cloud/pubsub/v1/_helpers" if ::File.file? helper_path
|
@@ -148,7 +148,13 @@ module Google
|
|
148
148
|
|
149
149
|
# Create credentials
|
150
150
|
credentials = @config.credentials
|
151
|
-
|
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
|
152
158
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
153
159
|
credentials = Credentials.new credentials, scope: @config.scope
|
154
160
|
end
|
@@ -474,7 +480,7 @@ module Google
|
|
474
480
|
|
475
481
|
config_attr :endpoint, "pubsub.googleapis.com", ::String
|
476
482
|
config_attr :credentials, nil do |value|
|
477
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
483
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
478
484
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
479
485
|
allowed.any? { |klass| klass === value }
|
480
486
|
end
|
@@ -514,7 +520,7 @@ module Google
|
|
514
520
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
515
521
|
# the following configuration fields:
|
516
522
|
#
|
517
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
523
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
518
524
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
519
525
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
520
526
|
# include the following keys:
|
@@ -71,7 +71,7 @@ module Google
|
|
71
71
|
initial_delay: 0.1,
|
72
72
|
max_delay: 60.0,
|
73
73
|
multiplier: 1.3,
|
74
|
-
retry_codes: [
|
74
|
+
retry_codes: [14]
|
75
75
|
}
|
76
76
|
|
77
77
|
default_config.rpcs.update_topic.timeout = 60.0
|
@@ -79,7 +79,7 @@ module Google
|
|
79
79
|
initial_delay: 0.1,
|
80
80
|
max_delay: 60.0,
|
81
81
|
multiplier: 1.3,
|
82
|
-
retry_codes: [
|
82
|
+
retry_codes: [14]
|
83
83
|
}
|
84
84
|
|
85
85
|
default_config.rpcs.publish.timeout = 60.0
|
@@ -87,7 +87,7 @@ module Google
|
|
87
87
|
initial_delay: 0.1,
|
88
88
|
max_delay: 60.0,
|
89
89
|
multiplier: 1.3,
|
90
|
-
retry_codes: [
|
90
|
+
retry_codes: [10, 1, 13, 8, 2, 14, 4]
|
91
91
|
}
|
92
92
|
|
93
93
|
default_config.rpcs.get_topic.timeout = 60.0
|
@@ -95,7 +95,7 @@ module Google
|
|
95
95
|
initial_delay: 0.1,
|
96
96
|
max_delay: 60.0,
|
97
97
|
multiplier: 1.3,
|
98
|
-
retry_codes: [
|
98
|
+
retry_codes: [2, 10, 14]
|
99
99
|
}
|
100
100
|
|
101
101
|
default_config.rpcs.list_topics.timeout = 60.0
|
@@ -103,7 +103,7 @@ module Google
|
|
103
103
|
initial_delay: 0.1,
|
104
104
|
max_delay: 60.0,
|
105
105
|
multiplier: 1.3,
|
106
|
-
retry_codes: [
|
106
|
+
retry_codes: [2, 10, 14]
|
107
107
|
}
|
108
108
|
|
109
109
|
default_config.rpcs.list_topic_subscriptions.timeout = 60.0
|
@@ -111,7 +111,7 @@ module Google
|
|
111
111
|
initial_delay: 0.1,
|
112
112
|
max_delay: 60.0,
|
113
113
|
multiplier: 1.3,
|
114
|
-
retry_codes: [
|
114
|
+
retry_codes: [2, 10, 14]
|
115
115
|
}
|
116
116
|
|
117
117
|
default_config.rpcs.list_topic_snapshots.timeout = 60.0
|
@@ -119,7 +119,7 @@ module Google
|
|
119
119
|
initial_delay: 0.1,
|
120
120
|
max_delay: 60.0,
|
121
121
|
multiplier: 1.3,
|
122
|
-
retry_codes: [
|
122
|
+
retry_codes: [2, 10, 14]
|
123
123
|
}
|
124
124
|
|
125
125
|
default_config.rpcs.delete_topic.timeout = 60.0
|
@@ -127,7 +127,7 @@ module Google
|
|
127
127
|
initial_delay: 0.1,
|
128
128
|
max_delay: 60.0,
|
129
129
|
multiplier: 1.3,
|
130
|
-
retry_codes: [
|
130
|
+
retry_codes: [14]
|
131
131
|
}
|
132
132
|
|
133
133
|
default_config.rpcs.detach_subscription.timeout = 60.0
|
@@ -135,7 +135,7 @@ module Google
|
|
135
135
|
initial_delay: 0.1,
|
136
136
|
max_delay: 60.0,
|
137
137
|
multiplier: 1.3,
|
138
|
-
retry_codes: [
|
138
|
+
retry_codes: [14]
|
139
139
|
}
|
140
140
|
|
141
141
|
default_config
|
@@ -199,7 +199,13 @@ module Google
|
|
199
199
|
|
200
200
|
# Create credentials
|
201
201
|
credentials = @config.credentials
|
202
|
-
|
202
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
203
|
+
# but only if the default endpoint does not have a region prefix.
|
204
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
205
|
+
@config.endpoint == Client.configure.endpoint &&
|
206
|
+
!@config.endpoint.split(".").first.include?("-")
|
207
|
+
credentials ||= Credentials.default scope: @config.scope,
|
208
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
203
209
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
204
210
|
credentials = Credentials.new credentials, scope: @config.scope
|
205
211
|
end
|
@@ -218,9 +224,8 @@ module Google
|
|
218
224
|
# Service calls
|
219
225
|
|
220
226
|
##
|
221
|
-
# Creates the given topic with the given name. See the
|
222
|
-
#
|
223
|
-
# resource name rules</a>.
|
227
|
+
# Creates the given topic with the given name. See the [resource name rules]
|
228
|
+
# (https://cloud.google.com/pubsub/docs/admin#resource_names).
|
224
229
|
#
|
225
230
|
# @overload create_topic(request, options = nil)
|
226
231
|
# Pass arguments to `create_topic` via a request object, either of type
|
@@ -232,7 +237,7 @@ module Google
|
|
232
237
|
# @param options [::Gapic::CallOptions, ::Hash]
|
233
238
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
234
239
|
#
|
235
|
-
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil)
|
240
|
+
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil)
|
236
241
|
# Pass arguments to `create_topic` via keyword arguments. Note that at
|
237
242
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
238
243
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -245,8 +250,8 @@ module Google
|
|
245
250
|
# signs (`%`). It must be between 3 and 255 characters in length, and it
|
246
251
|
# must not start with `"goog"`.
|
247
252
|
# @param labels [::Hash{::String => ::String}]
|
248
|
-
# See
|
249
|
-
#
|
253
|
+
# See [Creating and managing labels]
|
254
|
+
# (https://cloud.google.com/pubsub/docs/labels).
|
250
255
|
# @param message_storage_policy [::Google::Cloud::PubSub::V1::MessageStoragePolicy, ::Hash]
|
251
256
|
# Policy constraining the set of Google Cloud Platform regions where messages
|
252
257
|
# published to the topic may be stored. If not present, then no constraints
|
@@ -256,6 +261,13 @@ module Google
|
|
256
261
|
# to messages published on this topic.
|
257
262
|
#
|
258
263
|
# The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
|
264
|
+
# @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
|
265
|
+
# Settings for validating messages published against a schema.
|
266
|
+
#
|
267
|
+
# EXPERIMENTAL: Schema support is in development and may not work yet.
|
268
|
+
# @param satisfies_pzs [::Boolean]
|
269
|
+
# Reserved for future use. This field is set only in responses from the
|
270
|
+
# server; it is ignored if it is set in any requests.
|
259
271
|
#
|
260
272
|
# @yield [response, operation] Access the result along with the RPC operation
|
261
273
|
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
@@ -661,11 +673,10 @@ module Google
|
|
661
673
|
|
662
674
|
##
|
663
675
|
# Lists the names of the snapshots on this topic. Snapshots are used in
|
664
|
-
#
|
665
|
-
#
|
666
|
-
#
|
667
|
-
#
|
668
|
-
# captured by a snapshot.
|
676
|
+
# [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
|
677
|
+
# which allow you to manage message acknowledgments in bulk. That is, you can
|
678
|
+
# set the acknowledgment state of messages in an existing subscription to the
|
679
|
+
# state captured by a snapshot.
|
669
680
|
#
|
670
681
|
# @overload list_topic_snapshots(request, options = nil)
|
671
682
|
# Pass arguments to `list_topic_snapshots` via a request object, either of type
|
@@ -963,7 +974,7 @@ module Google
|
|
963
974
|
|
964
975
|
config_attr :endpoint, "pubsub.googleapis.com", ::String
|
965
976
|
config_attr :credentials, nil do |value|
|
966
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
977
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
967
978
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
968
979
|
allowed.any? { |klass| klass === value }
|
969
980
|
end
|
@@ -1003,7 +1014,7 @@ module Google
|
|
1003
1014
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1004
1015
|
# the following configuration fields:
|
1005
1016
|
#
|
1006
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1017
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1007
1018
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1008
1019
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1009
1020
|
# include the following keys:
|
@@ -38,6 +38,23 @@ module Google
|
|
38
38
|
"projects/#{project}"
|
39
39
|
end
|
40
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
|
+
|
41
58
|
##
|
42
59
|
# Create a fully-qualified Subscription resource string.
|
43
60
|
#
|
@@ -0,0 +1,47 @@
|
|
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/schema_service/credentials"
|
26
|
+
require "google/cloud/pubsub/v1/schema_service/paths"
|
27
|
+
require "google/cloud/pubsub/v1/schema_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module PubSub
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# To load this service and instantiate a client:
|
35
|
+
#
|
36
|
+
# require "google/cloud/pubsub/v1/schema_service"
|
37
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
38
|
+
#
|
39
|
+
module SchemaService
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
helper_path = ::File.join __dir__, "schema_service", "helpers.rb"
|
47
|
+
require "google/cloud/pubsub/v1/schema_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,783 @@
|
|
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/pubsub/v1/schema_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module PubSub
|
25
|
+
module V1
|
26
|
+
module SchemaService
|
27
|
+
##
|
28
|
+
# Client for the SchemaService service.
|
29
|
+
#
|
30
|
+
class Client
|
31
|
+
include Paths
|
32
|
+
|
33
|
+
# @private
|
34
|
+
attr_reader :schema_service_stub
|
35
|
+
|
36
|
+
##
|
37
|
+
# Configure the SchemaService Client class.
|
38
|
+
#
|
39
|
+
# See {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration}
|
40
|
+
# for a description of the configuration fields.
|
41
|
+
#
|
42
|
+
# ## Example
|
43
|
+
#
|
44
|
+
# To modify the configuration for all SchemaService clients:
|
45
|
+
#
|
46
|
+
# ::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
|
47
|
+
# config.timeout = 10.0
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# @yield [config] Configure the Client client.
|
51
|
+
# @yieldparam config [Client::Configuration]
|
52
|
+
#
|
53
|
+
# @return [Client::Configuration]
|
54
|
+
#
|
55
|
+
def self.configure
|
56
|
+
@configure ||= begin
|
57
|
+
namespace = ["Google", "Cloud", "PubSub", "V1"]
|
58
|
+
parent_config = while namespace.any?
|
59
|
+
parent_name = namespace.join "::"
|
60
|
+
parent_const = const_get parent_name
|
61
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
62
|
+
namespace.pop
|
63
|
+
end
|
64
|
+
default_config = Client::Configuration.new parent_config
|
65
|
+
|
66
|
+
default_config
|
67
|
+
end
|
68
|
+
yield @configure if block_given?
|
69
|
+
@configure
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# Configure the SchemaService Client instance.
|
74
|
+
#
|
75
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
76
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
77
|
+
# should be made on {Client.configure}.
|
78
|
+
#
|
79
|
+
# See {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration}
|
80
|
+
# for a description of the configuration fields.
|
81
|
+
#
|
82
|
+
# @yield [config] Configure the Client client.
|
83
|
+
# @yieldparam config [Client::Configuration]
|
84
|
+
#
|
85
|
+
# @return [Client::Configuration]
|
86
|
+
#
|
87
|
+
def configure
|
88
|
+
yield @config if block_given?
|
89
|
+
@config
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Create a new SchemaService client object.
|
94
|
+
#
|
95
|
+
# ## Examples
|
96
|
+
#
|
97
|
+
# To create a new SchemaService client with the default
|
98
|
+
# configuration:
|
99
|
+
#
|
100
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
|
101
|
+
#
|
102
|
+
# To create a new SchemaService client with a custom
|
103
|
+
# configuration:
|
104
|
+
#
|
105
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the SchemaService client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
def initialize
|
113
|
+
# These require statements are intentionally placed here to initialize
|
114
|
+
# the gRPC module only when it's required.
|
115
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
116
|
+
require "gapic/grpc"
|
117
|
+
require "google/pubsub/v1/schema_services_pb"
|
118
|
+
|
119
|
+
# Create the configuration object
|
120
|
+
@config = Configuration.new Client.configure
|
121
|
+
|
122
|
+
# Yield the configuration if needed
|
123
|
+
yield @config if block_given?
|
124
|
+
|
125
|
+
# Create credentials
|
126
|
+
credentials = @config.credentials
|
127
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
128
|
+
# but only if the default endpoint does not have a region prefix.
|
129
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
130
|
+
@config.endpoint == Client.configure.endpoint &&
|
131
|
+
!@config.endpoint.split(".").first.include?("-")
|
132
|
+
credentials ||= Credentials.default scope: @config.scope,
|
133
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
134
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
135
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
136
|
+
end
|
137
|
+
@quota_project_id = @config.quota_project
|
138
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
139
|
+
|
140
|
+
@schema_service_stub = ::Gapic::ServiceStub.new(
|
141
|
+
::Google::Cloud::PubSub::V1::SchemaService::Stub,
|
142
|
+
credentials: credentials,
|
143
|
+
endpoint: @config.endpoint,
|
144
|
+
channel_args: @config.channel_args,
|
145
|
+
interceptors: @config.interceptors
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Service calls
|
150
|
+
|
151
|
+
##
|
152
|
+
# Creates a schema.
|
153
|
+
#
|
154
|
+
# @overload create_schema(request, options = nil)
|
155
|
+
# Pass arguments to `create_schema` via a request object, either of type
|
156
|
+
# {::Google::Cloud::PubSub::V1::CreateSchemaRequest} or an equivalent Hash.
|
157
|
+
#
|
158
|
+
# @param request [::Google::Cloud::PubSub::V1::CreateSchemaRequest, ::Hash]
|
159
|
+
# A request object representing the call parameters. Required. To specify no
|
160
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
161
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
162
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
163
|
+
#
|
164
|
+
# @overload create_schema(parent: nil, schema: nil, schema_id: nil)
|
165
|
+
# Pass arguments to `create_schema` via keyword arguments. Note that at
|
166
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
167
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
168
|
+
#
|
169
|
+
# @param parent [::String]
|
170
|
+
# Required. The name of the project in which to create the schema.
|
171
|
+
# Format is `projects/{project-id}`.
|
172
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
173
|
+
# Required. The schema object to create.
|
174
|
+
#
|
175
|
+
# This schema's `name` parameter is ignored. The schema object returned
|
176
|
+
# by CreateSchema will have a `name` made using the given `parent` and
|
177
|
+
# `schema_id`.
|
178
|
+
# @param schema_id [::String]
|
179
|
+
# The ID to use for the schema, which will become the final component of
|
180
|
+
# the schema's resource name.
|
181
|
+
#
|
182
|
+
# See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
|
183
|
+
# name constraints.
|
184
|
+
#
|
185
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
186
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
|
187
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
188
|
+
#
|
189
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
190
|
+
#
|
191
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
192
|
+
#
|
193
|
+
def create_schema request, options = nil
|
194
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
195
|
+
|
196
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CreateSchemaRequest
|
197
|
+
|
198
|
+
# Converts hash and nil to an options object
|
199
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
200
|
+
|
201
|
+
# Customize the options with defaults
|
202
|
+
metadata = @config.rpcs.create_schema.metadata.to_h
|
203
|
+
|
204
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
205
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
206
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
207
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
208
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
209
|
+
|
210
|
+
header_params = {
|
211
|
+
"parent" => request.parent
|
212
|
+
}
|
213
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
214
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
215
|
+
|
216
|
+
options.apply_defaults timeout: @config.rpcs.create_schema.timeout,
|
217
|
+
metadata: metadata,
|
218
|
+
retry_policy: @config.rpcs.create_schema.retry_policy
|
219
|
+
options.apply_defaults metadata: @config.metadata,
|
220
|
+
retry_policy: @config.retry_policy
|
221
|
+
|
222
|
+
@schema_service_stub.call_rpc :create_schema, request, options: options do |response, operation|
|
223
|
+
yield response, operation if block_given?
|
224
|
+
return response
|
225
|
+
end
|
226
|
+
rescue ::GRPC::BadStatus => e
|
227
|
+
raise ::Google::Cloud::Error.from_error(e)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Gets a schema.
|
232
|
+
#
|
233
|
+
# @overload get_schema(request, options = nil)
|
234
|
+
# Pass arguments to `get_schema` via a request object, either of type
|
235
|
+
# {::Google::Cloud::PubSub::V1::GetSchemaRequest} or an equivalent Hash.
|
236
|
+
#
|
237
|
+
# @param request [::Google::Cloud::PubSub::V1::GetSchemaRequest, ::Hash]
|
238
|
+
# A request object representing the call parameters. Required. To specify no
|
239
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
240
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
241
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
242
|
+
#
|
243
|
+
# @overload get_schema(name: nil, view: nil)
|
244
|
+
# Pass arguments to `get_schema` via keyword arguments. Note that at
|
245
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
246
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
247
|
+
#
|
248
|
+
# @param name [::String]
|
249
|
+
# Required. The name of the schema to get.
|
250
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
251
|
+
# @param view [::Google::Cloud::PubSub::V1::SchemaView]
|
252
|
+
# The set of fields to return in the response. If not set, returns a Schema
|
253
|
+
# with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
|
254
|
+
# fields.
|
255
|
+
#
|
256
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
257
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
|
258
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
259
|
+
#
|
260
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
261
|
+
#
|
262
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
263
|
+
#
|
264
|
+
def get_schema request, options = nil
|
265
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
266
|
+
|
267
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetSchemaRequest
|
268
|
+
|
269
|
+
# Converts hash and nil to an options object
|
270
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
271
|
+
|
272
|
+
# Customize the options with defaults
|
273
|
+
metadata = @config.rpcs.get_schema.metadata.to_h
|
274
|
+
|
275
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
276
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
277
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
278
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
279
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
280
|
+
|
281
|
+
header_params = {
|
282
|
+
"name" => request.name
|
283
|
+
}
|
284
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
285
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
286
|
+
|
287
|
+
options.apply_defaults timeout: @config.rpcs.get_schema.timeout,
|
288
|
+
metadata: metadata,
|
289
|
+
retry_policy: @config.rpcs.get_schema.retry_policy
|
290
|
+
options.apply_defaults metadata: @config.metadata,
|
291
|
+
retry_policy: @config.retry_policy
|
292
|
+
|
293
|
+
@schema_service_stub.call_rpc :get_schema, request, options: options do |response, operation|
|
294
|
+
yield response, operation if block_given?
|
295
|
+
return response
|
296
|
+
end
|
297
|
+
rescue ::GRPC::BadStatus => e
|
298
|
+
raise ::Google::Cloud::Error.from_error(e)
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# Lists schemas in a project.
|
303
|
+
#
|
304
|
+
# @overload list_schemas(request, options = nil)
|
305
|
+
# Pass arguments to `list_schemas` via a request object, either of type
|
306
|
+
# {::Google::Cloud::PubSub::V1::ListSchemasRequest} or an equivalent Hash.
|
307
|
+
#
|
308
|
+
# @param request [::Google::Cloud::PubSub::V1::ListSchemasRequest, ::Hash]
|
309
|
+
# A request object representing the call parameters. Required. To specify no
|
310
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
311
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
312
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
313
|
+
#
|
314
|
+
# @overload list_schemas(parent: nil, view: nil, page_size: nil, page_token: nil)
|
315
|
+
# Pass arguments to `list_schemas` via keyword arguments. Note that at
|
316
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
317
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
318
|
+
#
|
319
|
+
# @param parent [::String]
|
320
|
+
# Required. The name of the project in which to list schemas.
|
321
|
+
# Format is `projects/{project-id}`.
|
322
|
+
# @param view [::Google::Cloud::PubSub::V1::SchemaView]
|
323
|
+
# The set of Schema fields to return in the response. If not set, returns
|
324
|
+
# Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
325
|
+
# retrieve all fields.
|
326
|
+
# @param page_size [::Integer]
|
327
|
+
# Maximum number of schemas to return.
|
328
|
+
# @param page_token [::String]
|
329
|
+
# The value returned by the last `ListSchemasResponse`; indicates that
|
330
|
+
# this is a continuation of a prior `ListSchemas` call, and that the
|
331
|
+
# system should return the next page of data.
|
332
|
+
#
|
333
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
334
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
335
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
336
|
+
#
|
337
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
338
|
+
#
|
339
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
340
|
+
#
|
341
|
+
def list_schemas request, options = nil
|
342
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
343
|
+
|
344
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemasRequest
|
345
|
+
|
346
|
+
# Converts hash and nil to an options object
|
347
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
348
|
+
|
349
|
+
# Customize the options with defaults
|
350
|
+
metadata = @config.rpcs.list_schemas.metadata.to_h
|
351
|
+
|
352
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
353
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
354
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
355
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
356
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
357
|
+
|
358
|
+
header_params = {
|
359
|
+
"parent" => request.parent
|
360
|
+
}
|
361
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
362
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
363
|
+
|
364
|
+
options.apply_defaults timeout: @config.rpcs.list_schemas.timeout,
|
365
|
+
metadata: metadata,
|
366
|
+
retry_policy: @config.rpcs.list_schemas.retry_policy
|
367
|
+
options.apply_defaults metadata: @config.metadata,
|
368
|
+
retry_policy: @config.retry_policy
|
369
|
+
|
370
|
+
@schema_service_stub.call_rpc :list_schemas, request, options: options do |response, operation|
|
371
|
+
response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schemas, request, response, operation, options
|
372
|
+
yield response, operation if block_given?
|
373
|
+
return response
|
374
|
+
end
|
375
|
+
rescue ::GRPC::BadStatus => e
|
376
|
+
raise ::Google::Cloud::Error.from_error(e)
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# Deletes a schema.
|
381
|
+
#
|
382
|
+
# @overload delete_schema(request, options = nil)
|
383
|
+
# Pass arguments to `delete_schema` via a request object, either of type
|
384
|
+
# {::Google::Cloud::PubSub::V1::DeleteSchemaRequest} or an equivalent Hash.
|
385
|
+
#
|
386
|
+
# @param request [::Google::Cloud::PubSub::V1::DeleteSchemaRequest, ::Hash]
|
387
|
+
# A request object representing the call parameters. Required. To specify no
|
388
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
389
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
390
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
391
|
+
#
|
392
|
+
# @overload delete_schema(name: nil)
|
393
|
+
# Pass arguments to `delete_schema` via keyword arguments. Note that at
|
394
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
395
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
396
|
+
#
|
397
|
+
# @param name [::String]
|
398
|
+
# Required. Name of the schema to delete.
|
399
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
400
|
+
#
|
401
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
402
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
403
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
404
|
+
#
|
405
|
+
# @return [::Google::Protobuf::Empty]
|
406
|
+
#
|
407
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
408
|
+
#
|
409
|
+
def delete_schema request, options = nil
|
410
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
411
|
+
|
412
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRequest
|
413
|
+
|
414
|
+
# Converts hash and nil to an options object
|
415
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
416
|
+
|
417
|
+
# Customize the options with defaults
|
418
|
+
metadata = @config.rpcs.delete_schema.metadata.to_h
|
419
|
+
|
420
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
421
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
422
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
423
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
424
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
425
|
+
|
426
|
+
header_params = {
|
427
|
+
"name" => request.name
|
428
|
+
}
|
429
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
430
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
431
|
+
|
432
|
+
options.apply_defaults timeout: @config.rpcs.delete_schema.timeout,
|
433
|
+
metadata: metadata,
|
434
|
+
retry_policy: @config.rpcs.delete_schema.retry_policy
|
435
|
+
options.apply_defaults metadata: @config.metadata,
|
436
|
+
retry_policy: @config.retry_policy
|
437
|
+
|
438
|
+
@schema_service_stub.call_rpc :delete_schema, request, options: options do |response, operation|
|
439
|
+
yield response, operation if block_given?
|
440
|
+
return response
|
441
|
+
end
|
442
|
+
rescue ::GRPC::BadStatus => e
|
443
|
+
raise ::Google::Cloud::Error.from_error(e)
|
444
|
+
end
|
445
|
+
|
446
|
+
##
|
447
|
+
# Validates a schema.
|
448
|
+
#
|
449
|
+
# @overload validate_schema(request, options = nil)
|
450
|
+
# Pass arguments to `validate_schema` via a request object, either of type
|
451
|
+
# {::Google::Cloud::PubSub::V1::ValidateSchemaRequest} or an equivalent Hash.
|
452
|
+
#
|
453
|
+
# @param request [::Google::Cloud::PubSub::V1::ValidateSchemaRequest, ::Hash]
|
454
|
+
# A request object representing the call parameters. Required. To specify no
|
455
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
456
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
457
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
458
|
+
#
|
459
|
+
# @overload validate_schema(parent: nil, schema: nil)
|
460
|
+
# Pass arguments to `validate_schema` via keyword arguments. Note that at
|
461
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
462
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
463
|
+
#
|
464
|
+
# @param parent [::String]
|
465
|
+
# Required. The name of the project in which to validate schemas.
|
466
|
+
# Format is `projects/{project-id}`.
|
467
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
468
|
+
# Required. The schema object to validate.
|
469
|
+
#
|
470
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
471
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
|
472
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
473
|
+
#
|
474
|
+
# @return [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
|
475
|
+
#
|
476
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
477
|
+
#
|
478
|
+
def validate_schema request, options = nil
|
479
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
480
|
+
|
481
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateSchemaRequest
|
482
|
+
|
483
|
+
# Converts hash and nil to an options object
|
484
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
485
|
+
|
486
|
+
# Customize the options with defaults
|
487
|
+
metadata = @config.rpcs.validate_schema.metadata.to_h
|
488
|
+
|
489
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
490
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
491
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
492
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
493
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
494
|
+
|
495
|
+
header_params = {
|
496
|
+
"parent" => request.parent
|
497
|
+
}
|
498
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
499
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
500
|
+
|
501
|
+
options.apply_defaults timeout: @config.rpcs.validate_schema.timeout,
|
502
|
+
metadata: metadata,
|
503
|
+
retry_policy: @config.rpcs.validate_schema.retry_policy
|
504
|
+
options.apply_defaults metadata: @config.metadata,
|
505
|
+
retry_policy: @config.retry_policy
|
506
|
+
|
507
|
+
@schema_service_stub.call_rpc :validate_schema, request, options: options do |response, operation|
|
508
|
+
yield response, operation if block_given?
|
509
|
+
return response
|
510
|
+
end
|
511
|
+
rescue ::GRPC::BadStatus => e
|
512
|
+
raise ::Google::Cloud::Error.from_error(e)
|
513
|
+
end
|
514
|
+
|
515
|
+
##
|
516
|
+
# Validates a message against a schema.
|
517
|
+
#
|
518
|
+
# @overload validate_message(request, options = nil)
|
519
|
+
# Pass arguments to `validate_message` via a request object, either of type
|
520
|
+
# {::Google::Cloud::PubSub::V1::ValidateMessageRequest} or an equivalent Hash.
|
521
|
+
#
|
522
|
+
# @param request [::Google::Cloud::PubSub::V1::ValidateMessageRequest, ::Hash]
|
523
|
+
# A request object representing the call parameters. Required. To specify no
|
524
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
525
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
526
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
527
|
+
#
|
528
|
+
# @overload validate_message(parent: nil, name: nil, schema: nil, message: nil, encoding: nil)
|
529
|
+
# Pass arguments to `validate_message` via keyword arguments. Note that at
|
530
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
531
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
532
|
+
#
|
533
|
+
# @param parent [::String]
|
534
|
+
# Required. The name of the project in which to validate schemas.
|
535
|
+
# Format is `projects/{project-id}`.
|
536
|
+
# @param name [::String]
|
537
|
+
# Name of the schema against which to validate.
|
538
|
+
#
|
539
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
540
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
541
|
+
# Ad-hoc schema against which to validate
|
542
|
+
# @param message [::String]
|
543
|
+
# Message to validate against the provided `schema_spec`.
|
544
|
+
# @param encoding [::Google::Cloud::PubSub::V1::Encoding]
|
545
|
+
# The encoding expected for messages
|
546
|
+
#
|
547
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
548
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
|
549
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
550
|
+
#
|
551
|
+
# @return [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
|
552
|
+
#
|
553
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
554
|
+
#
|
555
|
+
def validate_message request, options = nil
|
556
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
557
|
+
|
558
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateMessageRequest
|
559
|
+
|
560
|
+
# Converts hash and nil to an options object
|
561
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
562
|
+
|
563
|
+
# Customize the options with defaults
|
564
|
+
metadata = @config.rpcs.validate_message.metadata.to_h
|
565
|
+
|
566
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
567
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
568
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
569
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
570
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
571
|
+
|
572
|
+
header_params = {
|
573
|
+
"parent" => request.parent
|
574
|
+
}
|
575
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
576
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
577
|
+
|
578
|
+
options.apply_defaults timeout: @config.rpcs.validate_message.timeout,
|
579
|
+
metadata: metadata,
|
580
|
+
retry_policy: @config.rpcs.validate_message.retry_policy
|
581
|
+
options.apply_defaults metadata: @config.metadata,
|
582
|
+
retry_policy: @config.retry_policy
|
583
|
+
|
584
|
+
@schema_service_stub.call_rpc :validate_message, request, options: options do |response, operation|
|
585
|
+
yield response, operation if block_given?
|
586
|
+
return response
|
587
|
+
end
|
588
|
+
rescue ::GRPC::BadStatus => e
|
589
|
+
raise ::Google::Cloud::Error.from_error(e)
|
590
|
+
end
|
591
|
+
|
592
|
+
##
|
593
|
+
# Configuration class for the SchemaService API.
|
594
|
+
#
|
595
|
+
# This class represents the configuration for SchemaService,
|
596
|
+
# providing control over timeouts, retry behavior, logging, transport
|
597
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
598
|
+
# applied individually to specific RPCs. See
|
599
|
+
# {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration::Rpcs}
|
600
|
+
# for a list of RPCs that can be configured independently.
|
601
|
+
#
|
602
|
+
# Configuration can be applied globally to all clients, or to a single client
|
603
|
+
# on construction.
|
604
|
+
#
|
605
|
+
# # Examples
|
606
|
+
#
|
607
|
+
# To modify the global config, setting the timeout for create_schema
|
608
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
609
|
+
#
|
610
|
+
# ::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
|
611
|
+
# config.timeout = 10.0
|
612
|
+
# config.rpcs.create_schema.timeout = 20.0
|
613
|
+
# end
|
614
|
+
#
|
615
|
+
# To apply the above configuration only to a new client:
|
616
|
+
#
|
617
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
|
618
|
+
# config.timeout = 10.0
|
619
|
+
# config.rpcs.create_schema.timeout = 20.0
|
620
|
+
# end
|
621
|
+
#
|
622
|
+
# @!attribute [rw] endpoint
|
623
|
+
# The hostname or hostname:port of the service endpoint.
|
624
|
+
# Defaults to `"pubsub.googleapis.com"`.
|
625
|
+
# @return [::String]
|
626
|
+
# @!attribute [rw] credentials
|
627
|
+
# Credentials to send with calls. You may provide any of the following types:
|
628
|
+
# * (`String`) The path to a service account key file in JSON format
|
629
|
+
# * (`Hash`) A service account key as a Hash
|
630
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
631
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
632
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
633
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
634
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
635
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
636
|
+
# * (`nil`) indicating no credentials
|
637
|
+
# @return [::Object]
|
638
|
+
# @!attribute [rw] scope
|
639
|
+
# The OAuth scopes
|
640
|
+
# @return [::Array<::String>]
|
641
|
+
# @!attribute [rw] lib_name
|
642
|
+
# The library name as recorded in instrumentation and logging
|
643
|
+
# @return [::String]
|
644
|
+
# @!attribute [rw] lib_version
|
645
|
+
# The library version as recorded in instrumentation and logging
|
646
|
+
# @return [::String]
|
647
|
+
# @!attribute [rw] channel_args
|
648
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
649
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
650
|
+
# @return [::Hash]
|
651
|
+
# @!attribute [rw] interceptors
|
652
|
+
# An array of interceptors that are run before calls are executed.
|
653
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
654
|
+
# @!attribute [rw] timeout
|
655
|
+
# The call timeout in seconds.
|
656
|
+
# @return [::Numeric]
|
657
|
+
# @!attribute [rw] metadata
|
658
|
+
# Additional gRPC headers to be sent with the call.
|
659
|
+
# @return [::Hash{::Symbol=>::String}]
|
660
|
+
# @!attribute [rw] retry_policy
|
661
|
+
# The retry policy. The value is a hash with the following keys:
|
662
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
663
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
664
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
665
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
666
|
+
# trigger a retry.
|
667
|
+
# @return [::Hash]
|
668
|
+
# @!attribute [rw] quota_project
|
669
|
+
# A separate project against which to charge quota.
|
670
|
+
# @return [::String]
|
671
|
+
#
|
672
|
+
class Configuration
|
673
|
+
extend ::Gapic::Config
|
674
|
+
|
675
|
+
config_attr :endpoint, "pubsub.googleapis.com", ::String
|
676
|
+
config_attr :credentials, nil do |value|
|
677
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
678
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
679
|
+
allowed.any? { |klass| klass === value }
|
680
|
+
end
|
681
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
682
|
+
config_attr :lib_name, nil, ::String, nil
|
683
|
+
config_attr :lib_version, nil, ::String, nil
|
684
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
685
|
+
config_attr :interceptors, nil, ::Array, nil
|
686
|
+
config_attr :timeout, nil, ::Numeric, nil
|
687
|
+
config_attr :metadata, nil, ::Hash, nil
|
688
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
689
|
+
config_attr :quota_project, nil, ::String, nil
|
690
|
+
|
691
|
+
# @private
|
692
|
+
def initialize parent_config = nil
|
693
|
+
@parent_config = parent_config unless parent_config.nil?
|
694
|
+
|
695
|
+
yield self if block_given?
|
696
|
+
end
|
697
|
+
|
698
|
+
##
|
699
|
+
# Configurations for individual RPCs
|
700
|
+
# @return [Rpcs]
|
701
|
+
#
|
702
|
+
def rpcs
|
703
|
+
@rpcs ||= begin
|
704
|
+
parent_rpcs = nil
|
705
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
706
|
+
Rpcs.new parent_rpcs
|
707
|
+
end
|
708
|
+
end
|
709
|
+
|
710
|
+
##
|
711
|
+
# Configuration RPC class for the SchemaService API.
|
712
|
+
#
|
713
|
+
# Includes fields providing the configuration for each RPC in this service.
|
714
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
715
|
+
# the following configuration fields:
|
716
|
+
#
|
717
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
718
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
719
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
720
|
+
# include the following keys:
|
721
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
722
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
723
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
724
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
725
|
+
# trigger a retry.
|
726
|
+
#
|
727
|
+
class Rpcs
|
728
|
+
##
|
729
|
+
# RPC-specific configuration for `create_schema`
|
730
|
+
# @return [::Gapic::Config::Method]
|
731
|
+
#
|
732
|
+
attr_reader :create_schema
|
733
|
+
##
|
734
|
+
# RPC-specific configuration for `get_schema`
|
735
|
+
# @return [::Gapic::Config::Method]
|
736
|
+
#
|
737
|
+
attr_reader :get_schema
|
738
|
+
##
|
739
|
+
# RPC-specific configuration for `list_schemas`
|
740
|
+
# @return [::Gapic::Config::Method]
|
741
|
+
#
|
742
|
+
attr_reader :list_schemas
|
743
|
+
##
|
744
|
+
# RPC-specific configuration for `delete_schema`
|
745
|
+
# @return [::Gapic::Config::Method]
|
746
|
+
#
|
747
|
+
attr_reader :delete_schema
|
748
|
+
##
|
749
|
+
# RPC-specific configuration for `validate_schema`
|
750
|
+
# @return [::Gapic::Config::Method]
|
751
|
+
#
|
752
|
+
attr_reader :validate_schema
|
753
|
+
##
|
754
|
+
# RPC-specific configuration for `validate_message`
|
755
|
+
# @return [::Gapic::Config::Method]
|
756
|
+
#
|
757
|
+
attr_reader :validate_message
|
758
|
+
|
759
|
+
# @private
|
760
|
+
def initialize parent_rpcs = nil
|
761
|
+
create_schema_config = parent_rpcs&.create_schema if parent_rpcs&.respond_to? :create_schema
|
762
|
+
@create_schema = ::Gapic::Config::Method.new create_schema_config
|
763
|
+
get_schema_config = parent_rpcs&.get_schema if parent_rpcs&.respond_to? :get_schema
|
764
|
+
@get_schema = ::Gapic::Config::Method.new get_schema_config
|
765
|
+
list_schemas_config = parent_rpcs&.list_schemas if parent_rpcs&.respond_to? :list_schemas
|
766
|
+
@list_schemas = ::Gapic::Config::Method.new list_schemas_config
|
767
|
+
delete_schema_config = parent_rpcs&.delete_schema if parent_rpcs&.respond_to? :delete_schema
|
768
|
+
@delete_schema = ::Gapic::Config::Method.new delete_schema_config
|
769
|
+
validate_schema_config = parent_rpcs&.validate_schema if parent_rpcs&.respond_to? :validate_schema
|
770
|
+
@validate_schema = ::Gapic::Config::Method.new validate_schema_config
|
771
|
+
validate_message_config = parent_rpcs&.validate_message if parent_rpcs&.respond_to? :validate_message
|
772
|
+
@validate_message = ::Gapic::Config::Method.new validate_message_config
|
773
|
+
|
774
|
+
yield self if block_given?
|
775
|
+
end
|
776
|
+
end
|
777
|
+
end
|
778
|
+
end
|
779
|
+
end
|
780
|
+
end
|
781
|
+
end
|
782
|
+
end
|
783
|
+
end
|