google-cloud-web_risk 1.7.0 → 2.0.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 +0 -1
- data/README.md +3 -13
- data/lib/google/cloud/web_risk/version.rb +1 -1
- metadata +7 -34
- data/MIGRATING.md +0 -277
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 500e3cd716f44a7e6157b58c9072ca6b80ab1fca76d715a1ba0e3b57b5eb5001
|
4
|
+
data.tar.gz: 8d8b800f2f91f3ce1639a77a6e66d8fcf67f24277ca3817ce8acade4c11fd0f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51a7b2b453f755e0a1f45e4b8077da633327df9af4e091e2ce475ec3e30388a34fac53b8dec6c8312d371ab5078a6c6368c183b3eef89ff38302ed8ef64da38b
|
7
|
+
data.tar.gz: 8ae2cbe308de0ca65363e993079453a3ad08e4ac155620fed9992ceca176a53433956a9f64981d7acba7c09525e1f5cf329c2646c25b0d0ddefa80fe78cfa804
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Web Risk is an enterprise security product that lets your client applications ch
|
|
7
7
|
Actual client classes for the various versions of this API are defined in
|
8
8
|
_versioned_ client gems, with names of the form `google-cloud-web_risk-v*`.
|
9
9
|
The gem `google-cloud-web_risk` is the main client library that brings the
|
10
|
-
|
10
|
+
versioned gems in as dependencies, and provides high-level methods for
|
11
11
|
constructing clients. More information on versioned clients can be found below
|
12
12
|
in the section titled *Which client should I use?*.
|
13
13
|
|
@@ -16,8 +16,7 @@ for this library, google-cloud-web_risk, to see the convenience methods for
|
|
16
16
|
constructing client objects. Reference documentation for the client objects
|
17
17
|
themselves can be found in the client library documentation for the versioned
|
18
18
|
client gems:
|
19
|
-
[google-cloud-web_risk-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1/latest)
|
20
|
-
[google-cloud-web_risk-v1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1beta1/latest).
|
19
|
+
[google-cloud-web_risk-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1/latest).
|
21
20
|
|
22
21
|
See also the [Product Documentation](https://cloud.google.com/web-risk)
|
23
22
|
for more usage information.
|
@@ -35,14 +34,6 @@ In order to use this library, you first need to go through the following steps:
|
|
35
34
|
1. [Enable the API.](https://console.cloud.google.com/apis/library/webrisk.googleapis.com)
|
36
35
|
1. {file:AUTHENTICATION.md Set up authentication.}
|
37
36
|
|
38
|
-
## Migrating from 0.x versions
|
39
|
-
|
40
|
-
The 1.0 release of the google-cloud-web_risk client is a significant upgrade
|
41
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
42
|
-
and includes substantial interface changes. Existing code written for earlier
|
43
|
-
versions of this library will likely require updates to use this version.
|
44
|
-
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
45
|
-
|
46
37
|
## Debug Logging
|
47
38
|
|
48
39
|
This library comes with opt-in Debug Logging that can help you troubleshoot
|
@@ -71,8 +62,7 @@ results in logs appearing alongside your application logs in the
|
|
71
62
|
Debug logging also requires that the versioned clients for this service be
|
72
63
|
sufficiently recent, released after about Dec 10, 2024. If logging is not
|
73
64
|
working, try updating the versioned clients in your bundle or installed gems:
|
74
|
-
[google-cloud-web_risk-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1/latest)
|
75
|
-
[google-cloud-web_risk-v1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1beta1/latest).
|
65
|
+
[google-cloud-web_risk-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1/latest).
|
76
66
|
|
77
67
|
## Supported Ruby Versions
|
78
68
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-web_risk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: google-cloud-core
|
@@ -27,42 +27,16 @@ dependencies:
|
|
27
27
|
name: google-cloud-web_risk-v1
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0.11'
|
33
|
-
- - "<"
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 2.a
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0.11'
|
43
|
-
- - "<"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.a
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: google-cloud-web_risk-v1beta1
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0.9'
|
53
|
-
- - "<"
|
30
|
+
- - "~>"
|
54
31
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2
|
32
|
+
version: '1.2'
|
56
33
|
type: :runtime
|
57
34
|
prerelease: false
|
58
35
|
version_requirements: !ruby/object:Gem::Requirement
|
59
36
|
requirements:
|
60
|
-
- - "
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0.9'
|
63
|
-
- - "<"
|
37
|
+
- - "~>"
|
64
38
|
- !ruby/object:Gem::Version
|
65
|
-
version: 2
|
39
|
+
version: '1.2'
|
66
40
|
description: Web Risk is an enterprise security product that lets your client applications
|
67
41
|
check URLs against Google's constantly updated lists of unsafe web resources.
|
68
42
|
email: googleapis-packages@google.com
|
@@ -73,7 +47,6 @@ files:
|
|
73
47
|
- ".yardopts"
|
74
48
|
- AUTHENTICATION.md
|
75
49
|
- LICENSE.md
|
76
|
-
- MIGRATING.md
|
77
50
|
- README.md
|
78
51
|
- lib/google-cloud-web_risk.rb
|
79
52
|
- lib/google/cloud/web_risk.rb
|
@@ -96,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
69
|
- !ruby/object:Gem::Version
|
97
70
|
version: '0'
|
98
71
|
requirements: []
|
99
|
-
rubygems_version: 3.6.
|
72
|
+
rubygems_version: 3.6.8
|
100
73
|
specification_version: 4
|
101
74
|
summary: API Client library for the Web Risk API
|
102
75
|
test_files: []
|
data/MIGRATING.md
DELETED
@@ -1,277 +0,0 @@
|
|
1
|
-
## Migrating to google-cloud-web_risk 1.0
|
2
|
-
|
3
|
-
The `google-cloud-web_risk` gem is a significant upgrade over the older and now
|
4
|
-
deprecated `google-cloud-webrisk` gem. It is based on a
|
5
|
-
[next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
6
|
-
and includes substantial interface changes. Existing code written for the older
|
7
|
-
gem will likely require updates to use this version. This document describes
|
8
|
-
the changes that have been made, and what you need to do to update your usage.
|
9
|
-
|
10
|
-
To summarize:
|
11
|
-
|
12
|
-
* The new gem supports versions V1 and V1beta1 of the Web Risk service. The
|
13
|
-
older gem supported only V1beta1.
|
14
|
-
* The client has been broken out into multiple libraries. The new gems
|
15
|
-
`google-cloud-web_risk-v1` and `google-cloud-web_risk-v1beta1` contain the
|
16
|
-
actual client classes for versions V1 and V1beta1 of the Web Risk service,
|
17
|
-
and the gem `google-cloud-web_risk` provides a convenience wrapper.
|
18
|
-
See [Library Structure](#library-structure) for more info.
|
19
|
-
* Some classes have moved into different namespaces. In particular, the
|
20
|
-
`Google::Cloud::Webrisk` module has been renamed to `Google::Cloud::WebRisk`.
|
21
|
-
See [Class Namespaces](#class-namespaces) for more info.
|
22
|
-
* The library uses a new configuration mechanism giving you closer control
|
23
|
-
over endpoint address, network timeouts, and retry. See
|
24
|
-
[Client Configuration](#client-configuration) for more info. Furthermore,
|
25
|
-
when creating a client object, you can customize its configuration in a
|
26
|
-
block rather than passing arguments to the constructor. See
|
27
|
-
[Creating Clients](#creating-clients) for more info.
|
28
|
-
* Previously, positional arguments were used to indicate required arguments.
|
29
|
-
Now, all method arguments are keyword arguments, with documentation that
|
30
|
-
specifies whether they are required or optional. Additionally, you can pass
|
31
|
-
a proto request object instead of separate arguments. See
|
32
|
-
[Passing Arguments](#passing-arguments) for more info.
|
33
|
-
* Previously, clients reported RPC errors by raising instances of
|
34
|
-
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
35
|
-
`Google::Cloud::Error` and its subclasses. See
|
36
|
-
[Handling Errors](#handling-errors) for more info.
|
37
|
-
|
38
|
-
### Library Structure
|
39
|
-
|
40
|
-
The older `google-cloud-webrisk` gem was an all-in-one gem
|
41
|
-
that included potentially multiple clients for multiple versions of the
|
42
|
-
Web Risk service. The `Google::Cloud::Webrisk.new` factory method would
|
43
|
-
return you an instance of a `Google::Cloud::Webrisk::V1beta1::WebRiskServiceV1Beta1Client`
|
44
|
-
object for the V1beta1 version of the service. (Version V1 of the service was
|
45
|
-
not supported by the older gem.)
|
46
|
-
|
47
|
-
The new `google-cloud-web_risk` gem still provides factory
|
48
|
-
methods for obtaining clients. (The method signatures will have changed. See
|
49
|
-
[Creating Clients](#creating-clients) for details.) However, the actual client
|
50
|
-
classes have been moved into separate gems, one per service version. The
|
51
|
-
`Google::Cloud::WebRisk::V1::WebRiskService::Client` class, along with its
|
52
|
-
helpers and data types, is now part of the `google-cloud-web_risk-v1` gem.
|
53
|
-
Similarly, the `Google::Cloud::WebRisk::V1beta1::WebRiskService::Client`
|
54
|
-
class is part of the `google-cloud-web_risk-v1beta1` gem.
|
55
|
-
|
56
|
-
For normal usage, you can install the `google-cloud-web_risk` gem
|
57
|
-
(which will bring in the versioned client gems as dependencies) and continue to
|
58
|
-
use factory methods to create clients. However, you may alternatively choose to
|
59
|
-
install only one of the versioned gems. For example, if you know you will only
|
60
|
-
use `V1` of the service, you can install `google-cloud-web_risk-v1` by
|
61
|
-
itself, and construct instances of the
|
62
|
-
`Google::Cloud::WebRisk::V1::WebRiskService::Client` client class directly.
|
63
|
-
|
64
|
-
### Class Namespaces
|
65
|
-
|
66
|
-
As part of the gem being renamed from `google-cloud-webrisk` to
|
67
|
-
`google-cloud-web_risk`, the main namespace module has also been renamed
|
68
|
-
accordingly, from `Google::Cloud::Webrisk` to `Google::Cloud::WebRisk`. (Note
|
69
|
-
the "R" in "WebRisk" is now capitalized.) This affects the entire library,
|
70
|
-
including clients, data types, and all other modules and classes.
|
71
|
-
|
72
|
-
Additionally, some of the underlying classes have also been renamed.
|
73
|
-
In the older gem, the client object was of classes with names like:
|
74
|
-
`Google::Cloud::Webrisk::V1beta1::WebRiskServiceV1Beta1Client`.
|
75
|
-
In the new gem, the corresponding client object is of a different class:
|
76
|
-
`Google::Cloud::WebRisk::V1beta1::WebRiskService::Client`.
|
77
|
-
Note that most users will use the factory methods such as
|
78
|
-
`Google::Cloud::WebRisk.web_risk_service` to create instances of the client object,
|
79
|
-
so you may not need to reference the actual class directly.
|
80
|
-
See [Creating Clients](#creating-clients).
|
81
|
-
|
82
|
-
In older releases, the credentials object was of class
|
83
|
-
`Google::Cloud::Webrisk::V1beta1::Credentials`.
|
84
|
-
In the 1.0 release, each service has its own credentials class, e.g.
|
85
|
-
`Google::Cloud::WebRisk::V1beta1::WebRiskService::Credentials`.
|
86
|
-
Again, most users will not need to reference this class directly.
|
87
|
-
See [Client Configuration](#client-configuration).
|
88
|
-
|
89
|
-
### Client Configuration
|
90
|
-
|
91
|
-
In the older gem, if you wanted to customize performance parameters or
|
92
|
-
low-level behavior of the client (such as credentials, timeouts, or
|
93
|
-
instrumentation), you would pass a variety of keyword arguments to the client
|
94
|
-
constructor. It was also extremely difficult to customize the default settings.
|
95
|
-
|
96
|
-
In the new gem, a configuration interface provides control over these
|
97
|
-
parameters, including defaults for all instances of a client, and settings for
|
98
|
-
each specific client instance. For example, to set default credentials and
|
99
|
-
timeout for all Web Risk V1 clients:
|
100
|
-
|
101
|
-
```
|
102
|
-
Google::Cloud::WebRisk::V1::WebRiskService::Client.configure do |config|
|
103
|
-
config.credentials = "/path/to/credentials.json"
|
104
|
-
config.timeout = 10.0
|
105
|
-
end
|
106
|
-
```
|
107
|
-
|
108
|
-
Individual RPCs can also be configured independently. For example, to set the
|
109
|
-
timeout for the `search_uris` call:
|
110
|
-
|
111
|
-
```
|
112
|
-
Google::Cloud::WebRisk::V1::WebRiskService::Client.configure do |config|
|
113
|
-
config.rpcs.search_uris.timeout = 20.0
|
114
|
-
end
|
115
|
-
```
|
116
|
-
|
117
|
-
Defaults for certain configurations can be set for all Web Risk versions and
|
118
|
-
services globally:
|
119
|
-
|
120
|
-
```
|
121
|
-
Google::Cloud::WebRisk.configure do |config|
|
122
|
-
config.credentials = "/path/to/credentials.json"
|
123
|
-
config.timeout = 10.0
|
124
|
-
end
|
125
|
-
```
|
126
|
-
|
127
|
-
Finally, you can override the configuration for each client instance. See the
|
128
|
-
next section on [Creating Clients](#creating-clients) for details.
|
129
|
-
|
130
|
-
### Creating Clients
|
131
|
-
|
132
|
-
In the older gem, to create a client object, you would use the
|
133
|
-
`Google::Cloud::Webrisk.new` class method. Keyword arguments were available to
|
134
|
-
select a service version and to configure parameters such as credentials and
|
135
|
-
timeouts.
|
136
|
-
|
137
|
-
In the new gem, use the `Google::Cloud::WebRisk.web_risk_service` class
|
138
|
-
method to create a client object. You may select a service version using the
|
139
|
-
`:version` keyword argument. However, other configuration parameters should be
|
140
|
-
set in a configuration block when you create the client.
|
141
|
-
|
142
|
-
Old:
|
143
|
-
```
|
144
|
-
client = Google::Cloud::Webrisk.new credentials: "/path/to/credentials.json"
|
145
|
-
```
|
146
|
-
|
147
|
-
New:
|
148
|
-
```
|
149
|
-
client = Google::Cloud::WebRisk.web_risk_service do |config|
|
150
|
-
config.credentials = "/path/to/credentials.json"
|
151
|
-
end
|
152
|
-
```
|
153
|
-
|
154
|
-
The configuration block is optional. If you do not provide it, or you do not
|
155
|
-
set some configuration parameters, then the default configuration is used. See
|
156
|
-
[Client Configuration](#client-configuration).
|
157
|
-
|
158
|
-
### Passing Arguments
|
159
|
-
|
160
|
-
In the older gem, required arguments would be passed as positional method
|
161
|
-
arguments, while most optional arguments would be passed as keyword arguments.
|
162
|
-
|
163
|
-
In the new gem, all RPC arguments are passed as keyword arguments,
|
164
|
-
regardless of whether they are required or optional. For example:
|
165
|
-
|
166
|
-
Old:
|
167
|
-
```
|
168
|
-
client = Google::Cloud::Webrisk.new
|
169
|
-
|
170
|
-
uri = "http://example.com"
|
171
|
-
threat_types = [Google::Cloud::Webrisk::V1beta1::ThreatType::MALWARE]
|
172
|
-
|
173
|
-
# Both uri and threat_types are positional arguments.
|
174
|
-
response = client.search_uris uri, threat_types
|
175
|
-
```
|
176
|
-
|
177
|
-
New:
|
178
|
-
```
|
179
|
-
client = Google::Cloud::WebRisk.web_risk_service
|
180
|
-
|
181
|
-
uri = "http://example.com"
|
182
|
-
threat_types = [Google::Cloud::WebRisk::V1::ThreatType::MALWARE]
|
183
|
-
|
184
|
-
# Both uri and threat_types are keyword arguments.
|
185
|
-
response = client.search_uris uri: uri, threat_types: threat_types
|
186
|
-
```
|
187
|
-
|
188
|
-
In the new gem, it is also possible to pass a request object, either
|
189
|
-
as a hash or as a protocol buffer.
|
190
|
-
|
191
|
-
New:
|
192
|
-
```
|
193
|
-
client = Google::Cloud::WebRisk.web_risk_service
|
194
|
-
|
195
|
-
request = Google::Cloud::WebRisk::V1::SearchUrisRequest.new(
|
196
|
-
uri: "http://example.com",
|
197
|
-
threat_types: [Google::Cloud::WebRisk::V1::ThreatType::MALWARE]
|
198
|
-
)
|
199
|
-
|
200
|
-
# Pass a request object as a positional argument:
|
201
|
-
response = client.search_uris request
|
202
|
-
```
|
203
|
-
|
204
|
-
Finally, in older releases, to provide call options, you would pass a
|
205
|
-
`Google::Gax::CallOptions` object with the `:options` keyword argument. In the
|
206
|
-
1.0 release, pass call options using a _second set_ of keyword arguments.
|
207
|
-
|
208
|
-
Old:
|
209
|
-
```
|
210
|
-
client = Google::Cloud::Webrisk.new
|
211
|
-
|
212
|
-
uri = "http://example.com"
|
213
|
-
threat_types = [Google::Cloud::Webrisk::V1beta1::ThreatType::MALWARE]
|
214
|
-
|
215
|
-
options = Google::Gax::CallOptions.new timeout: 10.0
|
216
|
-
|
217
|
-
response = client.search_uris uri, threat_types, options: options
|
218
|
-
```
|
219
|
-
|
220
|
-
New:
|
221
|
-
```
|
222
|
-
client = Google::Cloud::WebRisk.web_risk_service
|
223
|
-
|
224
|
-
uri = "http://example.com"
|
225
|
-
threat_types = [Google::Cloud::WebRisk::V1::ThreatType::MALWARE]
|
226
|
-
|
227
|
-
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
228
|
-
# then add further keyword arguments for the call options.
|
229
|
-
response = client.search_uris(
|
230
|
-
{ uri: uri, threat_types: threat_types },
|
231
|
-
timeout: 10.0
|
232
|
-
)
|
233
|
-
```
|
234
|
-
|
235
|
-
### Handling Errors
|
236
|
-
|
237
|
-
The client reports standard
|
238
|
-
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
239
|
-
by raising exceptions. In the older gem, these exceptions were located in the
|
240
|
-
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
241
|
-
exception class, defined in the `google-gax` gem. However, these classes were
|
242
|
-
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
243
|
-
thrown by other client libraries such as `google-cloud-storage`.
|
244
|
-
|
245
|
-
The new client library now uses the `Google::Cloud::Error` exception hierarchy,
|
246
|
-
for consistency across all the Google Cloud client libraries. In general, these
|
247
|
-
exceptions have the same name as their counterparts from older releases, but
|
248
|
-
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
249
|
-
namespace.
|
250
|
-
|
251
|
-
Old:
|
252
|
-
```
|
253
|
-
client = Google::Cloud::Webrisk.new
|
254
|
-
|
255
|
-
uri = "http://example.com"
|
256
|
-
threat_types = [Google::Cloud::Webrisk::V1beta1::ThreatType::MALWARE]
|
257
|
-
|
258
|
-
begin
|
259
|
-
response = client.search_uris uri, threat_types
|
260
|
-
rescue Google::Gax::Error => e
|
261
|
-
# Handle exceptions that subclass Google::Gax::Error
|
262
|
-
end
|
263
|
-
```
|
264
|
-
|
265
|
-
New:
|
266
|
-
```
|
267
|
-
client = Google::Cloud::WebRisk.web_risk_service
|
268
|
-
|
269
|
-
uri = "http://example.com"
|
270
|
-
threat_types = [Google::Cloud::WebRisk::V1::ThreatType::MALWARE]
|
271
|
-
|
272
|
-
begin
|
273
|
-
response = client.search_uris uri: uri, threat_types: threat_types
|
274
|
-
rescue Google::Cloud::Error => e
|
275
|
-
# Handle exceptions that subclass Google::Cloud::Error
|
276
|
-
end
|
277
|
-
```
|