Class Resource

java.lang.Object
com.pulumi.resources.Resource
Direct Known Subclasses:
ComponentResource, CustomResource

@ParametersAreNonnullByDefault public abstract class Resource extends Object
Resource represents a class whose CRUD operations are implemented by a provider plugin.
  • Field Details

    • childResources

      protected final Set<Resource> childResources
    • remote

      protected final boolean remote
  • Constructor Details

    • Resource

      protected Resource(String type, String name, boolean custom, ResourceArgs args, ResourceOptions options)
      See Also:
    • Resource

      protected Resource(String type, String name, boolean custom, ResourceArgs args, ResourceOptions options, boolean remote, boolean dependency)
      See Also:
    • Resource

      protected Resource(String type, String name, boolean custom, ResourceArgs args, ResourceOptions options, boolean remote, boolean dependency, CompletableFuture<String> packageRef)
      Creates and registers a new resource object. The "type" is the fully qualified type token and "name" is the "name" part to of a stable and globally unique URN for the object, "dependsOn" is an optional list of other resources that this resource depends on, controlling the order in which we perform resource operations.
      Parameters:
      type - the type of the resource
      name - the unique name of the resource
      custom - true to indicate that this is a custom resource, managed by a plugin
      args - the arguments to use to populate the new resource
      options - a bag of options that control this resource's behavior
      remote - This parameter is intended for use by code-generated component SDKs; end users authoring their own ComponentResource subclasses should leave this at its default (false). When true, the component's children are constructed by the engine rather than in this process, and the constructor skips local child registration accordingly.
      dependency - true if this is a synthetic resource used internally for dependency tracking
      packageRef - the package reference to use if this resource belongs to a parameterized provider
  • Method Details

    • idFuture

      protected Optional<CompletableFuture<Output<String>>> idFuture()
      Lazy Initialization method called at the beginning of the constructor. Resources with the id field must override this method.
    • pulumiResourceType

      public String pulumiResourceType()
      The Pulumi type assigned to the resource at construction.
      Returns:
      the type of the Pulumi resource
    • pulumiResourceName

      public String pulumiResourceName()
      The Pulumi name assigned to the resource at construction.
      Returns:
      the name of the Pulumi resource
    • pulumiChildResources

      public Set<Resource> pulumiChildResources()
      The child resources of this Pulumi resource. We use these (only from a @see ComponentResource) to allow code to "dependOn" a @see ComponentResource and have that effectively mean that it is depending on all the @see ComponentResource children of that component.

      Important! We only walk through @see ComponentResources. They're the only resources that serve as an aggregation of other primitive (i.e.custom) resources. While a custom resource can be a parent of other resources, we don't want to ever depend on those child resource. If we do, it's simple to end up in a situation where we end up depending on a child resource that has a data cycle dependency due to the data passed into it. This would be pretty nonsensical as there is zero need for a custom resource to ever need to reference the urn of a component resource. So it's acceptable if that sort of pattern failed in practice.

      Returns:
      the child resources of this Pulumi resource
    • urn

      public Output<String> urn()
      Pulumi URN is the stable logical identifier used to distinctly address a resource, both before and after deployments.
      Returns:
      the stable logical Pulumi URN