constellation/cli/internal/cloudcmd/clients.go

45 lines
1.4 KiB
Go
Raw Normal View History

/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
2022-04-13 11:01:38 +00:00
package cloudcmd
import (
"context"
"io"
2022-04-13 11:01:38 +00:00
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
2023-02-24 10:36:41 +00:00
tfjson "github.com/hashicorp/terraform-json"
2022-04-13 11:01:38 +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)
}
2022-09-27 07:22:29 +00:00
type terraformClient interface {
PrepareWorkspace(path string, input terraform.Variables) error
2023-06-27 09:27:50 +00:00
CreateCluster(ctx context.Context, logLevel terraform.LogLevel) (terraform.CreateOutput, error)
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
}
type libvirtRunner interface {
Start(ctx context.Context, containerName, imageName string) error
Stop(ctx context.Context) error
}
type rawDownloader interface {
Download(ctx context.Context, errWriter io.Writer, isTTY bool, source, version string) (string, error)
}