google-cloud-security_center 1.8.0 → 2.0.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 +4 -4
- data/.yardopts +0 -1
- data/README.md +0 -10
- data/lib/google/cloud/security_center/version.rb +1 -1
- data/lib/google/cloud/security_center.rb +7 -7
- metadata +11 -44
- data/MIGRATING.md +0 -327
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d83c6a1a67c993c37e82363e6e309043eade2eb64d5a0c4f9bed9b78aa08b2f9
|
4
|
+
data.tar.gz: fa33f7fd1022cd49f034398b18e8de004f614518adfa32541a90728da4cd6019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '083c78f9edd15d19203ed585585dde6f3769231baf97ec2649da6bd834abd052e02509216949439dd010bae129fe91321da4cc7e29dc6d7f53cbd82a7b229ca1'
|
7
|
+
data.tar.gz: 3a935e97abcf50fb18f29f589ee73b44640698974f393090691bbe2986bf444cc6672a40e0633b9c35f590724903e97e73bf5d20c20df49c3db5434ba931d18a
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,6 @@ 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
19
|
[google-cloud-security_center-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v1/latest),
|
20
|
-
[google-cloud-security_center-v1p1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v1p1beta1/latest),
|
21
20
|
[google-cloud-security_center-v2](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest).
|
22
21
|
|
23
22
|
See also the [Product Documentation](https://cloud.google.com/security-command-center)
|
@@ -36,14 +35,6 @@ In order to use this library, you first need to go through the following steps:
|
|
36
35
|
1. [Enable the API.](https://console.cloud.google.com/apis/library/securitycenter.googleapis.com)
|
37
36
|
1. {file:AUTHENTICATION.md Set up authentication.}
|
38
37
|
|
39
|
-
## Migrating from 0.x versions
|
40
|
-
|
41
|
-
The 1.0 release of the google-cloud-security_center client is a significant upgrade
|
42
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
43
|
-
and includes substantial interface changes. Existing code written for earlier
|
44
|
-
versions of this library will likely require updates to use this version.
|
45
|
-
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
46
|
-
|
47
38
|
## Debug Logging
|
48
39
|
|
49
40
|
This library comes with opt-in Debug Logging that can help you troubleshoot
|
@@ -73,7 +64,6 @@ Debug logging also requires that the versioned clients for this service be
|
|
73
64
|
sufficiently recent, released after about Dec 10, 2024. If logging is not
|
74
65
|
working, try updating the versioned clients in your bundle or installed gems:
|
75
66
|
[google-cloud-security_center-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v1/latest),
|
76
|
-
[google-cloud-security_center-v1p1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v1p1beta1/latest),
|
77
67
|
[google-cloud-security_center-v2](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest).
|
78
68
|
|
79
69
|
## Supported Ruby Versions
|
@@ -49,8 +49,8 @@ module Google
|
|
49
49
|
# Create a new client object for SecurityCenter.
|
50
50
|
#
|
51
51
|
# By default, this returns an instance of
|
52
|
-
# [Google::Cloud::SecurityCenter::
|
53
|
-
# for a gRPC client for version
|
52
|
+
# [Google::Cloud::SecurityCenter::V2::SecurityCenter::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest/Google-Cloud-SecurityCenter-V2-SecurityCenter-Client)
|
53
|
+
# for a gRPC client for version V2 of the API.
|
54
54
|
# However, you can specify a different API version by passing it in the
|
55
55
|
# `version` parameter. If the SecurityCenter service is
|
56
56
|
# supported by that API version, and the corresponding gem is available, the
|
@@ -65,14 +65,14 @@ module Google
|
|
65
65
|
#
|
66
66
|
# ## About SecurityCenter
|
67
67
|
#
|
68
|
-
#
|
68
|
+
# V2 APIs for Security Center service.
|
69
69
|
#
|
70
70
|
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
71
|
-
# Defaults to `:
|
71
|
+
# Defaults to `:v2`.
|
72
72
|
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
73
73
|
# @return [::Object] A client object for the specified version.
|
74
74
|
#
|
75
|
-
def self.security_center version: :
|
75
|
+
def self.security_center version: :v2, transport: :grpc, &block
|
76
76
|
require "google/cloud/security_center/#{version.to_s.downcase}"
|
77
77
|
|
78
78
|
package_name = Google::Cloud::SecurityCenter
|
@@ -92,11 +92,11 @@ module Google
|
|
92
92
|
# or if the versioned client gem needs an update to support the SecurityCenter service.
|
93
93
|
#
|
94
94
|
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
95
|
-
# Defaults to `:
|
95
|
+
# Defaults to `:v2`.
|
96
96
|
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
97
97
|
# @return [boolean] Whether the service is available.
|
98
98
|
#
|
99
|
-
def self.security_center_available? version: :
|
99
|
+
def self.security_center_available? version: :v2, transport: :grpc
|
100
100
|
require "google/cloud/security_center/#{version.to_s.downcase}"
|
101
101
|
package_name = Google::Cloud::SecurityCenter
|
102
102
|
.constants
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-security_center
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: google-cloud-core
|
@@ -27,62 +27,30 @@ dependencies:
|
|
27
27
|
name: google-cloud-security_center-v1
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0.34'
|
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.34'
|
43
|
-
- - "<"
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.a
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: google-cloud-security_center-v1p1beta1
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0.13'
|
53
|
-
- - "<"
|
30
|
+
- - "~>"
|
54
31
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
32
|
+
version: '1.0'
|
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.13'
|
63
|
-
- - "<"
|
37
|
+
- - "~>"
|
64
38
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
39
|
+
version: '1.0'
|
66
40
|
- !ruby/object:Gem::Dependency
|
67
41
|
name: google-cloud-security_center-v2
|
68
42
|
requirement: !ruby/object:Gem::Requirement
|
69
43
|
requirements:
|
70
|
-
- - "
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0.0'
|
73
|
-
- - "<"
|
44
|
+
- - "~>"
|
74
45
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
46
|
+
version: '1.0'
|
76
47
|
type: :runtime
|
77
48
|
prerelease: false
|
78
49
|
version_requirements: !ruby/object:Gem::Requirement
|
79
50
|
requirements:
|
80
|
-
- - "
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.0'
|
83
|
-
- - "<"
|
51
|
+
- - "~>"
|
84
52
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
53
|
+
version: '1.0'
|
86
54
|
description: Security Command Center API provides access to temporal views of assets
|
87
55
|
and findings within an organization.
|
88
56
|
email: googleapis-packages@google.com
|
@@ -93,7 +61,6 @@ files:
|
|
93
61
|
- ".yardopts"
|
94
62
|
- AUTHENTICATION.md
|
95
63
|
- LICENSE.md
|
96
|
-
- MIGRATING.md
|
97
64
|
- README.md
|
98
65
|
- lib/google-cloud-security_center.rb
|
99
66
|
- lib/google/cloud/security_center.rb
|
@@ -116,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
83
|
- !ruby/object:Gem::Version
|
117
84
|
version: '0'
|
118
85
|
requirements: []
|
119
|
-
rubygems_version: 3.6.
|
86
|
+
rubygems_version: 3.6.3
|
120
87
|
specification_version: 4
|
121
88
|
summary: API Client library for the Security Command Center API
|
122
89
|
test_files: []
|
data/MIGRATING.md
DELETED
@@ -1,327 +0,0 @@
|
|
1
|
-
## Migrating to google-cloud-security_center 1.0
|
2
|
-
|
3
|
-
The 1.0 release of the google-cloud-security_center client is a significant upgrade
|
4
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
5
|
-
and includes substantial interface changes. Existing code written for earlier
|
6
|
-
versions of this library will likely require updates to use this version.
|
7
|
-
This document describes the changes that have been made, and what you need to
|
8
|
-
do to update your usage.
|
9
|
-
|
10
|
-
To summarize:
|
11
|
-
|
12
|
-
* The library has been broken out into three libraries. The new gems
|
13
|
-
`google-cloud-security_center-v1` and `google-cloud-security_center-v1p1beta1` contain the
|
14
|
-
actual client classes for versions V1 and V1p1beta1 of the Cloud Security Command Center
|
15
|
-
service, and the gem `google-cloud-security_center` now simply provides a
|
16
|
-
convenience wrapper. See [Library Structure](#library-structure) for more
|
17
|
-
info.
|
18
|
-
* The library uses a new configuration mechanism giving you closer control
|
19
|
-
over endpoint address, network timeouts, and retry. See
|
20
|
-
[Client Configuration](#client-configuration) for more info. Furthermore,
|
21
|
-
when creating a client object, you can customize its configuration in a
|
22
|
-
block rather than passing arguments to the constructor. See
|
23
|
-
[Creating Clients](#creating-clients) for more info.
|
24
|
-
* Previously, positional arguments were used to indicate required arguments.
|
25
|
-
Now, all method arguments are keyword arguments, with documentation that
|
26
|
-
specifies whether they are required or optional. Additionally, you can pass
|
27
|
-
a proto request object instead of separate arguments. See
|
28
|
-
[Passing Arguments](#passing-arguments) for more info.
|
29
|
-
* Previously, some client classes included helper methods for constructing
|
30
|
-
resource paths. These methods now take keyword rather than positional
|
31
|
-
arguments, and are also available in a separate paths module. See
|
32
|
-
[Resource Path Helpers](#resource-path-helpers) 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
|
-
* Some classes have moved into different namespaces. See
|
38
|
-
[Class Namespaces](#class-namespaces) for more info.
|
39
|
-
|
40
|
-
### Library Structure
|
41
|
-
|
42
|
-
Older 0.x releases of the `google-cloud-security_center` gem were all-in-one gems that
|
43
|
-
included potentially multiple clients for multiple versions of the Security
|
44
|
-
Command Center service. The `Google::Cloud::SecurityCenter.new` factory method would
|
45
|
-
return you an instance of a `Google::Cloud::SecurityCenter::V1::SecurityCenterClient`
|
46
|
-
object for the V1 version of the service, or a
|
47
|
-
`Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenterClient` object for the
|
48
|
-
V1p1beta1 version of the service. All these classes were defined in the same gem.
|
49
|
-
|
50
|
-
With the 1.0 release, the `google-cloud-security_center` gem still provides factory
|
51
|
-
methods for obtaining clients. (The method signatures will have changed. See
|
52
|
-
[Creating Clients](#creating-clients) for details.) However, the actual client
|
53
|
-
classes have been moved into separate gems, one per service version. The
|
54
|
-
`Google::Cloud::SecurityCenter::V1::SecurityCenter::Client` class, along with its
|
55
|
-
helpers and data types, is now part of the `google-cloud-security_center-v1` gem.
|
56
|
-
Similarly, the `Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Client`
|
57
|
-
class is part of the `google-cloud-security_center-v1p1beta1` gem.
|
58
|
-
|
59
|
-
For normal usage, you can continue to install the `google-cloud-security_center` gem
|
60
|
-
(which will bring in the versioned client gems as dependencies) and continue to
|
61
|
-
use factory methods to create clients. However, you may alternatively choose to
|
62
|
-
install only one of the versioned gems. For example, if you know you will only
|
63
|
-
`V1` of the service, you can install `google-cloud-security_center-v1` by itself, and
|
64
|
-
construct instances of the
|
65
|
-
`Google::Cloud::SecurityCenter::V1::SecurityCenter::Client` client class directly.
|
66
|
-
|
67
|
-
### Client Configuration
|
68
|
-
|
69
|
-
In older releases, if you wanted to customize performance parameters or
|
70
|
-
low-level behavior of the client (such as credentials, timeouts, or
|
71
|
-
instrumentation), you would pass a variety of keyword arguments to the client
|
72
|
-
constructor. It was also extremely difficult to customize the default settings.
|
73
|
-
|
74
|
-
With the 1.0 release, a configuration interface provides control over these
|
75
|
-
parameters, including defaults for all instances of a client, and settings for
|
76
|
-
each specific client instance. For example, to set default credentials and
|
77
|
-
timeout for all SecurityCenter V1 clients:
|
78
|
-
|
79
|
-
```
|
80
|
-
Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
|
81
|
-
config.credentials = "/path/to/credentials.json"
|
82
|
-
config.timeout = 10.0
|
83
|
-
end
|
84
|
-
```
|
85
|
-
|
86
|
-
Individual RPCs can also be configured independently. For example, to set the
|
87
|
-
timeout for the `list_findings` call:
|
88
|
-
|
89
|
-
```
|
90
|
-
Google::Cloud::SecurityCenter::V1::SecurityCenter::Client.configure do |config|
|
91
|
-
config.rpcs.list_findings.timeout = 20.0
|
92
|
-
end
|
93
|
-
```
|
94
|
-
|
95
|
-
Defaults for certain configurations can be set for all SecurityCenter versions
|
96
|
-
globally:
|
97
|
-
|
98
|
-
```
|
99
|
-
Google::Cloud::SecurityCenter.configure do |config|
|
100
|
-
config.credentials = "/path/to/credentials.json"
|
101
|
-
config.timeout = 10.0
|
102
|
-
end
|
103
|
-
```
|
104
|
-
|
105
|
-
Finally, you can override the configuration for each client instance. See the
|
106
|
-
next section on [Creating Clients](#creating-clients) for details.
|
107
|
-
|
108
|
-
### Creating Clients
|
109
|
-
|
110
|
-
In older releases, to create a client object, you would use the
|
111
|
-
`Google::Cloud::SecurityCenter.new` class method. Keyword arguments were available to
|
112
|
-
select a service version and to configure parameters such as credentials and
|
113
|
-
timeouts.
|
114
|
-
|
115
|
-
With the 1.0 release, use the `Google::Cloud::SecurityCenter.security_center` class
|
116
|
-
method to create a client object. You may select a service version using the
|
117
|
-
`:version` keyword argument. However, other configuration parameters should be
|
118
|
-
set in a configuration block when you create the client.
|
119
|
-
|
120
|
-
Old:
|
121
|
-
```
|
122
|
-
client = Google::Cloud::SecurityCenter.new credentials: "/path/to/credentials.json"
|
123
|
-
```
|
124
|
-
|
125
|
-
New:
|
126
|
-
```
|
127
|
-
client = Google::Cloud::SecurityCenter.security_center do |config|
|
128
|
-
config.credentials = "/path/to/credentials.json"
|
129
|
-
end
|
130
|
-
```
|
131
|
-
|
132
|
-
The configuration block is optional. If you do not provide it, or you do not
|
133
|
-
set some configuration parameters, then the default configuration is used. See
|
134
|
-
[Client Configuration](#client-configuration).
|
135
|
-
|
136
|
-
### Passing Arguments
|
137
|
-
|
138
|
-
In older releases, required arguments would be passed as positional method
|
139
|
-
arguments, while most optional arguments would be passed as keyword arguments.
|
140
|
-
|
141
|
-
With the 1.0 release, all RPC arguments are passed as keyword arguments,
|
142
|
-
regardless of whether they are required or optional. For example:
|
143
|
-
|
144
|
-
Old:
|
145
|
-
```
|
146
|
-
client = Google::Cloud::SecurityCenter.new
|
147
|
-
|
148
|
-
parent = "organizations/my-org/sources/-"
|
149
|
-
ordering = "name"
|
150
|
-
|
151
|
-
# Parent is a positional argument, while order_by is a keyword argument.
|
152
|
-
response = client.list_findings parent, order_by: ordering
|
153
|
-
```
|
154
|
-
|
155
|
-
New:
|
156
|
-
```
|
157
|
-
client = Google::Cloud::SecurityCenter.security_center
|
158
|
-
|
159
|
-
parent = "organizations/my-org/sources/-"
|
160
|
-
ordering = "name"
|
161
|
-
|
162
|
-
# Both parent and order_by are keyword arguments.
|
163
|
-
response = client.list_findings parent: parent, order_by: ordering
|
164
|
-
```
|
165
|
-
|
166
|
-
In the 1.0 release, it is also possible to pass a request object, either
|
167
|
-
as a hash or as a protocol buffer.
|
168
|
-
|
169
|
-
New:
|
170
|
-
```
|
171
|
-
client = Google::Cloud::SecurityCenter.security_center
|
172
|
-
|
173
|
-
request = Google::Cloud::SecurityCenter::V1::ListFindingsRequest.new(
|
174
|
-
parent: "organizations/my-org/sources/-",
|
175
|
-
order_by: "name"
|
176
|
-
)
|
177
|
-
|
178
|
-
# Pass a request object as a positional argument:
|
179
|
-
response = client.list_findings request
|
180
|
-
```
|
181
|
-
|
182
|
-
Finally, in older releases, to provide call options, you would pass a
|
183
|
-
`Google::Gax::CallOptions` object with the `:options` keyword argument. In the
|
184
|
-
1.0 release, pass call options using a _second set_ of keyword arguments.
|
185
|
-
|
186
|
-
Old:
|
187
|
-
```
|
188
|
-
client = Google::Cloud::SecurityCenter.new
|
189
|
-
|
190
|
-
parent = "organizations/my-org/sources/-"
|
191
|
-
ordering = "name"
|
192
|
-
|
193
|
-
options = Google::Gax::CallOptions.new timeout: 10.0
|
194
|
-
|
195
|
-
response = client.list_findings parent, order_by: ordering, options: options
|
196
|
-
```
|
197
|
-
|
198
|
-
New:
|
199
|
-
```
|
200
|
-
client = Google::Cloud::SecurityCenter.security_center
|
201
|
-
|
202
|
-
parent = "organizations/my-org/sources/-"
|
203
|
-
ordering = "name"
|
204
|
-
|
205
|
-
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
206
|
-
# then add further keyword arguments for the call options.
|
207
|
-
response = client.list_findings(
|
208
|
-
{ parent: parent, order_by: ordering },
|
209
|
-
timeout: 10.0
|
210
|
-
)
|
211
|
-
```
|
212
|
-
|
213
|
-
### Resource Path Helpers
|
214
|
-
|
215
|
-
The client library includes helper methods for generating the resource path
|
216
|
-
strings passed to many calls. These helpers have changed in two ways:
|
217
|
-
|
218
|
-
* In older releases, they are both _class_ methods and _instance_ methods on
|
219
|
-
the client class. In the 1.0 release, they are _instance methods only_.
|
220
|
-
However, they are also available on a separate paths module that you can
|
221
|
-
include elsewhere for convenience.
|
222
|
-
* In older releases, arguments to a resource path helper are passed as
|
223
|
-
_positional_ arguments. In the 1.0 release, they are passed as named _keyword_
|
224
|
-
arguments.
|
225
|
-
|
226
|
-
Following is an example involving using a resource path helper.
|
227
|
-
|
228
|
-
Old:
|
229
|
-
```
|
230
|
-
client = Google::Cloud::SecurityCenter.new
|
231
|
-
|
232
|
-
# Call the helper using positional arguments.
|
233
|
-
parent = client.source_path "my-org", "my-source"
|
234
|
-
|
235
|
-
response = client.list_findings parent
|
236
|
-
```
|
237
|
-
|
238
|
-
New:
|
239
|
-
```
|
240
|
-
client = Google::Cloud::SecurityCenter.security_center
|
241
|
-
|
242
|
-
# Call the helper using keyword arguments
|
243
|
-
parent = client.source_path organization: "my-org", source: "my-source"
|
244
|
-
|
245
|
-
response = client.list_findings parent: parent
|
246
|
-
```
|
247
|
-
|
248
|
-
In the 1.0 client, you can also use the paths module as a convenience module.
|
249
|
-
|
250
|
-
New:
|
251
|
-
```
|
252
|
-
# Bring the path helper methods into the current class
|
253
|
-
include Google::Cloud::SecurityCenter::V1::SecurityCenterService::Paths
|
254
|
-
|
255
|
-
def foo
|
256
|
-
client = Google::Cloud::SecurityCenter.security_center
|
257
|
-
|
258
|
-
# Call the included helper method
|
259
|
-
parent = source_path organization: "my-org", source: "my-source"
|
260
|
-
|
261
|
-
response = client.list_findings parent: parent
|
262
|
-
|
263
|
-
# Do something with response...
|
264
|
-
end
|
265
|
-
```
|
266
|
-
|
267
|
-
### Handling Errors
|
268
|
-
|
269
|
-
The client reports standard
|
270
|
-
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
271
|
-
by raising exceptions. In older releases, these exceptions were located in the
|
272
|
-
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
273
|
-
exception class, defined in the `google-gax` gem. However, these classes were
|
274
|
-
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
275
|
-
thrown by other client libraries such as `google-cloud-storage`.
|
276
|
-
|
277
|
-
The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
|
278
|
-
for consistency across all the Google Cloud client libraries. In general, these
|
279
|
-
exceptions have the same name as their counterparts from older releases, but
|
280
|
-
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
281
|
-
namespace.
|
282
|
-
|
283
|
-
Old:
|
284
|
-
```
|
285
|
-
client = Google::Cloud::SecurityCenter.new
|
286
|
-
|
287
|
-
parent = "organizations/my-org/sources/-"
|
288
|
-
ordering = "name"
|
289
|
-
|
290
|
-
begin
|
291
|
-
response = client.list_findings parent, order_by: ordering
|
292
|
-
rescue Google::Gax::Error => e
|
293
|
-
# Handle exceptions that subclass Google::Gax::Error
|
294
|
-
end
|
295
|
-
```
|
296
|
-
|
297
|
-
New:
|
298
|
-
```
|
299
|
-
client = Google::Cloud::SecurityCenter.security_center
|
300
|
-
|
301
|
-
parent = "organizations/my-org/sources/-"
|
302
|
-
ordering = "name"
|
303
|
-
|
304
|
-
begin
|
305
|
-
response = client.list_findings parent: parent, order_by: ordering
|
306
|
-
rescue Google::Cloud::Error => e
|
307
|
-
# Handle exceptions that subclass Google::Cloud::Error
|
308
|
-
end
|
309
|
-
```
|
310
|
-
|
311
|
-
### Class Namespaces
|
312
|
-
|
313
|
-
In older releases, the client object was of class
|
314
|
-
`Google::Cloud::SecurityCenter::V1::SecurityCenterClient`.
|
315
|
-
In the 1.0 release, the client object is of class
|
316
|
-
`Google::Cloud::SecurityCenter::V1::SecurityCenter::Client`.
|
317
|
-
Note that most users will use the `Google::Cloud::SecurityCenter.security_center`
|
318
|
-
factory method to create instances of the client object, so you may not need to
|
319
|
-
reference the actual class directly.
|
320
|
-
See [Creating Clients](#creating-clients).
|
321
|
-
|
322
|
-
In older releases, the credentials object was of class
|
323
|
-
`Google::Cloud::SecurityCenter::V1::Credentials`.
|
324
|
-
In the 1.0 release, the credentials object is of class
|
325
|
-
`Google::Cloud::SecurityCenter::V1::SecurityCenter::Credentials`.
|
326
|
-
Again, most users will not need to reference this class directly.
|
327
|
-
See [Client Configuration](#client-configuration).
|