google-cloud-trace-v1 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,227 @@
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/cloudtrace/v1/trace_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Trace
24
+ module V1
25
+ module TraceService
26
+ module Rest
27
+ ##
28
+ # REST service stub for the TraceService 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_traces REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Trace::V1::ListTracesRequest]
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::Trace::V1::ListTracesResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Trace::V1::ListTracesResponse]
56
+ # A result object deserialized from the server's reply
57
+ def list_traces 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_traces_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::Trace::V1::ListTracesResponse.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the get_trace REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Trace::V1::GetTraceRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Cloud::Trace::V1::Trace]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Trace::V1::Trace]
94
+ # A result object deserialized from the server's reply
95
+ def get_trace request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_trace_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Cloud::Trace::V1::Trace.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # Baseline implementation for the patch_traces REST call
121
+ #
122
+ # @param request_pb [::Google::Cloud::Trace::V1::PatchTracesRequest]
123
+ # A request object representing the call parameters. Required.
124
+ # @param options [::Gapic::CallOptions]
125
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
126
+ #
127
+ # @yield [result, operation] Access the result along with the TransportOperation object
128
+ # @yieldparam result [::Google::Protobuf::Empty]
129
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
130
+ #
131
+ # @return [::Google::Protobuf::Empty]
132
+ # A result object deserialized from the server's reply
133
+ def patch_traces request_pb, options = nil
134
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
135
+
136
+ verb, uri, query_string_params, body = ServiceStub.transcode_patch_traces_request request_pb
137
+ query_string_params = if query_string_params.any?
138
+ query_string_params.to_h { |p| p.split("=", 2) }
139
+ else
140
+ {}
141
+ end
142
+
143
+ response = @client_stub.make_http_request(
144
+ verb,
145
+ uri: uri,
146
+ body: body || "",
147
+ params: query_string_params,
148
+ options: options
149
+ )
150
+ operation = ::Gapic::Rest::TransportOperation.new response
151
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
152
+
153
+ yield result, operation if block_given?
154
+ result
155
+ end
156
+
157
+ ##
158
+ # @private
159
+ #
160
+ # GRPC transcoding helper method for the list_traces REST call
161
+ #
162
+ # @param request_pb [::Google::Cloud::Trace::V1::ListTracesRequest]
163
+ # A request object representing the call parameters. Required.
164
+ # @return [Array(String, [String, nil], Hash{String => String})]
165
+ # Uri, Body, Query string parameters
166
+ def self.transcode_list_traces_request request_pb
167
+ transcoder = Gapic::Rest::GrpcTranscoder.new
168
+ .with_bindings(
169
+ uri_method: :get,
170
+ uri_template: "/v1/projects/{project_id}/traces",
171
+ matches: [
172
+ ["project_id", %r{^[^/]+/?$}, false]
173
+ ]
174
+ )
175
+ transcoder.transcode request_pb
176
+ end
177
+
178
+ ##
179
+ # @private
180
+ #
181
+ # GRPC transcoding helper method for the get_trace REST call
182
+ #
183
+ # @param request_pb [::Google::Cloud::Trace::V1::GetTraceRequest]
184
+ # A request object representing the call parameters. Required.
185
+ # @return [Array(String, [String, nil], Hash{String => String})]
186
+ # Uri, Body, Query string parameters
187
+ def self.transcode_get_trace_request request_pb
188
+ transcoder = Gapic::Rest::GrpcTranscoder.new
189
+ .with_bindings(
190
+ uri_method: :get,
191
+ uri_template: "/v1/projects/{project_id}/traces/{trace_id}",
192
+ matches: [
193
+ ["project_id", %r{^[^/]+/?$}, false],
194
+ ["trace_id", %r{^[^/]+/?$}, false]
195
+ ]
196
+ )
197
+ transcoder.transcode request_pb
198
+ end
199
+
200
+ ##
201
+ # @private
202
+ #
203
+ # GRPC transcoding helper method for the patch_traces REST call
204
+ #
205
+ # @param request_pb [::Google::Cloud::Trace::V1::PatchTracesRequest]
206
+ # A request object representing the call parameters. Required.
207
+ # @return [Array(String, [String, nil], Hash{String => String})]
208
+ # Uri, Body, Query string parameters
209
+ def self.transcode_patch_traces_request request_pb
210
+ transcoder = Gapic::Rest::GrpcTranscoder.new
211
+ .with_bindings(
212
+ uri_method: :patch,
213
+ uri_template: "/v1/projects/{project_id}/traces",
214
+ body: "traces",
215
+ matches: [
216
+ ["project_id", %r{^[^/]+/?$}, false]
217
+ ]
218
+ )
219
+ transcoder.transcode request_pb
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,55 @@
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/trace/v1/version"
24
+
25
+ require "google/cloud/trace/v1/trace_service/credentials"
26
+ require "google/cloud/trace/v1/trace_service/rest/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Trace
31
+ module V1
32
+ ##
33
+ # This file describes an API for collecting and viewing traces and spans
34
+ # within a trace. A Trace is a collection of spans corresponding to a single
35
+ # operation or set of operations for an application. A span is an individual
36
+ # timed event which forms a node of the trace tree. Spans for a single trace
37
+ # may span multiple services.
38
+ #
39
+ # To load this service and instantiate a REST client:
40
+ #
41
+ # require "google/cloud/trace/v1/trace_service/rest"
42
+ # client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new
43
+ #
44
+ module TraceService
45
+ # Client for the REST transport
46
+ module Rest
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
55
+ require "google/cloud/trace/v1/trace_service/rest/helpers" if ::File.file? helper_path
@@ -24,6 +24,7 @@ require "google/cloud/trace/v1/version"
24
24
 
