2022-09-05 07:06:08 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-04-13 11:01:38 +00:00
|
|
|
package cloudcmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-11-22 17:47:08 +00:00
|
|
|
"io"
|
2022-04-13 11:01:38 +00:00
|
|
|
|
2022-09-26 13:52:31 +00:00
|
|
|
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
|
2022-10-26 13:57:00 +00:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
2023-05-23 07:17:27 +00:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/variant"
|
2023-02-24 10:36:41 +00:00
|
|
|
tfjson "github.com/hashicorp/terraform-json"
|
2022-04-13 11:01:38 +00:00
|
|
|
)
|
|
|
|
|
2023-03-03 08:38:23 +00:00
|
|
|
// imageFetcher gets an image reference from the versionsapi.
|
|
|
|
type imageFetcher interface {
|
2023-05-23 07:17:27 +00:00
|
|
|
FetchReference(ctx context.Context,
|
|
|
|
provider cloudprovider.Provider, attestationVariant variant.Variant,
|
|
|
|
image, region string,
|
|
|
|
) (string, error)
|
2023-03-03 08:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-09-27 07:22:29 +00:00
|
|
|
type terraformClient interface {
|
2022-12-07 10:48:54 +00:00
|
|
|
PrepareWorkspace(path string, input terraform.Variables) error
|
2023-05-22 11:31:20 +00:00
|
|
|
CreateCluster(ctx context.Context, logLevel terraform.LogLevel, targets ...string) (terraform.CreateOutput, error)
|
2023-04-14 12:15:07 +00:00
|
|
|
CreateIAMConfig(ctx context.Context, provider cloudprovider.Provider, logLevel terraform.LogLevel) (terraform.IAMOutput, error)
|
|
|
|
Destroy(ctx context.Context, logLevel terraform.LogLevel) error
|
2022-09-27 07:22:29 +00:00
|
|
|
CleanUpWorkspace() error
|
|
|
|
RemoveInstaller()
|
2023-02-24 10:36:41 +00:00
|
|
|
Show(ctx context.Context) (*tfjson.State, error)
|
2022-04-13 11:01:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-05 07:11:30 +00:00
|
|
|
type libvirtRunner interface {
|
|
|
|
Start(ctx context.Context, containerName, imageName string) error
|
|
|
|
Stop(ctx context.Context) error
|
|
|
|
}
|
2022-11-22 17:47:08 +00:00
|
|
|
|
|
|
|
type rawDownloader interface {
|
|
|
|
Download(ctx context.Context, errWriter io.Writer, isTTY bool, source, version string) (string, error)
|
|
|
|
}
|