google-cloud-pubsub-v1 0.1.1 → 0.4.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
@@ -62,7 +62,7 @@ module Google
62
62
  parent_config = while namespace.any?
63
63
  parent_name = namespace.join "::"
64
64
  parent_const = const_get parent_name
65
- break parent_const.configure if parent_const&.respond_to? :configure
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
66
  namespace.pop
67
67
  end
68
68
  default_config = Client::Configuration.new parent_config
@@ -70,129 +70,129 @@ module Google
70
70
  default_config.rpcs.create_subscription.timeout = 60.0
71
71
  default_config.rpcs.create_subscription.retry_policy = {
72
72
  initial_delay: 0.1,
73
- max_delay: 60.0,
74
- multiplier: 1.3,
75
- retry_codes: [2, 10, 14]
73
+ max_delay: 60.0,
74
+ multiplier: 1.3,
75
+ retry_codes: [2, 10, 14]
76
76
  }
77
77
 
78
78
  default_config.rpcs.get_subscription.timeout = 60.0
79
79
  default_config.rpcs.get_subscription.retry_policy = {
80
80
  initial_delay: 0.1,
81
- max_delay: 60.0,
82
- multiplier: 1.3,
83
- retry_codes: [2, 10, 14]
81
+ max_delay: 60.0,
82
+ multiplier: 1.3,
83
+ retry_codes: [2, 10, 14]
84
84
  }
85
85
 
86
86
  default_config.rpcs.update_subscription.timeout = 60.0
87
87
  default_config.rpcs.update_subscription.retry_policy = {
88
88
  initial_delay: 0.1,
89
- max_delay: 60.0,
90
- multiplier: 1.3,
91
- retry_codes: [14]
89
+ max_delay: 60.0,
90
+ multiplier: 1.3,
91
+ retry_codes: [14]
92
92
  }
93
93
 
94
94
  default_config.rpcs.list_subscriptions.timeout = 60.0
95
95
  default_config.rpcs.list_subscriptions.retry_policy = {
96
96
  initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [2, 10, 14]
97
+ max_delay: 60.0,
98
+ multiplier: 1.3,
99
+ retry_codes: [2, 10, 14]
100
100
  }
101
101
 
102
102
  default_config.rpcs.delete_subscription.timeout = 60.0
103
103
  default_config.rpcs.delete_subscription.retry_policy = {
104
104
  initial_delay: 0.1,
105
- max_delay: 60.0,
106
- multiplier: 1.3,
107
- retry_codes: [14]
105
+ max_delay: 60.0,
106
+ multiplier: 1.3,
107
+ retry_codes: [14]
108
108
  }
109
109
 
110
110
  default_config.rpcs.modify_ack_deadline.timeout = 60.0
111
111
  default_config.rpcs.modify_ack_deadline.retry_policy = {
112
112
  initial_delay: 0.1,
113
- max_delay: 60.0,
114
- multiplier: 1.3,
115
- retry_codes: [14]
113
+ max_delay: 60.0,
114
+ multiplier: 1.3,
115
+ retry_codes: [14]
116
116
  }
117
117
 
118
118
  default_config.rpcs.acknowledge.timeout = 60.0
119
119
  default_config.rpcs.acknowledge.retry_policy = {
120
120
  initial_delay: 0.1,
121
- max_delay: 60.0,
122
- multiplier: 1.3,
123
- retry_codes: [14]
121
+ max_delay: 60.0,
122
+ multiplier: 1.3,
123
+ retry_codes: [14]
124
124
  }
125
125
 
126
126
  default_config.rpcs.pull.timeout = 60.0
127
127
  default_config.rpcs.pull.retry_policy = {
128
128
  initial_delay: 0.1,
129
- max_delay: 60.0,
130
- multiplier: 1.3,
131
- retry_codes: [2, 10, 14]
129
+ max_delay: 60.0,
130
+ multiplier: 1.3,
131
+ retry_codes: [2, 10, 14]
132
132
  }
133
133
 
134
134
  default_config.rpcs.streaming_pull.timeout = 900.0
135
135
  default_config.rpcs.streaming_pull.retry_policy = {
136
136
  initial_delay: 0.1,
137
- max_delay: 60.0,
138
- multiplier: 1.3,
139
- retry_codes: [4, 8, 10, 13, 14]
137
+ max_delay: 60.0,
138
+ multiplier: 1.3,
139
+ retry_codes: [4, 8, 10, 13, 14]
140
140
  }
141
141
 
142
142
  default_config.rpcs.modify_push_config.timeout = 60.0
143
143
  default_config.rpcs.modify_push_config.retry_policy = {
144
144
  initial_delay: 0.1,
145
- max_delay: 60.0,
146
- multiplier: 1.3,
147
- retry_codes: [14]
145
+ max_delay: 60.0,
146
+ multiplier: 1.3,
147
+ retry_codes: [14]
148
148
  }
149
149
 
150
150
  default_config.rpcs.get_snapshot.timeout = 60.0
