google-cloud-profiler-v2 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 915e5cada2490a046e490973fd899e6a2bb835328587f7d86f06825bc9c03f1c
4
- data.tar.gz: 7fe3037b1bc866a8a6a37ab10bb90fc2e03d59fac1ceb680462f3b2a1d5134b6
3
+ metadata.gz: efdd220cd101cddf7abceed853ec2d3b06d61270a0efc737f9ef648d80fb149c
4
+ data.tar.gz: aa263ad4f17eb38eef30940e11b1caa20e6eb685399f62a2d15ee5032272e765
5
5
  SHA512:
6
- metadata.gz: 27b0174023a9e3297b6139f9d5dcd19d11c545e637b910e3d8067c64c618343ba0bee1759ce791af600398aa17888d8ef7792791e6f8115c4871d59898ca3de7
7
- data.tar.gz: e5a1da610c41c99038a0e321c90e46c706cc21b1375025e88bd365793b308d20e80286a0289fed93659283591c1e073f14ec9ac49f3c49245f0f3e9ae4e39b5a
6
+ metadata.gz: a2b3303a9f00c21b2e4585bfcbcab7744b53376f2abc57d2141ad36451080dea2ca8e07118f4c8f0023472bedc55bf4ca577ac9794f088d274295b9e0ca596bc
7
+ data.tar.gz: 27ca71c9d12361494cc64f5b1d28ded0fb7b7331d1c8ebab427cbe92b6783e44c455893a4f59e01c46ff80d002a4042b3105f910412b019f2c118ca7f530b9b6
@@ -0,0 +1,419 @@
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
+
22
+ module Google
23
+ module Cloud
24
+ module Profiler
25
+ module V2
26
+ module ExportService
27
+ ##
28
+ # Client for the ExportService service.
29
+ #
30
+ # Service allows existing Cloud Profiler customers to export their profile data
31
+ # out of Google Cloud.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :export_service_stub
38
+
39
+ ##
40
+ # Configure the ExportService Client class.
41
+ #
42
+ # See {::Google::Cloud::Profiler::V2::ExportService::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all ExportService clients
48
+ # ::Google::Cloud::Profiler::V2::ExportService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Profiler", "V2"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.timeout = 130.0
69
+ default_config.retry_policy = {
70
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
71
+ }
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the ExportService Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::Profiler::V2::ExportService::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new ExportService client object.
101
+ #
102
+ # @example
103
+ #
104
+ # # Create a client using the default configuration
105
+ # client = ::Google::Cloud::Profiler::V2::ExportService::Client.new
106
+ #
107
+ # # Create a client using a custom configuration
108
+ # client = ::Google::Cloud::Profiler::V2::ExportService::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the ExportService client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
116
+ # These require statements are intentionally placed here to initialize
117
+ # the gRPC module only when it's required.
118
+ # See https://github.com/googleapis/toolkit/issues/446
119
+ require "gapic/grpc"
120
+ require "google/devtools/cloudprofiler/v2/profiler_services_pb"
121
+
122
+ # Create the configuration object
123
+ @config = Configuration.new Client.configure
124
+
125
+ # Yield the configuration if needed
126
+ yield @config if block_given?
127
+
128
+ # Create credentials
129
+ credentials = @config.credentials
130
+ # Use self-signed JWT if the endpoint is unchanged from default,
131
+ # but only if the default endpoint does not have a region prefix.
132
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @export_service_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Profiler::V2::ExportService::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors,
148
+ channel_pool_config: @config.channel_pool
149
+ )
150
+ end
151
+
152
+ # Service calls
153
+
154
+ ##
155
+ # Lists profiles which have been collected so far and for which the caller
156
+ # has permission to view.
157
+ #
158
+ # @overload list_profiles(request, options = nil)
159
+ # Pass arguments to `list_profiles` via a request object, either of type
160
+ # {::Google::Cloud::Profiler::V2::ListProfilesRequest} or an equivalent Hash.
161
+ #
162
+ # @param request [::Google::Cloud::Profiler::V2::ListProfilesRequest, ::Hash]
163
+ # A request object representing the call parameters. Required. To specify no
164
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
165
+ # @param options [::Gapic::CallOptions, ::Hash]
166
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
167
+ #
168
+ # @overload list_profiles(parent: nil, page_size: nil, page_token: nil)
169
+ # Pass arguments to `list_profiles` via keyword arguments. Note that at
170
+ # least one keyword argument is required. To specify no parameters, or to keep all
171
+ # the default parameter values, pass an empty Hash as a request object (see above).
172
+ #
173
+ # @param parent [::String]
174
+ # Required. The parent, which owns this collection of profiles.
175
+ # Format: projects/\\{user_project_id}
176
+ # @param page_size [::Integer]
177
+ # The maximum number of items to return.
178
+ # Default page_size is 1000.
179
+ # Max limit is 10000.
180
+ # @param page_token [::String]
181
+ # The token to continue pagination and get profiles from a particular page.
182
+ # When paginating, all other parameters provided to `ListProfiles` must match
183
+ # the call that provided the page token.
184
+ #
185
+ # @yield [response, operation] Access the result along with the RPC operation
186
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Profiler::V2::Profile>]
187
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
188
+ #
189
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Profiler::V2::Profile>]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
192
+ #
193
+ # @example Basic example
194
+ # require "google/cloud/profiler/v2"
195
+ #
196
+ # # Create a client object. The client can be reused for multiple calls.
197
+ # client = Google::Cloud::Profiler::V2::ExportService::Client.new
198
+ #
199
+ # # Create a request. To set request fields, pass in keyword arguments.
200
+ # request = Google::Cloud::Profiler::V2::ListProfilesRequest.new
201
+ #
202
+ # # Call the list_profiles method.
203
+ # result = client.list_profiles request
204
+ #
205
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
206
+ # # over elements, and API calls will be issued to fetch pages as needed.
207
+ # result.each do |item|
208
+ # # Each element is of type ::Google::Cloud::Profiler::V2::Profile.
209
+ # p item
210
+ # end
211
+ #
212
+ def list_profiles request, options = nil
213
+ raise ::ArgumentError, "request must be provided" if request.nil?
214
+
215
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Profiler::V2::ListProfilesRequest
216
+
217
+ # Converts hash and nil to an options object
218
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
219
+
220
+ # Customize the options with defaults
221
+ metadata = @config.rpcs.list_profiles.metadata.to_h
222
+
223
+ # Set x-goog-api-client and x-goog-user-project headers
224
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
225
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
226
+ gapic_version: ::Google::Cloud::Profiler::V2::VERSION
227
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
228
+
229
+ header_params = {}
230
+ if request.parent
231
+ header_params["parent"] = request.parent
232
+ end
233
+
234
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
235
+ metadata[:"x-goog-request-params"] ||= request_params_header
236
+
237
+ options.apply_defaults timeout: @config.rpcs.list_profiles.timeout,
238
+ metadata: metadata,
239
+ retry_policy: @config.rpcs.list_profiles.retry_policy
240
+
241
+ options.apply_defaults timeout: @config.timeout,
242
+ metadata: @config.metadata,
243
+ retry_policy: @config.retry_policy
244
+
245
+ @export_service_stub.call_rpc :list_profiles, request, options: options do |response, operation|
246
+ response = ::Gapic::PagedEnumerable.new @export_service_stub, :list_profiles, request, response, operation, options
247
+ yield response, operation if block_given?
248
+ return response
249
+ end
250
+ rescue ::GRPC::BadStatus => e
251
+ raise ::Google::Cloud::Error.from_error(e)
252
+ end
253
+
254
+ ##
255
+ # Configuration class for the ExportService API.
256
+ #
257
+ # This class represents the configuration for ExportService,
258
+ # providing control over timeouts, retry behavior, logging, transport
259
+ # parameters, and other low-level controls. Certain parameters can also be
260
+ # applied individually to specific RPCs. See
261
+ # {::Google::Cloud::Profiler::V2::ExportService::Client::Configuration::Rpcs}
262
+ # for a list of RPCs that can be configured independently.
263
+ #
264
+ # Configuration can be applied globally to all clients, or to a single client
265
+ # on construction.
266
+ #
267
+ # @example
268
+ #
269
+ # # Modify the global config, setting the timeout for
270
+ # # list_profiles to 20 seconds,
271
+ # # and all remaining timeouts to 10 seconds.
272
+ # ::Google::Cloud::Profiler::V2::ExportService::Client.configure do |config|
273
+ # config.timeout = 10.0
274
+ # config.rpcs.list_profiles.timeout = 20.0
275
+ # end
276
+ #
277
+ # # Apply the above configuration only to a new client.
278
+ # client = ::Google::Cloud::Profiler::V2::ExportService::Client.new do |config|
279
+ # config.timeout = 10.0
280
+ # config.rpcs.list_profiles.timeout = 20.0
281
+ # end
282
+ #
283
+ # @!attribute [rw] endpoint
284
+ # The hostname or hostname:port of the service endpoint.
285
+ # Defaults to `"cloudprofiler.googleapis.com"`.
286
+ # @return [::String]
287
+ # @!attribute [rw] credentials
288
+ # Credentials to send with calls. You may provide any of the following types:
289
+ # * (`String`) The path to a service account key file in JSON format
290
+ # * (`Hash`) A service account key as a Hash
291
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
292
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
293
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
294
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
295
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
296
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
297
+ # * (`nil`) indicating no credentials
298
+ # @return [::Object]
299
+ # @!attribute [rw] scope
300
+ # The OAuth scopes
301
+ # @return [::Array<::String>]
302
+ # @!attribute [rw] lib_name
303
+ # The library name as recorded in instrumentation and logging
304
+ # @return [::String]
305
+ # @!attribute [rw] lib_version
306
+ # The library version as recorded in instrumentation and logging
307
+ # @return [::String]
308
+ # @!attribute [rw] channel_args
309
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
310
+ # `GRPC::Core::Channel` object is provided as the credential.
311
+ # @return [::Hash]
312
+ # @!attribute [rw] interceptors
313
+ # An array of interceptors that are run before calls are executed.
314
+ # @return [::Array<::GRPC::ClientInterceptor>]
315
+ # @!attribute [rw] timeout
316
+ # The call timeout in seconds.
317
+ # @return [::Numeric]
318
+ # @!attribute [rw] metadata
319
+ # Additional gRPC headers to be sent with the call.
320
+ # @return [::Hash{::Symbol=>::String}]
321
+ # @!attribute [rw] retry_policy
322
+ # The retry policy. The value is a hash with the following keys:
323
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
324
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
325
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
326
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
327
+ # trigger a retry.
328
+ # @return [::Hash]
329
+ # @!attribute [rw] quota_project
330
+ # A separate project against which to charge quota.
331
+ # @return [::String]
332
+ #
333
+ class Configuration
334
+ extend ::Gapic::Config
335
+
336
+ DEFAULT_ENDPOINT = "cloudprofiler.googleapis.com"
337
+
338
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
339
+ config_attr :credentials, nil do |value|
340
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
341
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
342
+ allowed.any? { |klass| klass === value }
343
+ end
344
+ config_attr :scope, nil, ::String, ::Array, nil
345
+ config_attr :lib_name, nil, ::String, nil
346
+ config_attr :lib_version, nil, ::String, nil
347
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
348
+ config_attr :interceptors, nil, ::Array, nil
349
+ config_attr :timeout, nil, ::Numeric, nil
350
+ config_attr :metadata, nil, ::Hash, nil
351
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
352
+ config_attr :quota_project, nil, ::String, nil
353
+
354
+ # @private
355
+ def initialize parent_config = nil
356
+ @parent_config = parent_config unless parent_config.nil?
357
+
358
+ yield self if block_given?
359
+ end
360
+
361
+ ##
362
+ # Configurations for individual RPCs
363
+ # @return [Rpcs]
364
+ #
365
+ def rpcs
366
+ @rpcs ||= begin
367
+ parent_rpcs = nil
368
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
369
+ Rpcs.new parent_rpcs
370
+ end
371
+ end
372
+
373
+ ##
374
+ # Configuration for the channel pool
375
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
376
+ #
377
+ def channel_pool
378
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
379
+ end
380
+
381
+ ##
382
+ # Configuration RPC class for the ExportService API.
383
+ #
384
+ # Includes fields providing the configuration for each RPC in this service.
385
+ # Each configuration object is of type `Gapic::Config::Method` and includes
386
+ # the following configuration fields:
387
+ #
388
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
389
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
390
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
391
+ # include the following keys:
392
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
393
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
394
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
395
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
396
+ # trigger a retry.
397
+ #
398
+ class Rpcs
399
+ ##
400
+ # RPC-specific configuration for `list_profiles`
401
+ # @return [::Gapic::Config::Method]
402
+ #
403
+ attr_reader :list_profiles
404
+
405
+ # @private
406
+ def initialize parent_rpcs = nil
407
+ list_profiles_config = parent_rpcs.list_profiles if parent_rpcs.respond_to? :list_profiles
408
+ @list_profiles = ::Gapic::Config::Method.new list_profiles_config
409
+
410
+ yield self if block_given?
411
+ end
412
+ end
413
+ end
414
+ end
415
+ end
416
+ end
417
+ end
418
+ end
419
+ 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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Profiler
24
+ module V2
25
+ module ExportService
26
+ # Credentials for the ExportService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/monitoring",
31
+ "https://www.googleapis.com/auth/monitoring.write"
32
+ ]
33
+ self.env_vars = [
34
+ "PROFILER_CREDENTIALS",
35
+ "PROFILER_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "PROFILER_CREDENTIALS_JSON",
40
+ "PROFILER_KEYFILE_JSON",
41
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
42
+ "GOOGLE_CLOUD_KEYFILE_JSON",
43
+ "GCLOUD_KEYFILE_JSON"
44
+ ]
45
+ self.paths = [
46
+ "~/.config/google_cloud/application_default_credentials.json"
47
+ ]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,47 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Profiler
23
+ module V2
24
+ module ExportService
25
+ # Path helper methods for the ExportService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Project resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}`
33
+ #
34
+ # @param project [String]
35
+ #
36
+ # @return [::String]
37
+ def project_path project:
38
+ "projects/#{project}"
39
+ end
40
+
41
+ extend self
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end