google-cloud-logging-v2 0.1.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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-cloud-logging-v2.rb +21 -0
- data/lib/google/cloud/logging/v2.rb +37 -0
- data/lib/google/cloud/logging/v2/config_service.rb +49 -0
- data/lib/google/cloud/logging/v2/config_service/client.rb +1723 -0
- data/lib/google/cloud/logging/v2/config_service/credentials.rb +54 -0
- data/lib/google/cloud/logging/v2/config_service/paths.rb +413 -0
- data/lib/google/cloud/logging/v2/logging_service.rb +49 -0
- data/lib/google/cloud/logging/v2/logging_service/client.rb +826 -0
- data/lib/google/cloud/logging/v2/logging_service/credentials.rb +55 -0
- data/lib/google/cloud/logging/v2/logging_service/paths.rb +154 -0
- data/lib/google/cloud/logging/v2/metrics_service.rb +49 -0
- data/lib/google/cloud/logging/v2/metrics_service/client.rb +726 -0
- data/lib/google/cloud/logging/v2/metrics_service/credentials.rb +55 -0
- data/lib/google/cloud/logging/v2/metrics_service/paths.rb +64 -0
- data/lib/google/cloud/logging/v2/version.rb +28 -0
- data/lib/google/logging/type/http_request_pb.rb +38 -0
- data/lib/google/logging/type/log_severity_pb.rb +31 -0
- data/lib/google/logging/v2/log_entry_pb.rb +62 -0
- data/lib/google/logging/v2/logging_config_pb.rb +176 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +113 -0
- data/lib/google/logging/v2/logging_metrics_pb.rb +75 -0
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +53 -0
- data/lib/google/logging/v2/logging_pb.rb +83 -0
- data/lib/google/logging/v2/logging_services_pb.rb +65 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/distribution.rb +225 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/label.rb +49 -0
- data/proto_docs/google/api/metric.rb +203 -0
- data/proto_docs/google/api/monitored_resource.rb +137 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/logging/type/http_request.rb +95 -0
- data/proto_docs/google/logging/type/log_severity.rb +71 -0
- data/proto_docs/google/logging/v2/log_entry.rb +203 -0
- data/proto_docs/google/logging/v2/logging.rb +303 -0
- data/proto_docs/google/logging/v2/logging_config.rb +735 -0
- data/proto_docs/google/logging/v2/logging_metrics.rb +256 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +231 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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 Logging
|
24
|
+
module V2
|
25
|
+
module LoggingService
|
26
|
+
# Credentials for the LoggingService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
30
|
+
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
31
|
+
"https://www.googleapis.com/auth/logging.admin",
|
32
|
+
"https://www.googleapis.com/auth/logging.read",
|
33
|
+
"https://www.googleapis.com/auth/logging.write"
|
34
|
+
]
|
35
|
+
self.env_vars = [
|
36
|
+
"LOGGING_CREDENTIALS",
|
37
|
+
"LOGGING_KEYFILE",
|
38
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
39
|
+
"GOOGLE_CLOUD_KEYFILE",
|
40
|
+
"GCLOUD_KEYFILE",
|
41
|
+
"LOGGING_CREDENTIALS_JSON",
|
42
|
+
"LOGGING_KEYFILE_JSON",
|
43
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
44
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
45
|
+
"GCLOUD_KEYFILE_JSON"
|
46
|
+
]
|
47
|
+
self.paths = [
|
48
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
49
|
+
]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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 Logging
|
23
|
+
module V2
|
24
|
+
module LoggingService
|
25
|
+
# Path helper methods for the LoggingService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified BillingAccount resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `billingAccounts/{billing_account}`
|
33
|
+
#
|
34
|
+
# @param billing_account [String]
|
35
|
+
#
|
36
|
+
# @return [::String]
|
37
|
+
def billing_account_path billing_account:
|
38
|
+
"billingAccounts/#{billing_account}"
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Create a fully-qualified Folder resource string.
|
43
|
+
#
|
44
|
+
# The resource will be in the following format:
|
45
|
+
#
|
46
|
+
# `folders/{folder}`
|
47
|
+
#
|
48
|
+
# @param folder [String]
|
49
|
+
#
|
50
|
+
# @return [::String]
|
51
|
+
def folder_path folder:
|
52
|
+
"folders/#{folder}"
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Create a fully-qualified Log resource string.
|
57
|
+
#
|
58
|
+
# @overload log_path(project:, log:)
|
59
|
+
# The resource will be in the following format:
|
60
|
+
#
|
61
|
+
# `projects/{project}/logs/{log}`
|
62
|
+
#
|
63
|
+
# @param project [String]
|
64
|
+
# @param log [String]
|
65
|
+
#
|
66
|
+
# @overload log_path(organization:, log:)
|
67
|
+
# The resource will be in the following format:
|
68
|
+
#
|
69
|
+
# `organizations/{organization}/logs/{log}`
|
70
|
+
#
|
71
|
+
# @param organization [String]
|
72
|
+
# @param log [String]
|
73
|
+
#
|
74
|
+
# @overload log_path(folder:, log:)
|
75
|
+
# The resource will be in the following format:
|
76
|
+
#
|
77
|
+
# `folders/{folder}/logs/{log}`
|
78
|
+
#
|
79
|
+
# @param folder [String]
|
80
|
+
# @param log [String]
|
81
|
+
#
|
82
|
+
# @overload log_path(billing_account:, log:)
|
83
|
+
# The resource will be in the following format:
|
84
|
+
#
|
85
|
+
# `billingAccounts/{billing_account}/logs/{log}`
|
86
|
+
#
|
87
|
+
# @param billing_account [String]
|
88
|
+
# @param log [String]
|
89
|
+
#
|
90
|
+
# @return [::String]
|
91
|
+
def log_path **args
|
92
|
+
resources = {
|
93
|
+
"log:project" => (proc do |project:, log:|
|
94
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
95
|
+
|
96
|
+
"projects/#{project}/logs/#{log}"
|
97
|
+
end),
|
98
|
+
"log:organization" => (proc do |organization:, log:|
|
99
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
100
|
+
|
101
|
+
"organizations/#{organization}/logs/#{log}"
|
102
|
+
end),
|
103
|
+
"folder:log" => (proc do |folder:, log:|
|
104
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
105
|
+
|
106
|
+
"folders/#{folder}/logs/#{log}"
|
107
|
+
end),
|
108
|
+
"billing_account:log" => (proc do |billing_account:, log:|
|
109
|
+
raise ::ArgumentError, "billing_account cannot contain /" if billing_account.to_s.include? "/"
|
110
|
+
|
111
|
+
"billingAccounts/#{billing_account}/logs/#{log}"
|
112
|
+
end)
|
113
|
+
}
|
114
|
+
|
115
|
+
resource = resources[args.keys.sort.join(":")]
|
116
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
117
|
+
resource.call(**args)
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# Create a fully-qualified Organization resource string.
|
122
|
+
#
|
123
|
+
# The resource will be in the following format:
|
124
|
+
#
|
125
|
+
# `organizations/{organization}`
|
126
|
+
#
|
127
|
+
# @param organization [String]
|
128
|
+
#
|
129
|
+
# @return [::String]
|
130
|
+
def organization_path organization:
|
131
|
+
"organizations/#{organization}"
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# Create a fully-qualified Project resource string.
|
136
|
+
#
|
137
|
+
# The resource will be in the following format:
|
138
|
+
#
|
139
|
+
# `projects/{project}`
|
140
|
+
#
|
141
|
+
# @param project [String]
|
142
|
+
#
|
143
|
+
# @return [::String]
|
144
|
+
def project_path project:
|
145
|
+
"projects/#{project}"
|
146
|
+
end
|
147
|
+
|
148
|
+
extend self
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/logging/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/logging/v2/metrics_service/credentials"
|
26
|
+
require "google/cloud/logging/v2/metrics_service/paths"
|
27
|
+
require "google/cloud/logging/v2/metrics_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Logging
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Service for configuring logs-based metrics.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/logging/v2/metrics_service"
|
39
|
+
# client = ::Google::Cloud::Logging::V2::MetricsService::Client.new
|
40
|
+
#
|
41
|
+
module MetricsService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "metrics_service", "helpers.rb"
|
49
|
+
require "google/cloud/logging/v2/metrics_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,726 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/logging/v2/logging_metrics_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Logging
|
25
|
+
module V2
|
26
|
+
module MetricsService
|
27
|
+
##
|
28
|
+
# Client for the MetricsService service.
|
29
|
+
#
|
30
|
+
# Service for configuring logs-based metrics.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :metrics_service_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the MetricsService Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Logging::V2::MetricsService::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all MetricsService clients:
|
47
|
+
#
|
48
|
+
# ::Google::Cloud::Logging::V2::MetricsService::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", "Logging", "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.rpcs.list_log_metrics.timeout = 60.0
|
69
|
+
default_config.rpcs.list_log_metrics.retry_policy = {
|
70
|
+
initial_delay: 0.1,
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.get_log_metric.timeout = 60.0
|
77
|
+
default_config.rpcs.get_log_metric.retry_policy = {
|
78
|
+
initial_delay: 0.1,
|
79
|
+
max_delay: 60.0,
|
80
|
+
multiplier: 1.3,
|
81
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
82
|
+
}
|
83
|
+
|
84
|
+
default_config.rpcs.create_log_metric.timeout = 60.0
|
85
|
+
|
86
|
+
default_config.rpcs.update_log_metric.timeout = 60.0
|
87
|
+
default_config.rpcs.update_log_metric.retry_policy = {
|
88
|
+
initial_delay: 0.1,
|
89
|
+
max_delay: 60.0,
|
90
|
+
multiplier: 1.3,
|
91
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
92
|
+
}
|
93
|
+
|
94
|
+
default_config.rpcs.delete_log_metric.timeout = 60.0
|
95
|
+
default_config.rpcs.delete_log_metric.retry_policy = {
|
96
|
+
initial_delay: 0.1,
|
97
|
+
max_delay: 60.0,
|
98
|
+
multiplier: 1.3,
|
99
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
100
|
+
}
|
101
|
+
|
102
|
+
default_config
|
103
|
+
end
|
104
|
+
yield @configure if block_given?
|
105
|
+
@configure
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Configure the MetricsService Client instance.
|
110
|
+
#
|
111
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
112
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
113
|
+
# should be made on {Client.configure}.
|
114
|
+
#
|
115
|
+
# See {::Google::Cloud::Logging::V2::MetricsService::Client::Configuration}
|
116
|
+
# for a description of the configuration fields.
|
117
|
+
#
|
118
|
+
# @yield [config] Configure the Client client.
|
119
|
+
# @yieldparam config [Client::Configuration]
|
120
|
+
#
|
121
|
+
# @return [Client::Configuration]
|
122
|
+
#
|
123
|
+
def configure
|
124
|
+
yield @config if block_given?
|
125
|
+
@config
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Create a new MetricsService client object.
|
130
|
+
#
|
131
|
+
# ## Examples
|
132
|
+
#
|
133
|
+
# To create a new MetricsService client with the default
|
134
|
+
# configuration:
|
135
|
+
#
|
136
|
+
# client = ::Google::Cloud::Logging::V2::MetricsService::Client.new
|
137
|
+
#
|
138
|
+
# To create a new MetricsService client with a custom
|
139
|
+
# configuration:
|
140
|
+
#
|
141
|
+
# client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
|
142
|
+
# config.timeout = 10.0
|
143
|
+
# end
|
144
|
+
#
|
145
|
+
# @yield [config] Configure the MetricsService client.
|
146
|
+
# @yieldparam config [Client::Configuration]
|
147
|
+
#
|
148
|
+
def initialize
|
149
|
+
# These require statements are intentionally placed here to initialize
|
150
|
+
# the gRPC module only when it's required.
|
151
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
152
|
+
require "gapic/grpc"
|
153
|
+
require "google/logging/v2/logging_metrics_services_pb"
|
154
|
+
|
155
|
+
# Create the configuration object
|
156
|
+
@config = Configuration.new Client.configure
|
157
|
+
|
158
|
+
# Yield the configuration if needed
|
159
|
+
yield @config if block_given?
|
160
|
+
|
161
|
+
# Create credentials
|
162
|
+
credentials = @config.credentials
|
163
|
+
credentials ||= Credentials.default scope: @config.scope
|
164
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
165
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
166
|
+
end
|
167
|
+
@quota_project_id = @config.quota_project
|
168
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
169
|
+
|
170
|
+
@metrics_service_stub = ::Gapic::ServiceStub.new(
|
171
|
+
::Google::Cloud::Logging::V2::MetricsServiceV2::Stub,
|
172
|
+
credentials: credentials,
|
173
|
+
endpoint: @config.endpoint,
|
174
|
+
channel_args: @config.channel_args,
|
175
|
+
interceptors: @config.interceptors
|
176
|
+
)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Service calls
|
180
|
+
|
181
|
+
##
|
182
|
+
# Lists logs-based metrics.
|
183
|
+
#
|
184
|
+
# @overload list_log_metrics(request, options = nil)
|
185
|
+
# Pass arguments to `list_log_metrics` via a request object, either of type
|
186
|
+
# {::Google::Cloud::Logging::V2::ListLogMetricsRequest} or an equivalent Hash.
|
187
|
+
#
|
188
|
+
# @param request [::Google::Cloud::Logging::V2::ListLogMetricsRequest, ::Hash]
|
189
|
+
# A request object representing the call parameters. Required. To specify no
|
190
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
191
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
192
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
193
|
+
#
|
194
|
+
# @overload list_log_metrics(parent: nil, page_token: nil, page_size: nil)
|
195
|
+
# Pass arguments to `list_log_metrics` via keyword arguments. Note that at
|
196
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
197
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
198
|
+
#
|
199
|
+
# @param parent [::String]
|
200
|
+
# Required. The name of the project containing the metrics:
|
201
|
+
#
|
202
|
+
# "projects/[PROJECT_ID]"
|
203
|
+
# @param page_token [::String]
|
204
|
+
# Optional. If present, then retrieve the next batch of results from the
|
205
|
+
# preceding call to this method. `pageToken` must be the value of
|
206
|
+
# `nextPageToken` from the previous response. The values of other method
|
207
|
+
# parameters should be identical to those in the previous call.
|
208
|
+
# @param page_size [::Integer]
|
209
|
+
# Optional. The maximum number of results to return from this request.
|
210
|
+
# Non-positive values are ignored. The presence of `nextPageToken` in the
|
211
|
+
# response indicates that more results might be available.
|
212
|
+
#
|
213
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
214
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogMetric>]
|
215
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
216
|
+
#
|
217
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogMetric>]
|
218
|
+
#
|
219
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
220
|
+
#
|
221
|
+
def list_log_metrics request, options = nil
|
222
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
223
|
+
|
224
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListLogMetricsRequest
|
225
|
+
|
226
|
+
# Converts hash and nil to an options object
|
227
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
228
|
+
|
229
|
+
# Customize the options with defaults
|
230
|
+
metadata = @config.rpcs.list_log_metrics.metadata.to_h
|
231
|
+
|
232
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
233
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
234
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
235
|
+
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
236
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
237
|
+
|
238
|
+
header_params = {
|
239
|
+
"parent" => request.parent
|
240
|
+
}
|
241
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
242
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
243
|
+
|
244
|
+
options.apply_defaults timeout: @config.rpcs.list_log_metrics.timeout,
|
245
|
+
metadata: metadata,
|
246
|
+
retry_policy: @config.rpcs.list_log_metrics.retry_policy
|
247
|
+
options.apply_defaults metadata: @config.metadata,
|
248
|
+
retry_policy: @config.retry_policy
|
249
|
+
|
250
|
+
@metrics_service_stub.call_rpc :list_log_metrics, request, options: options do |response, operation|
|
251
|
+
response = ::Gapic::PagedEnumerable.new @metrics_service_stub, :list_log_metrics, request, response, operation, options
|
252
|
+
yield response, operation if block_given?
|
253
|
+
return response
|
254
|
+
end
|
255
|
+
rescue ::GRPC::BadStatus => e
|
256
|
+
raise ::Google::Cloud::Error.from_error(e)
|
257
|
+
end
|
258
|
+
|
259
|
+
##
|
260
|
+
# Gets a logs-based metric.
|
261
|
+
#
|
262
|
+
# @overload get_log_metric(request, options = nil)
|
263
|
+
# Pass arguments to `get_log_metric` via a request object, either of type
|
264
|
+
# {::Google::Cloud::Logging::V2::GetLogMetricRequest} or an equivalent Hash.
|
265
|
+
#
|
266
|
+
# @param request [::Google::Cloud::Logging::V2::GetLogMetricRequest, ::Hash]
|
267
|
+
# A request object representing the call parameters. Required. To specify no
|
268
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
269
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
270
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
271
|
+
#
|
272
|
+
# @overload get_log_metric(metric_name: nil)
|
273
|
+
# Pass arguments to `get_log_metric` via keyword arguments. Note that at
|
274
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
275
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
276
|
+
#
|
277
|
+
# @param metric_name [::String]
|
278
|
+
# Required. The resource name of the desired metric:
|
279
|
+
#
|
280
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
281
|
+
#
|
282
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
283
|
+
# @yieldparam response [::Google::Cloud::Logging::V2::LogMetric]
|
284
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
285
|
+
#
|
286
|
+
# @return [::Google::Cloud::Logging::V2::LogMetric]
|
287
|
+
#
|
288
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
289
|
+
#
|
290
|
+
def get_log_metric request, options = nil
|
291
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
292
|
+
|
293
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetLogMetricRequest
|
294
|
+
|
295
|
+
# Converts hash and nil to an options object
|
296
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
297
|
+
|
298
|
+
# Customize the options with defaults
|
299
|
+
metadata = @config.rpcs.get_log_metric.metadata.to_h
|
300
|
+
|
301
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
302
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
303
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
304
|
+
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
305
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
306
|
+
|
307
|
+
header_params = {
|
308
|
+
"metric_name" => request.metric_name
|
309
|
+
}
|
310
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
311
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
312
|
+
|
313
|
+
options.apply_defaults timeout: @config.rpcs.get_log_metric.timeout,
|
314
|
+
metadata: metadata,
|
315
|
+
retry_policy: @config.rpcs.get_log_metric.retry_policy
|
316
|
+
options.apply_defaults metadata: @config.metadata,
|
317
|
+
retry_policy: @config.retry_policy
|
318
|
+
|
319
|
+
@metrics_service_stub.call_rpc :get_log_metric, request, options: options do |response, operation|
|
320
|
+
yield response, operation if block_given?
|
321
|
+
return response
|
322
|
+
end
|
323
|
+
rescue ::GRPC::BadStatus => e
|
324
|
+
raise ::Google::Cloud::Error.from_error(e)
|
325
|
+
end
|
326
|
+
|
327
|
+
##
|
328
|
+
# Creates a logs-based metric.
|
329
|
+
#
|
330
|
+
# @overload create_log_metric(request, options = nil)
|
331
|
+
# Pass arguments to `create_log_metric` via a request object, either of type
|
332
|
+
# {::Google::Cloud::Logging::V2::CreateLogMetricRequest} or an equivalent Hash.
|
333
|
+
#
|
334
|
+
# @param request [::Google::Cloud::Logging::V2::CreateLogMetricRequest, ::Hash]
|
335
|
+
# A request object representing the call parameters. Required. To specify no
|
336
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
337
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
338
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
339
|
+
#
|
340
|
+
# @overload create_log_metric(parent: nil, metric: nil)
|
341
|
+
# Pass arguments to `create_log_metric` via keyword arguments. Note that at
|
342
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
343
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
344
|
+
#
|
345
|
+
# @param parent [::String]
|
346
|
+
# Required. The resource name of the project in which to create the metric:
|
347
|
+
#
|
348
|
+
# "projects/[PROJECT_ID]"
|
349
|
+
#
|
350
|
+
# The new metric must be provided in the request.
|
351
|
+
# @param metric [::Google::Cloud::Logging::V2::LogMetric, ::Hash]
|
352
|
+
# Required. The new logs-based metric, which must not have an identifier that
|
353
|
+
# already exists.
|
354
|
+
#
|
355
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
356
|
+
# @yieldparam response [::Google::Cloud::Logging::V2::LogMetric]
|
357
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
358
|
+
#
|
359
|
+
# @return [::Google::Cloud::Logging::V2::LogMetric]
|
360
|
+
#
|
361
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
362
|
+
#
|
363
|
+
def create_log_metric request, options = nil
|
364
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
365
|
+
|
366
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateLogMetricRequest
|
367
|
+
|
368
|
+
# Converts hash and nil to an options object
|
369
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
370
|
+
|
371
|
+
# Customize the options with defaults
|
372
|
+
metadata = @config.rpcs.create_log_metric.metadata.to_h
|
373
|
+
|
374
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
375
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
376
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
377
|
+
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
378
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
379
|
+
|
380
|
+
header_params = {
|
381
|
+
"parent" => request.parent
|
382
|
+
}
|
383
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
384
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
385
|
+
|
386
|
+
options.apply_defaults timeout: @config.rpcs.create_log_metric.timeout,
|
387
|
+
metadata: metadata,
|
388
|
+
retry_policy: @config.rpcs.create_log_metric.retry_policy
|
389
|
+
options.apply_defaults metadata: @config.metadata,
|
390
|
+
retry_policy: @config.retry_policy
|
391
|
+
|
392
|
+
@metrics_service_stub.call_rpc :create_log_metric, request, options: options do |response, operation|
|
393
|
+
yield response, operation if block_given?
|
394
|
+
return response
|
395
|
+
end
|
396
|
+
rescue ::GRPC::BadStatus => e
|
397
|
+
raise ::Google::Cloud::Error.from_error(e)
|
398
|
+
end
|
399
|
+
|
400
|
+
##
|
401
|
+
# Creates or updates a logs-based metric.
|
402
|
+
#
|
403
|
+
# @overload update_log_metric(request, options = nil)
|
404
|
+
# Pass arguments to `update_log_metric` via a request object, either of type
|
405
|
+
# {::Google::Cloud::Logging::V2::UpdateLogMetricRequest} or an equivalent Hash.
|
406
|
+
#
|
407
|
+
# @param request [::Google::Cloud::Logging::V2::UpdateLogMetricRequest, ::Hash]
|
408
|
+
# A request object representing the call parameters. Required. To specify no
|
409
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
410
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
411
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
412
|
+
#
|
413
|
+
# @overload update_log_metric(metric_name: nil, metric: nil)
|
414
|
+
# Pass arguments to `update_log_metric` via keyword arguments. Note that at
|
415
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
416
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
417
|
+
#
|
418
|
+
# @param metric_name [::String]
|
419
|
+
# Required. The resource name of the metric to update:
|
420
|
+
#
|
421
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
422
|
+
#
|
423
|
+
# The updated metric must be provided in the request and it's
|
424
|
+
# `name` field must be the same as `[METRIC_ID]` If the metric
|
425
|
+
# does not exist in `[PROJECT_ID]`, then a new metric is created.
|
426
|
+
# @param metric [::Google::Cloud::Logging::V2::LogMetric, ::Hash]
|
427
|
+
# Required. The updated metric.
|
428
|
+
#
|
429
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
430
|
+
# @yieldparam response [::Google::Cloud::Logging::V2::LogMetric]
|
431
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
432
|
+
#
|
433
|
+
# @return [::Google::Cloud::Logging::V2::LogMetric]
|
434
|
+
#
|
435
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
436
|
+
#
|
437
|
+
def update_log_metric request, options = nil
|
438
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
439
|
+
|
440
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateLogMetricRequest
|
441
|
+
|
442
|
+
# Converts hash and nil to an options object
|
443
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
444
|
+
|
445
|
+
# Customize the options with defaults
|
446
|
+
metadata = @config.rpcs.update_log_metric.metadata.to_h
|
447
|
+
|
448
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
449
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
450
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
451
|
+
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
452
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
453
|
+
|
454
|
+
header_params = {
|
455
|
+
"metric_name" => request.metric_name
|
456
|
+
}
|
457
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
458
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
459
|
+
|
460
|
+
options.apply_defaults timeout: @config.rpcs.update_log_metric.timeout,
|
461
|
+
metadata: metadata,
|
462
|
+
retry_policy: @config.rpcs.update_log_metric.retry_policy
|
463
|
+
options.apply_defaults metadata: @config.metadata,
|
464
|
+
retry_policy: @config.retry_policy
|
465
|
+
|
466
|
+
@metrics_service_stub.call_rpc :update_log_metric, request, options: options do |response, operation|
|
467
|
+
yield response, operation if block_given?
|
468
|
+
return response
|
469
|
+
end
|
470
|
+
rescue ::GRPC::BadStatus => e
|
471
|
+
raise ::Google::Cloud::Error.from_error(e)
|
472
|
+
end
|
473
|
+
|
474
|
+
##
|
475
|
+
# Deletes a logs-based metric.
|
476
|
+
#
|
477
|
+
# @overload delete_log_metric(request, options = nil)
|
478
|
+
# Pass arguments to `delete_log_metric` via a request object, either of type
|
479
|
+
# {::Google::Cloud::Logging::V2::DeleteLogMetricRequest} or an equivalent Hash.
|
480
|
+
#
|
481
|
+
# @param request [::Google::Cloud::Logging::V2::DeleteLogMetricRequest, ::Hash]
|
482
|
+
# A request object representing the call parameters. Required. To specify no
|
483
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
484
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
485
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
486
|
+
#
|
487
|
+
# @overload delete_log_metric(metric_name: nil)
|
488
|
+
# Pass arguments to `delete_log_metric` via keyword arguments. Note that at
|
489
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
490
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
491
|
+
#
|
492
|
+
# @param metric_name [::String]
|
493
|
+
# Required. The resource name of the metric to delete:
|
494
|
+
#
|
495
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
496
|
+
#
|
497
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
498
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
499
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
500
|
+
#
|
501
|
+
# @return [::Google::Protobuf::Empty]
|
502
|
+
#
|
503
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
504
|
+
#
|
505
|
+
def delete_log_metric request, options = nil
|
506
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
507
|
+
|
508
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteLogMetricRequest
|
509
|
+
|
510
|
+
# Converts hash and nil to an options object
|
511
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
512
|
+
|
513
|
+
# Customize the options with defaults
|
514
|
+
metadata = @config.rpcs.delete_log_metric.metadata.to_h
|
515
|
+
|
516
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
517
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
518
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
519
|
+
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
520
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
521
|
+
|
522
|
+
header_params = {
|
523
|
+
"metric_name" => request.metric_name
|
524
|
+
}
|
525
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
526
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
527
|
+
|
528
|
+
options.apply_defaults timeout: @config.rpcs.delete_log_metric.timeout,
|
529
|
+
metadata: metadata,
|
530
|
+
retry_policy: @config.rpcs.delete_log_metric.retry_policy
|
531
|
+
options.apply_defaults metadata: @config.metadata,
|
532
|
+
retry_policy: @config.retry_policy
|
533
|
+
|
534
|
+
@metrics_service_stub.call_rpc :delete_log_metric, request, options: options do |response, operation|
|
535
|
+
yield response, operation if block_given?
|
536
|
+
return response
|
537
|
+
end
|
538
|
+
rescue ::GRPC::BadStatus => e
|
539
|
+
raise ::Google::Cloud::Error.from_error(e)
|
540
|
+
end
|
541
|
+
|
542
|
+
##
|
543
|
+
# Configuration class for the MetricsService API.
|
544
|
+
#
|
545
|
+
# This class represents the configuration for MetricsService,
|
546
|
+
# providing control over timeouts, retry behavior, logging, transport
|
547
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
548
|
+
# applied individually to specific RPCs. See
|
549
|
+
# {::Google::Cloud::Logging::V2::MetricsService::Client::Configuration::Rpcs}
|
550
|
+
# for a list of RPCs that can be configured independently.
|
551
|
+
#
|
552
|
+
# Configuration can be applied globally to all clients, or to a single client
|
553
|
+
# on construction.
|
554
|
+
#
|
555
|
+
# # Examples
|
556
|
+
#
|
557
|
+
# To modify the global config, setting the timeout for list_log_metrics
|
558
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
559
|
+
#
|
560
|
+
# ::Google::Cloud::Logging::V2::MetricsService::Client.configure do |config|
|
561
|
+
# config.timeout = 10.0
|
562
|
+
# config.rpcs.list_log_metrics.timeout = 20.0
|
563
|
+
# end
|
564
|
+
#
|
565
|
+
# To apply the above configuration only to a new client:
|
566
|
+
#
|
567
|
+
# client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
|
568
|
+
# config.timeout = 10.0
|
569
|
+
# config.rpcs.list_log_metrics.timeout = 20.0
|
570
|
+
# end
|
571
|
+
#
|
572
|
+
# @!attribute [rw] endpoint
|
573
|
+
# The hostname or hostname:port of the service endpoint.
|
574
|
+
# Defaults to `"logging.googleapis.com"`.
|
575
|
+
# @return [::String]
|
576
|
+
# @!attribute [rw] credentials
|
577
|
+
# Credentials to send with calls. You may provide any of the following types:
|
578
|
+
# * (`String`) The path to a service account key file in JSON format
|
579
|
+
# * (`Hash`) A service account key as a Hash
|
580
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
581
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
582
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
583
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
584
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
585
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
586
|
+
# * (`nil`) indicating no credentials
|
587
|
+
# @return [::Object]
|
588
|
+
# @!attribute [rw] scope
|
589
|
+
# The OAuth scopes
|
590
|
+
# @return [::Array<::String>]
|
591
|
+
# @!attribute [rw] lib_name
|
592
|
+
# The library name as recorded in instrumentation and logging
|
593
|
+
# @return [::String]
|
594
|
+
# @!attribute [rw] lib_version
|
595
|
+
# The library version as recorded in instrumentation and logging
|
596
|
+
# @return [::String]
|
597
|
+
# @!attribute [rw] channel_args
|
598
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
599
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
600
|
+
# @return [::Hash]
|
601
|
+
# @!attribute [rw] interceptors
|
602
|
+
# An array of interceptors that are run before calls are executed.
|
603
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
604
|
+
# @!attribute [rw] timeout
|
605
|
+
# The call timeout in seconds.
|
606
|
+
# @return [::Numeric]
|
607
|
+
# @!attribute [rw] metadata
|
608
|
+
# Additional gRPC headers to be sent with the call.
|
609
|
+
# @return [::Hash{::Symbol=>::String}]
|
610
|
+
# @!attribute [rw] retry_policy
|
611
|
+
# The retry policy. The value is a hash with the following keys:
|
612
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
613
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
614
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
615
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
616
|
+
# trigger a retry.
|
617
|
+
# @return [::Hash]
|
618
|
+
# @!attribute [rw] quota_project
|
619
|
+
# A separate project against which to charge quota.
|
620
|
+
# @return [::String]
|
621
|
+
#
|
622
|
+
class Configuration
|
623
|
+
extend ::Gapic::Config
|
624
|
+
|
625
|
+
config_attr :endpoint, "logging.googleapis.com", ::String
|
626
|
+
config_attr :credentials, nil do |value|
|
627
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
628
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
629
|
+
allowed.any? { |klass| klass === value }
|
630
|
+
end
|
631
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
632
|
+
config_attr :lib_name, nil, ::String, nil
|
633
|
+
config_attr :lib_version, nil, ::String, nil
|
634
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
635
|
+
config_attr :interceptors, nil, ::Array, nil
|
636
|
+
config_attr :timeout, nil, ::Numeric, nil
|
637
|
+
config_attr :metadata, nil, ::Hash, nil
|
638
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
639
|
+
config_attr :quota_project, nil, ::String, nil
|
640
|
+
|
641
|
+
# @private
|
642
|
+
def initialize parent_config = nil
|
643
|
+
@parent_config = parent_config unless parent_config.nil?
|
644
|
+
|
645
|
+
yield self if block_given?
|
646
|
+
end
|
647
|
+
|
648
|
+
##
|
649
|
+
# Configurations for individual RPCs
|
650
|
+
# @return [Rpcs]
|
651
|
+
#
|
652
|
+
def rpcs
|
653
|
+
@rpcs ||= begin
|
654
|
+
parent_rpcs = nil
|
655
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
656
|
+
Rpcs.new parent_rpcs
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
##
|
661
|
+
# Configuration RPC class for the MetricsService API.
|
662
|
+
#
|
663
|
+
# Includes fields providing the configuration for each RPC in this service.
|
664
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
665
|
+
# the following configuration fields:
|
666
|
+
#
|
667
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
668
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
669
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
670
|
+
# include the following keys:
|
671
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
672
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
673
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
674
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
675
|
+
# trigger a retry.
|
676
|
+
#
|
677
|
+
class Rpcs
|
678
|
+
##
|
679
|
+
# RPC-specific configuration for `list_log_metrics`
|
680
|
+
# @return [::Gapic::Config::Method]
|
681
|
+
#
|
682
|
+
attr_reader :list_log_metrics
|
683
|
+
##
|
684
|
+
# RPC-specific configuration for `get_log_metric`
|
685
|
+
# @return [::Gapic::Config::Method]
|
686
|
+
#
|
687
|
+
attr_reader :get_log_metric
|
688
|
+
##
|
689
|
+
# RPC-specific configuration for `create_log_metric`
|
690
|
+
# @return [::Gapic::Config::Method]
|
691
|
+
#
|
692
|
+
attr_reader :create_log_metric
|
693
|
+
##
|
694
|
+
# RPC-specific configuration for `update_log_metric`
|
695
|
+
# @return [::Gapic::Config::Method]
|
696
|
+
#
|
697
|
+
attr_reader :update_log_metric
|
698
|
+
##
|
699
|
+
# RPC-specific configuration for `delete_log_metric`
|
700
|
+
# @return [::Gapic::Config::Method]
|
701
|
+
#
|
702
|
+
attr_reader :delete_log_metric
|
703
|
+
|
704
|
+
# @private
|
705
|
+
def initialize parent_rpcs = nil
|
706
|
+
list_log_metrics_config = parent_rpcs&.list_log_metrics if parent_rpcs&.respond_to? :list_log_metrics
|
707
|
+
@list_log_metrics = ::Gapic::Config::Method.new list_log_metrics_config
|
708
|
+
get_log_metric_config = parent_rpcs&.get_log_metric if parent_rpcs&.respond_to? :get_log_metric
|
709
|
+
@get_log_metric = ::Gapic::Config::Method.new get_log_metric_config
|
710
|
+
create_log_metric_config = parent_rpcs&.create_log_metric if parent_rpcs&.respond_to? :create_log_metric
|
711
|
+
@create_log_metric = ::Gapic::Config::Method.new create_log_metric_config
|
712
|
+
update_log_metric_config = parent_rpcs&.update_log_metric if parent_rpcs&.respond_to? :update_log_metric
|
713
|
+
@update_log_metric = ::Gapic::Config::Method.new update_log_metric_config
|
714
|
+
delete_log_metric_config = parent_rpcs&.delete_log_metric if parent_rpcs&.respond_to? :delete_log_metric
|
715
|
+
@delete_log_metric = ::Gapic::Config::Method.new delete_log_metric_config
|
716
|
+
|
717
|
+
yield self if block_given?
|
718
|
+
end
|
719
|
+
end
|
720
|
+
end
|
721
|
+
end
|
722
|
+
end
|
723
|
+
end
|
724
|
+
end
|
725
|
+
end
|
726
|
+
end
|