google-cloud-profiler-v2 0.3.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/cloud/profiler/v2/export_service/client.rb +419 -0
- data/lib/google/cloud/profiler/v2/export_service/credentials.rb +53 -0
- data/lib/google/cloud/profiler/v2/export_service/paths.rb +47 -0
- data/lib/google/cloud/profiler/v2/export_service/rest/client.rb +383 -0
- data/lib/google/cloud/profiler/v2/export_service/rest/service_stub.rb +107 -0
- data/lib/google/cloud/profiler/v2/export_service/rest.rb +53 -0
- data/lib/google/cloud/profiler/v2/export_service.rb +56 -0
- data/lib/google/cloud/profiler/v2/profiler_service/client.rb +21 -8
- data/lib/google/cloud/profiler/v2/profiler_service/paths.rb +64 -0
- data/lib/google/cloud/profiler/v2/profiler_service/rest/client.rb +576 -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 +57 -0
- data/lib/google/cloud/profiler/v2/profiler_service.rb +8 -1
- data/lib/google/cloud/profiler/v2/rest.rb +38 -0
- data/lib/google/cloud/profiler/v2/version.rb +1 -1
- data/lib/google/cloud/profiler/v2.rb +8 -2
- data/lib/google/devtools/cloudprofiler/v2/profiler_pb.rb +31 -38
- data/lib/google/devtools/cloudprofiler/v2/profiler_services_pb.rb +19 -0
- data/proto_docs/google/api/client.rb +394 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/devtools/cloudprofiler/v2/profiler.rb +48 -7
- metadata +23 -8
@@ -0,0 +1,383 @@
|
|
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/export_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Profiler
|
26
|
+
module V2
|
27
|
+
module ExportService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the ExportService service.
|
31
|
+
#
|
32
|
+
# Service allows existing Cloud Profiler customers to export their profile data
|
33
|
+
# out of Google Cloud.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :export_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the ExportService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Profiler::V2::ExportService::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all ExportService clients
|
50
|
+
# ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "Profiler", "V2"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config.timeout = 130.0
|
71
|
+
default_config.retry_policy = {
|
72
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the ExportService Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {::Google::Cloud::Profiler::V2::ExportService::Rest::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Create a new ExportService REST client object.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
#
|
106
|
+
# # Create a client using the default configuration
|
107
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.new
|
108
|
+
#
|
109
|
+
# # Create a client using a custom configuration
|
110
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.new do |config|
|
111
|
+
# config.timeout = 10.0
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @yield [config] Configure the ExportService client.
|
115
|
+
# @yieldparam config [Client::Configuration]
|
116
|
+
#
|
117
|
+
def initialize
|
118
|
+
# Create the configuration object
|
119
|
+
@config = Configuration.new Client.configure
|
120
|
+
|
121
|
+
# Yield the configuration if needed
|
122
|
+
yield @config if block_given?
|
123
|
+
|
124
|
+
# Create credentials
|
125
|
+
credentials = @config.credentials
|
126
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
127
|
+
# but only if the default endpoint does not have a region prefix.
|
128
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
129
|
+
!@config.endpoint.split(".").first.include?("-")
|
130
|
+
credentials ||= Credentials.default scope: @config.scope,
|
131
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
132
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
133
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
134
|
+
end
|
135
|
+
|
136
|
+
@quota_project_id = @config.quota_project
|
137
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
138
|
+
|
139
|
+
@export_service_stub = ::Google::Cloud::Profiler::V2::ExportService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
140
|
+
end
|
141
|
+
|
142
|
+
# Service calls
|
143
|
+
|
144
|
+
##
|
145
|
+
# Lists profiles which have been collected so far and for which the caller
|
146
|
+
# has permission to view.
|
147
|
+
#
|
148
|
+
# @overload list_profiles(request, options = nil)
|
149
|
+
# Pass arguments to `list_profiles` via a request object, either of type
|
150
|
+
# {::Google::Cloud::Profiler::V2::ListProfilesRequest} or an equivalent Hash.
|
151
|
+
#
|
152
|
+
# @param request [::Google::Cloud::Profiler::V2::ListProfilesRequest, ::Hash]
|
153
|
+
# A request object representing the call parameters. Required. To specify no
|
154
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
155
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
156
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
157
|
+
#
|
158
|
+
# @overload list_profiles(parent: nil, page_size: nil, page_token: nil)
|
159
|
+
# Pass arguments to `list_profiles` via keyword arguments. Note that at
|
160
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
161
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
162
|
+
#
|
163
|
+
# @param parent [::String]
|
164
|
+
# Required. The parent, which owns this collection of profiles.
|
165
|
+
# Format: projects/\\{user_project_id}
|
166
|
+
# @param page_size [::Integer]
|
167
|
+
# The maximum number of items to return.
|
168
|
+
# Default page_size is 1000.
|
169
|
+
# Max limit is 10000.
|
170
|
+
# @param page_token [::String]
|
171
|
+
# The token to continue pagination and get profiles from a particular page.
|
172
|
+
# When paginating, all other parameters provided to `ListProfiles` must match
|
173
|
+
# the call that provided the page token.
|
174
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
175
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Profiler::V2::Profile>]
|
176
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
177
|
+
#
|
178
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Profiler::V2::Profile>]
|
179
|
+
#
|
180
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
181
|
+
#
|
182
|
+
# @example Basic example
|
183
|
+
# require "google/cloud/profiler/v2"
|
184
|
+
#
|
185
|
+
# # Create a client object. The client can be reused for multiple calls.
|
186
|
+
# client = Google::Cloud::Profiler::V2::ExportService::Rest::Client.new
|
187
|
+
#
|
188
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
189
|
+
# request = Google::Cloud::Profiler::V2::ListProfilesRequest.new
|
190
|
+
#
|
191
|
+
# # Call the list_profiles method.
|
192
|
+
# result = client.list_profiles request
|
193
|
+
#
|
194
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
195
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
196
|
+
# result.each do |item|
|
197
|
+
# # Each element is of type ::Google::Cloud::Profiler::V2::Profile.
|
198
|
+
# p item
|
199
|
+
# end
|
200
|
+
#
|
201
|
+
def list_profiles request, options = nil
|
202
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
203
|
+
|
204
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::ListProfilesRequest
|
205
|
+
|
206
|
+
# Converts hash and nil to an options object
|
207
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
208
|
+
|
209
|
+
# Customize the options with defaults
|
210
|
+
call_metadata = @config.rpcs.list_profiles.metadata.to_h
|
211
|
+
|
212
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
213
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
214
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
215
|
+
gapic_version: ::Google::Cloud::Profiler::V2::VERSION,
|
216
|
+
transports_version_send: [:rest]
|
217
|
+
|
218
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
219
|
+
|
220
|
+
options.apply_defaults timeout: @config.rpcs.list_profiles.timeout,
|
221
|
+
metadata: call_metadata,
|
222
|
+
retry_policy: @config.rpcs.list_profiles.retry_policy
|
223
|
+
|
224
|
+
options.apply_defaults timeout: @config.timeout,
|
225
|
+
metadata: @config.metadata,
|
226
|
+
retry_policy: @config.retry_policy
|
227
|
+
|
228
|
+
@export_service_stub.list_profiles request, options do |result, operation|
|
229
|
+
result = ::Gapic::Rest::PagedEnumerable.new @export_service_stub, :list_profiles, "profiles", request, result, options
|
230
|
+
yield result, operation if block_given?
|
231
|
+
return result
|
232
|
+
end
|
233
|
+
rescue ::Gapic::Rest::Error => e
|
234
|
+
raise ::Google::Cloud::Error.from_error(e)
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Configuration class for the ExportService REST API.
|
239
|
+
#
|
240
|
+
# This class represents the configuration for ExportService REST,
|
241
|
+
# providing control over timeouts, retry behavior, logging, transport
|
242
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
243
|
+
# applied individually to specific RPCs. See
|
244
|
+
# {::Google::Cloud::Profiler::V2::ExportService::Rest::Client::Configuration::Rpcs}
|
245
|
+
# for a list of RPCs that can be configured independently.
|
246
|
+
#
|
247
|
+
# Configuration can be applied globally to all clients, or to a single client
|
248
|
+
# on construction.
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
#
|
252
|
+
# # Modify the global config, setting the timeout for
|
253
|
+
# # list_profiles to 20 seconds,
|
254
|
+
# # and all remaining timeouts to 10 seconds.
|
255
|
+
# ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.configure do |config|
|
256
|
+
# config.timeout = 10.0
|
257
|
+
# config.rpcs.list_profiles.timeout = 20.0
|
258
|
+
# end
|
259
|
+
#
|
260
|
+
# # Apply the above configuration only to a new client.
|
261
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.new do |config|
|
262
|
+
# config.timeout = 10.0
|
263
|
+
# config.rpcs.list_profiles.timeout = 20.0
|
264
|
+
# end
|
265
|
+
#
|
266
|
+
# @!attribute [rw] endpoint
|
267
|
+
# The hostname or hostname:port of the service endpoint.
|
268
|
+
# Defaults to `"cloudprofiler.googleapis.com"`.
|
269
|
+
# @return [::String]
|
270
|
+
# @!attribute [rw] credentials
|
271
|
+
# Credentials to send with calls. You may provide any of the following types:
|
272
|
+
# * (`String`) The path to a service account key file in JSON format
|
273
|
+
# * (`Hash`) A service account key as a Hash
|
274
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
275
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
276
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
277
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
278
|
+
# * (`nil`) indicating no credentials
|
279
|
+
# @return [::Object]
|
280
|
+
# @!attribute [rw] scope
|
281
|
+
# The OAuth scopes
|
282
|
+
# @return [::Array<::String>]
|
283
|
+
# @!attribute [rw] lib_name
|
284
|
+
# The library name as recorded in instrumentation and logging
|
285
|
+
# @return [::String]
|
286
|
+
# @!attribute [rw] lib_version
|
287
|
+
# The library version as recorded in instrumentation and logging
|
288
|
+
# @return [::String]
|
289
|
+
# @!attribute [rw] timeout
|
290
|
+
# The call timeout in seconds.
|
291
|
+
# @return [::Numeric]
|
292
|
+
# @!attribute [rw] metadata
|
293
|
+
# Additional headers to be sent with the call.
|
294
|
+
# @return [::Hash{::Symbol=>::String}]
|
295
|
+
# @!attribute [rw] retry_policy
|
296
|
+
# The retry policy. The value is a hash with the following keys:
|
297
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
298
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
299
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
300
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
301
|
+
# trigger a retry.
|
302
|
+
# @return [::Hash]
|
303
|
+
# @!attribute [rw] quota_project
|
304
|
+
# A separate project against which to charge quota.
|
305
|
+
# @return [::String]
|
306
|
+
#
|
307
|
+
class Configuration
|
308
|
+
extend ::Gapic::Config
|
309
|
+
|
310
|
+
DEFAULT_ENDPOINT = "cloudprofiler.googleapis.com"
|
311
|
+
|
312
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
313
|
+
config_attr :credentials, nil do |value|
|
314
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
315
|
+
allowed.any? { |klass| klass === value }
|
316
|
+
end
|
317
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
318
|
+
config_attr :lib_name, nil, ::String, nil
|
319
|
+
config_attr :lib_version, nil, ::String, nil
|
320
|
+
config_attr :timeout, nil, ::Numeric, nil
|
321
|
+
config_attr :metadata, nil, ::Hash, nil
|
322
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
323
|
+
config_attr :quota_project, nil, ::String, nil
|
324
|
+
|
325
|
+
# @private
|
326
|
+
def initialize parent_config = nil
|
327
|
+
@parent_config = parent_config unless parent_config.nil?
|
328
|
+
|
329
|
+
yield self if block_given?
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# Configurations for individual RPCs
|
334
|
+
# @return [Rpcs]
|
335
|
+
#
|
336
|
+
def rpcs
|
337
|
+
@rpcs ||= begin
|
338
|
+
parent_rpcs = nil
|
339
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
340
|
+
Rpcs.new parent_rpcs
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
##
|
345
|
+
# Configuration RPC class for the ExportService API.
|
346
|
+
#
|
347
|
+
# Includes fields providing the configuration for each RPC in this service.
|
348
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
349
|
+
# the following configuration fields:
|
350
|
+
#
|
351
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
352
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
353
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
354
|
+
# include the following keys:
|
355
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
356
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
357
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
358
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
359
|
+
# trigger a retry.
|
360
|
+
#
|
361
|
+
class Rpcs
|
362
|
+
##
|
363
|
+
# RPC-specific configuration for `list_profiles`
|
364
|
+
# @return [::Gapic::Config::Method]
|
365
|
+
#
|
366
|
+
attr_reader :list_profiles
|
367
|
+
|
368
|
+
# @private
|
369
|
+
def initialize parent_rpcs = nil
|
370
|
+
list_profiles_config = parent_rpcs.list_profiles if parent_rpcs.respond_to? :list_profiles
|
371
|
+
@list_profiles = ::Gapic::Config::Method.new list_profiles_config
|
372
|
+
|
373
|
+
yield self if block_given?
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
@@ -0,0 +1,107 @@
|
|
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/devtools/cloudprofiler/v2/profiler_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Profiler
|
24
|
+
module V2
|
25
|
+
module ExportService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the ExportService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the list_profiles REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::Profiler::V2::ListProfilesRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::Profiler::V2::ListProfilesResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::Profiler::V2::ListProfilesResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def list_profiles request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_list_profiles_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::Profiler::V2::ListProfilesResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# @private
|
83
|
+
#
|
84
|
+
# GRPC transcoding helper method for the list_profiles REST call
|
85
|
+
#
|
86
|
+
# @param request_pb [::Google::Cloud::Profiler::V2::ListProfilesRequest]
|
87
|
+
# A request object representing the call parameters. Required.
|
88
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
89
|
+
# Uri, Body, Query string parameters
|
90
|
+
def self.transcode_list_profiles_request request_pb
|
91
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
92
|
+
.with_bindings(
|
93
|
+
uri_method: :get,
|
94
|
+
uri_template: "/v2/{parent}/profiles",
|
95
|
+
matches: [
|
96
|
+
["parent", %r{^projects/[^/]+/?$}, false]
|
97
|
+
]
|
98
|
+
)
|
99
|
+
transcoder.transcode request_pb
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,53 @@
|
|
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 "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/profiler/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/profiler/v2/export_service/credentials"
|
26
|
+
require "google/cloud/profiler/v2/export_service/paths"
|
27
|
+
require "google/cloud/profiler/v2/export_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Profiler
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Service allows existing Cloud Profiler customers to export their profile data
|
35
|
+
# out of Google Cloud.
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a REST client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/profiler/v2/export_service/rest"
|
40
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.new
|
41
|
+
#
|
42
|
+
module ExportService
|
43
|
+
# Client for the REST transport
|
44
|
+
module Rest
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
53
|
+
require "google/cloud/profiler/v2/export_service/rest/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,56 @@
|
|
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 "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/profiler/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/profiler/v2/export_service/credentials"
|
26
|
+
require "google/cloud/profiler/v2/export_service/paths"
|
27
|
+
require "google/cloud/profiler/v2/export_service/client"
|
28
|
+
require "google/cloud/profiler/v2/export_service/rest"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Profiler
|
33
|
+
module V2
|
34
|
+
##
|
35
|
+
# Service allows existing Cloud Profiler customers to export their profile data
|
36
|
+
# out of Google Cloud.
|
37
|
+
#
|
38
|
+
# @example Load this service and instantiate a gRPC client
|
39
|
+
#
|
40
|
+
# require "google/cloud/profiler/v2/export_service"
|
41
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Client.new
|
42
|
+
#
|
43
|
+
# @example Load this service and instantiate a REST client
|
44
|
+
#
|
45
|
+
# require "google/cloud/profiler/v2/export_service/rest"
|
46
|
+
# client = ::Google::Cloud::Profiler::V2::ExportService::Rest::Client.new
|
47
|
+
#
|
48
|
+
module ExportService
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
helper_path = ::File.join __dir__, "export_service", "helpers.rb"
|
56
|
+
require "google/cloud/profiler/v2/export_service/helpers" if ::File.file? helper_path
|