grafeas 0.1.1 → 1.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -3
  3. data/LICENSE.md +203 -0
  4. data/MIGRATING.md +366 -0
  5. data/README.md +28 -25
  6. data/lib/grafeas.rb +37 -118
  7. data/lib/grafeas/version.rb +6 -2
  8. metadata +49 -78
  9. data/AUTHENTICATION.md +0 -177
  10. data/LICENSE +0 -201
  11. data/lib/grafeas/v1.rb +0 -155
  12. data/lib/grafeas/v1/attestation_pb.rb +0 -27
  13. data/lib/grafeas/v1/build_pb.rb +0 -23
  14. data/lib/grafeas/v1/common_pb.rb +0 -34
  15. data/lib/grafeas/v1/credentials.rb +0 -37
  16. data/lib/grafeas/v1/cvss_pb.rb +0 -67
  17. data/lib/grafeas/v1/deployment_pb.rb +0 -35
  18. data/lib/grafeas/v1/discovery_pb.rb +0 -40
  19. data/lib/grafeas/v1/doc/google/protobuf/any.rb +0 -131
  20. data/lib/grafeas/v1/doc/google/protobuf/empty.rb +0 -29
  21. data/lib/grafeas/v1/doc/google/protobuf/field_mask.rb +0 -222
  22. data/lib/grafeas/v1/doc/google/protobuf/timestamp.rb +0 -113
  23. data/lib/grafeas/v1/doc/google/rpc/status.rb +0 -87
  24. data/lib/grafeas/v1/doc/grafeas/v1/attestation.rb +0 -64
  25. data/lib/grafeas/v1/doc/grafeas/v1/build.rb +0 -44
  26. data/lib/grafeas/v1/doc/grafeas/v1/common.rb +0 -105
  27. data/lib/grafeas/v1/doc/grafeas/v1/cvss.rb +0 -104
  28. data/lib/grafeas/v1/doc/grafeas/v1/deployment.rb +0 -64
  29. data/lib/grafeas/v1/doc/grafeas/v1/discovery.rb +0 -76
  30. data/lib/grafeas/v1/doc/grafeas/v1/grafeas.rb +0 -322
  31. data/lib/grafeas/v1/doc/grafeas/v1/image.rb +0 -79
  32. data/lib/grafeas/v1/doc/grafeas/v1/package.rb +0 -125
  33. data/lib/grafeas/v1/doc/grafeas/v1/provenance.rb +0 -248
  34. data/lib/grafeas/v1/doc/grafeas/v1/vulnerability.rb +0 -214
  35. data/lib/grafeas/v1/grafeas_client.rb +0 -961
  36. data/lib/grafeas/v1/grafeas_client_config.json +0 -96
  37. data/lib/grafeas/v1/grafeas_pb.rb +0 -163
  38. data/lib/grafeas/v1/grafeas_services_pb.rb +0 -86
  39. data/lib/grafeas/v1/image_pb.rb +0 -36
  40. data/lib/grafeas/v1/package_pb.rb +0 -59
  41. data/lib/grafeas/v1/provenance_pb.rb +0 -116
  42. data/lib/grafeas/v1/vulnerability_pb.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf078d19b5abb46085c1f282826329a38222189dae4db4dd6ca021ef5374245f
4
- data.tar.gz: 91a5bf5b5bcc209704179c058020f827a66606656834200b6188b3b90d45d6b2
3
+ metadata.gz: 76b8357d3f53347a325d45b4f2973f9ce2e1a527621662154765400b8b57a81d
4
+ data.tar.gz: b38f6d765a4ebcf4bdc5836f3d53f7ab77b1dcb783ed1e048f24c7e3a547725f
5
5
  SHA512:
