public abstract class DatabaseCenterClientReference documentation and code samples for the Database Center v1beta API class DatabaseCenterClient.
DatabaseCenter client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.DatabaseCenter.V1BetaAssembly
Google.Cloud.DatabaseCenter.V1Beta.dll
Remarks
DatabaseCenter contains methods to query fleet view for database resources.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }The default endpoint for the DatabaseCenter service, which is a host of "databasecenter.googleapis.com" and a port of 443.
| Property Value | |
|---|---|
| Type | Description |
string |
|
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }The default DatabaseCenter scopes.
| Property Value | |
|---|---|
| Type | Description |
IReadOnlyListstring |
|
The default DatabaseCenter scopes are:
GrpcClient
public virtual DatabaseCenter.DatabaseCenterClient GrpcClient { get; }The underlying gRPC DatabaseCenter client
| Property Value | |
|---|---|
| Type | Description |
DatabaseCenterDatabaseCenterClient |
|
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }The service metadata associated with this client type.
| Property Value | |
|---|---|
| Type | Description |
ServiceMetadata |
|
Methods
Create()
public static DatabaseCenterClient Create()Synchronously creates a DatabaseCenterClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DatabaseCenterClientBuilder.
| Returns | |
|---|---|
| Type | Description |
DatabaseCenterClient |
The created DatabaseCenterClient. |
CreateAsync(CancellationToken)
public static Task<DatabaseCenterClient> CreateAsync(CancellationToken cancellationToken = default)Asynchronously creates a DatabaseCenterClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DatabaseCenterClientBuilder.
| Parameter | |
|---|---|
| Name | Description |
cancellationToken |
CancellationTokenThe CancellationToken to use while creating the client. |
| Returns | |
|---|---|
| Type | Description |
TaskDatabaseCenterClient |
The task representing the created DatabaseCenterClient. |
QueryProducts(QueryProductsRequest, CallSettings)
public virtual PagedEnumerable<QueryProductsResponse, Product> QueryProducts(QueryProductsRequest request, CallSettings callSettings = null)QueryProducts provides a list of all possible products which can be used to filter database resources.
| Parameters | |
|---|---|
| Name | Description |
request |
QueryProductsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableQueryProductsResponseProduct |
A pageable sequence of Product resources. |
// Create client
DatabaseCenterClient databaseCenterClient = DatabaseCenterClient.Create();
// Initialize request argument(s)
QueryProductsRequest request = new QueryProductsRequest { Parent = "", };
// Make the request
PagedEnumerable<QueryProductsResponse, Product> response = databaseCenterClient.QueryProducts(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Product 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 (QueryProductsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product 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<Product> 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 (Product 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;
QueryProductsAsync(QueryProductsRequest, CallSettings)
public virtual PagedAsyncEnumerable<QueryProductsResponse, Product> QueryProductsAsync(QueryProductsRequest request, CallSettings callSettings = null)QueryProducts provides a list of all possible products which can be used to filter database resources.
| Parameters | |
|---|---|
| Name | Description |
request |
QueryProductsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableQueryProductsResponseProduct |
A pageable asynchronous sequence of Product resources. |
// Create client
DatabaseCenterClient databaseCenterClient = await DatabaseCenterClient.CreateAsync();
// Initialize request argument(s)
QueryProductsRequest request = new QueryProductsRequest { Parent = "", };
// Make the request
PagedAsyncEnumerable<QueryProductsResponse, Product> response = databaseCenterClient.QueryProductsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Product 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((QueryProductsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Product 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<Product> 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 (Product 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 | |
|---|---|
| Type | Description |
Task |
A task representing the asynchronous shutdown operation. |
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.