2.7.0 (latest) 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.2.0 1.1.0 1.0.0

    public abstract class ProfilerServiceClient

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

ProfilerService client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ProfilerServiceClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[ProfilerServiceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClientImpl.md.txt)

## Namespace

[Google.Cloud.Profiler.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.md.txt)

## Assembly

Google.Cloud.Profiler.V2.dll

## Remarks

Manage the collection of continuous profiling data provided by profiling
agents running in the cloud or by an offline provider of profiling data.

**The APIs listed in this service are intended for use within our profiler
agents only.**

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the ProfilerService 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 ProfilerService scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `IReadOnlyListstring` |   |

**Remarks** The default ProfilerService scopes are:

- <https://www.googleapis.com/auth/cloud-platform>
- <https://www.googleapis.com/auth/monitoring>
- <https://www.googleapis.com/auth/monitoring.write>

<br />

### GrpcClient

    public virtual ProfilerService.ProfilerServiceClient GrpcClient { get; }

The underlying gRPC ProfilerService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `ProfilerServiceProfilerServiceClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `ServiceMetadata` |   |

## Methods

### Create()

    public static ProfilerServiceClient Create()

Synchronously creates a [ProfilerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [ProfilerServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClientBuilder.md.txt).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ProfilerServiceClient` | The created [ProfilerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt). |

### CreateAsync(CancellationToken)

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

Asynchronously creates a [ProfilerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [ProfilerServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClientBuilder.md.txt).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `CancellationToken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfilerServiceClient` | The task representing the created [ProfilerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt). |

### CreateOfflineProfile(ProjectName, Profile, CallSettings)

    public virtual Profile CreateOfflineProfile(ProjectName parent, Profile profile, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `ProjectName` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(parent, profile);
```

### CreateOfflineProfile(CreateOfflineProfileRequest, CallSettings)

    public virtual Profile CreateOfflineProfile(CreateOfflineProfileRequest request, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateOfflineProfileRequest` 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** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(request);
```

### CreateOfflineProfile(string, Profile, CallSettings)

    public virtual Profile CreateOfflineProfile(string parent, Profile profile, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = profilerServiceClient.CreateOfflineProfile(parent, profile);
```

### CreateOfflineProfileAsync(ProjectName, Profile, CallSettings)

    public virtual Task<Profile> CreateOfflineProfileAsync(ProjectName parent, Profile profile, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `ProjectName` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);
```

### CreateOfflineProfileAsync(ProjectName, Profile, CancellationToken)

    public virtual Task<Profile> CreateOfflineProfileAsync(ProjectName parent, Profile profile, CancellationToken cancellationToken)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `ProjectName` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);
```

### CreateOfflineProfileAsync(CreateOfflineProfileRequest, CallSettings)

    public virtual Task<Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateOfflineProfileRequest` 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** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(request);
```

### CreateOfflineProfileAsync(CreateOfflineProfileRequest, CancellationToken)

    public virtual Task<Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, CancellationToken cancellationToken)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateOfflineProfileRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateOfflineProfileRequest request = new CreateOfflineProfileRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Profile = new Profile(),
};
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(request);
```

### CreateOfflineProfileAsync(string, Profile, CallSettings)

    public virtual Task<Profile> CreateOfflineProfileAsync(string parent, Profile profile, CallSettings callSettings = null)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);
```

### CreateOfflineProfileAsync(string, Profile, CancellationToken)

    public virtual Task<Profile> CreateOfflineProfileAsync(string parent, Profile profile, CancellationToken cancellationToken)

