google-cloud-asset 0.8.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +272 -0
  6. data/README.md +36 -24
  7. data/lib/{google/cloud/asset/v1/doc/google/protobuf/empty.rb → google-cloud-asset.rb} +4 -14
  8. data/lib/google/cloud/asset.rb +76 -116
  9. data/lib/google/cloud/asset/version.rb +1 -1
  10. metadata +73 -78
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/asset/v1.rb +0 -146
  13. data/lib/google/cloud/asset/v1/asset_service_client.rb +0 -669
  14. data/lib/google/cloud/asset/v1/asset_service_client_config.json +0 -61
  15. data/lib/google/cloud/asset/v1/asset_service_pb.rb +0 -123
  16. data/lib/google/cloud/asset/v1/asset_service_services_pb.rb +0 -69
  17. data/lib/google/cloud/asset/v1/assets_pb.rb +0 -51
  18. data/lib/google/cloud/asset/v1/credentials.rb +0 -41
  19. data/lib/google/cloud/asset/v1/doc/google/cloud/asset/v1/asset_service.rb +0 -295
  20. data/lib/google/cloud/asset/v1/doc/google/cloud/asset/v1/assets.rb +0 -116
  21. data/lib/google/cloud/asset/v1/doc/google/iam/v1/policy.rb +0 -151
  22. data/lib/google/cloud/asset/v1/doc/google/longrunning/operations.rb +0 -51
  23. data/lib/google/cloud/asset/v1/doc/google/protobuf/any.rb +0 -131
  24. data/lib/google/cloud/asset/v1/doc/google/protobuf/field_mask.rb +0 -222
  25. data/lib/google/cloud/asset/v1/doc/google/protobuf/struct.rb +0 -74
  26. data/lib/google/cloud/asset/v1/doc/google/protobuf/timestamp.rb +0 -113
  27. data/lib/google/cloud/asset/v1/doc/google/rpc/status.rb +0 -39
  28. data/lib/google/cloud/asset/v1/doc/google/type/expr.rb +0 -45
  29. data/lib/google/cloud/asset/v1/helpers.rb +0 -39
  30. data/lib/google/cloud/asset/v1beta1.rb +0 -146
  31. data/lib/google/cloud/asset/v1beta1/asset_service_client.rb +0 -400
  32. data/lib/google/cloud/asset/v1beta1/asset_service_client_config.json +0 -36
  33. data/lib/google/cloud/asset/v1beta1/asset_service_pb.rb +0 -67
  34. data/lib/google/cloud/asset/v1beta1/asset_service_services_pb.rb +0 -59
  35. data/lib/google/cloud/asset/v1beta1/assets_pb.rb +0 -50
  36. data/lib/google/cloud/asset/v1beta1/credentials.rb +0 -41
  37. data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/asset_service.rb +0 -140
  38. data/lib/google/cloud/asset/v1beta1/doc/google/cloud/asset/v1beta1/assets.rb +0 -108
  39. data/lib/google/cloud/asset/v1beta1/doc/google/iam/v1/policy.rb +0 -151
  40. data/lib/google/cloud/asset/v1beta1/doc/google/longrunning/operations.rb +0 -51
  41. data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/any.rb +0 -131
  42. data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/struct.rb +0 -74
  43. data/lib/google/cloud/asset/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  44. data/lib/google/cloud/asset/v1beta1/doc/google/rpc/status.rb +0 -39
  45. data/lib/google/cloud/asset/v1beta1/doc/google/type/expr.rb +0 -45
  46. data/lib/google/cloud/asset/v1beta1/helpers.rb +0 -31
  47. data/lib/google/cloud/orgpolicy/v1/doc/google/cloud/orgpolicy/v1/orgpolicy.rb +0 -308
  48. data/lib/google/cloud/orgpolicy/v1/orgpolicy_pb.rb +0 -55
