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