CreateOfflineProfile creates a new profile resource in the offline
mode. The client provides the profile to create along with the profile
bytes, the server records it.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Parent project to create the profile in. |
| `profile` | `Profile` Contents of the profile to create. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Profile profile = new Profile();
// Make the request
Profile response = await profilerServiceClient.CreateOfflineProfileAsync(parent, profile);
```

### CreateProfile(CreateProfileRequest, CallSettings)

    public virtual Profile CreateProfile(CreateProfileRequest request, CallSettings callSettings = null)

CreateProfile creates a new profile resource in the online mode.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

The server ensures that the new profiles are created at a constant rate per
deployment, so the creation request may hang for some time until the next
profile session is available.

The request may fail with ABORTED error if the creation is not available
within \~1m, the response will indicate the duration of the backoff the
client should take before attempting creating a profile again. The backoff
duration is returned in google.rpc.RetryInfo extension on the response
status. To a gRPC client, the extension will be return as a
binary-serialized proto in the trailing metadata item named
"google.rpc.retryinfo-bin".

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateProfileRequest` 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** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = profilerServiceClient.CreateProfile(request);
```

### CreateProfileAsync(CreateProfileRequest, CallSettings)

    public virtual Task<Profile> CreateProfileAsync(CreateProfileRequest request, CallSettings callSettings = null)

CreateProfile creates a new profile resource in the online mode.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

The server ensures that the new profiles are created at a constant rate per
deployment, so the creation request may hang for some time until the next
profile session is available.

The request may fail with ABORTED error if the creation is not available
within \~1m, the response will indicate the duration of the backoff the
client should take before attempting creating a profile again. The backoff
duration is returned in google.rpc.RetryInfo extension on the response
status. To a gRPC client, the extension will be return as a
binary-serialized proto in the trailing metadata item named
"google.rpc.retryinfo-bin".

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateProfileRequest` 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** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = await profilerServiceClient.CreateProfileAsync(request);
```

### CreateProfileAsync(CreateProfileRequest, CancellationToken)

    public virtual Task<Profile> CreateProfileAsync(CreateProfileRequest request, CancellationToken cancellationToken)

CreateProfile creates a new profile resource in the online mode.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

The server ensures that the new profiles are created at a constant rate per
deployment, so the creation request may hang for some time until the next
profile session is available.

The request may fail with ABORTED error if the creation is not available
within \~1m, the response will indicate the duration of the backoff the
client should take before attempting creating a profile again. The backoff
duration is returned in google.rpc.RetryInfo extension on the response
status. To a gRPC client, the extension will be return as a
binary-serialized proto in the trailing metadata item named
"google.rpc.retryinfo-bin".

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `CreateProfileRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
CreateProfileRequest request = new CreateProfileRequest
{
    Deployment = new Deployment(),
    ProfileType =
    {
        ProfileType.Unspecified,
    },
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Profile response = await profilerServiceClient.CreateProfileAsync(request);
```

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt#Google_Cloud_Profiler_V2_ProfilerServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt#Google_Cloud_Profiler_V2_ProfilerServiceClient_CreateAsync_System_Threading_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()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt#Google_Cloud_Profiler_V2_ProfilerServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Profiler.V2/latest/Google.Cloud.Profiler.V2.ProfilerServiceClient.md.txt#Google_Cloud_Profiler_V2_ProfilerServiceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### UpdateProfile(Profile, FieldMask, CallSettings)

    public virtual Profile UpdateProfile(Profile profile, FieldMask updateMask, CallSettings callSettings = null)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `profile` | `Profile` Profile to update. |
| `updateMask` | `FieldMask` Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in the mask. When no mask is provided, all fields are overwritten. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = profilerServiceClient.UpdateProfile(profile, updateMask);
```

### UpdateProfile(UpdateProfileRequest, CallSettings)

    public virtual Profile UpdateProfile(UpdateProfileRequest request, CallSettings callSettings = null)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `UpdateProfileRequest` 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** |
| `Profile` | The RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = profilerServiceClient.UpdateProfile(request);
```

### UpdateProfileAsync(Profile, FieldMask, CallSettings)

    public virtual Task<Profile> UpdateProfileAsync(Profile profile, FieldMask updateMask, CallSettings callSettings = null)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `profile` | `Profile` Profile to update. |
| `updateMask` | `FieldMask` Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in the mask. When no mask is provided, all fields are overwritten. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(profile, updateMask);
```

### UpdateProfileAsync(Profile, FieldMask, CancellationToken)

    public virtual Task<Profile> UpdateProfileAsync(Profile profile, FieldMask updateMask, CancellationToken cancellationToken)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `profile` | `Profile` Profile to update. |
| `updateMask` | `FieldMask` Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in the mask. When no mask is provided, all fields are overwritten. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
Profile profile = new Profile();
FieldMask updateMask = new FieldMask();
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(profile, updateMask);
```

### UpdateProfileAsync(UpdateProfileRequest, CallSettings)

    public virtual Task<Profile> UpdateProfileAsync(UpdateProfileRequest request, CallSettings callSettings = null)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `UpdateProfileRequest` 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** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(request);
```

### UpdateProfileAsync(UpdateProfileRequest, CancellationToken)

    public virtual Task<Profile> UpdateProfileAsync(UpdateProfileRequest request, CancellationToken cancellationToken)

UpdateProfile updates the profile bytes and labels on the profile resource
created in the online mode. Updating the bytes for profiles created in the
offline mode is currently not supported: the profile content must be
provided at the time of the profile creation.

*Direct use of this API is discouraged, please use a [supported
profiler
agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
instead for profile collection.*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `UpdateProfileRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskProfile` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateProfileRequest request = new UpdateProfileRequest
{
    Profile = new Profile(),
    UpdateMask = new FieldMask(),
};
// Make the request
Profile response = await profilerServiceClient.UpdateProfileAsync(request);
```