Cloud Private Catalog v1beta1 API - Class PrivateCatalogClient (2.0.0-beta05)

public abstract class PrivateCatalogClient

Reference documentation and code samples for the Cloud Private Catalog v1beta1 API class PrivateCatalogClient.

PrivateCatalog client wrapper, for convenient use.

Inheritance

object > PrivateCatalogClient

Derived Types

Namespace

Google.Cloud.PrivateCatalog.V1Beta1

Assembly

Google.Cloud.PrivateCatalog.V1Beta1.dll

Remarks

PrivateCatalog allows catalog consumers to retrieve Catalog, Product and Version resources under a target resource context.

Catalog is computed based on the [Association][]s linked to the target resource and its ancestors. Each association's [google.cloud.privatecatalogproducer.v1beta.Catalog][] is transformed into a Catalog. If multiple associations have the same parent [google.cloud.privatecatalogproducer.v1beta.Catalog][], they are de-duplicated into one Catalog. Users must have cloudprivatecatalog.catalogTargets.get IAM permission on the resource context in order to access catalogs. Catalog contains the resource name and a subset of data of the original [google.cloud.privatecatalogproducer.v1beta.Catalog][].

Product is child resource of the catalog. A Product contains the resource name and a subset of the data of the original [google.cloud.privatecatalogproducer.v1beta.Product][].

Version is child resource of the product. A Version contains the resource name and a subset of the data of the original [google.cloud.privatecatalogproducer.v1beta.Version][].

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PrivateCatalog scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default PrivateCatalog scopes are:

GrpcClient

public virtual PrivateCatalog.PrivateCatalogClient GrpcClient { get; }

The underlying gRPC PrivateCatalog client

Property Value
Type Description
PrivateCatalogPrivateCatalogClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static PrivateCatalogClient Create()

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

Returns
Type Description
PrivateCatalogClient

The created PrivateCatalogClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskPrivateCatalogClient

The task representing the created PrivateCatalogClient.

SearchCatalogs(SearchCatalogsRequest, CallSettings)

public virtual PagedEnumerable<SearchCatalogsResponse, Catalog> SearchCatalogs(SearchCatalogsRequest request, CallSettings callSettings = null)

Search [Catalog][google.cloud.privatecatalog.v1beta1.Catalog] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchCatalogsRequest

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
PagedEnumerableSearchCatalogsResponseCatalog

A pageable sequence of Catalog resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = gcpv::PrivateCatalogClient.Create();
// Initialize request argument(s)
gcpv::SearchCatalogsRequest request = new gcpv::SearchCatalogsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedEnumerable<gcpv::SearchCatalogsResponse, gcpv::Catalog> response = privateCatalogClient.SearchCatalogs(request);

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

SearchCatalogsAsync(SearchCatalogsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchCatalogsResponse, Catalog> SearchCatalogsAsync(SearchCatalogsRequest request, CallSettings callSettings = null)

Search [Catalog][google.cloud.privatecatalog.v1beta1.Catalog] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchCatalogsRequest

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
PagedAsyncEnumerableSearchCatalogsResponseCatalog

A pageable asynchronous sequence of Catalog resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = await gcpv::PrivateCatalogClient.CreateAsync();
// Initialize request argument(s)
gcpv::SearchCatalogsRequest request = new gcpv::SearchCatalogsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedAsyncEnumerable<gcpv::SearchCatalogsResponse, gcpv::Catalog> response = privateCatalogClient.SearchCatalogsAsync(request);

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

SearchProducts(SearchProductsRequest, CallSettings)

public virtual PagedEnumerable<SearchProductsResponse, Product> SearchProducts(SearchProductsRequest request, CallSettings callSettings = null)

Search [Product][google.cloud.privatecatalog.v1beta1.Product] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchProductsRequest

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
PagedEnumerableSearchProductsResponseProduct

A pageable sequence of Product resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = gcpv::PrivateCatalogClient.Create();
// Initialize request argument(s)
gcpv::SearchProductsRequest request = new gcpv::SearchProductsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedEnumerable<gcpv::SearchProductsResponse, gcpv::Product> response = privateCatalogClient.SearchProducts(request);

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

SearchProductsAsync(SearchProductsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchProductsResponse, Product> SearchProductsAsync(SearchProductsRequest request, CallSettings callSettings = null)

Search [Product][google.cloud.privatecatalog.v1beta1.Product] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchProductsRequest

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
PagedAsyncEnumerableSearchProductsResponseProduct

A pageable asynchronous sequence of Product resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = await gcpv::PrivateCatalogClient.CreateAsync();
// Initialize request argument(s)
gcpv::SearchProductsRequest request = new gcpv::SearchProductsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedAsyncEnumerable<gcpv::SearchProductsResponse, gcpv::Product> response = privateCatalogClient.SearchProductsAsync(request);

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

SearchVersions(SearchVersionsRequest, CallSettings)

public virtual PagedEnumerable<SearchVersionsResponse, Version> SearchVersions(SearchVersionsRequest request, CallSettings callSettings = null)

Search [Version][google.cloud.privatecatalog.v1beta1.Version] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchVersionsRequest

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
PagedEnumerableSearchVersionsResponseVersion

A pageable sequence of Version resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = gcpv::PrivateCatalogClient.Create();
// Initialize request argument(s)
gcpv::SearchVersionsRequest request = new gcpv::SearchVersionsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedEnumerable<gcpv::SearchVersionsResponse, gcpv::Version> response = privateCatalogClient.SearchVersions(request);

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

SearchVersionsAsync(SearchVersionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchVersionsResponse, Version> SearchVersionsAsync(SearchVersionsRequest request, CallSettings callSettings = null)

Search [Version][google.cloud.privatecatalog.v1beta1.Version] resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
Name Description
request SearchVersionsRequest

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
PagedAsyncEnumerableSearchVersionsResponseVersion

A pageable asynchronous sequence of Version resources.

Example
// Create client
gcpv::PrivateCatalogClient privateCatalogClient = await gcpv::PrivateCatalogClient.CreateAsync();
// Initialize request argument(s)
gcpv::SearchVersionsRequest request = new gcpv::SearchVersionsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedAsyncEnumerable<gcpv::SearchVersionsResponse, gcpv::Version> response = privateCatalogClient.SearchVersionsAsync(request);

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