google-cloud-monitoring 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +15 -33
- data/lib/google/cloud/monitoring/metrics_scope/version.rb +29 -0
- data/lib/google/cloud/monitoring/metrics_scope.rb +118 -0
- data/lib/google/cloud/monitoring/version.rb +1 -1
- data/lib/google-cloud-monitoring.rb +1 -0
- metadata +43 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66639e64cfad9b7da02a3d25c66ba7c9d2a86f171a9f8d85c3d99eed8782336e
|
4
|
+
data.tar.gz: 65a25266f3b4d772ec55fb21b0ba93e2a4c239e9856bde74c46e85319b574069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8be40c008098f622d1765af3871244bcf05d474074cecf22102bca962e6644f38a056a9c79168eaeb192ed18d5a55ebffac109955243045f6303ed341b3417e6
|
7
|
+
data.tar.gz: f21c596ef743858a1001e453b3c8776975b1cf0b815c425410a3aab377923dda0b0843a525fc4d307ca8321284de5f08c8ec11b8e76d996f05a40131841be440
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-monitoring
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
67
|
`::Google::Cloud::Monitoring::V3::AlertPolicyService::Credentials`):
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* `MONITORING_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
|
+
* `MONITORING_KEYFILE` - Path to JSON file, or JSON contents
|
71
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
72
|
+
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
73
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
require "google/cloud/monitoring"
|
@@ -82,8 +82,8 @@ client = Google::Cloud::Monitoring.alert_policy_service
|
|
82
82
|
|
83
83
|
### Configuration
|
84
84
|
|
85
|
-
The **Credentials JSON** can be configured instead of
|
86
|
-
environment
|
85
|
+
The path to the **Credentials JSON** file can be configured instead of storing
|
86
|
+
it in an environment variable. Either on an individual client initialization:
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/monitoring"
|
@@ -93,7 +93,7 @@ client = Google::Cloud::Monitoring.alert_policy_service do |config|
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
-
Or
|
96
|
+
Or globally for all clients:
|
97
97
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/monitoring"
|
@@ -120,15 +120,6 @@ To configure your system for this, simply:
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
121
121
|
*should* only be used during development.
|
122
122
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
125
|
-
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
127
|
-
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
131
|
-
|
132
123
|
## Creating a Service Account
|
133
124
|
|
134
125
|
Google Cloud requires **Service Account Credentials** to
|
@@ -139,31 +130,22 @@ If you are not running this client within
|
|
139
130
|
[Google Cloud Platform environments](#google-cloud-platform-environments), you
|
140
131
|
need a Google Developers service account.
|
141
132
|
|
142
|
-
1. Visit the [Google
|
133
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
143
134
|
2. Create a new project or click on an existing project.
|
144
|
-
3. Activate the
|
135
|
+
3. Activate the menu in the upper left and select **APIs & Services**. From
|
145
136
|
here, you will enable the APIs that your application requires.
|
146
137
|
|
147
|
-
![Enable the APIs that your application requires][enable-apis]
|
148
|
-
|
149
138
|
*Note: You may need to enable billing in order to use these services.*
|
150
139
|
|
151
140
|
4. Select **Credentials** from the side navigation.
|
152
141
|
|
153
|
-
|
154
|
-
|
155
|
-
![Create a new service account][create-new-service-account]
|
156
|
-
|
157
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
158
|
-
|
159
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
160
|
-
guided through downloading a new JSON key file.
|
142
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
143
|
+
"Service account" to be guided through downloading a new JSON key file.
|
161
144
|
|
162
145
|
If you want to re-use an existing service account, you can easily generate a
|
163
|
-
new key file. Just select the account you wish to re-use,
|
164
|
-
|
165
|
-
|
166
|
-
![Re-use an existing service account][reuse-service-account]
|
146
|
+
new key file. Just select the account you wish to re-use, click the pencil
|
147
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
148
|
+
and then select **Add Key**.
|
167
149
|
|
168
150
|
The key file you download will be used by this library to authenticate API
|
169
151
|
requests and should be stored in a secure location.
|
@@ -0,0 +1,29 @@
|
|
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 Monitoring
|
23
|
+
module MetricsScope
|
24
|
+
# @private
|
25
|
+
VERSION = ""
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 this file early so that the version constant gets defined before
|
20
|
+
# requiring "google/cloud". This is because google-cloud-core will load the
|
21
|
+
# entrypoint (gem name) file, which in turn re-requires this file (hence
|
22
|
+
# causing a require cycle) unless the version constant is already defined.
|
23
|
+
require "google/cloud/monitoring/metrics_scope/version"
|
24
|
+
|
25
|
+
require "googleauth"
|
26
|
+
gem "google-cloud-core"
|
27
|
+
require "google/cloud" unless defined? ::Google::Cloud.new
|
28
|
+
require "google/cloud/config"
|
29
|
+
|
30
|
+
# Set the default configuration
|
31
|
+
::Google::Cloud.configure.add_config! :monitoring_metrics_scope do |config|
|
32
|
+
config.add_field! :endpoint, "monitoring.googleapis.com", match: ::String
|
33
|
+
config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
|
34
|
+
config.add_field! :scope, nil, match: [::Array, ::String]
|
35
|
+
config.add_field! :lib_name, nil, match: ::String
|
36
|
+
config.add_field! :lib_version, nil, match: ::String
|
37
|
+
config.add_field! :interceptors, nil, match: ::Array
|
38
|
+
config.add_field! :timeout, nil, match: ::Numeric
|
39
|
+
config.add_field! :metadata, nil, match: ::Hash
|
40
|
+
config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
|
41
|
+
config.add_field! :quota_project, nil, match: ::String
|
42
|
+
end
|
43
|
+
|
44
|
+
module Google
|
45
|
+
module Cloud
|
46
|
+
module Monitoring
|
47
|
+
module MetricsScope
|
48
|
+
##
|
49
|
+
# Create a new client object for MetricsScopes.
|
50
|
+
#
|
51
|
+
# By default, this returns an instance of
|
52
|
+
# [Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client](https://googleapis.dev/ruby/google-cloud-monitoring-metrics_scope-v1/latest/Google/Cloud/Monitoring/MetricsScope/V1/MetricsScopes/Client.html)
|
53
|
+
# for version V1 of the API.
|
54
|
+
# However, you can specify specify a different API version by passing it in the
|
55
|
+
# `version` parameter. If the MetricsScopes service is
|
56
|
+
# supported by that API version, and the corresponding gem is available, the
|
57
|
+
# appropriate versioned client will be returned.
|
58
|
+
#
|
59
|
+
# ## About MetricsScopes
|
60
|
+
#
|
61
|
+
# Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
|
62
|
+
# projects and AWS accounts.
|
63
|
+
#
|
64
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
65
|
+
# Defaults to `:v1`.
|
66
|
+
# @return [MetricsScopes::Client] A client object for the specified version.
|
67
|
+
#
|
68
|
+
def self.metrics_scopes version: :v1, &block
|
69
|
+
require "google/cloud/monitoring/metrics_scope/#{version.to_s.downcase}"
|
70
|
+
|
71
|
+
package_name = Google::Cloud::Monitoring::MetricsScope
|
72
|
+
.constants
|
73
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
74
|
+
.first
|
75
|
+
package_module = Google::Cloud::Monitoring::MetricsScope.const_get package_name
|
76
|
+
package_module.const_get(:MetricsScopes).const_get(:Client).new(&block)
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Configure the google-cloud-monitoring-metrics_scope library.
|
81
|
+
#
|
82
|
+
# The following configuration parameters are supported:
|
83
|
+
#
|
84
|
+
# * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
|
85
|
+
# The path to the keyfile as a String, the contents of the keyfile as a
|
86
|
+
# Hash, or a Google::Auth::Credentials object.
|
87
|
+
# * `lib_name` (*type:* `String`) -
|
88
|
+
# The library name as recorded in instrumentation and logging.
|
89
|
+
# * `lib_version` (*type:* `String`) -
|
90
|
+
# The library version as recorded in instrumentation and logging.
|
91
|
+
# * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
|
92
|
+
# An array of interceptors that are run before calls are executed.
|
93
|
+
# * `timeout` (*type:* `Numeric`) -
|
94
|
+
# Default timeout in seconds.
|
95
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) -
|
96
|
+
# Additional gRPC headers to be sent with the call.
|
97
|
+
# * `retry_policy` (*type:* `Hash`) -
|
98
|
+
# The retry policy. The value is a hash with the following keys:
|
99
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
100
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
101
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
102
|
+
# * `:retry_codes` (*type:* `Array<String>`) -
|
103
|
+
# The error codes that should trigger a retry.
|
104
|
+
#
|
105
|
+
# @return [::Google::Cloud::Config] The default configuration used by this library
|
106
|
+
#
|
107
|
+
def self.configure
|
108
|
+
yield ::Google::Cloud.configure.monitoring_metrics_scope if block_given?
|
109
|
+
|
110
|
+
::Google::Cloud.configure.monitoring_metrics_scope
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
helper_path = ::File.join __dir__, "metrics_scope", "helpers.rb"
|
118
|
+
require "google/cloud/monitoring/metrics_scope/helpers" if ::File.file? helper_path
|
@@ -18,3 +18,4 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/monitoring" unless defined? Google::Cloud::Monitoring::VERSION
|
20
20
|
require "google/cloud/monitoring/dashboard" unless defined? Google::Cloud::Monitoring::Dashboard::VERSION
|
21
|
+
require "google/cloud/monitoring/metrics_scope" unless defined? Google::Cloud::Monitoring::MetricsScope::VERSION
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -16,42 +16,74 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: google-cloud-monitoring-v3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.4'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.a
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '0.4'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.a
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: google-cloud-monitoring-dashboard-v1
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0.5'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.a
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- - "
|
61
|
+
- - ">="
|
53
62
|
- !ruby/object:Gem::Version
|
54
63
|
version: '0.5'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.a
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: google-cloud-monitoring-metrics_scope-v1
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.0'
|
74
|
+
- - "<"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.a
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.0'
|
84
|
+
- - "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.a
|
55
87
|
- !ruby/object:Gem::Dependency
|
56
88
|
name: google-style
|
57
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +212,8 @@ files:
|
|
180
212
|
- lib/google/cloud/monitoring.rb
|
181
213
|
- lib/google/cloud/monitoring/dashboard.rb
|
182
214
|
- lib/google/cloud/monitoring/dashboard/version.rb
|
215
|
+
- lib/google/cloud/monitoring/metrics_scope.rb
|
216
|
+
- lib/google/cloud/monitoring/metrics_scope/version.rb
|
183
217
|
- lib/google/cloud/monitoring/version.rb
|
184
218
|
homepage: https://github.com/googleapis/google-cloud-ruby
|
185
219
|
licenses:
|
@@ -200,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
234
|
- !ruby/object:Gem::Version
|
201
235
|
version: '0'
|
202
236
|
requirements: []
|
203
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.3.4
|
204
238
|
signing_key:
|
205
239
|
specification_version: 4
|
206
240
|
summary: API Client library for the Cloud Monitoring API
|