pulumi/pkg/engine/env_info.go
Matt Ellis 93ab134bbb Have the CLI keep track of the current environment
Previously, the engine was concered with maintaing information about
the currently active environment. Now, the CLI is in charge of
this. As part of this change, the engine can now assume that every
environment has a non empty name (and I've added asserts on the
entrypoints of the engine API to ensure that any consumer of the
engine passes a non empty environment name)
2017-10-02 16:57:41 -07:00

22 lines
546 B
Go

// Copyright 2017, Pulumi Corporation. All rights reserved.
package engine
import (
"github.com/pulumi/pulumi/pkg/tokens"
"github.com/pulumi/pulumi/pkg/util/contract"
)
func (eng *Engine) GetEnvironmentInfo(envName tokens.QName) (EnvironmentInfo, error) {
contract.Require(envName != tokens.QName(""), "envName")
_, snapshot, checkpoint, err := eng.Environment.GetEnvironment(envName)
if err != nil {
return EnvironmentInfo{}, err
}
return EnvironmentInfo{Name: envName,
Snapshot: snapshot,
Checkpoint: checkpoint,
}, nil
}