@@ -1,45 +0,0 @@
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
- # https://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
-
16
- module Google
17
- module Type
18
- # Represents an expression text. Example:
19
- #
20
- # title: "User account presence"
21
- # description: "Determines whether the request has a user account"
22
- # expression: "size(request.user) > 0"
23
- # @!attribute [rw] expression
24
- # @return [String]
25
- # Textual representation of an expression in
26
- # Common Expression Language syntax.
27
- #
28
- # The application context of the containing message determines which
29
- # well-known feature set of CEL is supported.
30
- # @!attribute [rw] title
31
- # @return [String]
32
- # An optional title for the expression, i.e. a short string describing
33
- # its purpose. This can be used e.g. in UIs which allow to enter the
34
- # expression.
35
- # @!attribute [rw] description
36
- # @return [String]
37
- # An optional description of the expression. This is a longer text which
38
- # describes the expression, e.g. when hovered over it in a UI.
39
- # @!attribute [rw] location
40
- # @return [String]
41
- # An optional string indicating the location of the expression for error
42
- # reporting, e.g. a file name and a position in the file.
43
- class Expr; end
44
- end
45
- end
@@ -1,39 +0,0 @@
1
- # Copyright 2018 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
- # https://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
- module Google
16
- module Cloud
17
- module Asset
18
- module V1
19
- class AssetServiceClient
20
-
21
- # Alias for Google::Cloud::Asset::V1::AssetServiceClient.feed_path.
22
- # @param project [String]
23
- # @param feed [String]
24
- # @return [String]
25
- def feed_path project, feed
26
- self.class.feed_path project, feed
27
- end
28
-
29
- # Alias for Google::Cloud::Asset::V1::AssetServiceClient.project_path.
30
- # @param project [String]
31
- # @return [String]
32
- def project_path project
33
- self.class.project_path project
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,146 +0,0 @@
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
- # https://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
-
16
- require "google/cloud/asset/v1beta1/asset_service_client"
17
- require "google/cloud/asset/v1beta1/helpers"
18
-
19
- module Google
20
- module Cloud
21
- module Asset
22
- # rubocop:disable LineLength
23
-
24
- ##
25
- # # Ruby Client for Cloud Asset API
26
- #
27
- # [Cloud Asset API][Product Documentation]:
28
- # The cloud asset API manages the history and inventory of cloud resources.
29
- # - [Product Documentation][]
30
- #
31
- # ## Quick Start
32
- # In order to use this library, you first need to go through the following
33
- # steps:
34
- #
35
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
- # 3. [Enable the Cloud Asset API.](https://console.cloud.google.com/apis/library/asset.googleapis.com)
38
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-asset/latest/file.AUTHENTICATION.html)
39
- #
40
- # ### Installation
41
- # ```
42
- # $ gem install google-cloud-asset
43
- # ```
44
- #
45
- # ### Next Steps
46
- # - Read the [Cloud Asset API Product documentation][Product Documentation]
47
- # to learn more about the product and see How-to Guides.
48
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
49
- # to see the full list of Cloud APIs that we cover.
50
- #
51
- # [Product Documentation]: https://cloud.google.com/resource-manager
52
- #
53
- # ## Enabling Logging
54
- #
55
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
56
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
57
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
58
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
59
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
60
- #
61
- # Configuring a Ruby stdlib logger:
62
- #
63
- # ```ruby
64
- # require "logger"
65
- #
66
- # module MyLogger
67
- # LOGGER = Logger.new $stderr, level: Logger::WARN
68
- # def logger
69
- # LOGGER
70
- # end
71
- # end
72
- #
73
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
74
- # module GRPC
75
- # extend MyLogger
76
- # end
77
- # ```
78
- #
79
- module V1beta1
80
- # rubocop:enable LineLength
81
-
82
- ##
83
- # Asset service definition.
84
- #
85
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
86
- # Provides the means for authenticating requests made by the client. This parameter can
87
- # be many types.
88
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
89
- # authenticating requests made by this client.
90
- # A `String` will be treated as the path to the keyfile to be used for the construction of
91
- # credentials for this client.
92
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
93
- # credentials for this client.
94
- # A `GRPC::Core::Channel` will be used to make calls through.
95
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
96
- # should already be composed with a `GRPC::Core::CallCredentials` object.
97
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
98
- # metadata for requests, generally, to give OAuth credentials.
99
- # @param scopes [Array<String>]
100
- # The OAuth scopes for this service. This parameter is ignored if
101
- # an updater_proc is supplied.
102
- # @param client_config [Hash]
103
- # A Hash for call options for each method. See
104
- # Google::Gax#construct_settings for the structure of
105
- # this data. Falls back to the default config if not specified
106
- # or the specified config is missing data points.
107
- # @param timeout [Numeric]
108
- # The default timeout, in seconds, for calls made through this client.
109
- # @param metadata [Hash]
110
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
111
- # @param service_address [String]
112
- # Override for the service hostname, or `nil` to leave as the default.
113
- # @param service_port [Integer]
114
- # Override for the service port, or `nil` to leave as the default.
115
- # @param exception_transformer [Proc]
116
- # An optional proc that intercepts any exceptions raised during an API call to inject
117
- # custom error handling.
118
- def self.new \
119
- credentials: nil,
120
- scopes: nil,
121
- client_config: nil,
122
- timeout: nil,
123
- metadata: nil,
124
- service_address: nil,
125
- service_port: nil,
126
- exception_transformer: nil,
127
- lib_name: nil,
128
- lib_version: nil
129
- kwargs = {
130
- credentials: credentials,
131
- scopes: scopes,
132
- client_config: client_config,
133
- timeout: timeout,
134
- metadata: metadata,
135
- exception_transformer: exception_transformer,
136
- lib_name: lib_name,
137
- service_address: service_address,
138
- service_port: service_port,
139
- lib_version: lib_version
140
- }.select { |_, v| v != nil }
141
- Google::Cloud::Asset::V1beta1::AssetServiceClient.new(**kwargs)
142
- end
143
- end
144
- end
145
- end
146
- end
@@ -1,400 +0,0 @@
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
- # https://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
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/cloud/asset/v1beta1/asset_service.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
- require "google/gax/operation"
28
- require "google/longrunning/operations_client"
29
-
30
- require "google/cloud/asset/v1beta1/asset_service_pb"
31
- require "google/cloud/asset/v1beta1/credentials"
32
- require "google/cloud/asset/version"
33
-
34
- module Google
35
- module Cloud
36
- module Asset
37
- module V1beta1
38
- # Asset service definition.
39
- #
40
- # @!attribute [r] asset_service_stub
41
- # @return [Google::Cloud::Asset::V1beta1::AssetService::Stub]
42
- class AssetServiceClient
43
- # @private
44
- attr_reader :asset_service_stub
45
-
46
- # The default address of the service.
47
- SERVICE_ADDRESS = "cloudasset.googleapis.com".freeze
48
-
49
- # The default port of the service.
50
- DEFAULT_SERVICE_PORT = 443
51
-
52
- # The default set of gRPC interceptors.
53
- GRPC_INTERCEPTORS = []
54
-
55
- DEFAULT_TIMEOUT = 30
56
-
57
- # The scopes needed to make gRPC calls to all of the methods defined in
58
- # this service.
59
- ALL_SCOPES = [
60
- "https://www.googleapis.com/auth/cloud-platform"
61
- ].freeze
62
-
63
- # @private
64
- class OperationsClient < Google::Longrunning::OperationsClient
65
- self::SERVICE_ADDRESS = AssetServiceClient::SERVICE_ADDRESS
66
- self::GRPC_INTERCEPTORS = AssetServiceClient::GRPC_INTERCEPTORS
67
- end
68
-
69
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
70
- "projects/{project}"
71
- )
72
-
73
- private_constant :PROJECT_PATH_TEMPLATE
74
-
75
- # Returns a fully-qualified project resource name string.
76
- # @param project [String]
77
- # @return [String]
78
- def self.project_path project
79
- PROJECT_PATH_TEMPLATE.render(
80
- :"project" => project
81
- )
82
- end
83
-
84
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
85
- # Provides the means for authenticating requests made by the client. This parameter can
86
- # be many types.
87
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
88
- # authenticating requests made by this client.
89
- # A `String` will be treated as the path to the keyfile to be used for the construction of
90
- # credentials for this client.
91
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
92
- # credentials for this client.
93
- # A `GRPC::Core::Channel` will be used to make calls through.
94
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
95
- # should already be composed with a `GRPC::Core::CallCredentials` object.
96
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
97
- # metadata for requests, generally, to give OAuth credentials.
98
- # @param scopes [Array<String>]
99
- # The OAuth scopes for this service. This parameter is ignored if
100
- # an updater_proc is supplied.
101
- # @param client_config [Hash]
102
- # A Hash for call options for each method. See
103
- # Google::Gax#construct_settings for the structure of
104
- # this data. Falls back to the default config if not specified
105
- # or the specified config is missing data points.
106
- # @param timeout [Numeric]
107
- # The default timeout, in seconds, for calls made through this client.
108
- # @param metadata [Hash]
109
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
110
- # @param service_address [String]
111
- # Override for the service hostname, or `nil` to leave as the default.
112
- # @param service_port [Integer]
113
- # Override for the service port, or `nil` to leave as the default.
114
- # @param exception_transformer [Proc]
115
- # An optional proc that intercepts any exceptions raised during an API call to inject
116
- # custom error handling.
117
- def initialize \
118
- credentials: nil,
119
- scopes: ALL_SCOPES,
120
- client_config: {},
121
- timeout: DEFAULT_TIMEOUT,
122
- metadata: nil,
123
- service_address: nil,
124
- service_port: nil,
125
- exception_transformer: nil,
126
- lib_name: nil,
127
- lib_version: ""
128
- # These require statements are intentionally placed here to initialize
129
- # the gRPC module only when it's required.
130
- # See https://github.com/googleapis/toolkit/issues/446
131
- require "google/gax/grpc"
132
- require "google/cloud/asset/v1beta1/asset_service_services_pb"
133
-
134
- credentials ||= Google::Cloud::Asset::V1beta1::Credentials.default
135
-
136
- @operations_client = OperationsClient.new(
137
- credentials: credentials,
138
- scopes: scopes,
139
- client_config: client_config,
140
- timeout: timeout,
141
- lib_name: lib_name,
142
- service_address: service_address,
143
- service_port: service_port,
144
- lib_version: lib_version,
145
- metadata: metadata,
146
- )
147
-
148
- if credentials.is_a?(String) || credentials.is_a?(Hash)
149
- updater_proc = Google::Cloud::Asset::V1beta1::Credentials.new(credentials).updater_proc
150
- end
151
- if credentials.is_a?(GRPC::Core::Channel)
152
- channel = credentials
153
- end
154
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
155
- chan_creds = credentials
156
- end
157
- if credentials.is_a?(Proc)
158
- updater_proc = credentials
159
- end
160
- if credentials.is_a?(Google::Auth::Credentials)
161
- updater_proc = credentials.updater_proc
162
- end
163
-
164
- package_version = Google::Cloud::Asset::VERSION
165
-
166
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
167
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
168
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
169
- google_api_client << " grpc/#{GRPC::VERSION}"
170
- google_api_client.freeze
171
-
172
- headers = { :"x-goog-api-client" => google_api_client }
173
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
174
- headers[:"x-goog-user-project"] = credentials.quota_project_id
175
- end
176
- headers.merge!(metadata) unless metadata.nil?
177
- client_config_file = Pathname.new(__dir__).join(
178
- "asset_service_client_config.json"
179
- )
180
- defaults = client_config_file.open do |f|
181
- Google::Gax.construct_settings(
182
- "google.cloud.asset.v1beta1.AssetService",
183
- JSON.parse(f.read),
184
- client_config,
185
- Google::Gax::Grpc::STATUS_CODE_NAMES,
186
- timeout,
187
- errors: Google::Gax::Grpc::API_ERRORS,
188
- metadata: headers
189
- )
190
- end
191
-
192
- # Allow overriding the service path/port in subclasses.
193
- service_path = service_address || self.class::SERVICE_ADDRESS
194
- port = service_port || self.class::DEFAULT_SERVICE_PORT
195
- interceptors = self.class::GRPC_INTERCEPTORS
196
- @asset_service_stub = Google::Gax::Grpc.create_stub(
197
- service_path,
198
- port,
199
- chan_creds: chan_creds,
200
- channel: channel,
201
- updater_proc: updater_proc,
202
- scopes: scopes,
203
- interceptors: interceptors,
204
- &Google::Cloud::Asset::V1beta1::AssetService::Stub.method(:new)
205
- )
206
-
207
- @export_assets = Google::Gax.create_api_call(
208
- @asset_service_stub.method(:export_assets),
209
- defaults["export_assets"],
210
- exception_transformer: exception_transformer,
211
- params_extractor: proc do |request|
212
- {'parent' => request.parent}
213
- end
214
- )
215
- @batch_get_assets_history = Google::Gax.create_api_call(
216
- @asset_service_stub.method(:batch_get_assets_history),
217
- defaults["batch_get_assets_history"],
218
- exception_transformer: exception_transformer,
219
- params_extractor: proc do |request|
220
- {'parent' => request.parent}
221
- end
222
- )
223
- end
224
-
225
- # Service calls
226
-
227
- # Exports assets with time and resource types to a given Cloud Storage
228
- # location. The output format is newline-delimited JSON.
229
- # This API implements the
230
- # {Google::Longrunning::Operation} API allowing
231
- # you to keep track of the export.
232
- #
233
- # @param parent [String]
234
- # Required. The relative name of the root asset. This can only be an
235
- # organization number (such as "organizations/123"), a project ID (such as
236
- # "projects/my-project-id"), a project number (such as "projects/12345"), or
237
- # a folder number (such as "folders/123").
238
- # @param output_config [Google::Cloud::Asset::V1beta1::OutputConfig | Hash]
239
- # Required. Output configuration indicating where the results will be output
240
- # to. All results will be in newline delimited JSON format.
241
- # A hash of the same form as `Google::Cloud::Asset::V1beta1::OutputConfig`
242
- # can also be provided.
243
- # @param read_time [Google::Protobuf::Timestamp | Hash]
244
- # Timestamp to take an asset snapshot. This can only be set to a timestamp
245
- # between 2018-10-02 UTC (inclusive) and the current time. If not specified,
246
- # the current time will be used. Due to delays in resource data collection
247
- # and indexing, there is a volatile window during which running the same
248
- # query may get different results.
249
- # A hash of the same form as `Google::Protobuf::Timestamp`
250
- # can also be provided.
251
- # @param asset_types [Array<String>]
252
- # A list of asset types of which to take a snapshot for. For example:
253
- # "google.compute.Disk". If specified, only matching assets will be returned.
254
- # See [Introduction to Cloud Asset
255
- # Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview)
256
- # for all supported asset types.
257
- # @param content_type [Google::Cloud::Asset::V1beta1::ContentType]
258
- # Asset content type. If not specified, no content but the asset name will be
259
- # returned.
260
- # @param options [Google::Gax::CallOptions]
261
- # Overrides the default settings for this call, e.g, timeout,
262
- # retries, etc.
263
- # @return [Google::Gax::Operation]
264
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
265
- # @example
266
- # require "google/cloud/asset"
267
- #
268
- # asset_client = Google::Cloud::Asset.new(version: :v1beta1)
269
- # formatted_parent = Google::Cloud::Asset::V1beta1::AssetServiceClient.project_path("[PROJECT]")
270
- #
271
- # # TODO: Initialize `output_config`:
272
- # output_config = {}
273
- #
274
- # # Register a callback during the method call.
275
- # operation = asset_client.export_assets(formatted_parent, output_config) do |op|
276
- # raise op.results.message if op.error?
277
- # op_results = op.results
278
- # # Process the results.
279
- #
280
- # metadata = op.metadata
281
- # # Process the metadata.
282
- # end
283
- #
284
- # # Or use the return value to register a callback.
285
- # operation.on_done do |op|
286
- # raise op.results.message if op.error?
287
- # op_results = op.results
288
- # # Process the results.
289
- #
290
- # metadata = op.metadata
291
- # # Process the metadata.
292
- # end
293
- #
294
- # # Manually reload the operation.
295
- # operation.reload!
296
- #
297
- # # Or block until the operation completes, triggering callbacks on
298
- # # completion.
299
- # operation.wait_until_done!
300
-
301
- def export_assets \
302
- parent,
303
- output_config,
304
- read_time: nil,
305
- asset_types: nil,
306
- content_type: nil,
307
- options: nil
308
- req = {
309
- parent: parent,
310
- output_config: output_config,
311
- read_time: read_time,
312
- asset_types: asset_types,
313
- content_type: content_type
314
- }.delete_if { |_, v| v.nil? }
315
- req = Google::Gax::to_proto(req, Google::Cloud::Asset::V1beta1::ExportAssetsRequest)
316
- operation = Google::Gax::Operation.new(
317
- @export_assets.call(req, options),
318
- @operations_client,
319
- Google::Cloud::Asset::V1beta1::ExportAssetsResponse,
320
- Google::Cloud::Asset::V1beta1::ExportAssetsRequest,
321
- call_options: options
322
- )
323
- operation.on_done { |operation| yield(operation) } if block_given?
324
- operation
325
- end
326
-
327
- # Batch gets the update history of assets that overlap a time window.
328
- # For RESOURCE content, this API outputs history with asset in both
329
- # non-delete or deleted status.
330
- # For IAM_POLICY content, this API outputs history when the asset and its
331
- # attached IAM POLICY both exist. This can create gaps in the output history.
332
- # If a specified asset does not exist, this API returns an INVALID_ARGUMENT
333
- # error.
334
- #
335
- # @param parent [String]
336
- # Required. The relative name of the root asset. It can only be an
337
- # organization number (such as "organizations/123"), a project ID (such as
338
- # "projects/my-project-id")", or a project number (such as "projects/12345").
339
- # @param content_type [Google::Cloud::Asset::V1beta1::ContentType]
340
- # Optional. The content type.
341
- # @param read_time_window [Google::Cloud::Asset::V1beta1::TimeWindow | Hash]
342
- # Optional. The time window for the asset history. Both start_time and
343
- # end_time are optional and if set, it must be after 2018-10-02 UTC. If
344
- # end_time is not set, it is default to current timestamp. If start_time is
345
- # not set, the snapshot of the assets at end_time will be returned. The
346
- # returned results contain all temporal assets whose time window overlap with
347
- # read_time_window.
348
- # A hash of the same form as `Google::Cloud::Asset::V1beta1::TimeWindow`
349
- # can also be provided.
350
- # @param asset_names [Array<String>]
351
- # A list of the full names of the assets. For example:
352
- # `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
353
- # See [Resource
354
- # Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
355
- # for more info.
356
- #
357
- # The request becomes a no-op if the asset name list is empty, and the max
358
- # size of the asset name list is 100 in one request.
359
- # @param options [Google::Gax::CallOptions]
360
- # Overrides the default settings for this call, e.g, timeout,
361
- # retries, etc.
362
- # @yield [result, operation] Access the result along with the RPC operation
363
- # @yieldparam result [Google::Cloud::Asset::V1beta1::BatchGetAssetsHistoryResponse]
364
- # @yieldparam operation [GRPC::ActiveCall::Operation]
365
- # @return [Google::Cloud::Asset::V1beta1::BatchGetAssetsHistoryResponse]
366
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
367
- # @example
368
- # require "google/cloud/asset"
369
- #
370
- # asset_client = Google::Cloud::Asset.new(version: :v1beta1)
371
- # formatted_parent = Google::Cloud::Asset::V1beta1::AssetServiceClient.project_path("[PROJECT]")
372
- #
373
- # # TODO: Initialize `content_type`:
374
- # content_type = :CONTENT_TYPE_UNSPECIFIED
375
- #
376
- # # TODO: Initialize `read_time_window`:
377
- # read_time_window = {}
378
- # response = asset_client.batch_get_assets_history(formatted_parent, content_type, read_time_window)
379
-
380
- def batch_get_assets_history \
381
- parent,
382
- content_type,
383
- read_time_window,
384
- asset_names: nil,
385
- options: nil,
386
- &block
387
- req = {
388
- parent: parent,
389
- content_type: content_type,
390
- read_time_window: read_time_window,
391
- asset_names: asset_names
392
- }.delete_if { |_, v| v.nil? }
393
- req = Google::Gax::to_proto(req, Google::Cloud::Asset::V1beta1::BatchGetAssetsHistoryRequest)
394
- @batch_get_assets_history.call(req, options, &block)
395
- end
396
- end
397
- end
398
- end
399
- end
400
- end