Google Cloud Billing v1 API - Class CloudCatalogClient (3.7.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
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default CloudCatalog scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual CloudCatalog.CloudCatalogClient GrpcClient { get; }

The underlying gRPC CloudCatalog client

Property Value
Type Description
CloudCatalogCloudCatalogClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
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
Type Description
CloudCatalogClient

The created CloudCatalogClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskCloudCatalogClient

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
Name Description
request ListServicesRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListServicesResponseService

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, int?, CallSettings)

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

Lists all public cloud services.

Parameters
Name Description
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListServicesResponseService

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
Name Description
request ListServicesRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListServicesResponseService

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, int?, CallSettings)

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

Lists all public cloud services.

Parameters
Name Description
pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListServicesResponseService

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
Name Description
request ListSkusRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSkusResponseSku

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, int?, 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
Name Description
parent ServiceName

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

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSkusResponseSku

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, int?, 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
Name Description
parent string

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

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSkusResponseSku

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
Name Description
request ListSkusRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSkusResponseSku

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, int?, 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
Name Description
parent ServiceName

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

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSkusResponseSku

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, int?, 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
Name Description
parent string

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

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSkusResponseSku

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
Type Description
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.