Class Resource

  • Direct Known Subclasses:
    ComponentResource, CustomResource

    @ParametersAreNonnullByDefault
    public abstract class Resource
    extends java.lang.Object
    Resource represents a class whose CRUD operations are implemented by a provider plugin.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Resource​(java.lang.String type, java.lang.String name, boolean custom, ResourceArgs args, ResourceOptions options)  
      protected Resource​(java.lang.String type, java.lang.String name, boolean custom, ResourceArgs args, ResourceOptions options, boolean remote, boolean dependency)  
      protected Resource​(java.lang.String type, java.lang.String name, boolean custom, ResourceArgs args, ResourceOptions options, boolean remote, boolean dependency, java.util.concurrent.CompletableFuture<java.lang.String> packageRef)
      Creates and registers a new resource object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.Optional<java.util.concurrent.CompletableFuture<Output<java.lang.String>>> idFuture()
      Lazy Initialization method called at the beginning of the constructor.
      java.util.Set<Resource> pulumiChildResources()
      The child resources of this Pulumi resource.
      java.lang.String pulumiResourceName()
      The Pulumi name assigned to the resource at construction.
      java.lang.String pulumiResourceType()
      The Pulumi type assigned to the resource at construction.
      Output<java.lang.String> urn()
      Pulumi URN is the stable logical identifier used to distinctly address a resource, both before and after deployments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • childResources

        protected final java.util.Set<Resource> childResources
      • remote

        protected final boolean remote
    • Constructor Detail

      • Resource

        protected Resource​(java.lang.String type,
                           java.lang.String name,
                           boolean custom,
                           ResourceArgs args,
                           ResourceOptions options,
                           boolean remote,
                           boolean dependency,
                           java.util.concurrent.CompletableFuture<java.lang.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 - true if this is a remote component resource
        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 Detail

      • idFuture

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

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

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

        public java.util.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<java.lang.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