Class LocalWorkspace

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class LocalWorkspace
    extends Workspace
    LocalWorkspace is a default implementation of the Workspace interface.

    A Workspace is the execution context containing a single Pulumi project, a program, and multiple stacks. Workspaces are used to manage the execution environment, providing various utilities such as plugin installation, environment configuration ($PULUMI_HOME), and creation, deletion, and listing of Stacks.

    LocalWorkspace relies on Pulumi.yaml and Pulumi.{stack}.yaml as the intermediate format for Project and Stack settings. Modifying ProjectSettings will alter the Workspace Pulumi.yaml file, and setting config on a Stack will modify the Pulumi.{stack}.yaml file. This is identical to the behavior of Pulumi CLI driven workspaces.

    If not provided a working directory - causing LocalWorkspace to create a temp directory, then the temp directory will be cleaned up when close() is called.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEnvironments​(java.lang.String stackName, java.util.Collection<java.lang.String> environments)
      Adds environments to the end of a stack's import list.
      void changeSecretsProvider​(java.lang.String stackName, java.lang.String newSecretsProvider, SecretsProviderOptions options)
      Change the secrets provider for a stack.
      void close()  
      static LocalWorkspace create()
      Creates a workspace.
      static LocalWorkspace create​(LocalWorkspaceOptions options)
      Creates a workspace using the specified options.
      static WorkspaceStack createOrSelectStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program)
      Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack createOrSelectStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program, LocalWorkspaceOptions options)
      Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack createOrSelectStack​(java.lang.String stackName, java.nio.file.Path workDir)
      Creates or selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      static WorkspaceStack createOrSelectStack​(java.lang.String stackName, java.nio.file.Path workDir, LocalWorkspaceOptions options)
      Creates or selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      void createStack​(java.lang.String stackName)
      Creates and sets a new stack with the specified stack name, failing if one already exists.
      static WorkspaceStack createStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program)
      Creates a stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack createStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program, LocalWorkspaceOptions options)
      Creates a stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack createStack​(java.lang.String stackName, java.nio.file.Path workDir)
      Creates a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      static WorkspaceStack createStack​(java.lang.String stackName, java.nio.file.Path workDir, LocalWorkspaceOptions options)
      Creates a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      java.util.Map<java.lang.String,​java.lang.String> environmentVariables()
      Environment values scoped to the current workspace.
      StackDeployment exportStack​(java.lang.String stackName)
      Exports the deployment state of the stack.
      java.util.Map<java.lang.String,​ConfigValue> getAllConfig​(java.lang.String stackName)
      Returns the config map for the specified stack name, scoped to the current Workspace.
      ConfigValue getConfig​(java.lang.String stackName, java.lang.String key, boolean path)
      Returns the value associated with the specified stack name and key, scoped to the Workspace.
      java.util.Optional<ProjectSettings> getProjectSettings()
      Returns project settings for the current project if any.
      java.util.Map<java.lang.String,​OutputValue> getStackOutputs​(java.lang.String stackName)
      Gets the current set of Stack outputs from the last WorkspaceStack.up() call.
      java.util.Optional<StackSettings> getStackSettings​(java.lang.String stackName)
      Returns stack settings for the stack matching the specified stack name if any.
      java.lang.String getTag​(java.lang.String stackName, java.lang.String key)
      Returns the value associated with the stack and key, scoped to the Workspace.
      void importStack​(java.lang.String stackName, StackDeployment state)
      Imports the specified deployment state into a pre-existing stack.
      void installPlugin​(java.lang.String name, java.lang.String version, PluginInstallOptions options)
      Installs a plugin in the Workspace, for example to use cloud providers like AWS or GCP.
      java.util.List<PluginInfo> listPlugins()
      Returns a list of all plugins installed in the Workspace.
      java.util.List<StackSummary> listStacks()
      Returns all stacks created under the current project.
      java.util.Map<java.lang.String,​java.lang.String> listTags​(java.lang.String stackName)
      Returns the tag map for the specified stack name, scoped to the current Workspace.
      java.util.logging.Logger logger()
      A custom logger instance that will be used for the action.
      void postCommandCallback​(java.lang.String stackName)
      Hook executed after every command.
      java.util.function.Consumer<Context> program()
      The inline program to be used for Preview/Update operations if any.
      java.nio.file.Path pulumiHome()
      The directory override for CLI metadata if set.
      java.lang.String pulumiVersion()
      The version of the underlying Pulumi CLI/Engine.
      java.util.Map<java.lang.String,​ConfigValue> refreshConfig​(java.lang.String stackName)
      Gets and sets the config map used with the last update for the stack matching the specified stack name.
      void removeAllConfig​(java.lang.String stackName, java.util.Collection<java.lang.String> keys, boolean path)
      Removes all values in the provided key collection from the config map for the specified stack name.
      void removeConfig​(java.lang.String stackName, java.lang.String key, boolean path)
      Removes the specified key-value pair from the provided stack's config.
      void removeEnvironment​(java.lang.String stackName, java.lang.String environment)
      Removes environments from a stack's import list.
      void removePlugin​(PluginRemoveOptions options)
      Removes a plugin or plugins from the Workspace.
      void removeStack​(java.lang.String stackName)
      Deletes the stack and all associated configuration and history.
      void removeTag​(java.lang.String stackName, java.lang.String key)
      Removes the specified key-value pair on the provided stack name.
      void saveProjectSettings​(ProjectSettings settings)
      Overwrites the settings for the current project.
      void saveStackSettings​(java.lang.String stackName, StackSettings settings)
      Overwrite the settings for the stack matching the specified stack name.
      java.lang.String secretsProvider()
      The secrets provider to use for encryption and decryption of stack secrets.
      void selectStack​(java.lang.String stackName)
      Selects and sets an existing stack matching the stack name, failing if none exists.
      static WorkspaceStack selectStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program)
      Selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack selectStack​(java.lang.String projectName, java.lang.String stackName, java.util.function.Consumer<Context> program, LocalWorkspaceOptions options)
      Selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program.
      static WorkspaceStack selectStack​(java.lang.String stackName, java.nio.file.Path workDir)
      Selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      static WorkspaceStack selectStack​(java.lang.String stackName, java.nio.file.Path workDir, LocalWorkspaceOptions options)
      Selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir.
      java.util.List<java.lang.String> serializeArgsForOp​(java.lang.String stackName)
      Hook to provide additional args to every CLI command before they are executed.
      void setAllConfig​(java.lang.String stackName, java.util.Map<java.lang.String,​ConfigValue> configMap, boolean path)
      Sets all values in the provided config map for the specified stack name.
      void setConfig​(java.lang.String stackName, java.lang.String key, ConfigValue value, boolean path)
      Sets the specified key-value pair in the provided stack's config.
      void setTag​(java.lang.String stackName, java.lang.String key, java.lang.String value)
      Sets the specified key-value pair on the provided stack name.
      WhoAmIResult whoAmI()
      Returns the currently authenticated user.
      java.nio.file.Path workDir()
      The working directory to run Pulumi CLI commands.
      • Methods inherited from class java.lang.Object

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

      • create

        public static LocalWorkspace create​(@Nullable
                                            LocalWorkspaceOptions options)
                                     throws AutomationException
        Creates a workspace using the specified options. Used for maximal control and customization of the underlying environment before any stacks are created or selected.
        Parameters:
        options - Options used to configure the workspace
        Returns:
        the workspace
        Throws:
        AutomationException - if an error occurs
      • createStack

        public static WorkspaceStack createStack​(java.lang.String projectName,
                                                 java.lang.String stackName,
                                                 java.util.function.Consumer<Context> program)
                                          throws AutomationException
        Creates a stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. Default project settings will be created on behalf of the user and the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        Returns:
        the stack
        Throws:
        StackAlreadyExistsException - if a stack with the provided name already exists
        AutomationException - if an error occurs
      • createStack

        public static WorkspaceStack createStack​(java.lang.String projectName,
                                                 java.lang.String stackName,
                                                 java.util.function.Consumer<Context> program,
                                                 LocalWorkspaceOptions options)
                                          throws AutomationException
        Creates a stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. If no LocalWorkspaceOptions.projectSettings() option is specified, default project settings will be created on behalf of the user. Similarly, unless a LocalWorkspaceOptions.workDir() option is specified, the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        StackAlreadyExistsException - if a stack with the provided name already exists
        AutomationException - if an error occurs
      • createStack

        public static WorkspaceStack createStack​(java.lang.String stackName,
                                                 java.nio.file.Path workDir)
                                          throws AutomationException
        Creates a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        Returns:
        the stack
        Throws:
        StackAlreadyExistsException - if a stack with the provided name already exists
        AutomationException - if an error occurs
      • createStack

        public static WorkspaceStack createStack​(java.lang.String stackName,
                                                 java.nio.file.Path workDir,
                                                 LocalWorkspaceOptions options)
                                          throws AutomationException
        Creates a Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        StackAlreadyExistsException - if a stack with the provided name already exists
        AutomationException - if an error occurs
      • selectStack

        public static WorkspaceStack selectStack​(java.lang.String projectName,
                                                 java.lang.String stackName,
                                                 java.util.function.Consumer<Context> program)
                                          throws AutomationException
        Selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. Default project settings will be created on behalf of the user and the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        Returns:
        the stack
        Throws:
        StackNotFoundException - if a stack with the provided name does not exist
        AutomationException - if an error occurs
      • selectStack

        public static WorkspaceStack selectStack​(java.lang.String projectName,
                                                 java.lang.String stackName,
                                                 java.util.function.Consumer<Context> program,
                                                 LocalWorkspaceOptions options)
                                          throws AutomationException
        Selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. If no LocalWorkspaceOptions.projectSettings() option is specified, default project settings will be created on behalf of the user. Similarly, unless a LocalWorkspaceOptions.workDir() option is specified, the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        StackNotFoundException - if a stack with the provided name does not exist
        AutomationException - if an error occurs
      • selectStack

        public static WorkspaceStack selectStack​(java.lang.String stackName,
                                                 java.nio.file.Path workDir)
                                          throws AutomationException
        Selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        Returns:
        the stack
        Throws:
        StackNotFoundException - if a stack with the provided name does not exist
        AutomationException - if an error occurs
      • selectStack

        public static WorkspaceStack selectStack​(java.lang.String stackName,
                                                 java.nio.file.Path workDir,
                                                 LocalWorkspaceOptions options)
                                          throws AutomationException
        Selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        StackNotFoundException - if a stack with the provided name does not exist
        AutomationException - if an error occurs
      • createOrSelectStack

        public static WorkspaceStack createOrSelectStack​(java.lang.String projectName,
                                                         java.lang.String stackName,
                                                         java.util.function.Consumer<Context> program)
                                                  throws AutomationException
        Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. Default project settings will be created on behalf of the user and the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        Returns:
        the stack
        Throws:
        AutomationException - if an error occurs
      • createOrSelectStack

        public static WorkspaceStack createOrSelectStack​(java.lang.String projectName,
                                                         java.lang.String stackName,
                                                         java.util.function.Consumer<Context> program,
                                                         LocalWorkspaceOptions options)
                                                  throws AutomationException
        Creates or selects an existing Stack with a LocalWorkspace utilizing the specified inline (in process) program. This program is fully debuggable and runs in process. If no LocalWorkspaceOptions.projectSettings() option is specified, default project settings will be created on behalf of the user. Similarly, unless a LocalWorkspaceOptions.workDir() option is specified, the working directory will default to a new temporary directory provided by the OS.
        Parameters:
        projectName - the name of the project
        stackName - the name of the stack
        program - the program to run
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        AutomationException - if an error occurs
      • createOrSelectStack

        public static WorkspaceStack createOrSelectStack​(java.lang.String stackName,
                                                         java.nio.file.Path workDir)
                                                  throws AutomationException
        Creates or selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        Returns:
        the stack
        Throws:
        AutomationException - if an error occurs
      • createOrSelectStack

        public static WorkspaceStack createOrSelectStack​(java.lang.String stackName,
                                                         java.nio.file.Path workDir,
                                                         LocalWorkspaceOptions options)
                                                  throws AutomationException
        Creates or selects an existing Stack with a LocalWorkspace utilizing the local Pulumi CLI program from the specified workDir. This is a way to create drivers on top of pre-existing Pulumi programs. This Workspace will pick up any available Settings files(Pulumi.yaml, Pulumi.{stack}.yaml).
        Parameters:
        stackName - the name of the stack
        workDir - the working directory
        options - options used to configure the workspace
        Returns:
        the stack
        Throws:
        AutomationException - if an error occurs
      • workDir

        public java.nio.file.Path workDir()
        The working directory to run Pulumi CLI commands.
        Specified by:
        workDir in class Workspace
        Returns:
        the working directory
      • pulumiHome

        @Nullable
        public java.nio.file.Path pulumiHome()
        The directory override for CLI metadata if set.

        This customizes the location of $PULUMI_HOME where metadata is stored and plugins are installed.

        Specified by:
        pulumiHome in class Workspace
        Returns:
        the directory override
      • pulumiVersion

        public java.lang.String pulumiVersion()
        The version of the underlying Pulumi CLI/Engine.
        Specified by:
        pulumiVersion in class Workspace
        Returns:
        the version
      • secretsProvider

        @Nullable
        public java.lang.String secretsProvider()
        The secrets provider to use for encryption and decryption of stack secrets.

        See: https://www.pulumi.com/docs/intro/concepts/secrets/#available-encryption-providers

        Specified by:
        secretsProvider in class Workspace
        Returns:
        the secrets provider
      • program

        @Nullable
        public java.util.function.Consumer<Context> program()
        The inline program to be used for Preview/Update operations if any.

        If non specified, the stack will refer to ProjectSettings for this information.

        Specified by:
        program in class Workspace
        Returns:
        the inline program
      • logger

        @Nullable
        public java.util.logging.Logger logger()
        A custom logger instance that will be used for the action. Note that it will only be used Workspace.program() is also provided.
        Specified by:
        logger in class Workspace
        Returns:
        The logger
      • environmentVariables

        public java.util.Map<java.lang.String,​java.lang.String> environmentVariables()
        Environment values scoped to the current workspace. These will be supplied to every Pulumi command.
        Specified by:
        environmentVariables in class Workspace
        Returns:
        the environment variables
      • saveProjectSettings

        public void saveProjectSettings​(ProjectSettings settings)
                                 throws AutomationException
        Overwrites the settings for the current project.

        There can only be a single project per workspace. Fails if new project name does not match old.

        Specified by:
        saveProjectSettings in class Workspace
        Parameters:
        settings - the settings object to save
        Throws:
        AutomationException - if there was an issue saving the project
      • getStackSettings

        public java.util.Optional<StackSettings> getStackSettings​(java.lang.String stackName)
                                                           throws AutomationException
        Returns stack settings for the stack matching the specified stack name if any.
        Specified by:
        getStackSettings in class Workspace
        Parameters:
        stackName - the name of the stack
        Returns:
        the stack settings
        Throws:
        AutomationException - if there was an issue retrieving the stack
      • saveStackSettings

        public void saveStackSettings​(java.lang.String stackName,
                                      StackSettings settings)
                               throws AutomationException
        Overwrite the settings for the stack matching the specified stack name.
        Specified by:
        saveStackSettings in class Workspace
        Parameters:
        stackName - the name of the stack to operation on
        settings - the settings object to save
        Throws:
        AutomationException - if there was an issue saving the stack
      • serializeArgsForOp

        public java.util.List<java.lang.String> serializeArgsForOp​(java.lang.String stackName)
        Hook to provide additional args to every CLI command before they are executed.

        Provided with a stack name, returns a list of args to append to an invoked command ["--config=...", ].

        LocalWorkspace does not utilize this extensibility point.

        Specified by:
        serializeArgsForOp in class Workspace
        Parameters:
        stackName - the name of the stack
        Returns:
        the list of args to append
      • postCommandCallback

        public void postCommandCallback​(java.lang.String stackName)
                                 throws AutomationException
        Hook executed after every command. Called with the stack name.

        An extensibility point to perform workspace cleanup (CLI operations may create/modify a Pulumi.stack.yaml).

        LocalWorkspace does not utilize this extensibility point.

        Specified by:
        postCommandCallback in class Workspace
        Parameters:
        stackName - the name of the stack
        Throws:
        AutomationException - if there was an issue executing the post command
      • createStack

        public void createStack​(java.lang.String stackName)
                         throws AutomationException
        Creates and sets a new stack with the specified stack name, failing if one already exists.
        Specified by:
        createStack in class Workspace
        Parameters:
        stackName - the stack to create
        Throws:
        AutomationException - if there was an issue creating the stack
      • removeStack

        public void removeStack​(java.lang.String stackName)
                         throws AutomationException
        Deletes the stack and all associated configuration and history.
        Specified by:
        removeStack in class Workspace
        Parameters:
        stackName - the stack to remove
        Throws:
        AutomationException - if there was an issue removing the stack
      • listStacks

        public java.util.List<StackSummary> listStacks()
                                                throws AutomationException
        Returns all stacks created under the current project.

        This queries underlying backend and may return stacks not present in the Workspace (as Pulumi.{stack}.yaml files).

        Specified by:
        listStacks in class Workspace
        Returns:
        the list of stacks
        Throws:
        AutomationException - if there was an issue listing the stacks
      • addEnvironments

        public void addEnvironments​(java.lang.String stackName,
                                    java.util.Collection<java.lang.String> environments)
                             throws AutomationException
        Adds environments to the end of a stack's import list. Imported environments are merged in order per the ESC merge rules. The list of environments behaves as if it were the import list in an anonymous environment.
        Specified by:
        addEnvironments in class Workspace
        Parameters:
        stackName - the name of the stack
        environments - list of environments to add to the end of the stack's import list
        Throws:
        AutomationException - if there was an issue adding the environments
      • removeEnvironment

        public void removeEnvironment​(java.lang.String stackName,
                                      java.lang.String environment)
                               throws AutomationException
        Removes environments from a stack's import list.
        Specified by:
        removeEnvironment in class Workspace
        Parameters:
        stackName - the name of the stack
        environment - the name of the environment to remove from the stack's configuration
        Throws:
        AutomationException - if there was an issue removing the environment
      • getTag

        public java.lang.String getTag​(java.lang.String stackName,
                                       java.lang.String key)
                                throws AutomationException
        Returns the value associated with the stack and key, scoped to the Workspace.
        Specified by:
        getTag in class Workspace
        Parameters:
        stackName - the name of the stack to read tag metadata from
        key - the key to use for the tag lookup
        Returns:
        the value associated with the key
        Throws:
        AutomationException - if there was an issue reading the tag
      • setTag

        public void setTag​(java.lang.String stackName,
                           java.lang.String key,
                           java.lang.String value)
                    throws AutomationException
        Sets the specified key-value pair on the provided stack name.
        Specified by:
        setTag in class Workspace
        Parameters:
        stackName - the stack to operate on
        key - the tag key to set
        value - the tag value to set
        Throws:
        AutomationException - if there was an issue setting the tag
      • removeTag

        public void removeTag​(java.lang.String stackName,
                              java.lang.String key)
                       throws AutomationException
        Removes the specified key-value pair on the provided stack name.
        Specified by:
        removeTag in class Workspace
        Parameters:
        stackName - the stack to operate on
        key - the tag key to remove
        Throws:
        AutomationException - if there was an issue removing the tag
      • listTags

        public java.util.Map<java.lang.String,​java.lang.String> listTags​(java.lang.String stackName)
                                                                        throws AutomationException
        Returns the tag map for the specified stack name, scoped to the current Workspace.
        Specified by:
        listTags in class Workspace
        Parameters:
        stackName - the stack to operate on
        Returns:
        the tag map for the specified stack name
        Throws:
        AutomationException - if there was an issue listing the tags
      • getConfig

        public ConfigValue getConfig​(java.lang.String stackName,
                                     java.lang.String key,
                                     boolean path)
                              throws AutomationException
        Returns the value associated with the specified stack name and key, scoped to the Workspace.
        Specified by:
        getConfig in class Workspace
        Parameters:
        stackName - the name of the stack to read config from
        key - the key to use for the config lookup
        path - the key contains a path to a property in a map or list to get
        Returns:
        the value associated with the key
        Throws:
        AutomationException - if there was an issue reading the config
      • getAllConfig

        public java.util.Map<java.lang.String,​ConfigValue> getAllConfig​(java.lang.String stackName)
                                                                       throws AutomationException
        Returns the config map for the specified stack name, scoped to the current Workspace.
        Specified by:
        getAllConfig in class Workspace
        Parameters:
        stackName - the name of the stack to read config from
        Returns:
        the config map for the specified stack name
        Throws:
        AutomationException - if there was an issue listing the config
      • setConfig

        public void setConfig​(java.lang.String stackName,
                              java.lang.String key,
                              ConfigValue value,
                              boolean path)
                       throws AutomationException
        Sets the specified key-value pair in the provided stack's config.
        Specified by:
        setConfig in class Workspace
        Parameters:
        stackName - the name of the stack to operate on
        key - the config key to set
        value - the config value to set
        path - the key contains a path to a property in a map or list to set
        Throws:
        AutomationException - if there was an issue setting the config
      • setAllConfig

        public void setAllConfig​(java.lang.String stackName,
                                 java.util.Map<java.lang.String,​ConfigValue> configMap,
                                 boolean path)
                          throws AutomationException
        Sets all values in the provided config map for the specified stack name.
        Specified by:
        setAllConfig in class Workspace
        Parameters:
        stackName - the name of the stack to operate on
        configMap - the config map to upsert against the existing config
        path - the keys contain a path to a property in a map or list to set
        Throws:
        AutomationException - if there was an issue setting the config
      • removeConfig

        public void removeConfig​(java.lang.String stackName,
                                 java.lang.String key,
                                 boolean path)
                          throws AutomationException
        Removes the specified key-value pair from the provided stack's config.
        Specified by:
        removeConfig in class Workspace
        Parameters:
        stackName - the name of the stack to operate on
        key - the config key to remove
        path - the key contains a path to a property in a map or list to remove
        Throws:
        AutomationException - if there was an issue removing the config
      • removeAllConfig

        public void removeAllConfig​(java.lang.String stackName,
                                    java.util.Collection<java.lang.String> keys,
                                    boolean path)
                             throws AutomationException
        Removes all values in the provided key collection from the config map for the specified stack name.
        Specified by:
        removeAllConfig in class Workspace
        Parameters:
        stackName - the name of the stack to operate on
        keys - the collection of keys to remove from the underlying config map
        path - the keys contain a path to a property in a map or list to remove
        Throws:
        AutomationException - if there was an issue removing the config
      • refreshConfig

        public java.util.Map<java.lang.String,​ConfigValue> refreshConfig​(java.lang.String stackName)
                                                                        throws AutomationException
        Gets and sets the config map used with the last update for the stack matching the specified stack name.
        Specified by:
        refreshConfig in class Workspace
        Parameters:
        stackName - the name of the stack to operate on
        Returns:
        the config map used with the last update for the stack
        Throws:
        AutomationException - if there was an issue refreshing the config
      • installPlugin

        public void installPlugin​(java.lang.String name,
                                  java.lang.String version,
                                  PluginInstallOptions options)
                           throws AutomationException
        Installs a plugin in the Workspace, for example to use cloud providers like AWS or GCP.
        Specified by:
        installPlugin in class Workspace
        Parameters:
        name - the name of the plugin
        version - the version of the plugin, e.g. "v1.0.0"
        options - additional plugin installation options
        Throws:
        AutomationException - if there was an issue installing the plugin
      • changeSecretsProvider

        public void changeSecretsProvider​(java.lang.String stackName,
                                          java.lang.String newSecretsProvider,
                                          @Nullable
                                          SecretsProviderOptions options)
                                   throws AutomationException
        Change the secrets provider for a stack.
        Specified by:
        changeSecretsProvider in class Workspace
        Parameters:
        stackName - the name of the stack
        newSecretsProvider - the new secrets provider
        options - the options to change the secrets provider
        Throws:
        AutomationException - if there was an issue changing the secrets provider
      • close

        public void close()
                   throws java.lang.Exception
        Throws:
        java.lang.Exception