debugd: add AWS

This commit is contained in:
Leonard Cohnen 2022-10-30 03:37:44 +01:00 committed by 3u13r
parent 02602716b5
commit 828923d159
2 changed files with 19 additions and 0 deletions

View File

@ -55,6 +55,12 @@ func main() {
var fetcher metadata.Fetcher var fetcher metadata.Fetcher
csp := os.Getenv("CONSTEL_CSP") csp := os.Getenv("CONSTEL_CSP")
switch platform.FromString(csp) { switch platform.FromString(csp) {
case platform.AWS:
awsFetcher, err := cloudprovider.NewAWS(ctx)
if err != nil {
log.Fatalf("%s", err)
}
fetcher = awsFetcher
case platform.Azure: case platform.Azure:
azureFetcher, err := cloudprovider.NewAzure(ctx) azureFetcher, err := cloudprovider.NewAzure(ctx)
if err != nil { if err != nil {

View File

@ -11,6 +11,7 @@ import (
"fmt" "fmt"
"net" "net"
awscloud "github.com/edgelesssys/constellation/v2/internal/cloud/aws"
azurecloud "github.com/edgelesssys/constellation/v2/internal/cloud/azure" azurecloud "github.com/edgelesssys/constellation/v2/internal/cloud/azure"
gcpcloud "github.com/edgelesssys/constellation/v2/internal/cloud/gcp" gcpcloud "github.com/edgelesssys/constellation/v2/internal/cloud/gcp"
"github.com/edgelesssys/constellation/v2/internal/cloud/metadata" "github.com/edgelesssys/constellation/v2/internal/cloud/metadata"
@ -46,6 +47,18 @@ func NewGCP(ctx context.Context) (*Fetcher, error) {
}, nil }, nil
} }
// NewAzure creates a new Azure fetcher.
func NewAWS(ctx context.Context) (*Fetcher, error) {
metaAPI, err := awscloud.New(ctx)
if err != nil {
return nil, err
}
return &Fetcher{
metaAPI: metaAPI,
}, nil
}
// NewAzure creates a new Azure fetcher. // NewAzure creates a new Azure fetcher.
func NewAzure(ctx context.Context) (*Fetcher, error) { func NewAzure(ctx context.Context) (*Fetcher, error) {
metaAPI, err := azurecloud.NewMetadata(ctx) metaAPI, err := azurecloud.NewMetadata(ctx)