KMS Inventory V1 API - Class Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client (v0.7.0)

Reference documentation and code samples for the KMS Inventory V1 API class Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.

Client for the KeyTrackingService service.

Returns information about the resources in an org that are protected by a given Cloud KMS key via CMEK.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the KeyTrackingService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all KeyTrackingService clients
::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the KeyTrackingService 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 Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#get_protected_resources_summary

def get_protected_resources_summary(request, options = nil) -> ::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary
def get_protected_resources_summary(name: nil) -> ::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary

Returns aggregate information about the resources protected by the given Cloud KMS CryptoKey. Only resources within the same Cloud organization as the key will be returned. The project that holds the key must be part of an organization in order for this call to succeed.

Overloads
def get_protected_resources_summary(request, options = nil) -> ::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary
Pass arguments to get_protected_resources_summary via a request object, either of type GetProtectedResourcesSummaryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_protected_resources_summary(name: nil) -> ::Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary
Pass arguments to get_protected_resources_summary 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).
Parameter
  • name (::String) — Required. The resource name of the CryptoKey.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/kms/inventory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Kms::Inventory::V1::GetProtectedResourcesSummaryRequest.new

# Call the get_protected_resources_summary method.
result = client.get_protected_resources_summary request

# The returned object is of type Google::Cloud::Kms::Inventory::V1::ProtectedResourcesSummary.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new KeyTrackingService client object.

Yields
  • (config) — Configure the KeyTrackingService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new do |config|
  config.timeout = 10.0
end

#search_protected_resources

def search_protected_resources(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>
def search_protected_resources(scope: nil, crypto_key: nil, page_size: nil, page_token: nil, resource_types: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>

Returns metadata about the resources protected by the given Cloud KMS CryptoKey in the given Cloud organization.

Overloads
def search_protected_resources(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>
Pass arguments to search_protected_resources via a request object, either of type SearchProtectedResourcesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def search_protected_resources(scope: nil, crypto_key: nil, page_size: nil, page_token: nil, resource_types: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::Inventory::V1::ProtectedResource>
Pass arguments to search_protected_resources via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • scope (::String) — Required. Resource name of the organization. Example: organizations/123
  • crypto_key (::String) — Required. The resource name of the CryptoKey.
  • page_size (::Integer) — The maximum number of resources to return. The service may return fewer than this value. If unspecified, at most 500 resources will be returned. The maximum value is 500; values above 500 will be coerced to 500.
  • page_token (::String) — A page token, received from a previous KeyTrackingService.SearchProtectedResources call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to KeyTrackingService.SearchProtectedResources must match the call that provided the page token.

  • resource_types (::Array<::String>) — Optional. A list of resource types that this request searches for. If empty, it will search all the trackable resource types.

    Regular expressions are also supported. For example:

    • compute.googleapis.com.* snapshots resources whose type starts with compute.googleapis.com.
    • .*Image snapshots resources whose type ends with Image.
    • .*Image.* snapshots resources whose type contains Image.

    See RE2 for all supported regular expression syntax. If the regular expression does not match any supported resource type, an INVALID_ARGUMENT error will be returned.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/kms/inventory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Kms::Inventory::V1::SearchProtectedResourcesRequest.new

# Call the search_protected_resources method.
result = client.search_protected_resources request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Kms::Inventory::V1::ProtectedResource.
  p item
end