call method
Future<CallResponse>
call(
- ServiceCall call,
- CallRequest request
)
Implementation
@override
Future<providerpb.CallResponse> call(
ServiceCall call,
providerpb.CallRequest request,
) async {
return _withSerializedRuntime(() async {
try {
await _configureRuntime(
project: request.project,
stack: request.stack,
parallel: request.parallel,
monitorEndpoint: request.monitorEndpoint,
dryRun: request.dryRun,
organization: request.organization,
config: request.config,
configSecretKeys: request.configSecretKeys,
);
final args = await deserializeInputs(
request.args,
(key) => request.argDependencies[key]?.urns ?? const <String>[],
);
late final CallResult result;
try {
result = await provider.call(request.tok, args);
} on UnsupportedProviderOperationError catch (error) {
throw GrpcError.unimplemented(error.toString());
}
await DeploymentImpl.current?.registerOutputs();
final serialized = await _serializeInputMap(
'call(${request.tok})',
result.outputs,
);
final response = providerpb.CallResponse()
..return_1 = serialized.struct;
for (final entry in serialized.dependencies.entries) {
response.returnDependencies[entry.key] =
providerpb.CallResponse_ReturnDependencies()
..urns.addAll(entry.value);
}
if (result.failures != null) {
response.failures.addAll(
result.failures!.map(
(failure) => providerpb.CheckFailure(
property: failure.property,
reason: failure.reason,
),
),
);
}
return response;
} on InputPropertiesError catch (error) {
throw _buildInvalidPropertiesError(error.message, error.errors);
} on InputPropertyError catch (error) {
throw _buildInvalidPropertiesError('', <InputPropertyErrorDetails>[
InputPropertyErrorDetails(
propertyPath: error.propertyPath,
reason: error.reason,
),
]);
}
});
}