Google Cloud Billing v1 API - Class CloudCatalogClient (3.2.0)

public abstract class CloudCatalogClient

Reference documentation and code samples for the Google Cloud Billing v1 API class CloudCatalogClient.

CloudCatalog client wrapper, for convenient use.

Inheritance

Object > CloudCatalogClient

Derived Types

Namespace

Google.Cloud.Billing.V1

Assembly

Google.Cloud.Billing.V1.dll

Remarks

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default CloudCatalog scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual CloudCatalog.CloudCatalogClient GrpcClient { get; }

The underlying gRPC CloudCatalog client

Property Value
TypeDescription
CloudCatalog.CloudCatalogClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static CloudCatalogClient Create()

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

Returns
TypeDescription
CloudCatalogClient

The created CloudCatalogClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<CloudCatalogClient>

The task representing the created CloudCatalogClient.

ListServices(ListServicesRequest, CallSettings)

public virtual PagedEnumerable<ListServicesResponse, Service> ListServices(ListServicesRequest request, CallSettings callSettings = null)

Lists all public cloud services.

Parameters
NameDescription
requestListServicesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListServicesResponse, Service>

A pageable sequence of Service resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = CloudCatalogClient.Create();
// Initialize request argument(s)
ListServicesRequest request = new ListServicesRequest { };
// Make the request
PagedEnumerable<ListServicesResponse, Service> response = cloudCatalogClient.ListServices(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Service 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 (ListServicesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Service 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<Service> 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 (Service 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;

ListServices(String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListServicesResponse, Service> ListServices(string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all public cloud services.

Parameters
NameDescription
pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<ListServicesResponse, Service>

A pageable sequence of Service resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = CloudCatalogClient.Create();
// Make the request
PagedEnumerable<ListServicesResponse, Service> response = cloudCatalogClient.ListServices();

// Iterate over all response items, lazily performing RPCs as required
foreach (Service 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 (ListServicesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Service 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<Service> 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 (Service 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;

ListServicesAsync(ListServicesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListServicesResponse, Service> ListServicesAsync(ListServicesRequest request, CallSettings callSettings = null)

Lists all public cloud services.

Parameters
NameDescription
requestListServicesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListServicesResponse, Service>

A pageable asynchronous sequence of Service resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync();
// Initialize request argument(s)
ListServicesRequest request = new ListServicesRequest { };
// Make the request
PagedAsyncEnumerable<ListServicesResponse, Service> response = cloudCatalogClient.ListServicesAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Service 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((ListServicesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Service 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<Service> 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 (Service 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;

ListServicesAsync(String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListServicesResponse, Service> ListServicesAsync(string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all public cloud services.

Parameters
NameDescription
pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<ListServicesResponse, Service>

A pageable asynchronous sequence of Service resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync();
// Make the request
PagedAsyncEnumerable<ListServicesResponse, Service> response = cloudCatalogClient.ListServicesAsync();

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Service 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((ListServicesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Service 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<Service> 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 (Service 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;

ListSkus(ListSkusRequest, CallSettings)

public virtual PagedEnumerable<ListSkusResponse, Sku> ListSkus(ListSkusRequest request, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
requestListSkusRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListSkusResponse, Sku>

A pageable sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = CloudCatalogClient.Create();
// Initialize request argument(s)
ListSkusRequest request = new ListSkusRequest
{
    ParentAsServiceName = ServiceName.FromService("[SERVICE]"),
    StartTime = new Timestamp(),
    EndTime = new Timestamp(),
    CurrencyCode = "",
};
// Make the request
PagedEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkus(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Sku 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 (ListSkusResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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;

ListSkus(ServiceName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListSkusResponse, Sku> ListSkus(ServiceName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
parentServiceName

Required. The name of the service. Example: "services/DA34-426B-A397"

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<ListSkusResponse, Sku>

A pageable sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = CloudCatalogClient.Create();
// Initialize request argument(s)
ServiceName parent = ServiceName.FromService("[SERVICE]");
// Make the request
PagedEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkus(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Sku 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 (ListSkusResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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;

ListSkus(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListSkusResponse, Sku> ListSkus(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
parentString

Required. The name of the service. Example: "services/DA34-426B-A397"

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<ListSkusResponse, Sku>

A pageable sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = CloudCatalogClient.Create();
// Initialize request argument(s)
string parent = "services/[SERVICE]";
// Make the request
PagedEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkus(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Sku 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 (ListSkusResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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;

ListSkusAsync(ListSkusRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSkusResponse, Sku> ListSkusAsync(ListSkusRequest request, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
requestListSkusRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListSkusResponse, Sku>

A pageable asynchronous sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync();
// Initialize request argument(s)
ListSkusRequest request = new ListSkusRequest
{
    ParentAsServiceName = ServiceName.FromService("[SERVICE]"),
    StartTime = new Timestamp(),
    EndTime = new Timestamp(),
    CurrencyCode = "",
};
// Make the request
PagedAsyncEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkusAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Sku 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((ListSkusResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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;

ListSkusAsync(ServiceName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListSkusResponse, Sku> ListSkusAsync(ServiceName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
parentServiceName

Required. The name of the service. Example: "services/DA34-426B-A397"

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<ListSkusResponse, Sku>

A pageable asynchronous sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync();
// Initialize request argument(s)
ServiceName parent = ServiceName.FromService("[SERVICE]");
// Make the request
PagedAsyncEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkusAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Sku 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((ListSkusResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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;

ListSkusAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListSkusResponse, Sku> ListSkusAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists all publicly available SKUs for a given cloud service.

Parameters
NameDescription
parentString

Required. The name of the service. Example: "services/DA34-426B-A397"

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<ListSkusResponse, Sku>

A pageable asynchronous sequence of Sku resources.

Example
// Create client
CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync();
// Initialize request argument(s)
string parent = "services/[SERVICE]";
// Make the request
PagedAsyncEnumerable<ListSkusResponse, Sku> response = cloudCatalogClient.ListSkusAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Sku 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((ListSkusResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Sku 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<Sku> 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 (Sku 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.