google-cloud-asset 1.0.0 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1326f3bb22f3ef57697020d4f2be2fc411c036b12746b90b88c9e91b531f0d1
4
- data.tar.gz: a49e38dd8b599b7dc54cd9652fc4e5d824437c3db24eeaa999ed5d6072cb38df
3
+ metadata.gz: 6cd87f8eaedc875f454480b6b5d85f6e3f547e4e1c64bb1c80ce781dc1d50d16
4
+ data.tar.gz: fb37930d60d110953639d0358ee2fd6898a6ba2f1d347ff360e0a3dac4f8bd40
5
5
  SHA512:
6
- metadata.gz: '029240682af7151bf6e3e9cfe249bb6b2e13e817c56389bb91abc2800d87d3e5d4e81ebce3779d2ef67b9e14f7196ed3fd81437ad1a2d6c2cba718f165245aab'
7
- data.tar.gz: 3b8147d31606ade4c5ea06879758b27a0bc45cf85694a92816aad49b84e500f2b6e1486ac054abec913e4d2356f32ed4c04755872ded0fcd6fe8ee60bfb999ce
6
+ metadata.gz: ba3cdf950e6346d608b35fd6e924c3d2540d906f86fe574933f414725c6659bd109a9338d1bb37fe20a90deb861a2ddc55604d31c987077e0aacdb6a61cada45
7
+ data.tar.gz: ffcce1167e59b3488fc5bb51c20c8b3986e8fd35993bb3e0f1ca087cea792fd02a5f2219a44c870664b5db3551c02c113f946ca4f15d2f9e5c497c03d66b7265
@@ -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
- `Google::Cloud::Asset::V1::AssetService::Credentials`):
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
@@ -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 = 10_000
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 = 20_000
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 = 10_000
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: 10_000
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: 10_000)
201
+ response = client.get_feed({ name: name }, timeout: 10.0)
198
202
  ```
199
203
 
200
204
  ### Resource Path Helpers
@@ -234,11 +238,27 @@ name = client.feed_path project: "my-project", feed: "my-feed"
234
238
  response = client.get_feed name: name
235
239
  ```
236
240
 
237
- In the 1.0 client, you can also use the paths module as a convenience module.
241
+ Because helpers take keyword arguments, some can now generate several different
242
+ variations on the path that were not available under earlier versions of the
243
+ library. For example, `feed_path` can generate paths with either a folder or
244
+ organziation as the parent resource.
238
245
 
239
246
  New:
240
247
  ```
241
- # Bring the session_path method into the current class
248
+ client = Google::Cloud::Asset.asset_service
249
+
250
+ # Create paths with different parent resource types
251
+ name2 = client.feed_path folder: "my-folder", feed: "my-feed"
252
+ # => "folders/my-folder/feeds/my-feed"
253
+ name3 = client.feed_path organization: "my-org", feed: "my-feed"
254
+ # => "organizations/my-org/feeds/my-feed"
255
+ ```
256
+
257
+ Finally, in the 1.0 client, you can also use the paths module as a convenience module.
258
+
259
+ New:
260
+ ```
261
+ # Bring the path helper methods into the current class
242
262
  include Google::Cloud::Asset::V1::AssetService::Paths
243
263
 
244
264
  def foo
@@ -253,6 +273,48 @@ def foo
253
273
  end
254
274
  ```
255
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
+
256
318
  ### Class Namespaces
257
319
 
258
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/resource-manager)
21
+ See also the [Product Documentation](https://cloud.google.com/asset-inventory/)
22
22
  for more usage information.
23
23
 
24
24
  ## Quick Start
@@ -16,4 +16,4 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "google/cloud/asset"
19
+ require "google/cloud/asset" unless defined? Google::Cloud::Asset::VERSION
@@ -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! :credentials, nil, match: [String, Hash, Google::Auth::Credentials]
28
- config.add_field! :lib_name, nil, match: String
29
- config.add_field! :lib_version, nil, match: String
30
- config.add_field! :interceptors, nil, match: Array
31
- config.add_field! :timeout, nil, match: Numeric
32
- config.add_field! :metadata, nil, match: Hash
33
- config.add_field! :retry_policy, nil, match: [Hash, Proc]
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
  #
@@ -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
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Asset
19
- VERSION = "1.0.0".freeze
19
+ VERSION = "1.1.2".freeze
20
20
  end
21
21
  end
22
22
  end
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.0.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-16 00:00:00.000000000 Z
11
+ date: 2020-06-18 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: autotest-suffix
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.1'
62
- type: :development
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.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.10'
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.10'
82
+ version: '5.14'
97
83
  - !ruby/object:Gem::Dependency
98
- name: minitest-autotest
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.0'
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.0'
96
+ version: '1.1'
111
97
  - !ruby/object:Gem::Dependency
112
- name: minitest-focus
98
+ name: minitest-rg
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '1.1'
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: '1.1'
110
+ version: '5.2'
125
111
  - !ruby/object:Gem::Dependency
126
- name: minitest-rg
112
+ name: rake
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - "~>"
115
+ - - ">="
130
116
  - !ruby/object:Gem::Version
131
- version: '5.2'
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: '5.2'
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.0.6
201
+ rubygems_version: 3.1.3
216
202
  signing_key:
217
203
  specification_version: 4
218
204
  summary: API Client library for the Cloud Asset API