google-cloud-asset-v1 0.6.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +64 -0
- data/lib/google/cloud/asset/v1.rb +3 -0
- data/lib/google/cloud/asset/v1/asset_service/client.rb +187 -2
- data/lib/google/cloud/asset/v1/asset_service/operations.rb +89 -4
- data/lib/google/cloud/asset/v1/asset_service_pb.rb +92 -0
- data/lib/google/cloud/asset/v1/asset_service_services_pb.rb +22 -9
- data/lib/google/cloud/asset/v1/assets_pb.rb +49 -0
- data/lib/google/cloud/asset/v1/version.rb +1 -1
- data/lib/google/cloud/osconfig/v1/inventory_pb.rb +108 -0
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/asset/v1/asset_service.rb +406 -0
- data/proto_docs/google/cloud/asset/v1/assets.rb +172 -0
- data/proto_docs/google/cloud/osconfig/v1/inventory.rb +284 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75cda8bfe461ae4fe2acbe0c503017803a5b0e193b262f36fefd890aa66330ba
|
4
|
+
data.tar.gz: b48c761acb7589da45e2bfe5babc1082def71443f4ea43179d7b3f3769723ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f987829b1fd707a0310908385ea914d8d6db60a4f8fa481b66e66e0588d7226204069f6a04f1174bb946d4403d2f97a798eb612426164d674abc80e02dcf1e4
|
7
|
+
data.tar.gz: 70727f7f77059730b6d1343fb688f1072d215f7ca7c7e1e91ac756b9e1f4277a582b6100335617189fc69336aba1f39e39a8e26113cc1ab26dba934a07085e01
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@ A metadata inventory service that allows you to view, monitor, and analyze all y
|
|
6
6
|
|
7
7
|
https://github.com/googleapis/google-cloud-ruby
|
8
8
|
|
9
|
+
This gem is a _versioned_ client. It provides basic client classes for a
|
10
|
+
specific version of the Cloud Asset V1 API. Most users should consider using
|
11
|
+
the main client gem,
|
12
|
+
[google-cloud-asset](https://rubygems.org/gems/google-cloud-asset).
|
13
|
+
See the section below titled *Which client should I use?* for more information.
|
14
|
+
|
9
15
|
## Installation
|
10
16
|
|
11
17
|
```
|
@@ -73,3 +79,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
|
|
73
79
|
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
74
80
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
75
81
|
about the Ruby support schedule.
|
82
|
+
|
83
|
+
## Which client should I use?
|
84
|
+
|
85
|
+
Most modern Ruby client libraries for Google APIs come in two flavors: the main
|
86
|
+
client library with a name such as `google-cloud-asset`,
|
87
|
+
and lower-level _versioned_ client libraries with names such as
|
88
|
+
`google-cloud-asset-v1`.
|
89
|
+
_In most cases, you should install the main client._
|
90
|
+
|
91
|
+
### What's the difference between the main client and a versioned client?
|
92
|
+
|
93
|
+
A _versioned client_ provides a basic set of data types and client classes for
|
94
|
+
a _single version_ of a specific service. (That is, for a service with multiple
|
95
|
+
versions, there might be a separate versioned client for each service version.)
|
96
|
+
Most versioned clients are written and maintained by a code generator.
|
97
|
+
|
98
|
+
The _main client_ is designed to provide you with the _recommended_ client
|
99
|
+
interfaces for the service. There will be only one main client for any given
|
100
|
+
service, even a service with multiple versions. The main client includes
|
101
|
+
factory methods for constructing the client objects we recommend for most
|
102
|
+
users. In some cases, those will be classes provided by an underlying versioned
|
103
|
+
client; in other cases, they will be handwritten higher-level client objects
|
104
|
+
with additional capabilities, convenience methods, or best practices built in.
|
105
|
+
Generally, the main client will default to a recommended service version,
|
106
|
+
although in some cases you can override this if you need to talk to a specific
|
107
|
+
service version.
|
108
|
+
|
109
|
+
### Why would I want to use the main client?
|
110
|
+
|
111
|
+
We recommend that most users install the main client gem for a service. You can
|
112
|
+
identify this gem as the one _without_ a version in its name, e.g.
|
113
|
+
`google-cloud-asset`.
|
114
|
+
The main client is recommended because it will embody the best practices for
|
115
|
+
accessing the service, and may also provide more convenient interfaces or
|
116
|
+
tighter integration into frameworks and third-party libraries. In addition, the
|
117
|
+
documentation and samples published by Google will generally demonstrate use of
|
118
|
+
the main client.
|
119
|
+
|
120
|
+
### Why would I want to use a versioned client?
|
121
|
+
|
122
|
+
You can use a versioned client if you are content with a possibly lower-level
|
123
|
+
class interface, you explicitly want to avoid features provided by the main
|
124
|
+
client, or you want to access a specific service version not be covered by the
|
125
|
+
main client. You can identify versioned client gems because the service version
|
126
|
+
is part of the name, e.g. `google-cloud-asset-v1`.
|
127
|
+
|
128
|
+
### What about the google-apis-<name> clients?
|
129
|
+
|
130
|
+
Client library gems with names that begin with `google-apis-` are based on an
|
131
|
+
older code generation technology. They talk to a REST/JSON backend (whereas
|
132
|
+
most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
|
133
|
+
not offer the same performance, features, and ease of use provided by more
|
134
|
+
modern clients.
|
135
|
+
|
136
|
+
The `google-apis-` clients have wide coverage across Google services, so you
|
137
|
+
might need to use one if there is no modern client available for the service.
|
138
|
+
However, if a modern client is available, we generally recommend it over the
|
139
|
+
older `google-apis-` clients.
|
@@ -119,6 +119,16 @@ module Google
|
|
119
119
|
retry_codes: [4, 14]
|
120
120
|
}
|
121
121
|
|
122
|
+
default_config.rpcs.analyze_iam_policy.timeout = 300.0
|
123
|
+
default_config.rpcs.analyze_iam_policy.retry_policy = {
|
124
|
+
initial_delay: 0.1,
|
125
|
+
max_delay: 60.0,
|
126
|
+
multiplier: 1.3,
|
127
|
+
retry_codes: [14]
|
128
|
+
}
|
129
|
+
|
130
|
+
default_config.rpcs.analyze_iam_policy_longrunning.timeout = 60.0
|
131
|
+
|
122
132
|
default_config
|
123
133
|
end
|
124
134
|
yield @configure if block_given?
|
@@ -180,7 +190,13 @@ module Google
|
|
180
190
|
|
181
191
|
# Create credentials
|
182
192
|
credentials = @config.credentials
|
183
|
-
|
193
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
194
|
+
# but only if the default endpoint does not have a region prefix.
|
195
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
196
|
+
@config.endpoint == Client.configure.endpoint &&
|
197
|
+
!@config.endpoint.split(".").first.include?("-")
|
198
|
+
credentials ||= Credentials.default scope: @config.scope,
|
199
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
184
200
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
185
201
|
credentials = Credentials.new credentials, scope: @config.scope
|
186
202
|
end
|
@@ -1028,6 +1044,161 @@ module Google
|
|
1028
1044
|
raise ::Google::Cloud::Error.from_error(e)
|
1029
1045
|
end
|
1030
1046
|
|
1047
|
+
##
|
1048
|
+
# Analyzes IAM policies to answer which identities have what accesses on
|
1049
|
+
# which resources.
|
1050
|
+
#
|
1051
|
+
# @overload analyze_iam_policy(request, options = nil)
|
1052
|
+
# Pass arguments to `analyze_iam_policy` via a request object, either of type
|
1053
|
+
# {::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest} or an equivalent Hash.
|
1054
|
+
#
|
1055
|
+
# @param request [::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest, ::Hash]
|
1056
|
+
# A request object representing the call parameters. Required. To specify no
|
1057
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1058
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1059
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1060
|
+
#
|
1061
|
+
# @overload analyze_iam_policy(analysis_query: nil, execution_timeout: nil)
|
1062
|
+
# Pass arguments to `analyze_iam_policy` via keyword arguments. Note that at
|
1063
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1064
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1065
|
+
#
|
1066
|
+
# @param analysis_query [::Google::Cloud::Asset::V1::IamPolicyAnalysisQuery, ::Hash]
|
1067
|
+
# Required. The request query.
|
1068
|
+
# @param execution_timeout [::Google::Protobuf::Duration, ::Hash]
|
1069
|
+
# Optional. Amount of time executable has to complete. See JSON representation of
|
1070
|
+
# [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
|
1071
|
+
#
|
1072
|
+
# If this field is set with a value less than the RPC deadline, and the
|
1073
|
+
# execution of your query hasn't finished in the specified
|
1074
|
+
# execution timeout, you will get a response with partial result.
|
1075
|
+
# Otherwise, your query's execution will continue until the RPC deadline.
|
1076
|
+
# If it's not finished until then, you will get a DEADLINE_EXCEEDED error.
|
1077
|
+
#
|
1078
|
+
# Default is empty.
|
1079
|
+
#
|
1080
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1081
|
+
# @yieldparam response [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
|
1082
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1083
|
+
#
|
1084
|
+
# @return [::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse]
|
1085
|
+
#
|
1086
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1087
|
+
#
|
1088
|
+
def analyze_iam_policy request, options = nil
|
1089
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1090
|
+
|
1091
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeIamPolicyRequest
|
1092
|
+
|
1093
|
+
# Converts hash and nil to an options object
|
1094
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1095
|
+
|
1096
|
+
# Customize the options with defaults
|
1097
|
+
metadata = @config.rpcs.analyze_iam_policy.metadata.to_h
|
1098
|
+
|
1099
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1100
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1101
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1102
|
+
gapic_version: ::Google::Cloud::Asset::V1::VERSION
|
1103
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1104
|
+
|
1105
|
+
header_params = {
|
1106
|
+
"analysis_query.scope" => request.analysis_query.scope
|
1107
|
+
}
|
1108
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1109
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1110
|
+
|
1111
|
+
options.apply_defaults timeout: @config.rpcs.analyze_iam_policy.timeout,
|
1112
|
+
metadata: metadata,
|
1113
|
+
retry_policy: @config.rpcs.analyze_iam_policy.retry_policy
|
1114
|
+
options.apply_defaults metadata: @config.metadata,
|
1115
|
+
retry_policy: @config.retry_policy
|
1116
|
+
|
1117
|
+
@asset_service_stub.call_rpc :analyze_iam_policy, request, options: options do |response, operation|
|
1118
|
+
yield response, operation if block_given?
|
1119
|
+
return response
|
1120
|
+
end
|
1121
|
+
rescue ::GRPC::BadStatus => e
|
1122
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
##
|
1126
|
+
# Analyzes IAM policies asynchronously to answer which identities have what
|
1127
|
+
# accesses on which resources, and writes the analysis results to a Google
|
1128
|
+
# Cloud Storage or a BigQuery destination. For Cloud Storage destination, the
|
1129
|
+
# output format is the JSON format that represents a
|
1130
|
+
# {::Google::Cloud::Asset::V1::AnalyzeIamPolicyResponse AnalyzeIamPolicyResponse}. This method implements the
|
1131
|
+
# {::Google::Longrunning::Operation google.longrunning.Operation}, which allows you to track the operation
|
1132
|
+
# status. We recommend intervals of at least 2 seconds with exponential
|
1133
|
+
# backoff retry to poll the operation result. The metadata contains the
|
1134
|
+
# request to help callers to map responses to requests.
|
1135
|
+
#
|
1136
|
+
# @overload analyze_iam_policy_longrunning(request, options = nil)
|
1137
|
+
# Pass arguments to `analyze_iam_policy_longrunning` via a request object, either of type
|
1138
|
+
# {::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest} or an equivalent Hash.
|
1139
|
+
#
|
1140
|
+
# @param request [::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest, ::Hash]
|
1141
|
+
# A request object representing the call parameters. Required. To specify no
|
1142
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1143
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1144
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1145
|
+
#
|
1146
|
+
# @overload analyze_iam_policy_longrunning(analysis_query: nil, output_config: nil)
|
1147
|
+
# Pass arguments to `analyze_iam_policy_longrunning` via keyword arguments. Note that at
|
1148
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1149
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1150
|
+
#
|
1151
|
+
# @param analysis_query [::Google::Cloud::Asset::V1::IamPolicyAnalysisQuery, ::Hash]
|
1152
|
+
# Required. The request query.
|
1153
|
+
# @param output_config [::Google::Cloud::Asset::V1::IamPolicyAnalysisOutputConfig, ::Hash]
|
1154
|
+
# Required. Output configuration indicating where the results will be output to.
|
1155
|
+
#
|
1156
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1157
|
+
# @yieldparam response [::Gapic::Operation]
|
1158
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1159
|
+
#
|
1160
|
+
# @return [::Gapic::Operation]
|
1161
|
+
#
|
1162
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1163
|
+
#
|
1164
|
+
def analyze_iam_policy_longrunning request, options = nil
|
1165
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1166
|
+
|
1167
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Asset::V1::AnalyzeIamPolicyLongrunningRequest
|
1168
|
+
|
1169
|
+
# Converts hash and nil to an options object
|
1170
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1171
|
+
|
1172
|
+
# Customize the options with defaults
|
1173
|
+
metadata = @config.rpcs.analyze_iam_policy_longrunning.metadata.to_h
|
1174
|
+
|
1175
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1176
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1177
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1178
|
+
gapic_version: ::Google::Cloud::Asset::V1::VERSION
|
1179
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1180
|
+
|
1181
|
+
header_params = {
|
1182
|
+
"analysis_query.scope" => request.analysis_query.scope
|
1183
|
+
}
|
1184
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1185
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1186
|
+
|
1187
|
+
options.apply_defaults timeout: @config.rpcs.analyze_iam_policy_longrunning.timeout,
|
1188
|
+
metadata: metadata,
|
1189
|
+
retry_policy: @config.rpcs.analyze_iam_policy_longrunning.retry_policy
|
1190
|
+
options.apply_defaults metadata: @config.metadata,
|
1191
|
+
retry_policy: @config.retry_policy
|
1192
|
+
|
1193
|
+
@asset_service_stub.call_rpc :analyze_iam_policy_longrunning, request, options: options do |response, operation|
|
1194
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1195
|
+
yield response, operation if block_given?
|
1196
|
+
return response
|
1197
|
+
end
|
1198
|
+
rescue ::GRPC::BadStatus => e
|
1199
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1200
|
+
end
|
1201
|
+
|
1031
1202
|
##
|
1032
1203
|
# Configuration class for the AssetService API.
|
1033
1204
|
#
|
@@ -1153,7 +1324,7 @@ module Google
|
|
1153
1324
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1154
1325
|
# the following configuration fields:
|
1155
1326
|
#
|
1156
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1327
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1157
1328
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1158
1329
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1159
1330
|
# include the following keys:
|
@@ -1209,6 +1380,16 @@ module Google
|
|
1209
1380
|
# @return [::Gapic::Config::Method]
|
1210
1381
|
#
|
1211
1382
|
attr_reader :search_all_iam_policies
|
1383
|
+
##
|
1384
|
+
# RPC-specific configuration for `analyze_iam_policy`
|
1385
|
+
# @return [::Gapic::Config::Method]
|
1386
|
+
#
|
1387
|
+
attr_reader :analyze_iam_policy
|
1388
|
+
##
|
1389
|
+
# RPC-specific configuration for `analyze_iam_policy_longrunning`
|
1390
|
+
# @return [::Gapic::Config::Method]
|
1391
|
+
#
|
1392
|
+
attr_reader :analyze_iam_policy_longrunning
|
1212
1393
|
|
1213
1394
|
# @private
|
1214
1395
|
def initialize parent_rpcs = nil
|
@@ -1230,6 +1411,10 @@ module Google
|
|
1230
1411
|
@search_all_resources = ::Gapic::Config::Method.new search_all_resources_config
|
1231
1412
|
search_all_iam_policies_config = parent_rpcs&.search_all_iam_policies if parent_rpcs&.respond_to? :search_all_iam_policies
|
1232
1413
|
@search_all_iam_policies = ::Gapic::Config::Method.new search_all_iam_policies_config
|
1414
|
+
analyze_iam_policy_config = parent_rpcs&.analyze_iam_policy if parent_rpcs&.respond_to? :analyze_iam_policy
|
1415
|
+
@analyze_iam_policy = ::Gapic::Config::Method.new analyze_iam_policy_config
|
1416
|
+
analyze_iam_policy_longrunning_config = parent_rpcs&.analyze_iam_policy_longrunning if parent_rpcs&.respond_to? :analyze_iam_policy_longrunning
|
1417
|
+
@analyze_iam_policy_longrunning = ::Gapic::Config::Method.new analyze_iam_policy_longrunning_config
|
1233
1418
|
|
1234
1419
|
yield self if block_given?
|
1235
1420
|
end
|
@@ -103,8 +103,13 @@ module Google
|
|
103
103
|
# Lists operations that match the specified filter in the request. If the
|
104
104
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
105
|
#
|
106
|
-
# NOTE: the `name` binding
|
107
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
# NOTE: the `name` binding allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
108
113
|
#
|
109
114
|
# @overload list_operations(request, options = nil)
|
110
115
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -122,7 +127,7 @@ module Google
|
|
122
127
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
128
|
#
|
124
129
|
# @param name [::String]
|
125
|
-
# The name of the operation
|
130
|
+
# The name of the operation's parent resource.
|
126
131
|
# @param filter [::String]
|
127
132
|
# The standard list filter.
|
128
133
|
# @param page_size [::Integer]
|
@@ -390,6 +395,79 @@ module Google
|
|
390
395
|
raise ::Google::Cloud::Error.from_error(e)
|
391
396
|
end
|
392
397
|
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Asset::V1::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,6 +624,11 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
@@ -557,6 +640,8 @@ module Google
|
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
641
|
cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs&.wait_operation if parent_rpcs&.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|