示例#1
0
        private async Task <OutputData <T> > CallAsync <T>(
            string token, CallArgs args, Resource?self, CallOptions?options, bool convertResult)
        {
            var(result, deps) = await CallRawAsync(token, args, self, options).ConfigureAwait(false);

            if (convertResult)
            {
                var converted = Converter.ConvertValue <T>($"{token} result", new Value {
                    StructValue = result
                });
                return(new OutputData <T>(deps, converted.Value, converted.IsKnown, converted.IsSecret));
            }

            return(new OutputData <T>(ImmutableHashSet <Resource> .Empty, default !, isKnown: true, isSecret: false));
示例#2
0
 private Output <T> Call <T>(string token, CallArgs args, Resource?self, CallOptions?options, bool convertResult)
 => new Output <T>(CallAsync <T>(token, args, self, options, convertResult));
示例#3
0
 Output <T> IDeployment.Call <T>(string token, CallArgs args, Resource?self, CallOptions?options)
 => Call <T>(token, args, self, options, convertResult: true);
示例#4
0
 void IDeployment.Call(string token, CallArgs args, Resource?self, CallOptions?options)
 => Call <object>(token, args, self, options, convertResult: false);
示例#5
0
 /// <summary>
 /// Same as <see cref="Call{T}"/>, however the return value is ignored.
 /// </summary>
 public void Call(string token, CallArgs args, Resource?self = null, CallOptions?options = null)
 => _deployment.Call(token, args, self, options);
示例#6
0
 /// <summary>
 /// Dynamically calls the function '<paramref name="token"/>', which is offered by a
 /// provider plugin.
 /// <para/>
 /// The result of <see cref="Call{T}"/> will be a <see cref="Output{T}"/> resolved to the
 /// result value of the provider plugin.
 /// <para/>
 /// The <paramref name="args"/> inputs can be a bag of computed values(including, `T`s,
 /// <see cref="Task{TResult}"/>s, <see cref="Output{T}"/>s etc.).
 /// </summary>
 public Output <T> Call <T>(string token, CallArgs args, Resource?self = null, CallOptions?options = null)
 => _deployment.Call <T>(token, args, self, options);