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