google-cloud-kms-v1 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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 Kms
24
+ module V1
25
+ module EkmService
26
+ # Credentials for the EkmService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/cloudkms"
31
+ ]
32
+ self.env_vars = [
33
+ "KMS_CREDENTIALS",
34
+ "KMS_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS",
36
+ "GOOGLE_CLOUD_KEYFILE",
37
+ "GCLOUD_KEYFILE",
38
+ "KMS_CREDENTIALS_JSON",
39
+ "KMS_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,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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 Kms
23
+ module V1
24
+ module EkmService
25
+ # Path helper methods for the EkmService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified EkmConnection resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/ekmConnections/{ekm_connection}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param ekm_connection [String]
37
+ #
38
+ # @return [::String]
39
+ def ekm_connection_path project:, location:, ekm_connection:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/ekmConnections/#{ekm_connection}"
44
+ end
45
+
46
+ ##
47
+ # Create a fully-qualified Location resource string.
48
+ #
49
+ # The resource will be in the following format:
50
+ #
51
+ # `projects/{project}/locations/{location}`
52
+ #
53
+ # @param project [String]
54
+ # @param location [String]
55
+ #
56
+ # @return [::String]
57
+ def location_path project:, location:
58
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
59
+
60
+ "projects/#{project}/locations/#{location}"
61
+ end
62
+
63
+ ##
64
+ # Create a fully-qualified Service resource string.
65
+ #
66
+ # The resource will be in the following format:
67
+ #
68
+ # `projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}`
69
+ #
70
+ # @param project [String]
71
+ # @param location [String]
72
+ # @param namespace [String]
73
+ # @param service [String]
74
+ #
75
+ # @return [::String]
76
+ def service_path project:, location:, namespace:, service:
77
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
78
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
79
+ raise ::ArgumentError, "namespace cannot contain /" if namespace.to_s.include? "/"
80
+
81
+ "projects/#{project}/locations/#{location}/namespaces/#{namespace}/services/#{service}"
82
+ end
83
+
84
+ extend self
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/ekm_service/credentials"
26
+ require "google/cloud/kms/v1/ekm_service/paths"
27
+ require "google/cloud/kms/v1/ekm_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Kms
32
+ module V1
33
+ ##
34
+ # Google Cloud Key Management EKM Service
35
+ #
36
+ # Manages external cryptographic keys and operations using those keys.
37
+ # Implements a REST model with the following objects:
38
+ # * {::Google::Cloud::Kms::V1::EkmConnection EkmConnection}
39
+ #
40
+ # To load this service and instantiate a client:
41
+ #
42
+ # require "google/cloud/kms/v1/ekm_service"
43
+ # client = ::Google::Cloud::Kms::V1::EkmService::Client.new
44
+ #
45
+ module EkmService
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "ekm_service", "helpers.rb"
53
+ require "google/cloud/kms/v1/ekm_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,79 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/kms/v1/ekm_service.proto
3
+
4
+ require 'google/api/annotations_pb'
5
+ require 'google/api/client_pb'
6
+ require 'google/api/field_behavior_pb'
7
+ require 'google/api/resource_pb'
8
+ require 'google/protobuf/field_mask_pb'
9
+ require 'google/protobuf/timestamp_pb'
10
+ require 'google/protobuf'
11
+
12
+ Google::Protobuf::DescriptorPool.generated_pool.build do
13
+ add_file("google/cloud/kms/v1/ekm_service.proto", :syntax => :proto3) do
14
+ add_message "google.cloud.kms.v1.ListEkmConnectionsRequest" do
15
+ optional :parent, :string, 1
16
+ optional :page_size, :int32, 2
17
+ optional :page_token, :string, 3
18
+ optional :filter, :string, 4
19
+ optional :order_by, :string, 5
20
+ end
21
+ add_message "google.cloud.kms.v1.ListEkmConnectionsResponse" do
22
+ repeated :ekm_connections, :message, 1, "google.cloud.kms.v1.EkmConnection"
23
+ optional :next_page_token, :string, 2
24
+ optional :total_size, :int32, 3
25
+ end
26
+ add_message "google.cloud.kms.v1.GetEkmConnectionRequest" do
27
+ optional :name, :string, 1
28
+ end
29
+ add_message "google.cloud.kms.v1.CreateEkmConnectionRequest" do
30
+ optional :parent, :string, 1
31
+ optional :ekm_connection_id, :string, 2
32
+ optional :ekm_connection, :message, 3, "google.cloud.kms.v1.EkmConnection"
33
+ end
34
+ add_message "google.cloud.kms.v1.UpdateEkmConnectionRequest" do
35
+ optional :ekm_connection, :message, 1, "google.cloud.kms.v1.EkmConnection"
36
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
37
+ end
38
+ add_message "google.cloud.kms.v1.Certificate" do
39
+ optional :raw_der, :bytes, 1
40
+ optional :parsed, :bool, 2
41
+ optional :issuer, :string, 3
42
+ optional :subject, :string, 4
43
+ repeated :subject_alternative_dns_names, :string, 5
44
+ optional :not_before_time, :message, 6, "google.protobuf.Timestamp"
45
+ optional :not_after_time, :message, 7, "google.protobuf.Timestamp"
46
+ optional :serial_number, :string, 8
47
+ optional :sha256_fingerprint, :string, 9
48
+ end
49
+ add_message "google.cloud.kms.v1.EkmConnection" do
50
+ optional :name, :string, 1
51
+ optional :create_time, :message, 2, "google.protobuf.Timestamp"
52
+ repeated :service_resolvers, :message, 3, "google.cloud.kms.v1.EkmConnection.ServiceResolver"
53
+ optional :etag, :string, 5
54
+ end
55
+ add_message "google.cloud.kms.v1.EkmConnection.ServiceResolver" do
56
+ optional :service_directory_service, :string, 1
57
+ optional :endpoint_filter, :string, 2
58
+ optional :hostname, :string, 3
59
+ repeated :server_certificates, :message, 4, "google.cloud.kms.v1.Certificate"
60
+ end
61
+ end
62
+ end
63
+
64
+ module Google
65
+ module Cloud
66
+ module Kms
67
+ module V1
68
+ ListEkmConnectionsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.ListEkmConnectionsRequest").msgclass
69
+ ListEkmConnectionsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.ListEkmConnectionsResponse").msgclass
70
+ GetEkmConnectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.GetEkmConnectionRequest").msgclass
71
+ CreateEkmConnectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.CreateEkmConnectionRequest").msgclass
72
+ UpdateEkmConnectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.UpdateEkmConnectionRequest").msgclass
73
+ Certificate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.Certificate").msgclass
74
+ EkmConnection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.EkmConnection").msgclass
75
+ EkmConnection::ServiceResolver = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.kms.v1.EkmConnection.ServiceResolver").msgclass
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/kms/v1/ekm_service.proto for package 'google.cloud.kms.v1'
3
+ # Original file comments:
4
+ # Copyright 2021 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/kms/v1/ekm_service_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Kms
25
+ module V1
26
+ module EkmService
27
+ # Google Cloud Key Management EKM Service
28
+ #
29
+ # Manages external cryptographic keys and operations using those keys.
30
+ # Implements a REST model with the following objects:
31
+ # * [EkmConnection][google.cloud.kms.v1.EkmConnection]
32
+ class Service
33
+
34
+ include ::GRPC::GenericService
35
+
36
+ self.marshal_class_method = :encode
37
+ self.unmarshal_class_method = :decode
38
+ self.service_name = 'google.cloud.kms.v1.EkmService'
39
+
40
+ # Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].
41
+ rpc :ListEkmConnections, ::Google::Cloud::Kms::V1::ListEkmConnectionsRequest, ::Google::Cloud::Kms::V1::ListEkmConnectionsResponse
42
+ # Returns metadata for a given
43
+ # [EkmConnection][google.cloud.kms.v1.EkmConnection].
44
+ rpc :GetEkmConnection, ::Google::Cloud::Kms::V1::GetEkmConnectionRequest, ::Google::Cloud::Kms::V1::EkmConnection
45
+ # Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given
46
+ # Project and Location.
47
+ rpc :CreateEkmConnection, ::Google::Cloud::Kms::V1::CreateEkmConnectionRequest, ::Google::Cloud::Kms::V1::EkmConnection
48
+ # Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.
49
+ rpc :UpdateEkmConnection, ::Google::Cloud::Kms::V1::UpdateEkmConnectionRequest, ::Google::Cloud::Kms::V1::EkmConnection
50
+ end
51
+
52
+ Stub = Service.rpc_stub_class
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -202,6 +202,21 @@ module Google
202
202
  #
203
203
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
204
204
  #
205
+ # @example Basic example
206
+ # require "google/iam/v1"
207
+ #
208
+ # # Create a client object. The client can be reused for multiple calls.
209
+ # client = Google::Cloud::Kms::V1::IAMPolicy::Client.new
210
+ #
211
+ # # Create a request. To set request fields, pass in keyword arguments.
212
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
213
+ #
214
+ # # Call the set_iam_policy method.
215
+ # result = client.set_iam_policy request
216
+ #
217
+ # # The returned object is of type Google::Iam::V1::Policy.
218
+ # p result
219
+ #
205
220
  def set_iam_policy request, options = nil
206
221
  raise ::ArgumentError, "request must be provided" if request.nil?
207
222
 
@@ -219,9 +234,11 @@ module Google
219
234
  gapic_version: ::Google::Cloud::Kms::V1::VERSION
220
235
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
221
236
 
222
- header_params = {
223
- "resource" => request.resource
224
- }
237
+ header_params = {}
238
+ if request.resource
239
+ header_params["resource"] = request.resource
240
+ end
241
+
225
242
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
226
243
  metadata[:"x-goog-request-params"] ||= request_params_header
227
244
 
@@ -276,6 +293,21 @@ module Google
276
293
  #
277
294
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
278
295
  #
296
+ # @example Basic example
297
+ # require "google/iam/v1"
298
+ #
299
+ # # Create a client object. The client can be reused for multiple calls.
300
+ # client = Google::Cloud::Kms::V1::IAMPolicy::Client.new
301
+ #
302
+ # # Create a request. To set request fields, pass in keyword arguments.
303
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
304
+ #
305
+ # # Call the get_iam_policy method.
306
+ # result = client.get_iam_policy request
307
+ #
308
+ # # The returned object is of type Google::Iam::V1::Policy.
309
+ # p result
310
+ #
279
311
  def get_iam_policy request, options = nil
280
312
  raise ::ArgumentError, "request must be provided" if request.nil?
281
313
 
@@ -293,9 +325,11 @@ module Google
293
325
  gapic_version: ::Google::Cloud::Kms::V1::VERSION
294
326
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
327
 
296
- header_params = {
297
- "resource" => request.resource
298
- }
328
+ header_params = {}
329
+ if request.resource
330
+ header_params["resource"] = request.resource
331
+ end
332
+
299
333
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
300
334
  metadata[:"x-goog-request-params"] ||= request_params_header
301
335
 
@@ -356,6 +390,21 @@ module Google
356
390
  #
357
391
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
358
392
  #
393
+ # @example Basic example
394
+ # require "google/iam/v1"
395
+ #
396
+ # # Create a client object. The client can be reused for multiple calls.
397
+ # client = Google::Cloud::Kms::V1::IAMPolicy::Client.new
398
+ #
399
+ # # Create a request. To set request fields, pass in keyword arguments.
400
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
401
+ #
402
+ # # Call the test_iam_permissions method.
403
+ # result = client.test_iam_permissions request
404
+ #
405
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
406
+ # p result
407
+ #
359
408
  def test_iam_permissions request, options = nil
360
409
  raise ::ArgumentError, "request must be provided" if request.nil?
361
410
 
@@ -373,9 +422,11 @@ module Google
373
422
  gapic_version: ::Google::Cloud::Kms::V1::VERSION
374
423
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
375
424
 
376
- header_params = {
377
- "resource" => request.resource
378
- }
425
+ header_params = {}
426
+ if request.resource
427
+ header_params["resource"] = request.resource
428
+ end
429
+
379
430
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
380
431
  metadata[:"x-goog-request-params"] ||= request_params_header
381
432