Cloud Profiler v2 API - Class ExportServiceClient (2.5.0)

public abstract class ExportServiceClient

Reference documentation and code samples for the Cloud Profiler v2 API class ExportServiceClient.

ExportService client wrapper, for convenient use.

Inheritance

object > ExportServiceClient

Derived Types

Namespace

Google.Cloud.Profiler.V2

Assembly

Google.Cloud.Profiler.V2.dll

Remarks

Service allows existing Cloud Profiler customers to export their profile data out of Google Cloud.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ExportService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual ExportService.ExportServiceClient GrpcClient { get; }

The underlying gRPC ExportService client

Property Value
Type Description
ExportServiceExportServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static ExportServiceClient Create()

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

Returns
Type Description
ExportServiceClient

The created ExportServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskExportServiceClient

The task representing the created ExportServiceClient.

ListProfiles(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListProfilesResponse, Profile> ListProfiles(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
parent ProjectName

Required. The parent, which owns this collection of profiles. Format: projects/{user_project_id}

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
PagedEnumerableListProfilesResponseProfile

A pageable sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = ExportServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfiles(parent);

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

ListProfiles(ListProfilesRequest, CallSettings)

public virtual PagedEnumerable<ListProfilesResponse, Profile> ListProfiles(ListProfilesRequest request, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
request ListProfilesRequest

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
PagedEnumerableListProfilesResponseProfile

A pageable sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = ExportServiceClient.Create();
// Initialize request argument(s)
ListProfilesRequest request = new ListProfilesRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfiles(request);

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

ListProfiles(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListProfilesResponse, Profile> ListProfiles(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
parent string

Required. The parent, which owns this collection of profiles. Format: projects/{user_project_id}

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
PagedEnumerableListProfilesResponseProfile

A pageable sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = ExportServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfiles(parent);

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

ListProfilesAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListProfilesResponse, Profile> ListProfilesAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
parent ProjectName

Required. The parent, which owns this collection of profiles. Format: projects/{user_project_id}

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
PagedAsyncEnumerableListProfilesResponseProfile

A pageable asynchronous sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = await ExportServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfilesAsync(parent);

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

ListProfilesAsync(ListProfilesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListProfilesResponse, Profile> ListProfilesAsync(ListProfilesRequest request, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
request ListProfilesRequest

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
PagedAsyncEnumerableListProfilesResponseProfile

A pageable asynchronous sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = await ExportServiceClient.CreateAsync();
// Initialize request argument(s)
ListProfilesRequest request = new ListProfilesRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfilesAsync(request);

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

ListProfilesAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListProfilesResponse, Profile> ListProfilesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists profiles which have been collected so far and for which the caller has permission to view.

Parameters
Name Description
parent string

Required. The parent, which owns this collection of profiles. Format: projects/{user_project_id}

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
PagedAsyncEnumerableListProfilesResponseProfile

A pageable asynchronous sequence of Profile resources.

Example
// Create client
ExportServiceClient exportServiceClient = await ExportServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListProfilesResponse, Profile> response = exportServiceClient.ListProfilesAsync(parent);

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