Class PrivateCatalogClient (1.0.0-beta02)

public abstract 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
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PrivateCatalog scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default PrivateCatalog scopes are:

GrpcClient

public virtual PrivateCatalog.PrivateCatalogClient GrpcClient { get; }

The underlying gRPC PrivateCatalog client

Property Value
TypeDescription
PrivateCatalog.PrivateCatalogClient

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
TypeDescription
PrivateCatalogClient

The created PrivateCatalogClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<PrivateCatalogClient>

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
NameDescription
requestSearchCatalogsRequest

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<SearchCatalogsResponse, Catalog>

A pageable sequence of Catalog resources.

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

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

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<SearchCatalogsResponse, Catalog>

A pageable asynchronous sequence of Catalog resources.

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

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

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<SearchProductsResponse, Product>

A pageable sequence of Product resources.

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

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
NameDescription
requestSearchProductsRequest

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<SearchProductsResponse, Product>

A pageable asynchronous sequence of Product resources.

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

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
NameDescription
requestSearchVersionsRequest

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<SearchVersionsResponse, Version>

A pageable sequence of Version resources.

Example
// Create client
PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.Create();
// Initialize request argument(s)
SearchVersionsRequest request = new SearchVersionsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedEnumerable<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 (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
NameDescription
requestSearchVersionsRequest

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<SearchVersionsResponse, Version>

A pageable asynchronous sequence of Version resources.

Example
// Create client
PrivateCatalogClient privateCatalogClient = await PrivateCatalogClient.CreateAsync();
// Initialize request argument(s)
SearchVersionsRequest request = new SearchVersionsRequest
{
    Resource = "",
    Query = "",
};
// Make the request
PagedAsyncEnumerable<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((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
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.