151
151
  default_config.rpcs.get_snapshot.retry_policy = {
152
152
  initial_delay: 0.1,
153
- max_delay: 60.0,
154
- multiplier: 1.3,
155
- retry_codes: [2, 10, 14]
153
+ max_delay: 60.0,
154
+ multiplier: 1.3,
155
+ retry_codes: [2, 10, 14]
156
156
  }
157
157
 
158
158
  default_config.rpcs.list_snapshots.timeout = 60.0
159
159
  default_config.rpcs.list_snapshots.retry_policy = {
160
160
  initial_delay: 0.1,
161
- max_delay: 60.0,
162
- multiplier: 1.3,
163
- retry_codes: [2, 10, 14]
161
+ max_delay: 60.0,
162
+ multiplier: 1.3,
163
+ retry_codes: [2, 10, 14]
164
164
  }
165
165
 
166
166
  default_config.rpcs.create_snapshot.timeout = 60.0
167
167
  default_config.rpcs.create_snapshot.retry_policy = {
168
168
  initial_delay: 0.1,
169
- max_delay: 60.0,
170
- multiplier: 1.3,
171
- retry_codes: [14]
169
+ max_delay: 60.0,
170
+ multiplier: 1.3,
171
+ retry_codes: [14]
172
172
  }
173
173
 
174
174
  default_config.rpcs.update_snapshot.timeout = 60.0
175
175
  default_config.rpcs.update_snapshot.retry_policy = {
176
176
  initial_delay: 0.1,
177
- max_delay: 60.0,
178
- multiplier: 1.3,
179
- retry_codes: [14]
177
+ max_delay: 60.0,
178
+ multiplier: 1.3,
179
+ retry_codes: [14]
180
180
  }
181
181
 
182
182
  default_config.rpcs.delete_snapshot.timeout = 60.0
183
183
  default_config.rpcs.delete_snapshot.retry_policy = {
184
184
  initial_delay: 0.1,
185
- max_delay: 60.0,
186
- multiplier: 1.3,
187
- retry_codes: [14]
185
+ max_delay: 60.0,
186
+ multiplier: 1.3,
187
+ retry_codes: [14]
188
188
  }
189
189
 
190
190
  default_config.rpcs.seek.timeout = 60.0
