google-apis-ondemandscanning_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,321 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module OndemandscanningV1
23
+ # On-Demand Scanning API
24
+ #
25
+ # A service to scan container images for vulnerabilities.
26
+ #
27
+ # @example
28
+ # require 'google/apis/ondemandscanning_v1'
29
+ #
30
+ # Ondemandscanning = Google::Apis::OndemandscanningV1 # Alias the module
31
+ # service = Ondemandscanning::OnDemandScanningService.new
32
+ #
33
+ # @see https://cloud.google.com/container-analysis/docs/on-demand-scanning/
34
+ class OnDemandScanningService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://ondemandscanning.googleapis.com/', '',
47
+ client_name: 'google-apis-ondemandscanning_v1',
48
+ client_version: Google::Apis::OndemandscanningV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Starts asynchronous cancellation on a long-running operation. The server makes
53
+ # a best effort to cancel the operation, but success is not guaranteed. If the
54
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
55
+ # Clients can use Operations.GetOperation or other methods to check whether the
56
+ # cancellation succeeded or whether the operation completed despite cancellation.
57
+ # On successful cancellation, the operation is not deleted; instead, it becomes
58
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
59
+ # corresponding to `Code.CANCELLED`.
60
+ # @param [String] name
61
+ # The name of the operation resource to be cancelled.
62
+ # @param [String] fields
63
+ # Selector specifying which fields to include in a partial response.
64
+ # @param [String] quota_user
65
+ # Available to use for quota purposes for server-side applications. Can be any
66
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
67
+ # @param [Google::Apis::RequestOptions] options
68
+ # Request-specific options
69
+ #
70
+ # @yield [result, err] Result & error if block supplied
71
+ # @yieldparam result [Google::Apis::OndemandscanningV1::Empty] parsed result object
72
+ # @yieldparam err [StandardError] error object if request failed
73
+ #
74
+ # @return [Google::Apis::OndemandscanningV1::Empty]
75
+ #
76
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
77
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
78
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
79
+ def cancel_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
80
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
81
+ command.response_representation = Google::Apis::OndemandscanningV1::Empty::Representation
82
+ command.response_class = Google::Apis::OndemandscanningV1::Empty
83
+ command.params['name'] = name unless name.nil?
84
+ command.query['fields'] = fields unless fields.nil?
85
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
86
+ execute_or_queue_command(command, &block)
87
+ end
88
+
89
+ # Deletes a long-running operation. This method indicates that the client is no
90
+ # longer interested in the operation result. It does not cancel the operation.
91
+ # If the server doesn't support this method, it returns `google.rpc.Code.
92
+ # UNIMPLEMENTED`.
93
+ # @param [String] name
94
+ # The name of the operation resource to be deleted.
95
+ # @param [String] fields
96
+ # Selector specifying which fields to include in a partial response.
97
+ # @param [String] quota_user
98
+ # Available to use for quota purposes for server-side applications. Can be any
99
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
100
+ # @param [Google::Apis::RequestOptions] options
101
+ # Request-specific options
102
+ #
103
+ # @yield [result, err] Result & error if block supplied
104
+ # @yieldparam result [Google::Apis::OndemandscanningV1::Empty] parsed result object
105
+ # @yieldparam err [StandardError] error object if request failed
106
+ #
107
+ # @return [Google::Apis::OndemandscanningV1::Empty]
108
+ #
109
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
110
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
111
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
112
+ def delete_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
113
+ command = make_simple_command(:delete, 'v1/{+name}', options)
114
+ command.response_representation = Google::Apis::OndemandscanningV1::Empty::Representation
115
+ command.response_class = Google::Apis::OndemandscanningV1::Empty
116
+ command.params['name'] = name unless name.nil?
117
+ command.query['fields'] = fields unless fields.nil?
118
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
119
+ execute_or_queue_command(command, &block)
120
+ end
121
+
122
+ # Gets the latest state of a long-running operation. Clients can use this method
123
+ # to poll the operation result at intervals as recommended by the API service.
124
+ # @param [String] name
125
+ # The name of the operation resource.
126
+ # @param [String] fields
127
+ # Selector specifying which fields to include in a partial response.
128
+ # @param [String] quota_user
129
+ # Available to use for quota purposes for server-side applications. Can be any
130
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
131
+ # @param [Google::Apis::RequestOptions] options
132
+ # Request-specific options
133
+ #
134
+ # @yield [result, err] Result & error if block supplied
135
+ # @yieldparam result [Google::Apis::OndemandscanningV1::Operation] parsed result object
136
+ # @yieldparam err [StandardError] error object if request failed
137
+ #
138
+ # @return [Google::Apis::OndemandscanningV1::Operation]
139
+ #
140
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
141
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
142
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
143
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
144
+ command = make_simple_command(:get, 'v1/{+name}', options)
145
+ command.response_representation = Google::Apis::OndemandscanningV1::Operation::Representation
146
+ command.response_class = Google::Apis::OndemandscanningV1::Operation
147
+ command.params['name'] = name unless name.nil?
148
+ command.query['fields'] = fields unless fields.nil?
149
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
150
+ execute_or_queue_command(command, &block)
151
+ end
152
+
153
+ # Lists operations that match the specified filter in the request. If the server
154
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
155
+ # binding allows API services to override the binding to use different resource
156
+ # name schemes, such as `users/*/operations`. To override the binding, API
157
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
158
+ # service configuration. For backwards compatibility, the default name includes
159
+ # the operations collection id, however overriding users must ensure the name
160
+ # binding is the parent resource, without the operations collection id.
161
+ # @param [String] name
162
+ # The name of the operation's parent resource.
163
+ # @param [String] filter
164
+ # The standard list filter.
165
+ # @param [Fixnum] page_size
166
+ # The standard list page size.
167
+ # @param [String] page_token
168
+ # The standard list page token.
169
+ # @param [String] fields
170
+ # Selector specifying which fields to include in a partial response.
171
+ # @param [String] quota_user
172
+ # Available to use for quota purposes for server-side applications. Can be any
173
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
174
+ # @param [Google::Apis::RequestOptions] options
175
+ # Request-specific options
176
+ #
177
+ # @yield [result, err] Result & error if block supplied
178
+ # @yieldparam result [Google::Apis::OndemandscanningV1::ListOperationsResponse] parsed result object
179
+ # @yieldparam err [StandardError] error object if request failed
180
+ #
181
+ # @return [Google::Apis::OndemandscanningV1::ListOperationsResponse]
182
+ #
183
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
184
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
185
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
186
+ def list_project_location_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
187
+ command = make_simple_command(:get, 'v1/{+name}/operations', options)
188
+ command.response_representation = Google::Apis::OndemandscanningV1::ListOperationsResponse::Representation
189
+ command.response_class = Google::Apis::OndemandscanningV1::ListOperationsResponse
190
+ command.params['name'] = name unless name.nil?
191
+ command.query['filter'] = filter unless filter.nil?
192
+ command.query['pageSize'] = page_size unless page_size.nil?
193
+ command.query['pageToken'] = page_token unless page_token.nil?
194
+ command.query['fields'] = fields unless fields.nil?
195
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
196
+ execute_or_queue_command(command, &block)
197
+ end
198
+
199
+ # Waits until the specified long-running operation is done or reaches at most a
200
+ # specified timeout, returning the latest state. If the operation is already
201
+ # done, the latest state is immediately returned. If the timeout specified is
202
+ # greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If
203
+ # the server does not support this method, it returns `google.rpc.Code.
204
+ # UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return
205
+ # the latest state before the specified timeout (including immediately), meaning
206
+ # even an immediate response is no guarantee that the operation is done.
207
+ # @param [String] name
208
+ # The name of the operation resource to wait on.
209
+ # @param [String] timeout
210
+ # The maximum duration to wait before timing out. If left blank, the wait will
211
+ # be at most the time permitted by the underlying HTTP/RPC protocol. If RPC
212
+ # context deadline is also specified, the shorter one will be used.
213
+ # @param [String] fields
214
+ # Selector specifying which fields to include in a partial response.
215
+ # @param [String] quota_user
216
+ # Available to use for quota purposes for server-side applications. Can be any
217
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
218
+ # @param [Google::Apis::RequestOptions] options
219
+ # Request-specific options
220
+ #
221
+ # @yield [result, err] Result & error if block supplied
222
+ # @yieldparam result [Google::Apis::OndemandscanningV1::Operation] parsed result object
223
+ # @yieldparam err [StandardError] error object if request failed
224
+ #
225
+ # @return [Google::Apis::OndemandscanningV1::Operation]
226
+ #
227
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
228
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
229
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
230
+ def wait_project_location_operation(name, timeout: nil, fields: nil, quota_user: nil, options: nil, &block)
231
+ command = make_simple_command(:post, 'v1/{+name}:wait', options)
232
+ command.response_representation = Google::Apis::OndemandscanningV1::Operation::Representation
233
+ command.response_class = Google::Apis::OndemandscanningV1::Operation
234
+ command.params['name'] = name unless name.nil?
235
+ command.query['timeout'] = timeout unless timeout.nil?
236
+ command.query['fields'] = fields unless fields.nil?
237
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
238
+ execute_or_queue_command(command, &block)
239
+ end
240
+
241
+ # Initiates an analysis of the provided packages.
242
+ # @param [String] parent
243
+ # Required. The parent of the resource for which analysis is requested. Format:
244
+ # projects/[project_name]/locations/[location]
245
+ # @param [Google::Apis::OndemandscanningV1::AnalyzePackagesRequestV1] analyze_packages_request_v1_object
246
+ # @param [String] fields
247
+ # Selector specifying which fields to include in a partial response.
248
+ # @param [String] quota_user
249
+ # Available to use for quota purposes for server-side applications. Can be any
250
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
251
+ # @param [Google::Apis::RequestOptions] options
252
+ # Request-specific options
253
+ #
254
+ # @yield [result, err] Result & error if block supplied
255
+ # @yieldparam result [Google::Apis::OndemandscanningV1::Operation] parsed result object
256
+ # @yieldparam err [StandardError] error object if request failed
257
+ #
258
+ # @return [Google::Apis::OndemandscanningV1::Operation]
259
+ #
260
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
261
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
262
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
263
+ def analyze_scan_packages(parent, analyze_packages_request_v1_object = nil, fields: nil, quota_user: nil, options: nil, &block)
264
+ command = make_simple_command(:post, 'v1/{+parent}/scans:analyzePackages', options)
265
+ command.request_representation = Google::Apis::OndemandscanningV1::AnalyzePackagesRequestV1::Representation
266
+ command.request_object = analyze_packages_request_v1_object
267
+ command.response_representation = Google::Apis::OndemandscanningV1::Operation::Representation
268
+ command.response_class = Google::Apis::OndemandscanningV1::Operation
269
+ command.params['parent'] = parent unless parent.nil?
270
+ command.query['fields'] = fields unless fields.nil?
271
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
272
+ execute_or_queue_command(command, &block)
273
+ end
274
+
275
+ # Lists vulnerabilities resulting from a successfully completed scan.
276
+ # @param [String] parent
277
+ # Required. The parent of the collection of Vulnerabilities being requested.
278
+ # Format: projects/[project_name]/locations/[location]/scans/[scan_id]
279
+ # @param [Fixnum] page_size
280
+ # The number of vulnerabilities to retrieve.
281
+ # @param [String] page_token
282
+ # The page token, resulting from a previous call to ListVulnerabilities.
283
+ # @param [String] fields
284
+ # Selector specifying which fields to include in a partial response.
285
+ # @param [String] quota_user
286
+ # Available to use for quota purposes for server-side applications. Can be any
287
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
288
+ # @param [Google::Apis::RequestOptions] options
289
+ # Request-specific options
290
+ #
291
+ # @yield [result, err] Result & error if block supplied
292
+ # @yieldparam result [Google::Apis::OndemandscanningV1::ListVulnerabilitiesResponseV1] parsed result object
293
+ # @yieldparam err [StandardError] error object if request failed
294
+ #
295
+ # @return [Google::Apis::OndemandscanningV1::ListVulnerabilitiesResponseV1]
296
+ #
297
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
298
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
299
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
300
+ def list_project_location_scan_vulnerabilities(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
301
+ command = make_simple_command(:get, 'v1/{+parent}/vulnerabilities', options)
302
+ command.response_representation = Google::Apis::OndemandscanningV1::ListVulnerabilitiesResponseV1::Representation
303
+ command.response_class = Google::Apis::OndemandscanningV1::ListVulnerabilitiesResponseV1
304
+ command.params['parent'] = parent unless parent.nil?
305
+ command.query['pageSize'] = page_size unless page_size.nil?
306
+ command.query['pageToken'] = page_token unless page_token.nil?
307
+ command.query['fields'] = fields unless fields.nil?
308
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
309
+ execute_or_queue_command(command, &block)
310
+ end
311
+
312
+ protected
313
+
314
+ def apply_command_defaults(command)
315
+ command.query['key'] = key unless key.nil?
316
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
317
+ end
318
+ end
319
+ end
320
+ end
321
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-ondemandscanning_v1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Google LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: This is the simple REST client for On-Demand Scanning API V1. Simple
28
+ REST clients are Ruby client libraries that provide access to Google services via
29
+ their HTTP REST API endpoints. These libraries are generated and updated automatically
30
+ based on the discovery documents published by the service, and they handle most
31
+ concerns such as authentication, pagination, retry, timeouts, and logging. You can
32
+ use this client to access the On-Demand Scanning API, but note that some services
33
+ may provide a separate modern client that is easier to use.
34
+ email: googleapis-packages@google.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".yardopts"
40
+ - CHANGELOG.md
41
+ - LICENSE.md
42
+ - OVERVIEW.md
43
+ - lib/google-apis-ondemandscanning_v1.rb
44
+ - lib/google/apis/ondemandscanning_v1.rb
45
+ - lib/google/apis/ondemandscanning_v1/classes.rb
46
+ - lib/google/apis/ondemandscanning_v1/gem_version.rb
47
+ - lib/google/apis/ondemandscanning_v1/representations.rb
48
+ - lib/google/apis/ondemandscanning_v1/service.rb
49
+ homepage: https://github.com/google/google-api-ruby-client
50
+ licenses:
51
+ - Apache-2.0
52
+ metadata:
53
+ bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
54
+ changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-ondemandscanning_v1/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-ondemandscanning_v1/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-ondemandscanning_v1
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.5'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.2.13
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for On-Demand Scanning API V1
76
+ test_files: []