API hub v1 API - Class ApiHubCollectClient (1.1.0)

public abstract class ApiHubCollectClient

Reference documentation and code samples for the API hub v1 API class ApiHubCollectClient.

ApiHubCollect client wrapper, for convenient use.

Inheritance

object > ApiHubCollectClient

Derived Types

Namespace

Google.Cloud.ApiHub.V1

Assembly

Google.Cloud.ApiHub.V1.dll

Remarks

This service exposes methods used for collecting various types of data from different first party and third party sources and push it to Hub's collect layer.

Properties

CollectApiDataOperationsClient

public virtual OperationsClient CollectApiDataOperationsClient { get; }

The long-running operations client for CollectApiData.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ApiHubCollect scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default ApiHubCollect scopes are:

GrpcClient

public virtual ApiHubCollect.ApiHubCollectClient GrpcClient { get; }

The underlying gRPC ApiHubCollect client

Property Value
Type Description
ApiHubCollectApiHubCollectClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

CollectApiData(LocationName, CollectionType, ApiData, CallSettings)

public virtual Operation<CollectApiDataResponse, OperationMetadata> CollectApiData(LocationName location, CollectionType collectionType, ApiData apiData, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location LocationName

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationCollectApiDataResponseOperationMetadata

The RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = ApiHubCollectClient.Create();
// Initialize request argument(s)
LocationName location = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = apiHubCollectClient.CollectApiData(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = apiHubCollectClient.PollOnceCollectApiData(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiData(CollectApiDataRequest, CallSettings)

public virtual Operation<CollectApiDataResponse, OperationMetadata> CollectApiData(CollectApiDataRequest request, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
request CollectApiDataRequest

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
OperationCollectApiDataResponseOperationMetadata

The RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = ApiHubCollectClient.Create();
// Initialize request argument(s)
CollectApiDataRequest request = new CollectApiDataRequest
{
    LocationAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    CollectionType = CollectionType.Unspecified,
    PluginInstanceAsPluginInstanceName = PluginInstanceName.FromProjectLocationPluginInstance("[PROJECT]", "[LOCATION]", "[PLUGIN]", "[INSTANCE]"),
    ActionId = "",
    ApiData = new ApiData(),
};
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = apiHubCollectClient.CollectApiData(request);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = apiHubCollectClient.PollOnceCollectApiData(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiData(string, CollectionType, ApiData, CallSettings)

public virtual Operation<CollectApiDataResponse, OperationMetadata> CollectApiData(string location, CollectionType collectionType, ApiData apiData, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location string

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationCollectApiDataResponseOperationMetadata

The RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = ApiHubCollectClient.Create();
// Initialize request argument(s)
string location = "projects/[PROJECT]/locations/[LOCATION]";
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = apiHubCollectClient.CollectApiData(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = apiHubCollectClient.PollOnceCollectApiData(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(LocationName, CollectionType, ApiData, CallSettings)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(LocationName location, CollectionType collectionType, ApiData apiData, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location LocationName

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
LocationName location = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(LocationName, CollectionType, ApiData, CancellationToken)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(LocationName location, CollectionType collectionType, ApiData apiData, CancellationToken cancellationToken)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location LocationName

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
LocationName location = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(CollectApiDataRequest, CallSettings)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(CollectApiDataRequest request, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
request CollectApiDataRequest

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
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
CollectApiDataRequest request = new CollectApiDataRequest
{
    LocationAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    CollectionType = CollectionType.Unspecified,
    PluginInstanceAsPluginInstanceName = PluginInstanceName.FromProjectLocationPluginInstance("[PROJECT]", "[LOCATION]", "[PLUGIN]", "[INSTANCE]"),
    ActionId = "",
    ApiData = new ApiData(),
};
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(request);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(CollectApiDataRequest, CancellationToken)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(CollectApiDataRequest request, CancellationToken cancellationToken)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
request CollectApiDataRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
CollectApiDataRequest request = new CollectApiDataRequest
{
    LocationAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    CollectionType = CollectionType.Unspecified,
    PluginInstanceAsPluginInstanceName = PluginInstanceName.FromProjectLocationPluginInstance("[PROJECT]", "[LOCATION]", "[PLUGIN]", "[INSTANCE]"),
    ActionId = "",
    ApiData = new ApiData(),
};
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(request);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(string, CollectionType, ApiData, CallSettings)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(string location, CollectionType collectionType, ApiData apiData, CallSettings callSettings = null)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location string

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
string location = "projects/[PROJECT]/locations/[LOCATION]";
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

CollectApiDataAsync(string, CollectionType, ApiData, CancellationToken)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> CollectApiDataAsync(string location, CollectionType collectionType, ApiData apiData, CancellationToken cancellationToken)

Collect API data from a source and push it to Hub's collect layer.

Parameters
Name Description
location string

Required. The regional location of the API hub instance and its resources. Format: projects/{project}/locations/{location}

collectionType CollectionType

Required. The type of collection. Applies to all entries in [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].

apiData ApiData

Required. The API data to be collected.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ApiHubCollectClient apiHubCollectClient = await ApiHubCollectClient.CreateAsync();
// Initialize request argument(s)
string location = "projects/[PROJECT]/locations/[LOCATION]";
CollectionType collectionType = CollectionType.Unspecified;
ApiData apiData = new ApiData();
// Make the request
Operation<CollectApiDataResponse, OperationMetadata> response = await apiHubCollectClient.CollectApiDataAsync(location, collectionType, apiData);

// Poll until the returned long-running operation is complete
Operation<CollectApiDataResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
CollectApiDataResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<CollectApiDataResponse, OperationMetadata> retrievedResponse = await apiHubCollectClient.PollOnceCollectApiDataAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    CollectApiDataResponse retrievedResult = retrievedResponse.Result;
}

Create()

public static ApiHubCollectClient Create()

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

Returns
Type Description
ApiHubCollectClient

The created ApiHubCollectClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskApiHubCollectClient

The task representing the created ApiHubCollectClient.

PollOnceCollectApiData(string, CallSettings)

public virtual Operation<CollectApiDataResponse, OperationMetadata> PollOnceCollectApiData(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CollectApiData.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationCollectApiDataResponseOperationMetadata

The result of polling the operation.

PollOnceCollectApiDataAsync(string, CallSettings)

public virtual Task<Operation<CollectApiDataResponse, OperationMetadata>> PollOnceCollectApiDataAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CollectApiData.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationCollectApiDataResponseOperationMetadata

A task representing the result of polling the operation.

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.