# Cloud Profiler V2 API - Class Google::Cloud::Profiler::V2::ProfilerService::Rest::Client (v1.7.0)

1.7.0 (latest) 1.6.1 1.5.0 1.4.1 1.3.0 1.2.1 1.1.0 1.0.1 0.10.1 0.9.2 0.8.0 0.7.0 0.6.1 0.5.0 0.4.0 0.3.0 0.2.5 Reference documentation and code samples for the Cloud Profiler V2 API class Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.

REST client for the ProfilerService service.


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

<br />

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

## Inherits

- Object

## Includes

- [Google::Cloud::Profiler::V2::ProfilerService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the ProfilerService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration "Google::Cloud::Profiler::V2::ProfilerService::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all ProfilerService clients
::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.configure do |config|
  config.timeout = 10.0
end
```

### #configure

    def configure() { |config| ... } -> Client::Configuration

Configure the ProfilerService Client instance.


The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on [Client.configure](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client#Google__Cloud__Profiler__V2__ProfilerService__Rest__Client_configure_class_ "Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration "Google::Cloud::Profiler::V2::ProfilerService::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration))

### #create_offline_profile

    def create_offline_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
    def create_offline_profile(parent: nil, profile: nil) -> ::Google::Cloud::Profiler::V2::Profile

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.


<br />

*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.*
**Overloads**

    def create_offline_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `create_offline_profile` via a request object, either of type [CreateOfflineProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-CreateOfflineProfileRequest "Google::Cloud::Profiler::V2::CreateOfflineProfileRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-CreateOfflineProfileRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def create_offline_profile(parent: nil, profile: nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `create_offline_profile` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Parent project to create the profile in.
- **profile** ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile), ::Hash) --- Contents of the profile to create.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::CreateOfflineProfileRequest.new

# Call the create_offline_profile method.
result = client.create_offline_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result
```

### #create_profile

    def create_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
    def create_profile(parent: nil, deployment: nil, profile_type: nil) -> ::Google::Cloud::Profiler::V2::Profile

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.

<br />

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".
**Overloads**

    def create_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `create_profile` via a request object, either of type [CreateProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-CreateProfileRequest "Google::Cloud::Profiler::V2::CreateProfileRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Profiler::V2::CreateProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-CreateProfileRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def create_profile(parent: nil, deployment: nil, profile_type: nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `create_profile` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Parent project to create the profile in.
- **deployment** ([::Google::Cloud::Profiler::V2::Deployment](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Deployment), ::Hash) --- Deployment details.
- **profile_type** (::Array\<[::Google::Cloud::Profiler::V2::ProfileType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfileType)\>) --- One or more profile types that the agent is capable of providing.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::CreateProfileRequest.new

# Call the create_profile method.
result = client.create_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result
```

### #initialize

    def initialize() { |config| ... } -> Client

Create a new ProfilerService REST client object.
**Yields**

- (config) --- Configure the ProfilerService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-ProfilerService-Rest-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new do |config|
  config.timeout = 10.0
end
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

### #update_profile

    def update_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile
    def update_profile(profile: nil, update_mask: nil) -> ::Google::Cloud::Profiler::V2::Profile

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.


<br />

*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.*
**Overloads**

    def update_profile(request, options = nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `update_profile` via a request object, either of type [UpdateProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-UpdateProfileRequest "Google::Cloud::Profiler::V2::UpdateProfileRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Profiler::V2::UpdateProfileRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-UpdateProfileRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def update_profile(profile: nil, update_mask: nil) -> ::Google::Cloud::Profiler::V2::Profile

Pass arguments to `update_profile` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **profile** ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile), ::Hash) --- Profile to update.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Protobuf-FieldMask), ::Hash) --- 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.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::Profiler::V2::Profile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Profile))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/profiler/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Profiler::V2::UpdateProfileRequest.new

# Call the update_profile method.
result = client.update_profile request

# The returned object is of type Google::Cloud::Profiler::V2::Profile.
p result
```