25
25
  require "google/cloud/trace/v1/trace_service/credentials"
26
26
  require "google/cloud/trace/v1/trace_service/client"
27
+ require "google/cloud/trace/v1/trace_service/rest"
27
28
 
28
29
  module Google
29
30
  module Cloud
@@ -36,11 +37,16 @@ module Google
36
37
  # timed event which forms a node of the trace tree. Spans for a single trace
37
38
  # may span multiple services.
38
39
  #
39
- # To load this service and instantiate a client:
40
+ # @example Load this service and instantiate a gRPC client
40
41
  #
41
42
  # require "google/cloud/trace/v1/trace_service"
42
43
  # client = ::Google::Cloud::Trace::V1::TraceService::Client.new
43
44
  #
45
+ # @example Load this service and instantiate a REST client
46
+ #
47
+ # require "google/cloud/trace/v1/trace_service/rest"
48
+ # client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new
49
+ #
44
50
  module TraceService
45
51
  end
46
52
  end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Trace
23
23
  module V1
24
- VERSION = "0.4.0"
24
+ VERSION = "0.6.0"
25
25
  end
26
26
  end
27
27
  end
@@ -23,13 +23,18 @@ module Google
23
23
  module Cloud
24
24
  module Trace
25
25
  ##
26
- # To load this package, including all its services, and instantiate a client:
26
+ # API client module.
27
27
  #
28
- # @example
28
+ # @example Load this package, including all its services, and instantiate a gRPC client
29
29
  #
30
30
  # require "google/cloud/trace/v1"
31
31
  # client = ::Google::Cloud::Trace::V1::TraceService::Client.new
32
32
  #
33
+ # @example Load this package, including all its services, and instantiate a REST client
34
+ #
35
+ # require "google/cloud/trace/v1"
36
+ # client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new
37
+ #
33
38
  module V1
34
39
  end
35
40
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/devtools/cloudtrace/v1/trace.proto
3
4
 
@@ -5,64 +6,36 @@ require 'google/protobuf'
5
6
 
6
7
  require 'google/api/client_pb'
7
8
  require 'google/api/field_behavior_pb'
8
- require 'google/api/resource_pb'
9
9
  require 'google/protobuf/empty_pb'
10
10
  require 'google/protobuf/timestamp_pb'