191
191
  default_config.rpcs.seek.retry_policy = {
192
192
  initial_delay: 0.1,
193
- max_delay: 60.0,
194
- multiplier: 1.3,
195
- retry_codes: [2, 10, 14]
193
+ max_delay: 60.0,
194
+ multiplier: 1.3,
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
@@ -1499,8 +1505,8 @@ module Google
1499
1505
 
1500
1506
  ##
1501
1507
  # Seeks an existing subscription to a point in time or to a given snapshot,
1502
- # whichever is provided in the request. Snapshots are used in [Seek](
1503
- # https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1508
+ # whichever is provided in the request. Snapshots are used in [Seek]
1509
+ # (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1504
1510
  # allow you to manage message acknowledgments in bulk. That is, you can set
1505
1511
  # the acknowledgment state of messages in an existing subscription to the
1506
1512
  # state captured by a snapshot. Note that both the subscription and the
@@ -1670,14 +1676,14 @@ module Google
1670
1676
 
1671
1677
  config_attr :endpoint, "pubsub.googleapis.com", ::String
1672
1678
  config_attr :credentials, nil do |value|
1673
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1679
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1674
1680
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1675
1681
  allowed.any? { |klass| klass === value }
1676
1682
  end
1677
1683
  config_attr :scope, nil, ::String, ::Array, nil
1678
1684
  config_attr :lib_name, nil, ::String, nil
1679
1685
  config_attr :lib_version, nil, ::String, nil
1680
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1686
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1681
1687
  config_attr :interceptors, nil, ::Array, nil
1682
1688
  config_attr :timeout, nil, ::Numeric, nil
1683
1689
  config_attr :metadata, nil, ::Hash, nil
@@ -1698,7 +1704,7 @@ module Google
1698
1704
  def rpcs
1699
1705
  @rpcs ||= begin
1700
1706
  parent_rpcs = nil
1701
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1707
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1702
1708
  Rpcs.new parent_rpcs
1703
1709
  end
1704
1710
  end
@@ -1710,7 +1716,7 @@ module Google
1710
1716
  # Each configuration object is of type `Gapic::Config::Method` and includes
1711
1717
  # the following configuration fields:
1712
1718
  #
1713
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1719
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1714
1720
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1715
1721
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1716
1722
  # include the following keys:
@@ -1804,37 +1810,37 @@ module Google
1804
1810
 
1805
1811
  # @private
1806
1812
  def initialize parent_rpcs = nil
1807
- create_subscription_config = parent_rpcs&.create_subscription if parent_rpcs&.respond_to? :create_subscription
1813
+ create_subscription_config = parent_rpcs.create_subscription if parent_rpcs.respond_to? :create_subscription
1808
1814
  @create_subscription = ::Gapic::Config::Method.new create_subscription_config
1809
- get_subscription_config = parent_rpcs&.get_subscription if parent_rpcs&.respond_to? :get_subscription
1815
+ get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
1810
1816
  @get_subscription = ::Gapic::Config::Method.new get_subscription_config
1811
- update_subscription_config = parent_rpcs&.update_subscription if parent_rpcs&.respond_to? :update_subscription
1817
+ update_subscription_config = parent_rpcs.update_subscription if parent_rpcs.respond_to? :update_subscription
1812
1818
  @update_subscription = ::Gapic::Config::Method.new update_subscription_config
1813
- list_subscriptions_config = parent_rpcs&.list_subscriptions if parent_rpcs&.respond_to? :list_subscriptions
1819
+ list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
1814
1820
  @list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
1815
- delete_subscription_config = parent_rpcs&.delete_subscription if parent_rpcs&.respond_to? :delete_subscription
1821
+ delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
1816
1822
  @delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
1817
- modify_ack_deadline_config = parent_rpcs&.modify_ack_deadline if parent_rpcs&.respond_to? :modify_ack_deadline
1823
+ modify_ack_deadline_config = parent_rpcs.modify_ack_deadline if parent_rpcs.respond_to? :modify_ack_deadline
1818
1824
  @modify_ack_deadline = ::Gapic::Config::Method.new modify_ack_deadline_config
1819
- acknowledge_config = parent_rpcs&.acknowledge if parent_rpcs&.respond_to? :acknowledge
1825
+ acknowledge_config = parent_rpcs.acknowledge if parent_rpcs.respond_to? :acknowledge
1820
1826
  @acknowledge = ::Gapic::Config::Method.new acknowledge_config
1821
- pull_config = parent_rpcs&.pull if parent_rpcs&.respond_to? :pull
1827
+ pull_config = parent_rpcs.pull if parent_rpcs.respond_to? :pull
1822
1828
  @pull = ::Gapic::Config::Method.new pull_config
1823
- streaming_pull_config = parent_rpcs&.streaming_pull if parent_rpcs&.respond_to? :streaming_pull
1829
+ streaming_pull_config = parent_rpcs.streaming_pull if parent_rpcs.respond_to? :streaming_pull
1824
1830
  @streaming_pull = ::Gapic::Config::Method.new streaming_pull_config
1825
- modify_push_config_config = parent_rpcs&.modify_push_config if parent_rpcs&.respond_to? :modify_push_config
1831
+ modify_push_config_config = parent_rpcs.modify_push_config if parent_rpcs.respond_to? :modify_push_config
1826
1832
  @modify_push_config = ::Gapic::Config::Method.new modify_push_config_config
1827
- get_snapshot_config = parent_rpcs&.get_snapshot if parent_rpcs&.respond_to? :get_snapshot
1833
+ get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
1828
1834
  @get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
1829
- list_snapshots_config = parent_rpcs&.list_snapshots if parent_rpcs&.respond_to? :list_snapshots
1835
+ list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
1830
1836
  @list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
1831
- create_snapshot_config = parent_rpcs&.create_snapshot if parent_rpcs&.respond_to? :create_snapshot
1837
+ create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
1832
1838
  @create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
1833
- update_snapshot_config = parent_rpcs&.update_snapshot if parent_rpcs&.respond_to? :update_snapshot
1839
+ update_snapshot_config = parent_rpcs.update_snapshot if parent_rpcs.respond_to? :update_snapshot
1834
1840
  @update_snapshot = ::Gapic::Config::Method.new update_snapshot_config
1835
- delete_snapshot_config = parent_rpcs&.delete_snapshot if parent_rpcs&.respond_to? :delete_snapshot
1841
+ delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
1836
1842
  @delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
1837
- seek_config = parent_rpcs&.seek if parent_rpcs&.respond_to? :seek
1843
+ seek_config = parent_rpcs.seek if parent_rpcs.respond_to? :seek
1838
1844
  @seek = ::Gapic::Config::Method.new seek_config
1839
1845
 
1840
1846
  yield self if block_given?
@@ -96,7 +96,7 @@ module Google
96
96
 
97
97
  "projects/#{project}/topics/#{topic}"
98
98
  end),
99
- "" => (proc do
99
+ "" => (proc do
100
100
  "_deleted-topic_"
101
101
  end)
102
102
  }
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module PubSub
23
23
  module V1
24
- VERSION = "0.1.1"
24
+ VERSION = "0.4.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, Google::Iam::V1::SetIamPolicyRequest, Google::Iam::V1::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, Google::Iam::V1::GetIamPolicyRequest, Google::Iam::V1::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, Google::Iam::V1::TestIamPermissionsRequest, Google::Iam::V1::TestIamPermissionsResponse
74
+ rpc :TestIamPermissions, ::Google::Iam::V1::TestIamPermissionsRequest, ::Google::Iam::V1::TestIamPermissionsResponse
75
75
  end
76
76
 
77
77
  Stub = Service.rpc_stub_class