def unknown(): is_known_fut: asyncio.Future[bool] = asyncio.Future() is_secret_fut: asyncio.Future[bool] = asyncio.Future() is_known_fut.set_result(False) is_secret_fut.set_result(False) value_fut: asyncio.Future[Any] = asyncio.Future() value_fut.set_result(pulumi.UNKNOWN) return pulumi.Output(set(), value_fut, is_known_fut, is_secret_fut)
def output_depending_on_resource(r: pulumi.Resource, isKnown: bool) -> pulumi.Output[None]: """Returns an output that depends on the given resource.""" o = pulumi.Output.from_input(None) is_known_fut: asyncio.Future[bool] = asyncio.Future() is_known_fut.set_result(isKnown) return pulumi.Output(resources=set([r]), is_known=is_known_fut, future=o.future())
def _construct_output(the_input: Any, deps: Set[Resource]) -> Any: is_secret = rpc.is_rpc_secret(the_input) # If it's a prompt value, return it directly without wrapping # it as an output. if not is_secret and len(deps) == 0: return the_input # Otherwise, wrap it as an output so we can handle secrets # and/or track dependencies. return pulumi.Output( resources=deps, future=_as_future(rpc.unwrap_rpc_secret(the_input)), is_known=_as_future(True), is_secret=_as_future(is_secret))
def _construct_output(the_input: Any, deps: Set[Resource]) -> Any: is_secret = rpc.is_rpc_secret(the_input) # If it's a prompt value, return it directly without wrapping # it as an output. if not is_secret and len(deps) == 0: return the_input # Otherwise, wrap it as an output so we can handle secrets # and/or track dependencies. # Note: If the value is or contains an unknown value, the Output will mark its value as # unknown automatically, so we just pass true for is_known here. return pulumi.Output(resources=deps, future=_as_future( rpc.unwrap_rpc_secret(the_input)), is_known=_as_future(True), is_secret=_as_future(is_secret))
async def _create_output(the_input: Any, deps: Set[str]) -> Any: is_secret = rpc.is_rpc_secret(the_input) # If it's a resource reference or a prompt value, return it directly without wrapping # it as an output. if await _is_resource_reference( the_input, deps) or (not is_secret and len(deps) == 0): return the_input # Otherwise, wrap it as an output so we can handle secrets # and/or track dependencies. # Note: If the value is or contains an unknown value, the Output will mark its value as # unknown automatically, so we just pass true for is_known here. return pulumi.Output( resources=set(DependencyResource(urn) for urn in deps), future=_as_future(rpc.unwrap_rpc_secret(the_input)), is_known=_as_future(True), is_secret=_as_future(is_secret))
async def _select_value(the_input: Any, deps: Set[str]) -> Any: is_secret = rpc.is_rpc_secret(the_input) # If the input isn't a secret and either doesn't have any dependencies, already contains Outputs (from # deserialized output values), or is a resource reference, then return it directly without wrapping it # as an output. if not is_secret and (len(deps) == 0 or _contains_outputs(the_input) or await _is_resource_reference(the_input, deps)): return the_input # Otherwise, wrap it as an output so we can handle secrets # and/or track dependencies. # Note: If the value is or contains an unknown value, the Output will mark its value as # unknown automatically, so we just pass true for is_known here. return pulumi.Output( resources=set(DependencyResource(urn) for urn in deps), future=_as_future(rpc.unwrap_rpc_secret(the_input)), is_known=_as_future(True), is_secret=_as_future(is_secret))