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