예제 #1
0
 def _construct_options(request: proto.ConstructRequest) -> pulumi.ResourceOptions:
     parent = None
     if not _empty_as_none(request.parent):
         parent = DependencyResource(request.parent)
     return pulumi.ResourceOptions(
         aliases=list(request.aliases),
         depends_on=[DependencyResource(urn)
                     for urn in request.dependencies],
         protect=request.protect,
         providers={pkg: DependencyProviderResource(ref)
                    for pkg, ref in request.providers.items()},
         parent=parent)
예제 #2
0
파일: server.py 프로젝트: orionstudt/pulumi
    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))
예제 #3
0
    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))
예제 #4
0
 def deps(key: str) -> Set[Resource]:
     return set(DependencyResource(urn) for urn in
                request.inputDependencies.get(
                    key,
                    proto.ConstructRequest.PropertyDependencies()
                ).urns)