Class: Google::Cloud::Kms::V1::KeyManagementServiceClient
- Inherits:
-
Object
- Object
- Google::Cloud::Kms::V1::KeyManagementServiceClient
- Defined in:
- lib/google/cloud/kms/v1/key_management_service_client.rb,
lib/google/cloud/kms/v1/helpers.rb
Overview
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.
Constant Summary collapse
- SERVICE_ADDRESS =
The default address of the service.
"cloudkms.googleapis.com".freeze
- DEFAULT_SERVICE_PORT =
The default port of the service.
443
- GRPC_INTERCEPTORS =
The default set of gRPC interceptors.
[]
- DEFAULT_TIMEOUT =
30
- ALL_SCOPES =
The scopes needed to make gRPC calls to all of the methods defined in this service.
[ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloudkms" ].freeze
Class Method Summary collapse
-
.crypto_key_path(project, location, key_ring, crypto_key) ⇒ String
Returns a fully-qualified crypto_key resource name string.
-
.crypto_key_path_path(project, location, key_ring, crypto_key_path) ⇒ String
Returns a fully-qualified crypto_key_path resource name string.
-
.crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) ⇒ String
Returns a fully-qualified crypto_key_version resource name string.
-
.import_job_path(project, location, key_ring, import_job) ⇒ String
Returns a fully-qualified import_job resource name string.
-
.key_ring_path(project, location, key_ring) ⇒ String
Returns a fully-qualified key_ring resource name string.
-
.location_path(project, location) ⇒ String
Returns a fully-qualified location resource name string.
Instance Method Summary collapse
-
#asymmetric_decrypt(name, ciphertext, options: nil) {|result, operation| ... } ⇒ 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.
-
#asymmetric_sign(name, digest, options: nil) {|result, operation| ... } ⇒ 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.
- #create_crypto_key(parent, crypto_key_id, crypto_key, skip_initial_version_creation: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
-
#create_crypto_key_version(parent, crypto_key_version, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Create a new CryptoKeyVersion in a CryptoKey.
- #create_import_job(parent, import_job_id, import_job, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::ImportJob
-
#create_key_ring(parent, key_ring_id, key_ring, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::KeyRing
Create a new KeyRing in a given Project and Location.
-
#crypto_key_path(project, location, key_ring, crypto_key) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_path.
-
#crypto_key_path_path(project, location, key_ring, crypto_key_path) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_path_path.
-
#crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_version_path.
-
#decrypt(name, ciphertext, additional_authenticated_data: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::DecryptResponse
Decrypts data that was protected by Encrypt.
-
#destroy_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Schedule a CryptoKeyVersion for destruction.
-
#encrypt(name, plaintext, additional_authenticated_data: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::EncryptResponse
Encrypts data, so that it can only be recovered by a call to Decrypt.
-
#get_crypto_key(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion.
-
#get_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Returns metadata for a given CryptoKeyVersion.
-
#get_iam_policy(resource, options_: nil, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a resource.
-
#get_import_job(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::ImportJob
Returns metadata for a given ImportJob.
-
#get_key_ring(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::KeyRing
Returns metadata for a given KeyRing.
-
#get_public_key(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::PublicKey
Returns the public key for the given CryptoKeyVersion.
-
#import_crypto_key_version(parent, algorithm, import_job, rsa_aes_wrapped_key: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Imports a new CryptoKeyVersion into an existing CryptoKey using the wrapped key material provided in the request.
-
#import_job_path(project, location, key_ring, import_job) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.import_job_path.
-
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ KeyManagementServiceClient
constructor
A new instance of KeyManagementServiceClient.
-
#key_ring_path(project, location, key_ring) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.key_ring_path.
-
#list_crypto_key_versions(parent, page_size: nil, view: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::CryptoKeyVersion>
Lists CryptoKeyVersions.
-
#list_crypto_keys(parent, page_size: nil, version_view: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::CryptoKey>
Lists CryptoKeys.
-
#list_import_jobs(parent, page_size: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::ImportJob>
Lists ImportJobs.
-
#list_key_rings(parent, page_size: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::KeyRing>
Lists KeyRings.
-
#location_path(project, location) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.location_path.
-
#restore_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Restore a CryptoKeyVersion in the DESTROY_SCHEDULED state.
-
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy on the specified resource.
-
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified resource.
-
#update_crypto_key(crypto_key, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Update a CryptoKey.
-
#update_crypto_key_primary_version(name, crypto_key_version_id, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Update the version of a CryptoKey that will be used in Encrypt.
-
#update_crypto_key_version(crypto_key_version, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Update a CryptoKeyVersion's metadata.
Constructor Details
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ KeyManagementServiceClient
Returns a new instance of KeyManagementServiceClient.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 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 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 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 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 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 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 253 def initialize \ credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "" # 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 "google/gax/grpc" require "google/cloud/kms/v1/service_services_pb" require "google/iam/v1/iam_policy_services_pb" credentials ||= Google::Cloud::Kms::V1::Credentials.default if credentials.is_a?(String) || credentials.is_a?(Hash) updater_proc = Google::Cloud::Kms::V1::Credentials.new(credentials).updater_proc end if credentials.is_a?(GRPC::Core::Channel) channel = credentials end if credentials.is_a?(GRPC::Core::ChannelCredentials) chan_creds = credentials end if credentials.is_a?(Proc) updater_proc = credentials end if credentials.is_a?(Google::Auth::Credentials) updater_proc = credentials.updater_proc end package_version = Google::Cloud::Kms::VERSION google_api_client = "gl-ruby/#{RUBY_VERSION}" google_api_client << " #{lib_name}/#{lib_version}" if lib_name google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}" google_api_client << " grpc/#{GRPC::VERSION}" google_api_client.freeze headers = { :"x-goog-api-client" => google_api_client } headers.merge!() unless .nil? client_config_file = Pathname.new(__dir__).join( "key_management_service_client_config.json" ) defaults = client_config_file.open do |f| Google::Gax.construct_settings( "google.cloud.kms.v1.KeyManagementService", JSON.parse(f.read), client_config, Google::Gax::Grpc::STATUS_CODE_NAMES, timeout, page_descriptors: PAGE_DESCRIPTORS, errors: Google::Gax::Grpc::API_ERRORS, metadata: headers ) end # Allow overriding the service path/port in subclasses. service_path = service_address || self.class::SERVICE_ADDRESS port = service_port || self.class::DEFAULT_SERVICE_PORT interceptors = self.class::GRPC_INTERCEPTORS @key_management_service_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Cloud::Kms::V1::KeyManagementService::Stub.method(:new) ) @iam_policy_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Iam::V1::IAMPolicy::Stub.method(:new) ) @list_key_rings = Google::Gax.create_api_call( @key_management_service_stub.method(:list_key_rings), defaults["list_key_rings"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @list_import_jobs = Google::Gax.create_api_call( @key_management_service_stub.method(:list_import_jobs), defaults["list_import_jobs"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @list_crypto_keys = Google::Gax.create_api_call( @key_management_service_stub.method(:list_crypto_keys), defaults["list_crypto_keys"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @list_crypto_key_versions = Google::Gax.create_api_call( @key_management_service_stub.method(:list_crypto_key_versions), defaults["list_crypto_key_versions"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @get_key_ring = Google::Gax.create_api_call( @key_management_service_stub.method(:get_key_ring), defaults["get_key_ring"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @get_import_job = Google::Gax.create_api_call( @key_management_service_stub.method(:get_import_job), defaults["get_import_job"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @get_crypto_key = Google::Gax.create_api_call( @key_management_service_stub.method(:get_crypto_key), defaults["get_crypto_key"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @get_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:get_crypto_key_version), defaults["get_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @create_key_ring = Google::Gax.create_api_call( @key_management_service_stub.method(:create_key_ring), defaults["create_key_ring"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @create_import_job = Google::Gax.create_api_call( @key_management_service_stub.method(:create_import_job), defaults["create_import_job"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @create_crypto_key = Google::Gax.create_api_call( @key_management_service_stub.method(:create_crypto_key), defaults["create_crypto_key"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @create_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:create_crypto_key_version), defaults["create_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @import_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:import_crypto_key_version), defaults["import_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @update_crypto_key = Google::Gax.create_api_call( @key_management_service_stub.method(:update_crypto_key), defaults["update_crypto_key"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'crypto_key.name' => request.crypto_key.name} end ) @update_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:update_crypto_key_version), defaults["update_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'crypto_key_version.name' => request.crypto_key_version.name} end ) @encrypt = Google::Gax.create_api_call( @key_management_service_stub.method(:encrypt), defaults["encrypt"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @decrypt = Google::Gax.create_api_call( @key_management_service_stub.method(:decrypt), defaults["decrypt"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @update_crypto_key_primary_version = Google::Gax.create_api_call( @key_management_service_stub.method(:update_crypto_key_primary_version), defaults["update_crypto_key_primary_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @destroy_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:destroy_crypto_key_version), defaults["destroy_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @restore_crypto_key_version = Google::Gax.create_api_call( @key_management_service_stub.method(:restore_crypto_key_version), defaults["restore_crypto_key_version"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @get_public_key = Google::Gax.create_api_call( @key_management_service_stub.method(:get_public_key), defaults["get_public_key"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @asymmetric_decrypt = Google::Gax.create_api_call( @key_management_service_stub.method(:asymmetric_decrypt), defaults["asymmetric_decrypt"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @asymmetric_sign = Google::Gax.create_api_call( @key_management_service_stub.method(:asymmetric_sign), defaults["asymmetric_sign"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @set_iam_policy = Google::Gax.create_api_call( @iam_policy_stub.method(:set_iam_policy), defaults["set_iam_policy"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) @get_iam_policy = Google::Gax.create_api_call( @iam_policy_stub.method(:get_iam_policy), defaults["get_iam_policy"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) @test_iam_permissions = Google::Gax.create_api_call( @iam_policy_stub.method(:test_iam_permissions), defaults["test_iam_permissions"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'resource' => request.resource} end ) end |
Class Method Details
.crypto_key_path(project, location, key_ring, crypto_key) ⇒ String
Returns a fully-qualified crypto_key resource name string.
140 141 142 143 144 145 146 147 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 140 def self.crypto_key_path project, location, key_ring, crypto_key CRYPTO_KEY_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"key_ring" => key_ring, :"crypto_key" => crypto_key ) end |
.crypto_key_path_path(project, location, key_ring, crypto_key_path) ⇒ String
Returns a fully-qualified crypto_key_path resource name string.
155 156 157 158 159 160 161 162 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 155 def self.crypto_key_path_path project, location, key_ring, crypto_key_path CRYPTO_KEY_PATH_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"key_ring" => key_ring, :"crypto_key_path" => crypto_key_path ) end |
.crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) ⇒ String
Returns a fully-qualified crypto_key_version resource name string.
171 172 173 174 175 176 177 178 179 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 171 def self.crypto_key_version_path project, location, key_ring, crypto_key, crypto_key_version CRYPTO_KEY_VERSION_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"key_ring" => key_ring, :"crypto_key" => crypto_key, :"crypto_key_version" => crypto_key_version ) end |
.import_job_path(project, location, key_ring, import_job) ⇒ String
Returns a fully-qualified import_job resource name string.
187 188 189 190 191 192 193 194 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 187 def self.import_job_path project, location, key_ring, import_job IMPORT_JOB_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"key_ring" => key_ring, :"import_job" => import_job ) end |
.key_ring_path(project, location, key_ring) ⇒ String
Returns a fully-qualified key_ring resource name string.
201 202 203 204 205 206 207 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 201 def self.key_ring_path project, location, key_ring KEY_RING_PATH_TEMPLATE.render( :"project" => project, :"location" => location, :"key_ring" => key_ring ) end |
.location_path(project, location) ⇒ String
Returns a fully-qualified location resource name string.
213 214 215 216 217 218 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 213 def self.location_path project, location LOCATION_PATH_TEMPLATE.render( :"project" => project, :"location" => location ) end |
Instance Method Details
#asymmetric_decrypt(name, ciphertext, options: nil) {|result, operation| ... } ⇒ 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.
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1618 def asymmetric_decrypt \ name, ciphertext, options: nil, &block req = { name: name, ciphertext: ciphertext }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::AsymmetricDecryptRequest) @asymmetric_decrypt.call(req, , &block) end |
#asymmetric_sign(name, digest, options: nil) {|result, operation| ... } ⇒ 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.
1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1661 def asymmetric_sign \ name, digest, options: nil, &block req = { name: name, digest: digest }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::AsymmetricSignRequest) @asymmetric_sign.call(req, , &block) end |
#create_crypto_key(parent, crypto_key_id, crypto_key, skip_initial_version_creation: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Create a new CryptoKey within a KeyRing.
CryptoKey#purpose and CryptoKey#version_template#algorithm are required.
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1101 def create_crypto_key \ parent, crypto_key_id, crypto_key, skip_initial_version_creation: nil, options: nil, &block req = { parent: parent, crypto_key_id: crypto_key_id, crypto_key: crypto_key, skip_initial_version_creation: skip_initial_version_creation }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::CreateCryptoKeyRequest) @create_crypto_key.call(req, , &block) end |
#create_crypto_key_version(parent, crypto_key_version, options: nil) {|result, operation| ... } ⇒ 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.
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1149 def create_crypto_key_version \ parent, crypto_key_version, options: nil, &block req = { parent: parent, crypto_key_version: crypto_key_version }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest) @create_crypto_key_version.call(req, , &block) end |
#create_import_job(parent, import_job_id, import_job, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::ImportJob
Create a new ImportJob within a KeyRing.
ImportJob#import_method is required.
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1038 def create_import_job \ parent, import_job_id, import_job, options: nil, &block req = { parent: parent, import_job_id: import_job_id, import_job: import_job }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::CreateImportJobRequest) @create_import_job.call(req, , &block) end |
#create_key_ring(parent, key_ring_id, key_ring, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::KeyRing
Create a new KeyRing in a given Project and Location.
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 990 def create_key_ring \ parent, key_ring_id, key_ring, options: nil, &block req = { parent: parent, key_ring_id: key_ring_id, key_ring: key_ring }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::CreateKeyRingRequest) @create_key_ring.call(req, , &block) end |
#crypto_key_path(project, location, key_ring, crypto_key) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_path.
25 26 27 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 25 def crypto_key_path project, location, key_ring, crypto_key self.class.crypto_key_path project, location, key_ring, crypto_key end |
#crypto_key_path_path(project, location, key_ring, crypto_key_path) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_path_path.
35 36 37 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 35 def crypto_key_path_path project, location, key_ring, crypto_key_path self.class.crypto_key_path_path project, location, key_ring, crypto_key_path end |
#crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.crypto_key_version_path.
46 47 48 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 46 def crypto_key_version_path project, location, key_ring, crypto_key, crypto_key_version self.class.crypto_key_version_path project, location, key_ring, crypto_key, crypto_key_version end |
#decrypt(name, ciphertext, additional_authenticated_data: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::DecryptResponse
Decrypts data that was protected by Encrypt. The CryptoKey#purpose must be ENCRYPT_DECRYPT.
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1425 def decrypt \ name, ciphertext, additional_authenticated_data: nil, options: nil, &block req = { name: name, ciphertext: ciphertext, additional_authenticated_data: additional_authenticated_data }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::DecryptRequest) @decrypt.call(req, , &block) end |
#destroy_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ 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.
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1509 def destroy_crypto_key_version \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::DestroyCryptoKeyVersionRequest) @destroy_crypto_key_version.call(req, , &block) end |
#encrypt(name, plaintext, additional_authenticated_data: nil, options: nil) {|result, operation| ... } ⇒ 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.
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1380 def encrypt \ name, plaintext, additional_authenticated_data: nil, options: nil, &block req = { name: name, plaintext: plaintext, additional_authenticated_data: additional_authenticated_data }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::EncryptRequest) @encrypt.call(req, , &block) end |
#get_crypto_key(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion.
916 917 918 919 920 921 922 923 924 925 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 916 def get_crypto_key \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::GetCryptoKeyRequest) @get_crypto_key.call(req, , &block) end |
#get_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKeyVersion
Returns metadata for a given CryptoKeyVersion.
946 947 948 949 950 951 952 953 954 955 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 946 def get_crypto_key_version \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest) @get_crypto_key_version.call(req, , &block) end |
#get_iam_policy(resource, options_: nil, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1747 def get_iam_policy \ resource, options_: nil, options: nil, &block req = { resource: resource, options: }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest) @get_iam_policy.call(req, , &block) end |
#get_import_job(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::ImportJob
Returns metadata for a given ImportJob.
885 886 887 888 889 890 891 892 893 894 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 885 def get_import_job \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::GetImportJobRequest) @get_import_job.call(req, , &block) end |
#get_key_ring(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::KeyRing
Returns metadata for a given KeyRing.
855 856 857 858 859 860 861 862 863 864 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 855 def get_key_ring \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::GetKeyRingRequest) @get_key_ring.call(req, , &block) end |
#get_public_key(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::PublicKey
Returns the public key for the given CryptoKeyVersion. The CryptoKey#purpose must be ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT.
1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1579 def get_public_key \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::GetPublicKeyRequest) @get_public_key.call(req, , &block) end |
#import_crypto_key_version(parent, algorithm, import_job, rsa_aes_wrapped_key: nil, options: nil) {|result, operation| ... } ⇒ 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.
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 1224 def import_crypto_key_version \ parent, algorithm, import_job, rsa_aes_wrapped_key: nil, options: nil, &block req = { parent: parent, algorithm: algorithm, import_job: import_job, rsa_aes_wrapped_key: rsa_aes_wrapped_key }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest) @import_crypto_key_version.call(req, , &block) end |
#import_job_path(project, location, key_ring, import_job) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.import_job_path.
56 57 58 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 56 def import_job_path project, location, key_ring, import_job self.class.import_job_path project, location, key_ring, import_job end |
#key_ring_path(project, location, key_ring) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.key_ring_path.
65 66 67 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 65 def key_ring_path project, location, key_ring self.class.key_ring_path project, location, key_ring end |
#list_crypto_key_versions(parent, page_size: nil, view: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::CryptoKeyVersion>
Lists CryptoKeyVersions.
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 817 def list_crypto_key_versions \ parent, page_size: nil, view: nil, filter: nil, order_by: nil, options: nil, &block req = { parent: parent, page_size: page_size, view: view, filter: filter, order_by: order_by }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest) @list_crypto_key_versions.call(req, , &block) end |
#list_crypto_keys(parent, page_size: nil, version_view: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::CryptoKey>
Lists CryptoKeys.
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 744 def list_crypto_keys \ parent, page_size: nil, version_view: nil, filter: nil, order_by: nil, options: nil, &block req = { parent: parent, page_size: page_size, version_view: version_view, filter: filter, order_by: order_by }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::ListCryptoKeysRequest) @list_crypto_keys.call(req, , &block) end |
#list_import_jobs(parent, page_size: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::ImportJob>
Lists ImportJobs.
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 673 def list_import_jobs \ parent, page_size: nil, filter: nil, order_by: nil, options: nil, &block req = { parent: parent, page_size: page_size, filter: filter, order_by: order_by }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::ListImportJobsRequest) @list_import_jobs.call(req, , &block) end |
#list_key_rings(parent, page_size: nil, filter: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Kms::V1::KeyRing>
Lists KeyRings.
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 604 def list_key_rings \ parent, page_size: nil, filter: nil, order_by: nil, options: nil, &block req = { parent: parent, page_size: page_size, filter: filter, order_by: order_by }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::ListKeyRingsRequest) @list_key_rings.call(req, , &block) end |
#location_path(project, location) ⇒ String
Alias for Google::Cloud::Kms::V1::KeyManagementServiceClient.location_path.
73 74 75 |
# File 'lib/google/cloud/kms/v1/helpers.rb', line 73 def location_path project, location self.class.location_path project, location end |
#restore_crypto_key_version(name, options: nil) {|result, operation| ... } ⇒ 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.
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1545 def restore_crypto_key_version \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::RestoreCryptoKeyVersionRequest) @restore_crypto_key_version.call(req, , &block) end |
#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1708 def set_iam_policy \ resource, policy, options: nil, &block req = { resource: resource, policy: policy }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest) @set_iam_policy.call(req, , &block) end |
#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1794 def \ resource, , options: nil, &block req = { resource: resource, permissions: }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest) @test_iam_permissions.call(req, , &block) end |
#update_crypto_key(crypto_key, update_mask, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Kms::V1::CryptoKey
Update a CryptoKey.
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1271 def update_crypto_key \ crypto_key, update_mask, options: nil, &block req = { crypto_key: crypto_key, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::UpdateCryptoKeyRequest) @update_crypto_key.call(req, , &block) end |
#update_crypto_key_primary_version(name, crypto_key_version_id, options: nil) {|result, operation| ... } ⇒ 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.
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1466 def update_crypto_key_primary_version \ name, crypto_key_version_id, options: nil, &block req = { name: name, crypto_key_version_id: crypto_key_version_id }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::UpdateCryptoKeyPrimaryVersionRequest) @update_crypto_key_primary_version.call(req, , &block) end |
#update_crypto_key_version(crypto_key_version, update_mask, options: nil) {|result, operation| ... } ⇒ 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.
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 |
# File 'lib/google/cloud/kms/v1/key_management_service_client.rb', line 1320 def update_crypto_key_version \ crypto_key_version, update_mask, options: nil, &block req = { crypto_key_version: crypto_key_version, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Kms::V1::UpdateCryptoKeyVersionRequest) @update_crypto_key_version.call(req, , &block) end |