# frozen_string_literal: true # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/errors" require "google/cloud/kms/v1/service_pb" module Google module Cloud module Kms module V1 module KeyManagementService ## # 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: # # * {::Google::Cloud::Kms::V1::KeyRing KeyRing} # * {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} # * {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} # * {::Google::Cloud::Kms::V1::ImportJob ImportJob} # # If you are using manual gRPC libraries, see # [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). # class Client include Paths # @private attr_reader :key_management_service_stub ## # Configure the KeyManagementService Client class. # # See {::Google::Cloud::Kms::V1::KeyManagementService::Client::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 # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } 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: ["INTERNAL", "UNAVAILABLE", "DEADLINE_EXCEEDED"] } default_config end yield @configure if block_given? @configure end ## # 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 {Client.configure}. # # See {::Google::Cloud::Kms::V1::KeyManagementService::Client::Configuration} # for a description of the configuration fields. # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def configure yield @config if block_given? @config end ## # 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 # # @yield [config] Configure the KeyManagementService client. # @yieldparam config [Client::Configuration] # 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 # Service calls ## # Lists {::Google::Cloud::Kms::V1::KeyRing KeyRings}. # # @overload list_key_rings(request, options = nil) # Pass arguments to `list_key_rings` via a request object, either of type # {::Google::Cloud::Kms::V1::ListKeyRingsRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload list_key_rings(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # 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). # # @param parent [::String] # Required. The resource name of the location associated with the # {::Google::Cloud::Kms::V1::KeyRing KeyRings}, in the format `projects/*/locations/*`. # @param page_size [::Integer] # Optional. Optional limit on the number of {::Google::Cloud::Kms::V1::KeyRing KeyRings} to include in the # response. Further {::Google::Cloud::Kms::V1::KeyRing KeyRings} can subsequently be obtained by # including the {::Google::Cloud::Kms::V1::ListKeyRingsResponse#next_page_token ListKeyRingsResponse.next_page_token} in a subsequent # request. If unspecified, the server will pick an appropriate default. # @param page_token [::String] # Optional. Optional pagination token, returned earlier via # {::Google::Cloud::Kms::V1::ListKeyRingsResponse#next_page_token ListKeyRingsResponse.next_page_token}. # @param filter [::String] # Optional. Only include resources that match the filter in the response. For # more information, see # [Sorting and filtering list # results](https://cloud.google.com/kms/docs/sorting-and-filtering). # @param order_by [::String] # 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](https://cloud.google.com/kms/docs/sorting-and-filtering). # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.list_key_rings.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_key_rings.timeout, metadata: metadata, retry_policy: @config.rpcs.list_key_rings.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Lists {::Google::Cloud::Kms::V1::CryptoKey CryptoKeys}. # # @overload list_crypto_keys(request, options = nil) # Pass arguments to `list_crypto_keys` via a request object, either of type # {::Google::Cloud::Kms::V1::ListCryptoKeysRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload list_crypto_keys(parent: nil, page_size: nil, page_token: nil, version_view: nil, filter: nil, order_by: nil) # 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). # # @param parent [::String] # Required. The resource name of the {::Google::Cloud::Kms::V1::KeyRing KeyRing} to list, in the format # `projects/*/locations/*/keyRings/*`. # @param page_size [::Integer] # Optional. Optional limit on the number of {::Google::Cloud::Kms::V1::CryptoKey CryptoKeys} to include in the # response. Further {::Google::Cloud::Kms::V1::CryptoKey CryptoKeys} can subsequently be obtained by # including the {::Google::Cloud::Kms::V1::ListCryptoKeysResponse#next_page_token ListCryptoKeysResponse.next_page_token} in a subsequent # request. If unspecified, the server will pick an appropriate default. # @param page_token [::String] # Optional. Optional pagination token, returned earlier via # {::Google::Cloud::Kms::V1::ListCryptoKeysResponse#next_page_token ListCryptoKeysResponse.next_page_token}. # @param version_view [::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionView] # The fields of the primary version to include in the response. # @param filter [::String] # Optional. Only include resources that match the filter in the response. For # more information, see # [Sorting and filtering list # results](https://cloud.google.com/kms/docs/sorting-and-filtering). # @param order_by [::String] # 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](https://cloud.google.com/kms/docs/sorting-and-filtering). # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.list_crypto_keys.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_crypto_keys.timeout, metadata: metadata, retry_policy: @config.rpcs.list_crypto_keys.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Lists {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersions}. # # @overload list_crypto_key_versions(request, options = nil) # Pass arguments to `list_crypto_key_versions` via a request object, either of type # {::Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload list_crypto_key_versions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil) # 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). # # @param parent [::String] # Required. The resource name of the {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} to list, in the format # `projects/*/locations/*/keyRings/*/cryptoKeys/*`. # @param page_size [::Integer] # Optional. Optional limit on the number of {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersions} to # include in the response. Further {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersions} can # subsequently be obtained by including the # {::Google::Cloud::Kms::V1::ListCryptoKeyVersionsResponse#next_page_token ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. # If unspecified, the server will pick an appropriate default. # @param page_token [::String] # Optional. Optional pagination token, returned earlier via # {::Google::Cloud::Kms::V1::ListCryptoKeyVersionsResponse#next_page_token ListCryptoKeyVersionsResponse.next_page_token}. # @param view [::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionView] # The fields to include in the response. # @param filter [::String] # Optional. Only include resources that match the filter in the response. For # more information, see # [Sorting and filtering list # results](https://cloud.google.com/kms/docs/sorting-and-filtering). # @param order_by [::String] # 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](https://cloud.google.com/kms/docs/sorting-and-filtering). # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.list_crypto_key_versions.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_crypto_key_versions.timeout, metadata: metadata, retry_policy: @config.rpcs.list_crypto_key_versions.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Lists {::Google::Cloud::Kms::V1::ImportJob ImportJobs}. # # @overload list_import_jobs(request, options = nil) # Pass arguments to `list_import_jobs` via a request object, either of type # {::Google::Cloud::Kms::V1::ListImportJobsRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload list_import_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # 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). # # @param parent [::String] # Required. The resource name of the {::Google::Cloud::Kms::V1::KeyRing KeyRing} to list, in the format # `projects/*/locations/*/keyRings/*`. # @param page_size [::Integer] # Optional. Optional limit on the number of {::Google::Cloud::Kms::V1::ImportJob ImportJobs} to include in the # response. Further {::Google::Cloud::Kms::V1::ImportJob ImportJobs} can subsequently be obtained by # including the {::Google::Cloud::Kms::V1::ListImportJobsResponse#next_page_token ListImportJobsResponse.next_page_token} in a subsequent # request. If unspecified, the server will pick an appropriate default. # @param page_token [::String] # Optional. Optional pagination token, returned earlier via # {::Google::Cloud::Kms::V1::ListImportJobsResponse#next_page_token ListImportJobsResponse.next_page_token}. # @param filter [::String] # Optional. Only include resources that match the filter in the response. For # more information, see # [Sorting and filtering list # results](https://cloud.google.com/kms/docs/sorting-and-filtering). # @param order_by [::String] # 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](https://cloud.google.com/kms/docs/sorting-and-filtering). # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.list_import_jobs.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_import_jobs.timeout, metadata: metadata, retry_policy: @config.rpcs.list_import_jobs.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Returns metadata for a given {::Google::Cloud::Kms::V1::KeyRing KeyRing}. # # @overload get_key_ring(request, options = nil) # Pass arguments to `get_key_ring` via a request object, either of type # {::Google::Cloud::Kms::V1::GetKeyRingRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_key_ring(name: nil) # 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). # # @param name [::String] # Required. The {::Google::Cloud::Kms::V1::KeyRing#name name} of the {::Google::Cloud::Kms::V1::KeyRing KeyRing} to get. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::KeyRing] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::KeyRing] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.get_key_ring.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_key_ring.timeout, metadata: metadata, retry_policy: @config.rpcs.get_key_ring.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Returns metadata for a given {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}, as well as its # {::Google::Cloud::Kms::V1::CryptoKey#primary primary} {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion}. # # @overload get_crypto_key(request, options = nil) # Pass arguments to `get_crypto_key` via a request object, either of type # {::Google::Cloud::Kms::V1::GetCryptoKeyRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_crypto_key(name: nil) # 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). # # @param name [::String] # Required. The {::Google::Cloud::Kms::V1::CryptoKey#name name} of the {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} to get. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::CryptoKey] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::CryptoKey] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.get_crypto_key.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_crypto_key.timeout, metadata: metadata, retry_policy: @config.rpcs.get_crypto_key.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Returns metadata for a given {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion}. # # @overload get_crypto_key_version(request, options = nil) # Pass arguments to `get_crypto_key_version` via a request object, either of type # {::Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_crypto_key_version(name: nil) # 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). # # @param name [::String] # Required. The {::Google::Cloud::Kms::V1::CryptoKeyVersion#name name} of the {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} to get. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::CryptoKeyVersion] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::CryptoKeyVersion] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.get_crypto_key_version.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_crypto_key_version.timeout, metadata: metadata, retry_policy: @config.rpcs.get_crypto_key_version.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Returns the public key for the given {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion}. The # {::Google::Cloud::Kms::V1::CryptoKey#purpose CryptoKey.purpose} must be # {::Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose::ASYMMETRIC_SIGN ASYMMETRIC_SIGN} or # {::Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose::ASYMMETRIC_DECRYPT ASYMMETRIC_DECRYPT}. # # @overload get_public_key(request, options = nil) # Pass arguments to `get_public_key` via a request object, either of type # {::Google::Cloud::Kms::V1::GetPublicKeyRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_public_key(name: nil) # 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). # # @param name [::String] # Required. The {::Google::Cloud::Kms::V1::CryptoKeyVersion#name name} of the {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} public key to # get. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::PublicKey] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::PublicKey] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.get_public_key.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_public_key.timeout, metadata: metadata, retry_policy: @config.rpcs.get_public_key.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Returns metadata for a given {::Google::Cloud::Kms::V1::ImportJob ImportJob}. # # @overload get_import_job(request, options = nil) # Pass arguments to `get_import_job` via a request object, either of type # {::Google::Cloud::Kms::V1::GetImportJobRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_import_job(name: nil) # 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). # # @param name [::String] # Required. The {::Google::Cloud::Kms::V1::ImportJob#name name} of the {::Google::Cloud::Kms::V1::ImportJob ImportJob} to get. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::ImportJob] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::ImportJob] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.get_import_job.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_import_job.timeout, metadata: metadata, retry_policy: @config.rpcs.get_import_job.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Create a new {::Google::Cloud::Kms::V1::KeyRing KeyRing} in a given Project and Location. # # @overload create_key_ring(request, options = nil) # Pass arguments to `create_key_ring` via a request object, either of type # {::Google::Cloud::Kms::V1::CreateKeyRingRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload create_key_ring(parent: nil, key_ring_id: nil, key_ring: nil) # 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). # # @param parent [::String] # Required. The resource name of the location associated with the # {::Google::Cloud::Kms::V1::KeyRing KeyRings}, in the format `projects/*/locations/*`. # @param key_ring_id [::String] # Required. It must be unique within a location and match the regular # expression `[a-zA-Z0-9_-]{1,63}` # @param key_ring [::Google::Cloud::Kms::V1::KeyRing, ::Hash] # Required. A {::Google::Cloud::Kms::V1::KeyRing KeyRing} with initial field values. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::KeyRing] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::KeyRing] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.create_key_ring.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_key_ring.timeout, metadata: metadata, retry_policy: @config.rpcs.create_key_ring.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Create a new {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} within a {::Google::Cloud::Kms::V1::KeyRing KeyRing}. # # {::Google::Cloud::Kms::V1::CryptoKey#purpose CryptoKey.purpose} and # {::Google::Cloud::Kms::V1::CryptoKeyVersionTemplate#algorithm CryptoKey.version_template.algorithm} # are required. # # @overload create_crypto_key(request, options = nil) # Pass arguments to `create_crypto_key` via a request object, either of type # {::Google::Cloud::Kms::V1::CreateCryptoKeyRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload create_crypto_key(parent: nil, crypto_key_id: nil, crypto_key: nil, skip_initial_version_creation: nil) # 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). # # @param parent [::String] # Required. The {::Google::Cloud::Kms::V1::KeyRing#name name} of the KeyRing associated with the # {::Google::Cloud::Kms::V1::CryptoKey CryptoKeys}. # @param crypto_key_id [::String] # Required. It must be unique within a KeyRing and match the regular # expression `[a-zA-Z0-9_-]{1,63}` # @param crypto_key [::Google::Cloud::Kms::V1::CryptoKey, ::Hash] # Required. A {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} with initial field values. # @param skip_initial_version_creation [::Boolean] # If set to true, the request will create a {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} without any # {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersions}. You must manually call # {::Google::Cloud::Kms::V1::KeyManagementService::Client#create_crypto_key_version CreateCryptoKeyVersion} or # {::Google::Cloud::Kms::V1::KeyManagementService::Client#import_crypto_key_version ImportCryptoKeyVersion} # before you can use this {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::CryptoKey] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::CryptoKey] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.create_crypto_key.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_crypto_key.timeout, metadata: metadata, retry_policy: @config.rpcs.create_crypto_key.retry_policy options.apply_defaults metadata: @config.metadata, 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 a new {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} in a {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}. # # The server will assign the next sequential id. If unset, # {::Google::Cloud::Kms::V1::CryptoKeyVersion#state state} will be set to # {::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionState::ENABLED ENABLED}. # # @overload create_crypto_key_version(request, options = nil) # Pass arguments to `create_crypto_key_version` via a request object, either of type # {::Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest, ::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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload create_crypto_key_version(parent: nil, crypto_key_version: nil) # Pass arguments to `create_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). # # @param parent [::String] # Required. The {::Google::Cloud::Kms::V1::CryptoKey#name name} of the {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} associated with # the {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersions}. # @param crypto_key_version [::Google::Cloud::Kms::V1::CryptoKeyVersion, ::Hash] # Required. A {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} with initial field values. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Kms::V1::CryptoKeyVersion] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Kms::V1::CryptoKeyVersion] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # 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 metadata = @config.rpcs.create_crypto_key_version.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"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 metadata[:"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("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_crypto_key_version.timeout, metadata: metadata, retry_policy: @config.rpcs.create_crypto_key_version.retry_policy options.apply_defaults metadata: @config.metadata, 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 ## # Imports a new {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} into an existing {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} using the # wrapped key material provided in the request. # # The version ID will be assigned the next sequential id within the # {::Google::Cloud::Kms::V1::CryptoKey CryptoKey}. # # @overload import_crypto_key_version(request, options = nil) # Pass arguments to `import_crypto_key_version` via a request object, either of type # {::Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest} or an equivalent Hash. # # @param 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. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload import_crypto_key_version(parent: nil, algorithm: nil, import_job: nil, rsa_aes_wrapped_key: nil) # 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). # # @param parent [::String] # Required. The {::Google::Cloud::Kms::V1::CryptoKey#name name} of the {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} to # be imported into. # @param algorithm [::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionAlgorithm] # Required. The {::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionAlgorithm algorithm} of # the key being imported. This does not need to match the # {::Google::Cloud::Kms::V1::CryptoKey#version_template version_template} of the {::Google::Cloud::Kms::V1::CryptoKey CryptoKey} this # version imports into. # @param import_job [::String] # Required. The {::Google::Cloud::Kms::V1::ImportJob#name name} of the {::Google::Cloud::Kms::V1::ImportJob ImportJob} that was used to # wrap this key material. # @param rsa_aes_wrapped_key [::String] # Wrapped key material produced with # {::Google::Cloud::Kms::V1::ImportJob::ImportMethod::RSA_OAEP_3072_SHA1_AES_256 RSA_OAEP_3072_SHA1_AES_256} # or # {::Google::Cloud::Kms::V1::ImportJob::ImportMethod::RSA_OAEP_4096_SHA1_AES_256 RSA_OAEP_4096_SHA1_AES_256}. # # This field contains the concatenation of two wrapped keys: #