Documentation ¶
Index ¶
- Constants
- func DeleteAccessToken(key string) error
- func DetectProjectPath() (string, error)
- func DetectProjectPathFrom(path string) (string, error)
- func DetectProjectStackPath(stackName tokens.QName) (string, error)
- func GetAccessToken(key string) (string, error)
- func GetCurrentCloudURL() (string, error)
- func GetPluginDir() (string, error)
- func GetPluginPath(kind PluginKind, name string, version *semver.Version) (string, string, error)
- func GetTemplateDir(name string) (string, error)
- func HasPlugin(plug PluginInfo) bool
- func HasPluginGTE(plug PluginInfo) (bool, error)
- func InstallTemplate(name string, tarball io.ReadCloser) error
- func IsPluginKind(k string) bool
- func IsValidProjectName(name string) bool
- func SaveProject(proj *Project) error
- func SaveProjectStack(stackName tokens.QName, stack *ProjectStack) error
- func StoreAccessToken(key string, token string, current bool) error
- func StoreCredentials(creds Credentials) error
- func ValueOrDefaultProjectDescription(description string, defaultDescription string) string
- func ValueOrSanitizedDefaultProjectName(name string, defaultNameToSanitize string) string
- type Analyzers
- type Credentials
- type PluginInfo
- func (info PluginInfo) Delete() error
- func (info PluginInfo) Dir() string
- func (info PluginInfo) DirPath() (string, error)
- func (info PluginInfo) File() string
- func (info PluginInfo) FilePath() (string, error)
- func (info PluginInfo) FilePrefix() string
- func (info PluginInfo) FileSuffix() string
- func (info PluginInfo) Install(tarball io.ReadCloser) error
- func (info *PluginInfo) SetFileMetadata(path string) error
- func (info PluginInfo) String() string
- type PluginKind
- type Project
- type ProjectStack
- type Settings
- type Template
- type W
Constants ¶
const ( BackupDir = "backups" // the name of the folder where backup stack information is stored. BookkeepingDir = ".pulumi" // the name of our bookeeping folder, we store state here (like .git for git). ConfigDir = "config" // the name of the folder that holds local configuration information. GitDir = ".git" // the name of the folder git uses to store information. HistoryDir = "history" // the name of the directory that holds historical information for projects. PluginDir = "plugins" // the name of the directory containing plugins. StackDir = "stacks" // the name of the directory that holds stack information for projects. TemplateDir = "templates" // the name of the directory containing templates. WorkspaceDir = "workspaces" // the name of the directory that holds workspace information for projects. IgnoreFile = ".pulumiignore" // the name of the file that we use to control what to upload to the service. ProjectFile = "Pulumi" // the base name of a project file. RepoFile = "settings.json" // the name of the file that holds information specific to the entire repository. WorkspaceFile = "workspace.json" // the name of the file that holds workspace information. )
const PulumiCredentialsPathEnvVar = "PULUMI_CREDENTIALS_PATH"
PulumiCredentialsPathEnvVar is a path to the folder where credentials are stored. We use this in testing so that tests which log in and out do not impact the local developer's credentials or tests interacting with one another
Variables ¶
This section is empty.
Functions ¶
func DeleteAccessToken ¶
DeleteAccessToken deletes an access token underneath the given key.
func DetectProjectPath ¶
DetectProjectPath locates the closest project from the current working directory, or an error if not found.
func DetectProjectPathFrom ¶
DetectProjectPathFrom locates the closest project from the given path, searching "upwards" in the directory hierarchy. If no project is found, an empty path is returned.
func DetectProjectStackPath ¶
DetectProjectStackPath returns the name of the file to store stack specific project settings in. We place stack specific settings next to the Pulumi.yaml file, named like: Pulumi.<stack-name>.yaml
func GetAccessToken ¶
GetAccessToken returns an access token underneath a given key.
func GetCurrentCloudURL ¶
GetCurrentCloudURL returns the URL of the cloud we are currently connected to. This may be empty if we have not logged in.
func GetPluginDir ¶
GetPluginDir returns the directory in which plugins on the current machine are managed.
func GetPluginPath ¶
GetPluginPath finds a plugin's path by its kind, name, and optional version. It will match the latest version that is >= the version specified. If no version is supplied, the latest plugin for that given kind/name pair is loaded, using standard semver sorting rules. A plugin may be overridden entirely by placing it on your $PATH.
func GetTemplateDir ¶
GetTemplateDir returns the directory in which templates on the current machine are stored.
func HasPlugin ¶
func HasPlugin(plug PluginInfo) bool
HasPlugin returns true if the given plugin exists.
func HasPluginGTE ¶
func HasPluginGTE(plug PluginInfo) (bool, error)
HasPluginGTE returns true if the given plugin exists at the given version number or greater.
func InstallTemplate ¶
func InstallTemplate(name string, tarball io.ReadCloser) error
InstallTemplate installs a template tarball into the local cache.
func IsPluginKind ¶
IsPluginKind returns true if k is a valid plugin kind, and false otherwise.
func IsValidProjectName ¶
IsValidProjectName returns true if the project name is a valid name.
func SaveProject ¶
SaveProject saves the project file on top of the existing one, using the standard location.
func SaveProjectStack ¶
func SaveProjectStack(stackName tokens.QName, stack *ProjectStack) error
func StoreAccessToken ¶
StoreAccessToken saves the given access token underneath the given key.
func StoreCredentials ¶
func StoreCredentials(creds Credentials) error
StoreCredentials updates the stored credentials on the machine, replacing the existing set. If the credentials are empty, the auth file will be deleted rather than just serializing an empty map.
func ValueOrDefaultProjectDescription ¶
ValueOrDefaultProjectDescription returns the value or defaultDescription.
func ValueOrSanitizedDefaultProjectName ¶
ValueOrSanitizedDefaultProjectName returns the value or a sanitized valid project name based on defaultNameToSanitize.
Types ¶
type Credentials ¶
type Credentials struct { Current string `json:"current,omitempty"` // the currently selected key. AccessTokens map[string]string `json:"accessTokens,omitempty"` // a map of arbitrary key strings to tokens. }
Credentials hold the information necessary for authenticating Pulumi Cloud API requests. It contains a map from the cloud API URL to the associated access token.
func GetStoredCredentials ¶
func GetStoredCredentials() (Credentials, error)
GetStoredCredentials returns any credentials stored on the local machine.
type PluginInfo ¶
type PluginInfo struct { Name string // the simple name of the plugin. Path string // the path that a plugin was loaded from. Kind PluginKind // the kind of the plugin (language, resource, etc). Version *semver.Version // the plugin's semantic version, if present. Size int64 // the size of the plugin, in bytes. InstallTime time.Time // the time the plugin was installed. LastUsedTime time.Time // the last time the plugin was used. }
PluginInfo provides basic information about a plugin. Each plugin gets installed into a system-wide location, by default `~/.pulumi/plugins/<kind>-<name>-<version>/`. A plugin may contain multiple files, however the primary loadable executable must be named `pulumi-<kind>-<name>`.
func GetPlugins ¶
func GetPlugins() ([]PluginInfo, error)
GetPlugins returns a list of installed plugins.
func (PluginInfo) Delete ¶
func (info PluginInfo) Delete() error
Delete removes the plugin from the cache. It also deletes any supporting files in the cache, which includes any files that contain the same prefix as the plugin itself.
func (PluginInfo) Dir ¶
func (info PluginInfo) Dir() string
Dir gets the expected plugin directory for this plugin.
func (PluginInfo) DirPath ¶
func (info PluginInfo) DirPath() (string, error)
DirPath returns the directory where this plugin should be installed.
func (PluginInfo) File ¶
func (info PluginInfo) File() string
File gets the expected filename for this plugin.
func (PluginInfo) FilePath ¶
func (info PluginInfo) FilePath() (string, error)
FilePath returns the full path where this plugin's primary executable should be installed.
func (PluginInfo) FilePrefix ¶
func (info PluginInfo) FilePrefix() string
FilePrefix gets the expected default file prefix for the plugin.
func (PluginInfo) FileSuffix ¶
func (info PluginInfo) FileSuffix() string
FileSuffix returns the suffix for the plugin (if any).
func (PluginInfo) Install ¶
func (info PluginInfo) Install(tarball io.ReadCloser) error
Install installs a plugin's tarball into the cache. It validates that plugin names are in the expected format.
func (*PluginInfo) SetFileMetadata ¶
func (info *PluginInfo) SetFileMetadata(path string) error
SetFileMetadata adds extra metadata from the given file, representing this plugin's directory.
func (PluginInfo) String ¶
func (info PluginInfo) String() string
type PluginKind ¶
type PluginKind string
PluginKind represents a kind of a plugin that may be dynamically loaded and used by Pulumi.
const ( // AnalyzerPlugin is a plugin that can be used as a resource analyzer. AnalyzerPlugin PluginKind = "analyzer" // LanguagePlugin is a plugin that can be used as a language host. LanguagePlugin PluginKind = "language" // ResourcePlugin is a plugin that can be used as a resource provider for custom CRUD operations. ResourcePlugin PluginKind = "resource" )
type Project ¶
type Project struct { Name tokens.PackageName `json:"name" yaml:"name"` // a required fully qualified name. Runtime string `json:"runtime" yaml:"runtime"` // a required runtime that executes code. Main string `json:"main,omitempty" yaml:"main,omitempty"` // an optional override for the main program location. Description *string `json:"description,omitempty" yaml:"description,omitempty"` // an optional informational description. Author *string `json:"author,omitempty" yaml:"author,omitempty"` // an optional author. Website *string `json:"website,omitempty" yaml:"website,omitempty"` // an optional website for additional info. License *string `json:"license,omitempty" yaml:"license,omitempty"` // an optional license governing this project's usage. Analyzers *Analyzers `json:"analyzers,omitempty" yaml:"analyzers,omitempty"` // any analyzers enabled for this project. Context string `json:"context,omitempty" yaml:"context,omitempty"` // an optional path (combined with the on disk location of Pulumi.yaml) to control the data uploaded to the service. NoDefaultIgnores *bool `json:"nodefaultignores,omitempty" yaml:"nodefaultignores,omitempty"` // true if we should only respect .pulumiignore when archiving Config string `json:"config,omitempty" yaml:"config,omitempty"` // where to store Pulumi.<stack-name>.yaml files, this is combined with the folder Pulumi.yaml is in. }
Project is a Pulumi project manifest..
We explicitly add yaml tags (instead of using the default behavior from https://github.com/ghodss/yaml which works in terms of the JSON tags) so we can directly marshall and unmarshall this struct using go-yaml an have the fields in the serialized object match the order they are defined in this struct.
TODO[pulumi/pulumi#423]: use DOM based marshalling so we can roundtrip the seralized structure perfectly. nolint: lll
func DetectProject ¶
DetectProject loads the closest project from the current working directory, or an error if not found.
func DetectProjectAndPath ¶
DetectProjectAndPath loads the closest package from the current working directory, or an error if not found. It also returns the path where the package was found.
func LoadProject ¶
LoadProject reads a project definition from a file.
func (*Project) UseDefaultIgnores ¶
type ProjectStack ¶
type ProjectStack struct { EncryptionSalt string `json:"encryptionsalt,omitempty" yaml:"encryptionsalt,omitempty"` // base64 encoded encryption salt. Config config.Map `json:"config,omitempty" yaml:"config,omitempty"` // optional config. }
ProjectStack holds stack specific information about a project. nolint: lll
func DetectProjectStack ¶
func DetectProjectStack(stackName tokens.QName) (*ProjectStack, error)
func LoadProjectStack ¶
func LoadProjectStack(path string) (*ProjectStack, error)
LoadProjectStack reads a stack definition from a file.
func (*ProjectStack) Save ¶
func (ps *ProjectStack) Save(path string) error
Save writes a project definition to a file.
type Settings ¶
type Settings struct {
Stack string `json:"stack,omitempty" yaml:"env,omitempty"` // an optional default stack to use.
}
Settings defines workspace settings shared amongst many related projects. nolint: lll
type Template ¶
type Template struct { // The name of the template. Name string `json:"name" yaml:"name"` // Optional description of the template, also used as a default project description. Description string `json:"description" yaml:"description"` // Optional bool which determines whether dependencies should be installed after project creation. InstallDependencies bool `json:"installdependencies" yaml:"installdependencies"` // Optional default config values. Config map[config.Key]string `json:"config" yaml:"config"` }
Template represents a project template.
func ListLocalTemplates ¶
ListLocalTemplates returns a list of local templates.
func LoadLocalTemplate ¶
LoadLocalTemplate returns a local template.
func (Template) CopyTemplateFiles ¶
func (template Template) CopyTemplateFiles( destDir string, force bool, projectName string, projectDescription string) error
CopyTemplateFiles does the actual copy operation to a destination directory.
func (Template) CopyTemplateFilesDryRun ¶
CopyTemplateFilesDryRun does a dry run of copying a template to a destination directory, to ensure it won't overwrite any files.