google-cloud-asset 1.0.1 → 1.1.3
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/AUTHENTICATION.md +1 -1
- data/MIGRATING.md +52 -6
- data/README.md +1 -1
- data/lib/google-cloud-asset.rb +1 -1
- data/lib/google/cloud/asset.rb +26 -15
- data/lib/google/cloud/asset/version.rb +1 -1
- metadata +20 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09db442c372ae41d87689be2a298aaa634c05cdcbc418de411c3fb75921bf66b'
|
4
|
+
data.tar.gz: 0caeffa7b03849c8d41cfb9bc8174c0f65995699649264040bb926f66fedd2fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb6070eeb6136af6f131038df8a55e68e5a361af36ac132cd204654c34d21fd9b5cb9f295f6e20486ef1b76811ddfb1d74f1b701f5ae00332287a492b68d1e80
|
7
|
+
data.tar.gz: c152e5cb3256c97824684ba398387301504e39b09f48721f58a5ca723a372f4cd72e05e745c3b136debe5e7aeec7ab7f41ed6ec8e0bf3dfdd3e435f85cac7697
|
data/AUTHENTICATION.md
CHANGED
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
|
|
64
64
|
|
65
65
|
The environment variables that google-cloud-asset
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
|
67
|
+
`::Google::Cloud::Asset::V1::AssetService::Credentials`):
|
68
68
|
|
69
69
|
1. `ASSET_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
70
|
2. `ASSET_KEYFILE` - Path to JSON file, or JSON contents
|
data/MIGRATING.md
CHANGED
@@ -29,6 +29,10 @@ To summarize:
|
|
29
29
|
resource paths. These paths are now instance methods on the client objects,
|
30
30
|
and are also available in a separate paths module. See
|
31
31
|
[Resource Path Helpers](#resource-path-helpers) for more info.
|
32
|
+
* Previously, clients reported RPC errors by raising instances of
|
33
|
+
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
34
|
+
`Google::Cloud::Error` and its subclasses. See
|
35
|
+
[Handling Errors](#handling-errors) for more info.
|
32
36
|
* Some classes have moved into different namespaces. See
|
33
37
|
[Class Namespaces](#class-namespaces) for more info.
|
34
38
|
|
@@ -74,7 +78,7 @@ timeout for all Asset V1 clients:
|
|
74
78
|
```
|
75
79
|
Google::Cloud::Asset::V1::AssetService::Client.configure do |config|
|
76
80
|
config.credentials = "/path/to/credentials.json"
|
77
|
-
config.timeout =
|
81
|
+
config.timeout = 10.0
|
78
82
|
end
|
79
83
|
```
|
80
84
|
|
@@ -83,7 +87,7 @@ timeout for the `create_feed` call:
|
|
83
87
|
|
84
88
|
```
|
85
89
|
Google::Cloud::Asset::V1::AssetService::Client.configure do |config|
|
86
|
-
config.rpcs.create_feed.timeout =
|
90
|
+
config.rpcs.create_feed.timeout = 20.0
|
87
91
|
end
|
88
92
|
```
|
89
93
|
|
@@ -93,7 +97,7 @@ services globally:
|
|
93
97
|
```
|
94
98
|
Google::Cloud::Asset.configure do |config|
|
95
99
|
config.credentials = "/path/to/credentials.json"
|
96
|
-
config.timeout =
|
100
|
+
config.timeout = 10.0
|
97
101
|
end
|
98
102
|
```
|
99
103
|
|
@@ -181,7 +185,7 @@ client = Google::Cloud::Asset.new
|
|
181
185
|
|
182
186
|
name = "projects/my-project/feeds/my-feed"
|
183
187
|
|
184
|
-
options = Google::Gax::CallOptions.new timeout:
|
188
|
+
options = Google::Gax::CallOptions.new timeout: 10.0
|
185
189
|
|
186
190
|
response = client.get_feed name, options: options
|
187
191
|
```
|
@@ -194,7 +198,7 @@ name = "projects/my-project/feeds/my-feed"
|
|
194
198
|
|
195
199
|
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
196
200
|
# then add further keyword arguments for the call options.
|
197
|
-
response = client.get_feed({ name: name }, timeout:
|
201
|
+
response = client.get_feed({ name: name }, timeout: 10.0)
|
198
202
|
```
|
199
203
|
|
200
204
|
### Resource Path Helpers
|
@@ -254,7 +258,7 @@ Finally, in the 1.0 client, you can also use the paths module as a convenience m
|
|
254
258
|
|
255
259
|
New:
|
256
260
|
```
|
257
|
-
# Bring the
|
261
|
+
# Bring the path helper methods into the current class
|
258
262
|
include Google::Cloud::Asset::V1::AssetService::Paths
|
259
263
|
|
260
264
|
def foo
|
@@ -269,6 +273,48 @@ def foo
|
|
269
273
|
end
|
270
274
|
```
|
271
275
|
|
276
|
+
### Handling Errors
|
277
|
+
|
278
|
+
The client reports standard
|
279
|
+
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
280
|
+
by raising exceptions. In older releases, these exceptions were located in the
|
281
|
+
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
282
|
+
exception class, defined in the `google-gax` gem. However, these classes were
|
283
|
+
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
284
|
+
thrown by other client libraries such as `google-cloud-storage`.
|
285
|
+
|
286
|
+
The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy
|
287
|
+
for consistency across all the Google Cloud client libraries. In general, these
|
288
|
+
exceptions have the same name as their counterparts from older releases, but
|
289
|
+
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
290
|
+
namespace.
|
291
|
+
|
292
|
+
Old:
|
293
|
+
```
|
294
|
+
client = Google::Cloud::Asset.new
|
295
|
+
|
296
|
+
name = "projects/my-project/feeds/my-feed"
|
297
|
+
|
298
|
+
begin
|
299
|
+
client.get_feed name
|
300
|
+
rescue Google::Gax::Error => e
|
301
|
+
# Handle exceptions that subclass Google::Gax::Error
|
302
|
+
end
|
303
|
+
```
|
304
|
+
|
305
|
+
New:
|
306
|
+
```
|
307
|
+
client = Google::Cloud::Asset.asset_service
|
308
|
+
|
309
|
+
name = "projects/my-project/feeds/my-feed"
|
310
|
+
|
311
|
+
begin
|
312
|
+
client.get_feed name: name
|
313
|
+
rescue Google::Cloud::Error => e
|
314
|
+
# Handle exceptions that subclass Google::Cloud::Error
|
315
|
+
end
|
316
|
+
```
|
317
|
+
|
272
318
|
### Class Namespaces
|
273
319
|
|
274
320
|
In older releases, the client object was of classes with names like:
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ client gems:
|
|
18
18
|
[google-cloud-asset-v1](https://googleapis.dev/ruby/google-cloud-asset-v1/latest),
|
19
19
|
[google-cloud-asset-v1beta1](https://googleapis.dev/ruby/google-cloud-asset-v1beta1/latest).
|
20
20
|
|
21
|
-
See also the [Product Documentation](https://cloud.google.com/
|
21
|
+
See also the [Product Documentation](https://cloud.google.com/asset-inventory/)
|
22
22
|
for more usage information.
|
23
23
|
|
24
24
|
## Quick Start
|
data/lib/google-cloud-asset.rb
CHANGED
data/lib/google/cloud/asset.rb
CHANGED
@@ -16,21 +16,29 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
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.
|
19
23
|
require "google/cloud/asset/version"
|
24
|
+
|
20
25
|
require "googleauth"
|
21
26
|
gem "google-cloud-core"
|
22
|
-
require "google/cloud" unless defined? Google::Cloud.new
|
27
|
+
require "google/cloud" unless defined? ::Google::Cloud.new
|
23
28
|
require "google/cloud/config"
|
24
29
|
|
25
30
|
# Set the default configuration
|
26
|
-
Google::Cloud.configure.add_config! :asset do |config|
|
27
|
-
config.add_field! :
|
28
|
-
config.add_field! :
|
29
|
-
config.add_field! :
|
30
|
-
config.add_field! :
|
31
|
-
config.add_field! :
|
32
|
-
config.add_field! :
|
33
|
-
config.add_field! :
|
31
|
+
::Google::Cloud.configure.add_config! :asset do |config|
|
32
|
+
config.add_field! :endpoint, "cloudasset.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
|
34
42
|
end
|
35
43
|
|
36
44
|
module Google
|
@@ -51,7 +59,7 @@ module Google
|
|
51
59
|
#
|
52
60
|
# Asset service definition.
|
53
61
|
#
|
54
|
-
# @param version [String, Symbol] The API version to connect to. Optional.
|
62
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
55
63
|
# Defaults to `:v1`.
|
56
64
|
# @return [AssetService::Client] A client object for the specified version.
|
57
65
|
#
|
@@ -80,8 +88,8 @@ module Google
|
|
80
88
|
# The library version as recorded in instrumentation and logging.
|
81
89
|
# * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
|
82
90
|
# An array of interceptors that are run before calls are executed.
|
83
|
-
# * `timeout` (*type:* `
|
84
|
-
# Default timeout in
|
91
|
+
# * `timeout` (*type:* `Numeric`) -
|
92
|
+
# Default timeout in seconds.
|
85
93
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) -
|
86
94
|
# Additional gRPC headers to be sent with the call.
|
87
95
|
# * `retry_policy` (*type:* `Hash`) -
|
@@ -92,13 +100,16 @@ module Google
|
|
92
100
|
# * `:retry_codes` (*type:* `Array<String>`) -
|
93
101
|
# The error codes that should trigger a retry.
|
94
102
|
#
|
95
|
-
# @return [Google::Cloud::Config] The default configuration used by this library
|
103
|
+
# @return [::Google::Cloud::Config] The default configuration used by this library
|
96
104
|
#
|
97
105
|
def self.configure
|
98
|
-
yield Google::Cloud.configure.asset if block_given?
|
106
|
+
yield ::Google::Cloud.configure.asset if block_given?
|
99
107
|
|
100
|
-
Google::Cloud.configure.asset
|
108
|
+
::Google::Cloud.configure.asset
|
101
109
|
end
|
102
110
|
end
|
103
111
|
end
|
104
112
|
end
|
113
|
+
|
114
|
+
helper_path = ::File.join __dir__, "asset", "helpers.rb"
|
115
|
+
require "google/cloud/asset/helpers" if ::File.file? helper_path
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-asset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
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: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: google-cloud-core
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.5'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.5'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: google-cloud-asset-v1
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +39,19 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: google-cloud-core
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
62
|
-
type: :
|
47
|
+
version: '1.5'
|
48
|
+
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
54
|
+
version: '1.5'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: google-style
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,56 +72,56 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '5.
|
75
|
+
version: '5.14'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '5.
|
82
|
+
version: '5.14'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: minitest-
|
84
|
+
name: minitest-focus
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
89
|
+
version: '1.1'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
96
|
+
version: '1.1'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: minitest-
|
98
|
+
name: minitest-rg
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
103
|
+
version: '5.2'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
110
|
+
version: '5.2'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: rake
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- - "
|
115
|
+
- - ">="
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
117
|
+
version: '12.0'
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- - "
|
122
|
+
- - ">="
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
124
|
+
version: '12.0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: redcarpet
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
198
|
- !ruby/object:Gem::Version
|
213
199
|
version: '0'
|
214
200
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
201
|
+
rubygems_version: 3.2.6
|
216
202
|
signing_key:
|
217
203
|
specification_version: 4
|
218
204
|
summary: API Client library for the Cloud Asset API
|