Documentation
¶
Index ¶
Constants ¶
const RemoteStateFileName = "cli-state.json"
const StateFileName = "cli-state.json"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalFileBackend ¶
type LocalFileBackend struct {
FilePath string
}
func NewLocalFileBackend ¶
func NewLocalFileBackend(filePath *string, debug bool) *LocalFileBackend
func (LocalFileBackend) Close ¶
func (b LocalFileBackend) Close() error
func (LocalFileBackend) DebugString ¶
func (b LocalFileBackend) DebugString() string
func (LocalFileBackend) LoadState ¶
func (b LocalFileBackend) LoadState(debug bool) (*model.State, error)
func (LocalFileBackend) SaveState ¶
func (b LocalFileBackend) SaveState(state *model.State, debug bool) error
func (LocalFileBackend) Type ¶
func (b LocalFileBackend) Type() StorageBackendType
type RemoteFileBackend ¶
func NewRemoteFileBackend ¶
func NewRemoteFileBackend(remoteURI string, debug bool) (*RemoteFileBackend, error)
NewRemoteFileBackend creates a new remote file backend from a bucket URI. The URI format depends on the provider:
S3: s3://bucket-name/path/prefix?region=us-east-1 GCS: gs://bucket-name/path/prefix Azure: azblob://container-name/path/prefix
The state file will be stored at: <bucket>/<path/prefix>/cli-state.json The remoteURI parameter must not be nil or empty.
Authentication is handled through provider-specific mechanisms:
- S3: AWS credentials (env vars, IAM role, ~/.aws/credentials)
- GCS: Google Application Default Credentials or GOOGLE_APPLICATION_CREDENTIALS
- Azure: AZURE_STORAGE_ACCOUNT + AZURE_STORAGE_KEY or AZURE_STORAGE_SAS_TOKEN or managed identity
func (RemoteFileBackend) Close ¶
func (b RemoteFileBackend) Close() error
Close closes the bucket connection.
func (RemoteFileBackend) DebugString ¶
func (b RemoteFileBackend) DebugString() string
func (RemoteFileBackend) LoadState ¶
func (b RemoteFileBackend) LoadState(debug bool) (*model.State, error)
func (RemoteFileBackend) SaveState ¶
func (b RemoteFileBackend) SaveState(state *model.State, debug bool) error
func (RemoteFileBackend) Type ¶
func (b RemoteFileBackend) Type() StorageBackendType
type StorageBackend ¶
type StorageBackendType ¶
type StorageBackendType string
const ( FileBackend StorageBackendType = "file" RemoteBackend StorageBackendType = "remote" )
type StorageConfig ¶
func NewStorageConfig ¶
func NewStorageConfig(stateEnabled *bool, stateFilePath *string, stateRemoteURI *string) StorageConfig
NewStorageConfig creates a StorageConfig based on the provided pointers. If the pointers are nil, it falls back to environment variables: - CDK_STATE_ENABLED for Enabled (expects "true" or "false") - CDK_STATE_FILE for FilePath (local backend) - CDK_STATE_REMOTE_URI for RemoteURI (remote backend)
If RemoteURI is provided, the remote backend will be used. Otherwise, the local file backend will be used.
type StorageError ¶
type StorageError struct {
BackendType StorageBackendType
Cause error
Message string
Tip string
}
StorageError represents a general storage-related error.
func NewStorageError ¶
func NewStorageError(backendType StorageBackendType, msg string, cause error, tip string) *StorageError
func (*StorageError) Error ¶
func (e *StorageError) Error() string
func (*StorageError) Unwrap ¶
func (e *StorageError) Unwrap() error