11
11
  require 'google/api/annotations_pb'
12
12
 
13
- Google::Protobuf::DescriptorPool.generated_pool.build do
14
- add_file("google/devtools/cloudtrace/v1/trace.proto", :syntax => :proto3) do
15
- add_message "google.devtools.cloudtrace.v1.Trace" do
16
- optional :project_id, :string, 1
17
- optional :trace_id, :string, 2
18
- repeated :spans, :message, 3, "google.devtools.cloudtrace.v1.TraceSpan"
19
- end
20
- add_message "google.devtools.cloudtrace.v1.Traces" do
21
- repeated :traces, :message, 1, "google.devtools.cloudtrace.v1.Trace"
22
- end
23
- add_message "google.devtools.cloudtrace.v1.TraceSpan" do
24
- optional :span_id, :fixed64, 1
25
- optional :kind, :enum, 2, "google.devtools.cloudtrace.v1.TraceSpan.SpanKind"
26
- optional :name, :string, 3
27
- optional :start_time, :message, 4, "google.protobuf.Timestamp"
28
- optional :end_time, :message, 5, "google.protobuf.Timestamp"
29
- optional :parent_span_id, :fixed64, 6
30
- map :labels, :string, :string, 7
31
- end
32
- add_enum "google.devtools.cloudtrace.v1.TraceSpan.SpanKind" do
33
- value :SPAN_KIND_UNSPECIFIED, 0
34
- value :RPC_SERVER, 1
35
- value :RPC_CLIENT, 2
36
- end
37
- add_message "google.devtools.cloudtrace.v1.ListTracesRequest" do
38
- optional :project_id, :string, 1
39
- optional :view, :enum, 2, "google.devtools.cloudtrace.v1.ListTracesRequest.ViewType"
40
- optional :page_size, :int32, 3
41
- optional :page_token, :string, 4
42
- optional :start_time, :message, 5, "google.protobuf.Timestamp"
43
- optional :end_time, :message, 6, "google.protobuf.Timestamp"
44
- optional :filter, :string, 7
45
- optional :order_by, :string, 8
46
- end
47
- add_enum "google.devtools.cloudtrace.v1.ListTracesRequest.ViewType" do
48
- value :VIEW_TYPE_UNSPECIFIED, 0
49
- value :MINIMAL, 1
50
- value :ROOTSPAN, 2
51
- value :COMPLETE, 3
52
- end
53
- add_message "google.devtools.cloudtrace.v1.ListTracesResponse" do
54
- repeated :traces, :message, 1, "google.devtools.cloudtrace.v1.Trace"
55
- optional :next_page_token, :string, 2
56
- end
57
- add_message "google.devtools.cloudtrace.v1.GetTraceRequest" do
58
- optional :project_id, :string, 1
59
- optional :trace_id, :string, 2
60
- end
61
- add_message "google.devtools.cloudtrace.v1.PatchTracesRequest" do
62
- optional :project_id, :string, 1
63
- optional :traces, :message, 2, "google.devtools.cloudtrace.v1.Traces"
13
+
14
+ descriptor_data = "\n)google/devtools/cloudtrace/v1/trace.proto\x12\x1dgoogle.devtools.cloudtrace.v1\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto\"f\n\x05Trace\x12\x12\n\nproject_id\x18\x01 \x01(\t\x12\x10\n\x08trace_id\x18\x02 \x01(\t\x12\x37\n\x05spans\x18\x03 \x03(\x0b\x32(.google.devtools.cloudtrace.v1.TraceSpan\">\n\x06Traces\x12\x34\n\x06traces\x18\x01 \x03(\x0b\x32$.google.devtools.cloudtrace.v1.Trace\"\xa2\x03\n\tTraceSpan\x12\x0f\n\x07span_id\x18\x01 \x01(\x06\x12?\n\x04kind\x18\x02 \x01(\x0e\x32\x31.google.devtools.cloudtrace.v1.TraceSpan.SpanKind\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\nstart_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1b\n\x0eparent_span_id\x18\x06 \x01(\x06\x42\x03\xe0\x41\x01\x12\x44\n\x06labels\x18\x07 \x03(\x0b\x32\x34.google.devtools.cloudtrace.v1.TraceSpan.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"E\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x0e\n\nRPC_SERVER\x10\x01\x12\x0e\n\nRPC_CLIENT\x10\x02\"\x80\x03\n\x11ListTracesRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12L\n\x04view\x18\x02 \x01(\x0e\x32\x39.google.devtools.cloudtrace.v1.ListTracesRequest.ViewTypeB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x12\n\npage_token\x18\x04 \x01(\t\x12.\n\nstart_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x06\x66ilter\x18\x07 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x08 \x01(\tB\x03\xe0\x41\x01\"N\n\x08ViewType\x12\x19\n\x15VIEW_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07MINIMAL\x10\x01\x12\x0c\n\x08ROOTSPAN\x10\x02\x12\x0c\n\x08\x43OMPLETE\x10\x03\"c\n\x12ListTracesResponse\x12\x34\n\x06traces\x18\x01 \x03(\x0b\x32$.google.devtools.cloudtrace.v1.Trace\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"A\n\x0fGetTraceRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08trace_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\"i\n\x12PatchTracesRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12:\n\x06traces\x18\x02 \x01(\x0b\x32%.google.devtools.cloudtrace.v1.TracesB\x03\xe0\x41\x02\x32\xb5\x05\n\x0cTraceService\x12\xa8\x01\n\nListTraces\x12\x30.google.devtools.cloudtrace.v1.ListTracesRequest\x1a\x31.google.devtools.cloudtrace.v1.ListTracesResponse\"5\x82\xd3\xe4\x93\x02\"\x12 /v1/projects/{project_id}/traces\xda\x41\nproject_id\x12\xab\x01\n\x08GetTrace\x12..google.devtools.cloudtrace.v1.GetTraceRequest\x1a$.google.devtools.cloudtrace.v1.Trace\"I\x82\xd3\xe4\x93\x02-\x12+/v1/projects/{project_id}/traces/{trace_id}\xda\x41\x13project_id,trace_id\x12\x9e\x01\n\x0bPatchTraces\x12\x31.google.devtools.cloudtrace.v1.PatchTracesRequest\x1a\x16.google.protobuf.Empty\"D\x82\xd3\xe4\x93\x02*2 /v1/projects/{project_id}/traces:\x06traces\xda\x41\x11project_id,traces\x1a\xaa\x01\xca\x41\x19\x63loudtrace.googleapis.com\xd2\x41\x8a\x01https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/trace.append,https://www.googleapis.com/auth/trace.readonlyB\xad\x01\n!com.google.devtools.cloudtrace.v1B\nTraceProtoP\x01Z/cloud.google.com/go/trace/apiv1/tracepb;tracepb\xaa\x02\x15Google.Cloud.Trace.V1\xca\x02\x15Google\\Cloud\\Trace\\V1\xea\x02\x18Google::Cloud::Trace::V1b\x06proto3"
15
+
16
+ pool = Google::Protobuf::DescriptorPool.generated_pool
17
+
18
+ begin
19
+ pool.add_serialized_file(descriptor_data)
20
+ rescue TypeError => e
21
+ # Compatibility code: will be removed in the next major version.
22
+ require 'google/protobuf/descriptor_pb'
23
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
24
+ parsed.clear_dependency
25
+ serialized = parsed.class.encode(parsed)
26
+ file = pool.add_serialized_file(serialized)
27
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
28
+ imports = [
29
+ ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"],
30
+ ]
31
+ imports.each do |type_name, expected_filename|
32
+ import_file = pool.lookup(type_name).file_descriptor
33
+ if import_file.name != expected_filename
34
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
64
35
  end
65
36
  end
37
+ warn "Each proto file must use a consistent fully-qualified name."
38
+ warn "This will become an error in the next major version."
66
39
  end
67
40
 
68
41
  module Google