6
- metadata.gz: a91b90e2b90c28357aede2ab29f6059516384462c4fcb5a8d53f903c9a1adcfbb56c7237a967c9669181b3dfb98ae9b6d823c8b4354d89fdaf1c3868f77dc23a
7
- data.tar.gz: f3488b8143b2b6043a5ac8bf56a004f33893874b469f1ca9bceb39b275957dabfca9b4eea18a249713116c6ce0a23068222a80e8953861c1b63b03bb55dca959
6
+ metadata.gz: 3995ca21a0518be93bde1964034f42550c9a884729b5304fb2cb85c939fcca3b2df5b1a7123b86e1c0d093aafd328c41b4f4abffd1662a5a07a1504de7028c6b
7
+ data.tar.gz: ade5d279c0a6f348060133ed6252a982d047c824371be386c20555badf7342a3973a715f0e0e600d753816acba217eb6daa3c3605de564878c2b01921d523f5b
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Container Analysis API
2
+ --title=Grafeas API
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
@@ -7,5 +7,5 @@
7
7
  ./lib/**/*.rb
8
8
  -
9
9
  README.md
10
- AUTHENTICATION.md
11
- LICENSE
10
+ MIGRATING.md
11
+ LICENSE.md
@@ -0,0 +1,203 @@
1
+ Apache License
2
+ ==============
3
+
4
+ * Version 2.0, January 2004
5
+ * https://www.apache.org/licenses/
6
+
7
+ ### TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. **Definitions.**
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. **Grant of Copyright License.** Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. **Grant of Patent License.** Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. **Redistribution.** You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ * **(a)** You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ * **(b)** You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ * **(c)** You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ * **(d)** If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. **Submission of Contributions.** Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. **Trademarks.** This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. **Disclaimer of Warranty.** Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. **Limitation of Liability.** In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. **Accepting Warranty or Additional Liability.** While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ _END OF TERMS AND CONDITIONS_
179
+
180
+ ### APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "`[]`"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ https://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -0,0 +1,366 @@
1
+ ## Migrating to grafeas 1.0
2
+
3
+ The 1.0 release of the grafeas 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 two libraries. The new gem
13
+ `grafeas-v1` contains the actual client classes for version
14
+ V1 of the Grafeas service, and the gem `grafeas` now
15
+ simply provides a convenience wrapper. See
16
+ [Library Structure](#library-structure) for more info.
17
+ * The library uses a new configuration mechanism giving you closer control
18
+ over endpoint address, network timeouts, and retry. See
19
+ [Client Configuration](#client-configuration) for more info. Furthermore,
20
+ when creating a client object, you can customize its configuration in a
21
+ block rather than passing arguments to the constructor.
22
+ See [Creating Clients](#creating-clients) for more info.
23
+ * The library is now provider-agnostic, no longer defaulting to the endpoint
24
+ and credentials for Google's implementation. You must specify the endpoint
25
+ explicitly. If you want to use Google's Cloud Container Analysis service,
26
+ install the `google-cloud-container_analysis` gem, which provides a
27
+ Google-specific wrapper. See [Provider Independence](#provider-independence)
28
+ for more info.
29
+ * Previously, positional arguments were used to indicate required arguments.
30
+ Now, all method arguments are keyword arguments, with documentation that
31
+ specifies whether they are required or optional. Additionally, you can pass
32
+ a proto request object instead of separate arguments. See
33
+ [Passing Arguments](#passing-arguments) for more info.
34
+ * Previously, some client classes included helper methods for constructing
35
+ resource paths. These methods now take keyword rather than positional
36
+ arguments, and are also available in a separate paths module. See
37
+ [Resource Path Helpers](#resource-path-helpers) for more info.
38
+ * Previously, clients reported RPC errors by raising instances of
39
+ `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
40
+ `Google::Cloud::Error` and its subclasses. See
41
+ [Handling Errors](#handling-errors) for more info.
42
+ * Some classes have moved into different namespaces. See
43
+ [Class Namespaces](#class-namespaces) for more info.
44
+
45
+ ### Library Structure
46
+
47
+ Older 0.x releases of the `grafeas` gem were all-in-one gems
48
+ that included potentially multiple clients for multiple versions of the
49
+ Grafeas service. The `Grafeas.new` factory method would
50
+ return you an instance of a `Grafeas::V1::GrafeasClient`
51
+ object for the V1 version of the service.
52
+
53
+ With the 1.0 release, the `grafeas` gem still provides factory
54
+ methods for obtaining clients. (The method signatures will have changed. See
55
+ [Creating Clients](#creating-clients) for details.) However, the actual client
56
+ classes have been moved into separate gems, one per service version. Currently,
57
+ Grafeas has one version, V1. The
58
+ `Grafeas::V1::Grafeas::Client` class, along with its
59
+ helpers and data types, is now part of the `grafeas-v1` gem.
60
+ If additional versions of the Grafeas service are released, additional gems
61
+ may be provided for their client classes.
62
+
63
+ For normal usage, you can continue to install the `grafeas` gem
64
+ (which will bring in the versioned client gems as dependencies) and continue to
65
+ use factory methods to create clients. However, you may alternatively choose to
66
+ install only one of the versioned gems. For example, if you know you will only
67
+ use implementations of `V1` of the service, you can install `grafeas-v1` by
68
+ itself, and construct instances of the `Grafeas::V1::Grafeas::Client` client
69
+ class directly.
70
+
71
+ ### Client Configuration
72
+
73
+ In older releases, if you wanted to customize performance parameters or
74
+ low-level behavior of the client (such as credentials, timeouts, or
75
+ instrumentation), you would pass a variety of keyword arguments to the client
76
+ constructor. It was also extremely difficult to customize the default settings.
77
+
78
+ With the 1.0 release, a configuration interface provides control over these
79
+ parameters, including defaults for all instances of a client, and settings for
80
+ each specific client instance. For example, to set default credentials and
81
+ timeout for all Grafeas V1 clients:
82
+
83
+ ```
84
+ Grafeas::V1::Grafeas::Client.configure do |config|
85
+ config.credentials = my_credentials
86
+ config.timeout = 10.0
87
+ end
88
+ ```
89
+
90
+ Individual RPCs can also be configured independently. For example, to set the
91
+ timeout for the `create_occurrence` call:
92
+
93
+ ```
94
+ Grafeas::V1::Grafeas::Client.configure do |config|
95
+ config.rpcs.create_occurrence.timeout = 20.0
96
+ end
97
+ ```
98
+
99
+ Finally, you can override the configuration for each client instance. See the
100
+ section on [Creating Clients](#creating-clients) for details.
101
+
102
+ ### Creating Clients
103
+
104
+ In older releases, to create a client object, you would use the
105
+ `Grafeas.new` class method. Keyword arguments were available to
106
+ select a service version and to configure parameters such as credentials and
107
+ timeouts.
108
+
109
+ With the 1.0 release, use the `Grafeas.grafeas` class
110
+ method to create a client object. You may select a service version using the
111
+ `:version` keyword argument. However, other configuration parameters should be
112
+ set in a configuration block when you create the client.
113
+
114
+ Old:
115
+ ```
116
+ client = Grafeas.new credentials: my_credentials_object
117
+ ```
118
+
119
+ New:
120
+ ```
121
+ client = Grafeas.grafeas do |config|
122
+ config.credentials = my_credentials_object
123
+ end
124
+ ```
125
+
126
+ The configuration block is optional. If you do not provide it, or you do not
127
+ set some configuration parameters, then the default configuration is used. See
128
+ [Client Configuration](#client-configuration).
129
+
130
+ ### Provider Independence
131
+
132
+ Older releases were tied to Google's Grafeas implementation, the Google Cloud
133
+ Container Analysis service. Clients were configured to use Google's endpoint
134
+ and credentials by default, though this could be overridden. You could also use
135
+ Google-specific credential specifications such as the path to a Google service
136
+ account keyfile.
137
+
138
+ With the 1.0 release, the `grafeas` gem is provider-independent, and does not
139
+ default to the Google implementation. You must specify an endpoint host, and
140
+ you must provide gRPC-based credentials (such as a
141
+ `GRPC::Core::ChannelCredentials` or a pre-constructed `GRPC::Core::Channel`
142
+ object) when creating a client object. These properties can be set using the
143
+ [configuration interface](#client-configuration) or by passing a block to the
144
+ constructor as covered in [Creating Clients](#creating-clients).
145
+
146
+ Old:
147
+ ```
148
+ client = Grafeas.new credentials: "path/to/google/keyfile.json"
149
+ ```
150
+
151
+ New:
152
+ ```
153
+ client = Grafeas.grafeas do |config|
154
+ config.endpoint = "my-grafeas.example.com"
155
+ config.credentials = my_grpc_credentials
156
+ end
157
+
158
+ # or
159
+
160
+ client = Grafeas.grafeas do |config|
161
+ config.credentials = my_existing_grpc_channel
162
+ end
163
+ ```
164
+
165
+ If you want to continue using Google's Cloud Container Analysis implementation,
166
+ we recommend using the `google-cloud-container_analysis` gem, which provides
167
+ the Google-specific default endpoint and credentials. Using the Container
168
+ Analysis client library, you can obtain a Grafeas client object connected and
169
+ authenticated with the Google backend.
170
+
171
+ New:
172
+ ```
173
+ require "google/cloud/container_analysis"
174
+
175
+ # Create a connection to the Google Container Analysis service
176
+ container_analysis = Google::Cloud::ContainerAnalysis.container_analysis do |config|
177
+ config.credentials = "/path/to/google/keyfile.json"
178
+ end
179
+
180
+ # You can obtain a Grafeas client from the Container Analysis connection
181
+ grafeas_client = container_analysis.grafeas_client
182
+ ```
183
+
184
+ ### Passing Arguments
185
+
186
+ In older releases, required arguments would be passed as positional method
187
+ arguments, while most optional arguments would be passed as keyword arguments.
188
+
189
+ With the 1.0 release, all RPC arguments are passed as keyword arguments,
190
+ regardless of whether they are required or optional. For example:
191
+
192
+ Old:
193
+ ```
194
+ client = Grafeas.new
195
+
196
+ parent = "projects/my-project"
197
+
198
+ # Parent is a positional argument, while page_size is a keyword argument.
199
+ response = client.list_occurrences parent, page_size: 10
200
+ ```
201
+
202
+ New:
203
+ ```
204
+ client = Grafeas.grafeas
205
+
206
+ parent = "projects/my-project"
207
+
208
+ # Parent and page_size are both keyword arguments
209
+ response = client.list_occurrences parent: parent, page_size: 10
210
+ ```
211
+
212
+ In the 1.0 release, it is also possible to pass a request object, either
213
+ as a hash or as a protocol buffer.
214
+
215
+ New:
216
+ ```
217
+ client = Grafeas.grafeas
218
+
219
+ request = Grafeas::V1::ListOccurrencesRequest.new(
220
+ parent: "projects/my-project",
221
+ page_size: 10
222
+ )
223
+
224
+ # Pass a request object as a positional argument:
225
+ response = client.list_occurrences request
226
+ ```
227
+
228
+ Finally, in older releases, to provide call options, you would pass a
229
+ `Google::Gax::CallOptions` object with the `:options` keyword argument. In the
230
+ 1.0 release, pass call options using a _second set_ of keyword arguments.
231
+
232
+ Old:
233
+ ```
234
+ client = Grafeas.new
235
+
236
+ parent = "projects/my-project"
237
+
238
+ options = Google::Gax::CallOptions.new timeout: 10.0
239
+
240
+ response = client.list_occurrences parent, page_size: 10, options: options
241
+ ```
242
+
243
+ New:
244
+ ```
245
+ client = Grafeas.grafeas
246
+
247
+ parent = "projects/my-project"
248
+
249
+ # Use a hash to wrap the normal call arguments (or pass a request object), and
250
+ # then add further keyword arguments for the call options.
251
+ response = client.list_occurrences(
252
+ { parent: parent, page_size: 10 },
253
+ timeout: 10.0
254
+ )
255
+ ```
256
+
257
+ ### Resource Path Helpers
258
+
259
+ The client library includes helper methods for generating the resource path
260
+ strings passed to many calls. These helpers have changed in two ways:
261
+
262
+ * In older releases, they are _class_ methods on the client class. In the 1.0
263
+ release, they are _instance_ methods on the client. They are also available
264
+ on a separate paths module that you can include elsewhere for convenience.
265
+ * In older releases, arguments to a resource path helper are passed as
266
+ _positional_ arguments. In the 1.0 release, they are passed as named _keyword_
267
+ arguments.
268
+
269
+ Following is an example involving using a resource path helper.
270
+
271
+ Old:
272
+ ```
273
+ client = Grafeas.new
274
+
275
+ # Call the helper on the client class
276
+ parent = Grafeas::V1::GrafeasClient.project_path "my-project"
277
+
278
+ response = client.list_occurrences parent
279
+ ```
280
+
281
+ New:
282
+ ```
283
+ client = Grafeas.grafeas
284
+
285
+ # Call the helper on the client instance, and use keyword arguments
286
+ parent = client.project_path project: "my-project"
287
+
288
+ response = client.list_occurrences parent: parent
289
+ ```
290
+
291
+ In the 1.0 client, you can also use the paths module as a convenience module.
292
+
293
+ New:
294
+ ```
295
+ # Bring the path helper methods into the current class
296
+ include Grafeas::V1::Grafeas::Paths
297
+
298
+ def foo
299
+ client = Grafeas.grafeas
300
+
301
+ # Call the included helper method
302
+ parent = project_path project: "my-project"
303
+
304
+ response = client.list_occurrences parent: parent
305
+
306
+ # Do something with response...
307
+ end
308
+ ```
309
+
310
+ ### Handling Errors
311
+
312
+ The client reports standard
313
+ [gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
314
+ by raising exceptions. In older releases, these exceptions were located in the
315
+ `Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
316
+ exception class, defined in the `google-gax` gem. However, these classes were
317
+ different from the standard exceptions (subclasses of `Google::Cloud::Error`)
318
+ thrown by other client libraries such as `google-cloud-storage`.
319
+
320
+ The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
321
+ for consistency across all the Google Cloud client libraries. In general, these
322
+ exceptions have the same name as their counterparts from older releases, but
323
+ are located in the `Google::Cloud` namespace rather than the `Google::Gax`
324
+ namespace.
325
+
326
+ Old:
327
+ ```
328
+ client = Grafeas.new
329
+
330
+ parent = "projects/my-project"
331
+
332
+ begin
333
+ response = client.list_occurrences parent, page_size: 10
334
+ rescue Google::Gax::Error => e
335
+ # Handle exceptions that subclass Google::Gax::Error
336
+ end
337
+ ```
338
+
339
+ New:
340
+ ```
341
+ client = Grafeas.grafeas
342
+
343
+ parent = "projects/my-project"
344
+
345
+ begin
346
+ response = client.list_occurrences parent: parent, page_size: 10
347
+ rescue Google::Cloud::Error => e
348
+ # Handle exceptions that subclass Google::Cloud::Error
349
+ end
350
+ ```
351
+
352
+ ### Class Namespaces
353
+
354
+ In older releases, the client object was of classes with names like:
355
+ `Grafeas::V1::GrafeasClient`.
356
+ In the 1.0 release, the client object is of a different class:
357
+ `Grafeas::V1::Grafeas::Client`.
358
+ Note that most users will use the factory methods such as
359
+ `Grafeas.grafeas` to create instances of the client object,
360
+ so you may not need to reference the actual class directly.
361
+ See [Creating Clients](#creating-clients).
362
+
363
+ In older releases, there was a Google-specific credentials class named
364
+ `Grafeas::V1::Credentials`.
365
+ In the 1.0 release, this class is no longer present.
366
+ See [Provider Independence](#provider-independence).