2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-04-13 07:01:38 -04:00
|
|
|
package cloudcmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-11-22 12:47:08 -05:00
|
|
|
"io"
|
2022-04-13 07:01:38 -04:00
|
|
|
|
2023-09-25 10:19:43 -04:00
|
|
|
"github.com/edgelesssys/constellation/v2/cli/internal/state"
|
2022-09-26 09:52:31 -04:00
|
|
|
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
|
2023-06-09 09:41:02 -04:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
|
2022-10-26 09:57:00 -04:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
2022-04-13 07:01:38 -04:00
|
|
|
)
|
|
|
|
|
2023-03-03 03:38:23 -05:00
|
|
|
// imageFetcher gets an image reference from the versionsapi.
|
|
|
|
type imageFetcher interface {
|
2023-05-23 03:17:27 -04:00
|
|
|
FetchReference(ctx context.Context,
|
|
|
|
provider cloudprovider.Provider, attestationVariant variant.Variant,
|
|
|
|
image, region string,
|
|
|
|
) (string, error)
|
2023-03-03 03:38:23 -05:00
|
|
|
}
|
|
|
|
|
2023-07-31 04:53:05 -04:00
|
|
|
type tfCommonClient interface {
|
2022-09-27 03:22:29 -04:00
|
|
|
CleanUpWorkspace() error
|
2023-07-31 04:53:05 -04:00
|
|
|
Destroy(ctx context.Context, logLevel terraform.LogLevel) error
|
|
|
|
PrepareWorkspace(path string, input terraform.Variables) error
|
2022-09-27 03:22:29 -04:00
|
|
|
RemoveInstaller()
|
2023-07-31 04:53:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type tfResourceClient interface {
|
|
|
|
tfCommonClient
|
2023-09-25 11:10:23 -04:00
|
|
|
ApplyCluster(ctx context.Context, provider cloudprovider.Provider, logLevel terraform.LogLevel) (state.Infrastructure, error)
|
2023-09-25 10:19:43 -04:00
|
|
|
ShowInfrastructure(ctx context.Context, provider cloudprovider.Provider) (state.Infrastructure, error)
|
2023-07-31 04:53:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type tfIAMClient interface {
|
|
|
|
tfCommonClient
|
2023-08-21 04:26:53 -04:00
|
|
|
ApplyIAM(ctx context.Context, provider cloudprovider.Provider, logLevel terraform.LogLevel) (terraform.IAMOutput, error)
|
2023-07-31 04:53:05 -04:00
|
|
|
ShowIAM(ctx context.Context, provider cloudprovider.Provider) (terraform.IAMOutput, error)
|
2022-04-13 07:01:38 -04:00
|
|
|
}
|
|
|
|
|
2023-08-23 04:35:42 -04:00
|
|
|
type tfUpgradePlanner interface {
|
|
|
|
ShowPlan(ctx context.Context, logLevel terraform.LogLevel, output io.Writer) error
|
|
|
|
Plan(ctx context.Context, logLevel terraform.LogLevel) (bool, error)
|
2023-10-26 04:55:50 -04:00
|
|
|
PrepareWorkspace(path string, vars terraform.Variables) error
|
2023-08-23 04:35:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type tfIAMUpgradeClient interface {
|
|
|
|
tfUpgradePlanner
|
|
|
|
ApplyIAM(ctx context.Context, csp cloudprovider.Provider, logLevel terraform.LogLevel) (terraform.IAMOutput, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type tfClusterUpgradeClient interface {
|
|
|
|
tfUpgradePlanner
|
2023-09-25 11:10:23 -04:00
|
|
|
ApplyCluster(ctx context.Context, provider cloudprovider.Provider, logLevel terraform.LogLevel) (state.Infrastructure, error)
|
2023-08-23 04:35:42 -04:00
|
|
|
}
|
|
|
|
|
2022-10-05 03:11:30 -04:00
|
|
|
type libvirtRunner interface {
|
|
|
|
Start(ctx context.Context, containerName, imageName string) error
|
|
|
|
Stop(ctx context.Context) error
|
|
|
|
}
|
2022-11-22 12:47:08 -05:00
|
|
|
|
|
|
|
type rawDownloader interface {
|
|
|
|
Download(ctx context.Context, errWriter io.Writer, isTTY bool, source, version string) (string, error)
|
|
|
|
}
|