Class: Google::Cloud::Kms::V1::KeyManagementService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/kms/v1/key_management_service/client.rb

Overview

Client for the KeyManagementService service.

Google Cloud Key Management Service

Manages cryptographic keys and operations using those keys. Implements a REST model with the following objects:

If you are using manual gRPC libraries, see Using gRPC with Cloud KMS.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#crypto_key_path, #crypto_key_version_path, #import_job_path, #key_ring_path, #location_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new KeyManagementService client object.

Examples

To create a new KeyManagementService client with the default configuration:

client = ::Google::Cloud::Kms::V1::KeyManagementService::Client.new

To create a new KeyManagementService client with a custom configuration:

client = ::Google::Cloud::Kms::V1::KeyManagementService::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the KeyManagementService client.

Yield Parameters:



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 297

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/kms/v1/service_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  credentials ||= Credentials.default scope: @config.scope
  if credentials.is_a?(String) || credentials.is_a?(Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @key_management_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Kms::V1::KeyManagementService::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the KeyManagementService Client class.

See Configuration for a description of the configuration fields.

Example

To modify the configuration for all KeyManagementService clients:

::Google::Cloud::Kms::V1::KeyManagementService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 68

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Kms", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const&.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.list_key_rings.timeout = 60.0
    default_config.rpcs.list_key_rings.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.list_crypto_keys.timeout = 60.0
    default_config.rpcs.list_crypto_keys.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.list_crypto_key_versions.timeout = 60.0
    default_config.rpcs.list_crypto_key_versions.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.list_import_jobs.timeout = 60.0
    default_config.rpcs.list_import_jobs.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.get_key_ring.timeout = 60.0
    default_config.rpcs.get_key_ring.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.get_crypto_key.timeout = 60.0
    default_config.rpcs.get_crypto_key.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.get_crypto_key_version.timeout = 60.0
    default_config.rpcs.get_crypto_key_version.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.get_public_key.timeout = 60.0
    default_config.rpcs.get_public_key.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.get_import_job.timeout = 60.0
    default_config.rpcs.get_import_job.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.create_key_ring.timeout = 60.0
    default_config.rpcs.create_key_ring.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.create_crypto_key.timeout = 60.0
    default_config.rpcs.create_crypto_key.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.create_crypto_key_version.timeout = 60.0

    default_config.rpcs.import_crypto_key_version.timeout = 60.0

    default_config.rpcs.create_import_job.timeout = 60.0
    default_config.rpcs.create_import_job.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.update_crypto_key.timeout = 60.0
    default_config.rpcs.update_crypto_key.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.update_crypto_key_version.timeout = 60.0
    default_config.rpcs.update_crypto_key_version.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.encrypt.timeout = 60.0
    default_config.rpcs.encrypt.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.decrypt.timeout = 60.0
    default_config.rpcs.decrypt.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.asymmetric_sign.timeout = 60.0
    default_config.rpcs.asymmetric_sign.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.asymmetric_decrypt.timeout = 60.0
    default_config.rpcs.asymmetric_decrypt.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.update_crypto_key_primary_version.timeout = 60.0
    default_config.rpcs.update_crypto_key_primary_version.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.destroy_crypto_key_version.timeout = 60.0
    default_config.rpcs.destroy_crypto_key_version.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config.rpcs.restore_crypto_key_version.timeout = 60.0
    default_config.rpcs.restore_crypto_key_version.retry_policy = {
      initial_delay: 0.1,
      max_delay:     60.0,
      multiplier:    1.3,
      retry_codes:   [13, 14, 4]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#asymmetric_decrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse #asymmetric_decrypt(name: nil, ciphertext: nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse

Decrypts data that was encrypted with a public key retrieved from GetPublicKey corresponding to a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_DECRYPT.

Overloads:

  • #asymmetric_decrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse

    Pass arguments to asymmetric_decrypt via a request object, either of type AsymmetricDecryptRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::AsymmetricDecryptRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #asymmetric_decrypt(name: nil, ciphertext: nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse

    Pass arguments to asymmetric_decrypt via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKeyVersion to use for decryption.

    • ciphertext (::String) (defaults to: nil)

      Required. The data encrypted with the named CryptoKeyVersion's public key using OAEP.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1832

def asymmetric_decrypt request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::AsymmetricDecryptRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.asymmetric_decrypt..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.asymmetric_decrypt.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.asymmetric_decrypt.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :asymmetric_decrypt, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#asymmetric_sign(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricSignResponse #asymmetric_sign(name: nil, digest: nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricSignResponse

Signs data using a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from GetPublicKey.

Overloads:

  • #asymmetric_sign(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricSignResponse

    Pass arguments to asymmetric_sign via a request object, either of type AsymmetricSignRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::AsymmetricSignRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #asymmetric_sign(name: nil, digest: nil) ⇒ ::Google::Cloud::Kms::V1::AsymmetricSignResponse

    Pass arguments to asymmetric_sign via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKeyVersion to use for signing.

    • digest (::Google::Cloud::Kms::V1::Digest, ::Hash) (defaults to: nil)

      Required. The digest of the data to sign. The digest must be produced with the same digest algorithm as specified by the key version's algorithm.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1760

def asymmetric_sign request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::AsymmetricSignRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.asymmetric_sign..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.asymmetric_sign.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.asymmetric_sign.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :asymmetric_sign, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the KeyManagementService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



272
273
274
275
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 272

def configure
  yield @config if block_given?
  @config
end

#create_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey #create_crypto_key(parent: nil, crypto_key_id: nil, crypto_key: nil, skip_initial_version_creation: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

Create a new CryptoKey within a KeyRing.

CryptoKey.purpose and CryptoKey.version_template.algorithm are required.

Overloads:

  • #create_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to create_crypto_key via a request object, either of type CreateCryptoKeyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::CreateCryptoKeyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_crypto_key(parent: nil, crypto_key_id: nil, crypto_key: nil, skip_initial_version_creation: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to create_crypto_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1131

def create_crypto_key request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateCryptoKeyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_crypto_key..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_crypto_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_crypto_key.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :create_crypto_key, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #create_crypto_key_version(parent: nil, crypto_key_version: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Create a new CryptoKeyVersion in a CryptoKey.

The server will assign the next sequential id. If unset, state will be set to ENABLED.

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1204

def create_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :create_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_import_job(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob #create_import_job(parent: nil, import_job_id: nil, import_job: nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

Create a new ImportJob within a KeyRing.

ImportJob.import_method is required.

Overloads:

  • #create_import_job(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

    Pass arguments to create_import_job via a request object, either of type CreateImportJobRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::CreateImportJobRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_import_job(parent: nil, import_job_id: nil, import_job: nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

    Pass arguments to create_import_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the KeyRing associated with the ImportJobs.

    • import_job_id (::String) (defaults to: nil)

      Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

    • import_job (::Google::Cloud::Kms::V1::ImportJob, ::Hash) (defaults to: nil)

      Required. An ImportJob with initial field values.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1381

def create_import_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateImportJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_import_job..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_import_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_import_job.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :create_import_job, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_key_ring(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing #create_key_ring(parent: nil, key_ring_id: nil, key_ring: nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

Create a new KeyRing in a given Project and Location.

Overloads:

  • #create_key_ring(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

    Pass arguments to create_key_ring via a request object, either of type CreateKeyRingRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::CreateKeyRingRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_key_ring(parent: nil, key_ring_id: nil, key_ring: nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

    Pass arguments to create_key_ring via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name of the location associated with the KeyRings, in the format projects/*/locations/*.

    • key_ring_id (::String) (defaults to: nil)

      Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

    • key_ring (::Google::Cloud::Kms::V1::KeyRing, ::Hash) (defaults to: nil)

      Required. A KeyRing with initial field values.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1049

def create_key_ring request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::CreateKeyRingRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_key_ring..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_key_ring.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_key_ring.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :create_key_ring, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#decrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::DecryptResponse #decrypt(name: nil, ciphertext: nil, additional_authenticated_data: nil) ⇒ ::Google::Cloud::Kms::V1::DecryptResponse

Decrypts data that was protected by Encrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.

Overloads:

  • #decrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::DecryptResponse

    Pass arguments to decrypt via a request object, either of type DecryptRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::DecryptRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #decrypt(name: nil, ciphertext: nil, additional_authenticated_data: nil) ⇒ ::Google::Cloud::Kms::V1::DecryptResponse

    Pass arguments to decrypt via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKey to use for decryption. The server will choose the appropriate version.

    • ciphertext (::String) (defaults to: nil)

      Required. The encrypted data originally returned in EncryptResponse.ciphertext.

    • additional_authenticated_data (::String) (defaults to: nil)

      Optional. Optional data that must match the data originally supplied in EncryptRequest.additional_authenticated_data.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1688

def decrypt request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::DecryptRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.decrypt..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.decrypt.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.decrypt.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :decrypt, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#destroy_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #destroy_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Schedule a CryptoKeyVersion for destruction.

Upon calling this method, CryptoKeyVersion.state will be set to DESTROY_SCHEDULED and destroy_time will be set to a time 24 hours in the future, at which point the state will be changed to DESTROYED, and the key material will be irrevocably destroyed.

Before the destroy_time is reached, RestoreCryptoKeyVersion may be called to reverse the process.

Overloads:

  • #destroy_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to destroy_crypto_key_version via a request object, either of type DestroyCryptoKeyVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::DestroyCryptoKeyVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #destroy_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to destroy_crypto_key_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKeyVersion to destroy.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1979

def destroy_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::DestroyCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.destroy_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.destroy_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.destroy_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :destroy_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#encrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::EncryptResponse #encrypt(name: nil, plaintext: nil, additional_authenticated_data: nil) ⇒ ::Google::Cloud::Kms::V1::EncryptResponse

Encrypts data, so that it can only be recovered by a call to Decrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.

Overloads:

  • #encrypt(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::EncryptResponse

    Pass arguments to encrypt via a request object, either of type EncryptRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::EncryptRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #encrypt(name: nil, plaintext: nil, additional_authenticated_data: nil) ⇒ ::Google::Cloud::Kms::V1::EncryptResponse

    Pass arguments to encrypt via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKey or CryptoKeyVersion to use for encryption.

      If a CryptoKey is specified, the server will use its primary version.

    • plaintext (::String) (defaults to: nil)

      Required. The data to encrypt. Must be no larger than 64KiB.

      The maximum size depends on the key version's protection_level. For SOFTWARE keys, the plaintext must be no larger than 64KiB. For HSM keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

    • additional_authenticated_data (::String) (defaults to: nil)

      Optional. Optional data that, if specified, must also be provided during decryption through DecryptRequest.additional_authenticated_data.

      The maximum size depends on the key version's protection_level. For SOFTWARE keys, the AAD must be no larger than 64KiB. For HSM keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1614

def encrypt request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::EncryptRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.encrypt..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.encrypt.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.encrypt.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :encrypt, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey #get_crypto_key(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion.

Overloads:

  • #get_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to get_crypto_key via a request object, either of type GetCryptoKeyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::GetCryptoKeyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_crypto_key(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to get_crypto_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the CryptoKey to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 775

def get_crypto_key request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetCryptoKeyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_crypto_key..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_crypto_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_crypto_key.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :get_crypto_key, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #get_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Returns metadata for a given CryptoKeyVersion.

Overloads:

  • #get_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to get_crypto_key_version via a request object, either of type GetCryptoKeyVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to get_crypto_key_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 841

def get_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :get_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_import_job(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob #get_import_job(name: nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

Returns metadata for a given ImportJob.

Overloads:

  • #get_import_job(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

    Pass arguments to get_import_job via a request object, either of type GetImportJobRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::GetImportJobRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_import_job(name: nil) ⇒ ::Google::Cloud::Kms::V1::ImportJob

    Pass arguments to get_import_job via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the ImportJob to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 977

def get_import_job request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetImportJobRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_import_job..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_import_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_import_job.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :get_import_job, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_key_ring(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing #get_key_ring(name: nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

Returns metadata for a given KeyRing.

Overloads:

  • #get_key_ring(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

    Pass arguments to get_key_ring via a request object, either of type GetKeyRingRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::GetKeyRingRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_key_ring(name: nil) ⇒ ::Google::Cloud::Kms::V1::KeyRing

    Pass arguments to get_key_ring via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the KeyRing to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 708

def get_key_ring request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetKeyRingRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_key_ring..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_key_ring.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_key_ring.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :get_key_ring, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_public_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::PublicKey #get_public_key(name: nil) ⇒ ::Google::Cloud::Kms::V1::PublicKey

Returns the public key for the given CryptoKeyVersion. The CryptoKey.purpose must be ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT.

Overloads:

  • #get_public_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::PublicKey

    Pass arguments to get_public_key via a request object, either of type GetPublicKeyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::GetPublicKeyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_public_key(name: nil) ⇒ ::Google::Cloud::Kms::V1::PublicKey

    Pass arguments to get_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the CryptoKeyVersion public key to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 911

def get_public_key request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::GetPublicKeyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_public_key..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_public_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_public_key.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :get_public_key, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #import_crypto_key_version(parent: nil, algorithm: nil, import_job: nil, rsa_aes_wrapped_key: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Imports a new CryptoKeyVersion into an existing CryptoKey using the wrapped key material provided in the request.

The version ID will be assigned the next sequential id within the CryptoKey.

Overloads:

  • #import_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to import_crypto_key_version via a request object, either of type ImportCryptoKeyVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #import_crypto_key_version(parent: nil, algorithm: nil, import_job: nil, rsa_aes_wrapped_key: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to import_crypto_key_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the CryptoKey to be imported into.

    • algorithm (::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionAlgorithm) (defaults to: nil)

      Required. The algorithm of the key being imported. This does not need to match the version_template of the CryptoKey this version imports into.

    • import_job (::String) (defaults to: nil)

      Required. The name of the ImportJob that was used to wrap this key material.

    • rsa_aes_wrapped_key (::String) (defaults to: nil)

      Wrapped key material produced with RSA_OAEP_3072_SHA1_AES_256 or RSA_OAEP_4096_SHA1_AES_256.

      This field contains the concatenation of two wrapped keys:

      1. An ephemeral AES-256 wrapping key wrapped with the public_key using RSAES-OAEP with SHA-1, MGF1 with SHA-1, and an empty label.
      2. The key to be imported, wrapped with the ephemeral AES-256 key using AES-KWP (RFC 5649).

      If importing symmetric key material, it is expected that the unwrapped key contains plain bytes. If importing asymmetric key material, it is expected that the unwrapped key is in PKCS#8-encoded DER format (the PrivateKeyInfo structure from RFC 5208).

      This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1307

def import_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.import_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.import_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :import_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_crypto_key_versions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion> #list_crypto_key_versions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>

Overloads:

  • #list_crypto_key_versions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>

    Pass arguments to list_crypto_key_versions via a request object, either of type ListCryptoKeyVersionsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_crypto_key_versions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>

    Pass arguments to list_crypto_key_versions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 555

def list_crypto_key_versions request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_crypto_key_versions..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_crypto_key_versions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_crypto_key_versions.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :list_crypto_key_versions, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @key_management_service_stub, :list_crypto_key_versions, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_crypto_keys(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey> #list_crypto_keys(parent: nil, page_size: nil, page_token: nil, version_view: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>

Lists CryptoKeys.

Overloads:

  • #list_crypto_keys(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>

    Pass arguments to list_crypto_keys via a request object, either of type ListCryptoKeysRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::ListCryptoKeysRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_crypto_keys(parent: nil, page_size: nil, page_token: nil, version_view: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>

    Pass arguments to list_crypto_keys via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 466

def list_crypto_keys request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListCryptoKeysRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_crypto_keys..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_crypto_keys.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_crypto_keys.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :list_crypto_keys, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @key_management_service_stub, :list_crypto_keys, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_import_jobs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob> #list_import_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>

Lists ImportJobs.

Overloads:

  • #list_import_jobs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>

    Pass arguments to list_import_jobs via a request object, either of type ListImportJobsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::ListImportJobsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_import_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>

    Pass arguments to list_import_jobs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name of the KeyRing to list, in the format projects/*/locations/*/keyRings/*.

    • page_size (::Integer) (defaults to: nil)

      Optional. Optional limit on the number of ImportJobs to include in the response. Further ImportJobs can subsequently be obtained by including the ListImportJobsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      Optional. Optional pagination token, returned earlier via ListImportJobsResponse.next_page_token.

    • filter (::String) (defaults to: nil)

      Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.

    • order_by (::String) (defaults to: nil)

      Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 641

def list_import_jobs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListImportJobsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_import_jobs..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_import_jobs.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_import_jobs.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :list_import_jobs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @key_management_service_stub, :list_import_jobs, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_key_rings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing> #list_key_rings(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>

Lists KeyRings.

Overloads:

  • #list_key_rings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>

    Pass arguments to list_key_rings via a request object, either of type ListKeyRingsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::ListKeyRingsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_key_rings(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>

    Pass arguments to list_key_rings via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name of the location associated with the KeyRings, in the format projects/*/locations/*.

    • page_size (::Integer) (defaults to: nil)

      Optional. Optional limit on the number of KeyRings to include in the response. Further KeyRings can subsequently be obtained by including the ListKeyRingsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.

    • page_token (::String) (defaults to: nil)

      Optional. Optional pagination token, returned earlier via ListKeyRingsResponse.next_page_token.

    • filter (::String) (defaults to: nil)

      Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.

    • order_by (::String) (defaults to: nil)

      Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 378

def list_key_rings request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::ListKeyRingsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_key_rings..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_key_rings.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_key_rings.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :list_key_rings, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @key_management_service_stub, :list_key_rings, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restore_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #restore_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Restore a CryptoKeyVersion in the DESTROY_SCHEDULED state.

Upon restoration of the CryptoKeyVersion, state will be set to DISABLED, and destroy_time will be cleared.

Overloads:

  • #restore_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to restore_crypto_key_version via a request object, either of type RestoreCryptoKeyVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::RestoreCryptoKeyVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #restore_crypto_key_version(name: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

    Pass arguments to restore_crypto_key_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKeyVersion to restore.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 2051

def restore_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::RestoreCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.restore_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.restore_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.restore_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :restore_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey #update_crypto_key(crypto_key: nil, update_mask: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

Update a CryptoKey.

Overloads:

  • #update_crypto_key(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to update_crypto_key via a request object, either of type UpdateCryptoKeyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::UpdateCryptoKeyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_crypto_key(crypto_key: nil, update_mask: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to update_crypto_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1449

def update_crypto_key request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateCryptoKeyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_crypto_key..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "crypto_key.name" => request.crypto_key.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_crypto_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_crypto_key.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :update_crypto_key, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_crypto_key_primary_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey #update_crypto_key_primary_version(name: nil, crypto_key_version_id: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

Update the version of a CryptoKey that will be used in Encrypt.

Returns an error if called on an asymmetric key.

Overloads:

  • #update_crypto_key_primary_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to update_crypto_key_primary_version via a request object, either of type UpdateCryptoKeyPrimaryVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Kms::V1::UpdateCryptoKeyPrimaryVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_crypto_key_primary_version(name: nil, crypto_key_version_id: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKey

    Pass arguments to update_crypto_key_primary_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the CryptoKey to update.

    • crypto_key_version_id (::String) (defaults to: nil)

      Required. The id of the child CryptoKeyVersion to use as primary.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1902

def update_crypto_key_primary_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateCryptoKeyPrimaryVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_crypto_key_primary_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_crypto_key_primary_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_crypto_key_primary_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :update_crypto_key_primary_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_crypto_key_version(request, options = nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion #update_crypto_key_version(crypto_key_version: nil, update_mask: nil) ⇒ ::Google::Cloud::Kms::V1::CryptoKeyVersion

Update a CryptoKeyVersion's metadata.

state may be changed between ENABLED and DISABLED using this method. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion to move between other states.

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
# File 'lib/google/cloud/kms/v1/key_management_service/client.rb', line 1523

def update_crypto_key_version request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Kms::V1::UpdateCryptoKeyVersionRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_crypto_key_version..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Kms::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "crypto_key_version.name" => request.crypto_key_version.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_crypto_key_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_crypto_key_version.retry_policy
  options.apply_defaults metadata:     @config.,
                         retry_policy: @config.retry_policy

  @key_management_service_stub.call_rpc :update_crypto_key_version, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end