KMS Inventory v1 API - Class KeyDashboardServiceClient (1.1.0)

public abstract class KeyDashboardServiceClient

Reference documentation and code samples for the KMS Inventory v1 API class KeyDashboardServiceClient.

KeyDashboardService client wrapper, for convenient use.

Inheritance

object > KeyDashboardServiceClient

Namespace

Google.Cloud.Kms.Inventory.V1

Assembly

Google.Cloud.Kms.Inventory.V1.dll

Remarks

Provides a cross-region view of all Cloud KMS keys in a given Cloud project.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the KeyDashboardService service, which is a host of "kmsinventory.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default KeyDashboardService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default KeyDashboardService scopes are:

GrpcClient

public virtual KeyDashboardService.KeyDashboardServiceClient GrpcClient { get; }

The underlying gRPC KeyDashboardService client

Property Value
TypeDescription
KeyDashboardServiceKeyDashboardServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static KeyDashboardServiceClient Create()

Synchronously creates a KeyDashboardServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyDashboardServiceClientBuilder.

Returns
TypeDescription
KeyDashboardServiceClient

The created KeyDashboardServiceClient.

CreateAsync(CancellationToken)

public static Task<KeyDashboardServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a KeyDashboardServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyDashboardServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskKeyDashboardServiceClient

The task representing the created KeyDashboardServiceClient.

ListCryptoKeys(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
parentProjectName

Required. The Google Cloud project for which to retrieve key metadata, in the format projects/*

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = KeyDashboardServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (gckv::CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(ListCryptoKeysRequest, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(ListCryptoKeysRequest request, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
requestListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = KeyDashboardServiceClient.Create();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeys(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (gckv::CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
parentstring

Required. The Google Cloud project for which to retrieve key metadata, in the format projects/*

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = KeyDashboardServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (gckv::CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
parentProjectName

Required. The Google Cloud project for which to retrieve key metadata, in the format projects/*

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = await KeyDashboardServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gckv::CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(ListCryptoKeysRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(ListCryptoKeysRequest request, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
requestListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = await KeyDashboardServiceClient.CreateAsync();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeysAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gckv::CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns cryptographic keys managed by Cloud KMS in a given Cloud project. Note that this data is sourced from snapshots, meaning it may not completely reflect the actual state of key metadata at call time.

Parameters
NameDescription
parentstring

Required. The Google Cloud project for which to retrieve key metadata, in the format projects/*

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyDashboardServiceClient keyDashboardServiceClient = await KeyDashboardServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, gckv::CryptoKey> response = keyDashboardServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gckv::CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (gckv::CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<gckv::CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (gckv::CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.