mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-15 02:05:45 -04:00

find -name '*.go' -exec sed -i 's/SPDX-License-Identifier: AGPL-3.0-only/SPDX-License-Identifier: BUSL-1.1/' {} +
35 lines
594 B
Go
35 lines
594 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
package snp
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/azure"
|
|
)
|
|
|
|
const tagMAAURL = "constellation-maa-url"
|
|
|
|
type imdsClient struct {
|
|
imdsClient *azure.IMDSClient
|
|
}
|
|
|
|
func newIMDSClient() *imdsClient {
|
|
return &imdsClient{
|
|
imdsClient: azure.NewIMDSClient(),
|
|
}
|
|
}
|
|
|
|
func (c *imdsClient) getMAAURL(ctx context.Context) (string, error) {
|
|
tags, err := c.imdsClient.Tags(ctx)
|
|
if err != nil {
|
|
return "", fmt.Errorf("getting tags: %w", err)
|
|
}
|
|
|
|
return tags[tagMAAURL], nil
|
|
}
|