google-cloud-profiler-v2 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/profiler/v2/profiler_service/rest/client.rb +524 -0
- data/lib/google/cloud/profiler/v2/profiler_service/rest/service_stub.rb +228 -0
- data/lib/google/cloud/profiler/v2/profiler_service/rest.rb +56 -0
- data/lib/google/cloud/profiler/v2/profiler_service.rb +7 -1
- data/lib/google/cloud/profiler/v2/rest.rb +37 -0
- data/lib/google/cloud/profiler/v2/version.rb +1 -1
- data/lib/google/cloud/profiler/v2.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716fb3f3f491283d7ba21a56eb7a3d18df375df341652532bbb1565b09a6496e
|
4
|
+
data.tar.gz: dc677f58ec3c3c8786bc462e3fb76cf43b6009d25c71382f8c8004ea469ca71e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753cdc171cf5660bcebfa7978464bbcf23468fea579b8ee9b78fe5be6df1179a6a2491bbabb69d07c82f18b4292ea2ad8ac2c5a79d57e85fd3385975bbf66f4c
|
7
|
+
data.tar.gz: dd53a4f1b9592b414f8216d54105406db51690a31c4d045c30047c4c9d2c4fdb1752f98b51b81b2771bee9caaa7d77411039b6e38b6624a39de2d1a9cc62bc2b
|
data/AUTHENTICATION.md
CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
114
114
|
To configure your system for this, simply:
|
115
115
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
118
118
|
3. Write code as if already authenticated.
|
119
119
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the Cloud Profiler V2 API
|
2
2
|
|
3
|
-
|
3
|
+
Manages continuous profiling information.
|
4
4
|
|
5
5
|
Cloud Profiler is a statistical, low-overhead profiler that continuously gathers CPU usage and memory-allocation information from your production applications. It attributes that information to the application's source code, helping you identify the parts of the application consuming the most resources, and otherwise illuminating the performance characteristics of the code.
|
6
6
|
|
@@ -46,7 +46,7 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
@@ -0,0 +1,524 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/devtools/cloudprofiler/v2/profiler_pb"
|
21
|
+
require "google/cloud/profiler/v2/profiler_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Profiler
|
26
|
+
module V2
|
27
|
+
module ProfilerService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the ProfilerService service.
|
31
|
+
#
|
32
|
+
# Manage the collection of continuous profiling data provided by profiling
|
33
|
+
# agents running in the cloud or by an offline provider of profiling data.
|
34
|
+
#
|
35
|
+
# General guidelines:
|
36
|
+
# * Profiles for a single deployment must be created in ascending time order.
|
37
|
+
# * Profiles can be created in either online or offline mode, see below.
|
38
|
+
#
|
39
|
+
class Client
|
40
|
+
# @private
|
41
|
+
attr_reader :profiler_service_stub
|
42
|
+
|
43
|
+
##
|
44
|
+
# Configure the ProfilerService Client class.
|
45
|
+
#
|
46
|
+
# See {::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client::Configuration}
|
47
|
+
# for a description of the configuration fields.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
#
|
51
|
+
# # Modify the configuration for all ProfilerService clients
|
52
|
+
# ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.configure do |config|
|
53
|
+
# config.timeout = 10.0
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# @yield [config] Configure the Client client.
|
57
|
+
# @yieldparam config [Client::Configuration]
|
58
|
+
#
|
59
|
+
# @return [Client::Configuration]
|
60
|
+
#
|
61
|
+
def self.configure
|
62
|
+
@configure ||= begin
|
63
|
+
namespace = ["Google", "Cloud", "Profiler", "V2"]
|
64
|
+
parent_config = while namespace.any?
|
65
|
+
parent_name = namespace.join "::"
|
66
|
+
parent_const = const_get parent_name
|
67
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
68
|
+
namespace.pop
|
69
|
+
end
|
70
|
+
default_config = Client::Configuration.new parent_config
|
71
|
+
|
72
|
+
default_config.timeout = 30.0
|
73
|
+
default_config.retry_policy = {
|
74
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
75
|
+
}
|
76
|
+
|
77
|
+
default_config.rpcs.create_profile.timeout = 3600.0
|
78
|
+
|
79
|
+
default_config.rpcs.create_offline_profile.timeout = 30.0
|
80
|
+
|
81
|
+
default_config.rpcs.update_profile.timeout = 30.0
|
82
|
+
|
83
|
+
default_config
|
84
|
+
end
|
85
|
+
yield @configure if block_given?
|
86
|
+
@configure
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# Configure the ProfilerService Client instance.
|
91
|
+
#
|
92
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
93
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
94
|
+
# should be made on {Client.configure}.
|
95
|
+
#
|
96
|
+
# See {::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client::Configuration}
|
97
|
+
# for a description of the configuration fields.
|
98
|
+
#
|
99
|
+
# @yield [config] Configure the Client client.
|
100
|
+
# @yieldparam config [Client::Configuration]
|
101
|
+
#
|
102
|
+
# @return [Client::Configuration]
|
103
|
+
#
|
104
|
+
def configure
|
105
|
+
yield @config if block_given?
|
106
|
+
@config
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Create a new ProfilerService REST client object.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
#
|
114
|
+
# # Create a client using the default configuration
|
115
|
+
# client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new
|
116
|
+
#
|
117
|
+
# # Create a client using a custom configuration
|
118
|
+
# client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new do |config|
|
119
|
+
# config.timeout = 10.0
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# @yield [config] Configure the ProfilerService client.
|
123
|
+
# @yieldparam config [Client::Configuration]
|
124
|
+
#
|
125
|
+
def initialize
|
126
|
+
# Create the configuration object
|
127
|
+
@config = Configuration.new Client.configure
|
128
|
+
|
129
|
+
# Yield the configuration if needed
|
130
|
+
yield @config if block_given?
|
131
|
+
|
132
|
+
# Create credentials
|
133
|
+
credentials = @config.credentials
|
134
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
135
|
+
# but only if the default endpoint does not have a region prefix.
|
136
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
137
|
+
!@config.endpoint.split(".").first.include?("-")
|
138
|
+
credentials ||= Credentials.default scope: @config.scope,
|
139
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
140
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
141
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
142
|
+
end
|
143
|
+
|
144
|
+
@quota_project_id = @config.quota_project
|
145
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
146
|
+
|
147
|
+
@profiler_service_stub = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
148
|
+
end
|
149
|
+
|
150
|
+
# Service calls
|
151
|
+
|
152
|
+
##
|
153
|
+
# CreateProfile creates a new profile resource in the online mode.
|
154
|
+
#
|
155
|
+
# The server ensures that the new profiles are created at a constant rate per
|
156
|
+
# deployment, so the creation request may hang for some time until the next
|
157
|
+
# profile session is available.
|
158
|
+
#
|
159
|
+
# The request may fail with ABORTED error if the creation is not available
|
160
|
+
# within ~1m, the response will indicate the duration of the backoff the
|
161
|
+
# client should take before attempting creating a profile again. The backoff
|
162
|
+
# duration is returned in google.rpc.RetryInfo extension on the response
|
163
|
+
# status. To a gRPC client, the extension will be return as a
|
164
|
+
# binary-serialized proto in the trailing metadata item named
|
165
|
+
# "google.rpc.retryinfo-bin".
|
166
|
+
#
|
167
|
+
# @overload create_profile(request, options = nil)
|
168
|
+
# Pass arguments to `create_profile` via a request object, either of type
|
169
|
+
# {::Google::Cloud::Profiler::V2::CreateProfileRequest} or an equivalent Hash.
|
170
|
+
#
|
171
|
+
# @param request [::Google::Cloud::Profiler::V2::CreateProfileRequest, ::Hash]
|
172
|
+
# A request object representing the call parameters. Required. To specify no
|
173
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
174
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
175
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
176
|
+
#
|
177
|
+
# @overload create_profile(parent: nil, deployment: nil, profile_type: nil)
|
178
|
+
# Pass arguments to `create_profile` via keyword arguments. Note that at
|
179
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
180
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
181
|
+
#
|
182
|
+
# @param parent [::String]
|
183
|
+
# Parent project to create the profile in.
|
184
|
+
# @param deployment [::Google::Cloud::Profiler::V2::Deployment, ::Hash]
|
185
|
+
# Deployment details.
|
186
|
+
# @param profile_type [::Array<::Google::Cloud::Profiler::V2::ProfileType>]
|
187
|
+
# One or more profile types that the agent is capable of providing.
|
188
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
189
|
+
# @yieldparam result [::Google::Cloud::Profiler::V2::Profile]
|
190
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
191
|
+
#
|
192
|
+
# @return [::Google::Cloud::Profiler::V2::Profile]
|
193
|
+
#
|
194
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
195
|
+
def create_profile request, options = nil
|
196
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
197
|
+
|
198
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::CreateProfileRequest
|
199
|
+
|
200
|
+
# Converts hash and nil to an options object
|
201
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
202
|
+
|
203
|
+
# Customize the options with defaults
|
204
|
+
call_metadata = @config.rpcs.create_profile.metadata.to_h
|
205
|
+
|
206
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
207
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
208
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
209
|
+
gapic_version: ::Google::Cloud::Profiler::V2::VERSION,
|
210
|
+
transports_version_send: [:rest]
|
211
|
+
|
212
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
213
|
+
|
214
|
+
options.apply_defaults timeout: @config.rpcs.create_profile.timeout,
|
215
|
+
metadata: call_metadata,
|
216
|
+
retry_policy: @config.rpcs.create_profile.retry_policy
|
217
|
+
|
218
|
+
options.apply_defaults timeout: @config.timeout,
|
219
|
+
metadata: @config.metadata,
|
220
|
+
retry_policy: @config.retry_policy
|
221
|
+
|
222
|
+
@profiler_service_stub.create_profile request, options do |result, operation|
|
223
|
+
yield result, operation if block_given?
|
224
|
+
return result
|
225
|
+
end
|
226
|
+
rescue ::Gapic::Rest::Error => e
|
227
|
+
raise ::Google::Cloud::Error.from_error(e)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# CreateOfflineProfile creates a new profile resource in the offline mode.
|
232
|
+
# The client provides the profile to create along with the profile bytes, the
|
233
|
+
# server records it.
|
234
|
+
#
|
235
|
+
# @overload create_offline_profile(request, options = nil)
|
236
|
+
# Pass arguments to `create_offline_profile` via a request object, either of type
|
237
|
+
# {::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest} or an equivalent Hash.
|
238
|
+
#
|
239
|
+
# @param request [::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest, ::Hash]
|
240
|
+
# A request object representing the call parameters. Required. To specify no
|
241
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
242
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
243
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
244
|
+
#
|
245
|
+
# @overload create_offline_profile(parent: nil, profile: nil)
|
246
|
+
# Pass arguments to `create_offline_profile` via keyword arguments. Note that at
|
247
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
248
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
249
|
+
#
|
250
|
+
# @param parent [::String]
|
251
|
+
# Parent project to create the profile in.
|
252
|
+
# @param profile [::Google::Cloud::Profiler::V2::Profile, ::Hash]
|
253
|
+
# Contents of the profile to create.
|
254
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
255
|
+
# @yieldparam result [::Google::Cloud::Profiler::V2::Profile]
|
256
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
257
|
+
#
|
258
|
+
# @return [::Google::Cloud::Profiler::V2::Profile]
|
259
|
+
#
|
260
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
261
|
+
def create_offline_profile request, options = nil
|
262
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
263
|
+
|
264
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::CreateOfflineProfileRequest
|
265
|
+
|
266
|
+
# Converts hash and nil to an options object
|
267
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
268
|
+
|
269
|
+
# Customize the options with defaults
|
270
|
+
call_metadata = @config.rpcs.create_offline_profile.metadata.to_h
|
271
|
+
|
272
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
273
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
274
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
275
|
+
gapic_version: ::Google::Cloud::Profiler::V2::VERSION,
|
276
|
+
transports_version_send: [:rest]
|
277
|
+
|
278
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
279
|
+
|
280
|
+
options.apply_defaults timeout: @config.rpcs.create_offline_profile.timeout,
|
281
|
+
metadata: call_metadata,
|
282
|
+
retry_policy: @config.rpcs.create_offline_profile.retry_policy
|
283
|
+
|
284
|
+
options.apply_defaults timeout: @config.timeout,
|
285
|
+
metadata: @config.metadata,
|
286
|
+
retry_policy: @config.retry_policy
|
287
|
+
|
288
|
+
@profiler_service_stub.create_offline_profile request, options do |result, operation|
|
289
|
+
yield result, operation if block_given?
|
290
|
+
return result
|
291
|
+
end
|
292
|
+
rescue ::Gapic::Rest::Error => e
|
293
|
+
raise ::Google::Cloud::Error.from_error(e)
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# UpdateProfile updates the profile bytes and labels on the profile resource
|
298
|
+
# created in the online mode. Updating the bytes for profiles created in the
|
299
|
+
# offline mode is currently not supported: the profile content must be
|
300
|
+
# provided at the time of the profile creation.
|
301
|
+
#
|
302
|
+
# @overload update_profile(request, options = nil)
|
303
|
+
# Pass arguments to `update_profile` via a request object, either of type
|
304
|
+
# {::Google::Cloud::Profiler::V2::UpdateProfileRequest} or an equivalent Hash.
|
305
|
+
#
|
306
|
+
# @param request [::Google::Cloud::Profiler::V2::UpdateProfileRequest, ::Hash]
|
307
|
+
# A request object representing the call parameters. Required. To specify no
|
308
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
309
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
310
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
311
|
+
#
|
312
|
+
# @overload update_profile(profile: nil, update_mask: nil)
|
313
|
+
# Pass arguments to `update_profile` via keyword arguments. Note that at
|
314
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
315
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
316
|
+
#
|
317
|
+
# @param profile [::Google::Cloud::Profiler::V2::Profile, ::Hash]
|
318
|
+
# Profile to update
|
319
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
320
|
+
# Field mask used to specify the fields to be overwritten. Currently only
|
321
|
+
# profile_bytes and labels fields are supported by UpdateProfile, so only
|
322
|
+
# those fields can be specified in the mask. When no mask is provided, all
|
323
|
+
# fields are overwritten.
|
324
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
325
|
+
# @yieldparam result [::Google::Cloud::Profiler::V2::Profile]
|
326
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
327
|
+
#
|
328
|
+
# @return [::Google::Cloud::Profiler::V2::Profile]
|
329
|
+
#
|
330
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
331
|
+
def update_profile request, options = nil
|
332
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
333
|
+
|
334
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::UpdateProfileRequest
|
335
|
+
|
336
|
+
# Converts hash and nil to an options object
|
337
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
338
|
+
|
339
|
+
# Customize the options with defaults
|
340
|
+
call_metadata = @config.rpcs.update_profile.metadata.to_h
|
341
|
+
|
342
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
343
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
344
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
345
|
+
gapic_version: ::Google::Cloud::Profiler::V2::VERSION,
|
346
|
+
transports_version_send: [:rest]
|
347
|
+
|
348
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
349
|
+
|
350
|
+
options.apply_defaults timeout: @config.rpcs.update_profile.timeout,
|
351
|
+
metadata: call_metadata,
|
352
|
+
retry_policy: @config.rpcs.update_profile.retry_policy
|
353
|
+
|
354
|
+
options.apply_defaults timeout: @config.timeout,
|
355
|
+
metadata: @config.metadata,
|
356
|
+
retry_policy: @config.retry_policy
|
357
|
+
|
358
|
+
@profiler_service_stub.update_profile request, options do |result, operation|
|
359
|
+
yield result, operation if block_given?
|
360
|
+
return result
|
361
|
+
end
|
362
|
+
rescue ::Gapic::Rest::Error => e
|
363
|
+
raise ::Google::Cloud::Error.from_error(e)
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# Configuration class for the ProfilerService REST API.
|
368
|
+
#
|
369
|
+
# This class represents the configuration for ProfilerService REST,
|
370
|
+
# providing control over timeouts, retry behavior, logging, transport
|
371
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
372
|
+
# applied individually to specific RPCs. See
|
373
|
+
# {::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client::Configuration::Rpcs}
|
374
|
+
# for a list of RPCs that can be configured independently.
|
375
|
+
#
|
376
|
+
# Configuration can be applied globally to all clients, or to a single client
|
377
|
+
# on construction.
|
378
|
+
#
|
379
|
+
# @example
|
380
|
+
#
|
381
|
+
# # Modify the global config, setting the timeout for
|
382
|
+
# # create_profile to 20 seconds,
|
383
|
+
# # and all remaining timeouts to 10 seconds.
|
384
|
+
# ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.configure do |config|
|
385
|
+
# config.timeout = 10.0
|
386
|
+
# config.rpcs.create_profile.timeout = 20.0
|
387
|
+
# end
|
388
|
+
#
|
389
|
+
# # Apply the above configuration only to a new client.
|
390
|
+
# client = ::Google::Cloud::Profiler::V2::ProfilerService::Rest::Client.new do |config|
|
391
|
+
# config.timeout = 10.0
|
392
|
+
# config.rpcs.create_profile.timeout = 20.0
|
393
|
+
# end
|
394
|
+
#
|
395
|
+
# @!attribute [rw] endpoint
|
396
|
+
# The hostname or hostname:port of the service endpoint.
|
397
|
+
# Defaults to `"cloudprofiler.googleapis.com"`.
|
398
|
+
# @return [::String]
|
399
|
+
# @!attribute [rw] credentials
|
400
|
+
# Credentials to send with calls. You may provide any of the following types:
|
401
|
+
# * (`String`) The path to a service account key file in JSON format
|
402
|
+
# * (`Hash`) A service account key as a Hash
|
403
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
404
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
405
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
406
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
407
|
+
# * (`nil`) indicating no credentials
|
408
|
+
# @return [::Object]
|
409
|
+
# @!attribute [rw] scope
|
410
|
+
# The OAuth scopes
|
411
|
+
# @return [::Array<::String>]
|
412
|
+
# @!attribute [rw] lib_name
|
413
|
+
# The library name as recorded in instrumentation and logging
|
414
|
+
# @return [::String]
|
415
|
+
# @!attribute [rw] lib_version
|
416
|
+
# The library version as recorded in instrumentation and logging
|
417
|
+
# @return [::String]
|
418
|
+
# @!attribute [rw] timeout
|
419
|
+
# The call timeout in seconds.
|
420
|
+
# @return [::Numeric]
|
421
|
+
# @!attribute [rw] metadata
|
422
|
+
# Additional headers to be sent with the call.
|
423
|
+
# @return [::Hash{::Symbol=>::String}]
|
424
|
+
# @!attribute [rw] retry_policy
|
425
|
+
# The retry policy. The value is a hash with the following keys:
|
426
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
427
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
428
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
429
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
430
|
+
# trigger a retry.
|
431
|
+
# @return [::Hash]
|
432
|
+
# @!attribute [rw] quota_project
|
433
|
+
# A separate project against which to charge quota.
|
434
|
+
# @return [::String]
|
435
|
+
#
|
436
|
+
class Configuration
|
437
|
+
extend ::Gapic::Config
|
438
|
+
|
439
|
+
config_attr :endpoint, "cloudprofiler.googleapis.com", ::String
|
440
|
+
config_attr :credentials, nil do |value|
|
441
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
442
|
+
allowed.any? { |klass| klass === value }
|
443
|
+
end
|
444
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
445
|
+
config_attr :lib_name, nil, ::String, nil
|
446
|
+
config_attr :lib_version, nil, ::String, nil
|
447
|
+
config_attr :timeout, nil, ::Numeric, nil
|
448
|
+
config_attr :metadata, nil, ::Hash, nil
|
449
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
450
|
+
config_attr :quota_project, nil, ::String, nil
|
451
|
+
|
452
|
+
# @private
|
453
|
+
def initialize parent_config = nil
|
454
|
+
@parent_config = parent_config unless parent_config.nil?
|
455
|
+
|
456
|
+
yield self if block_given?
|
457
|
+
end
|
458
|
+
|
459
|
+
##
|
460
|
+
# Configurations for individual RPCs
|
461
|
+
# @return [Rpcs]
|
462
|
+
#
|
463
|
+
def rpcs
|
464
|
+
@rpcs ||= begin
|
465
|
+
parent_rpcs = nil
|
466
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
467
|
+
Rpcs.new parent_rpcs
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configuration RPC class for the ProfilerService API.
|
473
|
+
#
|
474
|
+
# Includes fields providing the configuration for each RPC in this service.
|
475
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
476
|
+
# the following configuration fields:
|
477
|
+
#
|
478
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
479
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
480
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
481
|
+
# include the following keys:
|
482
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
483
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
484
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
485
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
486
|
+
# trigger a retry.
|
487
|
+
#
|
488
|
+
class Rpcs
|
489
|
+
##
|
490
|
+
# RPC-specific configuration for `create_profile`
|
491
|
+
# @return [::Gapic::Config::Method]
|
492
|
+
#
|
493
|
+
attr_reader :create_profile
|
494
|
+
##
|
495
|
+
# RPC-specific configuration for `create_offline_profile`
|
496
|
+
# @return [::Gapic::Config::Method]
|
497
|
+
#
|
498
|
+
attr_reader :create_offline_profile
|
499
|
+
##
|
500
|
+
# RPC-specific configuration for `update_profile`
|
501
|
+
# @return [::Gapic::Config::Method]
|
502
|
+
#
|
503
|
+
attr_reader :update_profile
|
504
|
+
|
505
|
+
# @private
|
506
|
+
def initialize parent_rpcs = nil
|
507
|
+
create_profile_config = parent_rpcs.create_profile if parent_rpcs.respond_to? :create_profile
|
508
|
+
@create_profile = ::Gapic::Config::Method.new create_profile_config
|
509
|
+
create_offline_profile_config = parent_rpcs.create_offline_profile if parent_rpcs.respond_to? :create_offline_profile
|
510
|
+
@create_offline_profile = ::Gapic::Config::Method.new create_offline_profile_config
|
511
|
+
update_profile_config = parent_rpcs.update_profile if parent_rpcs.respond_to? :update_profile
|
512
|
+
@update_profile = ::Gapic::Config::Method.new update_profile_config
|
513
|
+
|
514
|
+
yield self if block_given?
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|