From e4bc426dc212cf5fb7989d347eb981167b996596 Mon Sep 17 00:00:00 2001 From: Adrian Stobbe Date: Tue, 10 Sep 2024 14:07:14 +0200 Subject: [PATCH] rename to attestationconfig --- .../e2e_attestationconfigapi/action.yml | 2 +- .github/actions/e2e_verify/action.yml | 4 +- .../workflows/e2e-attestationconfigapi.yml | 6 +-- .../BUILD.bazel | 10 ++--- .../attestationconfig.go} | 2 +- .../fetcher.go | 2 +- .../fetcher_test.go | 2 +- .../internal/cli/BUILD.bazel | 6 +-- .../internal/cli/client/BUILD.bazel | 6 +-- .../internal/cli/client/client.go | 22 +++++----- .../internal/cli/client/client_test.go | 8 ++-- .../internal/cli/client/reporter.go | 40 +++++++++---------- .../internal/cli/client/reporter_test.go | 34 ++++++++-------- .../internal/cli/compare.go | 2 +- .../internal/cli/delete.go | 10 ++--- .../internal/cli/e2e/test.sh.in | 0 .../internal/cli/main.go | 2 +- .../internal/cli/upload.go | 16 ++++---- .../internal/cli/validargs.go | 0 .../version.go | 2 +- .../version_test.go | 2 +- cli/internal/cmd/BUILD.bazel | 4 +- cli/internal/cmd/apply.go | 8 ++-- cli/internal/cmd/configfetchmeasurements.go | 6 +-- .../cmd/configfetchmeasurements_test.go | 8 ++-- cli/internal/cmd/iamupgradeapply.go | 6 +-- cli/internal/cmd/iamupgradeapply_test.go | 6 +-- cli/internal/cmd/miniup.go | 6 +-- cli/internal/cmd/recover.go | 6 +-- cli/internal/cmd/status.go | 6 +-- cli/internal/cmd/upgradecheck.go | 6 +-- cli/internal/cmd/verify.go | 6 +-- debugd/internal/cdbg/cmd/BUILD.bazel | 2 +- debugd/internal/cdbg/cmd/deploy.go | 4 +- dev-docs/workflows/attestationconfigapi.md | 4 +- e2e/internal/upgrade/BUILD.bazel | 2 +- e2e/internal/upgrade/upgrade.go | 4 +- hack/gocoverage/main_test.go | 2 +- hack/image-fetch/BUILD.bazel | 2 +- hack/image-fetch/main.go | 4 +- internal/config/BUILD.bazel | 4 +- internal/config/aws.go | 6 +-- internal/config/azure.go | 8 ++-- internal/config/config.go | 4 +- internal/config/config_test.go | 8 ++-- internal/config/gcp.go | 6 +-- internal/verify/verify.go | 2 +- .../internal/provider/BUILD.bazel | 2 +- .../provider/attestation_data_source.go | 8 ++-- .../internal/provider/convert.go | 4 +- 50 files changed, 161 insertions(+), 161 deletions(-) rename api/{attestationconfigapi => attestationconfig}/BUILD.bazel (80%) rename api/{attestationconfigapi/attestationconfigapi.go => attestationconfig/attestationconfig.go} (97%) rename api/{attestationconfigapi => attestationconfig}/fetcher.go (99%) rename api/{attestationconfigapi => attestationconfig}/fetcher_test.go (99%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/BUILD.bazel (90%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/client/BUILD.bazel (86%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/client/client.go (83%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/client/client_test.go (59%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/client/reporter.go (88%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/client/reporter_test.go (68%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/compare.go (97%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/delete.go (95%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/e2e/test.sh.in (100%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/main.go (98%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/upload.go (94%) rename api/{attestationconfigapi => attestationconfig}/internal/cli/validargs.go (100%) rename api/{attestationconfigapi => attestationconfig}/version.go (99%) rename api/{attestationconfigapi => attestationconfig}/version_test.go (98%) diff --git a/.github/actions/e2e_attestationconfigapi/action.yml b/.github/actions/e2e_attestationconfigapi/action.yml index 6717168ac..70094e685 100644 --- a/.github/actions/e2e_attestationconfigapi/action.yml +++ b/.github/actions/e2e_attestationconfigapi/action.yml @@ -30,4 +30,4 @@ runs: COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }} COSIGN_PASSWORD: ${{ inputs.cosignPassword }} run: | - bazel run //api/attestationconfigapi/internal/cli:cli_e2e_test -- ${{ inputs.attestationVariant }} + bazel run //api/attestationconfig/internal/cli:cli_e2e_test -- ${{ inputs.attestationVariant }} diff --git a/.github/actions/e2e_verify/action.yml b/.github/actions/e2e_verify/action.yml index b44ca9c0c..3e65837cd 100644 --- a/.github/actions/e2e_verify/action.yml +++ b/.github/actions/e2e_verify/action.yml @@ -103,9 +103,9 @@ runs: absolute_reports="${absolute_reports} $(realpath "${report}")" done - report=$(bazel run //api/attestationconfigapi/internal/cli -- compare ${{ inputs.attestationVariant }} ${absolute_reports}) + report=$(bazel run //api/attestationconfig/internal/cli -- compare ${{ inputs.attestationVariant }} ${absolute_reports}) path=$(realpath "${report}") cat "${path}" - bazel run //api/attestationconfigapi/internal/cli -- upload ${{ inputs.attestationVariant }} attestation-report "${path}" + bazel run //api/attestationconfig/internal/cli -- upload ${{ inputs.attestationVariant }} attestation-report "${path}" diff --git a/.github/workflows/e2e-attestationconfigapi.yml b/.github/workflows/e2e-attestationconfigapi.yml index 56fb81255..24c9253af 100644 --- a/.github/workflows/e2e-attestationconfigapi.yml +++ b/.github/workflows/e2e-attestationconfigapi.yml @@ -8,8 +8,8 @@ on: - "release/**" paths: - "internal/api/**" - - "api/attestationconfigapi/**" - - ".github/workflows/e2e-attestationconfigapi.yml" + - "api/attestationconfig/**" + - ".github/workflows/e2e-attestationconfig.yml" - "go.mod" jobs: @@ -33,7 +33,7 @@ jobs: ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || github.event.pull_request.head.sha || '' }} - name: Run Attestationconfig API E2E - uses: ./.github/actions/e2e_attestationconfigapi + uses: ./.github/actions/e2e_attestationconfig with: cosignPrivateKey: ${{ secrets.COSIGN_DEV_PRIVATE_KEY }} cosignPassword: ${{ secrets.COSIGN_DEV_PASSWORD }} diff --git a/api/attestationconfigapi/BUILD.bazel b/api/attestationconfig/BUILD.bazel similarity index 80% rename from api/attestationconfigapi/BUILD.bazel rename to api/attestationconfig/BUILD.bazel index 45fc68bc4..6c04608f4 100644 --- a/api/attestationconfigapi/BUILD.bazel +++ b/api/attestationconfig/BUILD.bazel @@ -2,13 +2,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("//bazel/go:go_test.bzl", "go_test") go_library( - name = "attestationconfigapi", + name = "attestationconfig", srcs = [ - "attestationconfigapi.go", + "attestationconfig.go", "fetcher.go", "version.go", ], - importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi", + importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig", visibility = ["//:__subpackages__"], deps = [ "//internal/api/fetcher", @@ -19,12 +19,12 @@ go_library( ) go_test( - name = "attestationconfigapi_test", + name = "attestationconfig_test", srcs = [ "fetcher_test.go", "version_test.go", ], - embed = [":attestationconfigapi"], + embed = [":attestationconfig"], deps = [ "//internal/attestation/variant", "//internal/constants", diff --git a/api/attestationconfigapi/attestationconfigapi.go b/api/attestationconfig/attestationconfig.go similarity index 97% rename from api/attestationconfigapi/attestationconfigapi.go rename to api/attestationconfig/attestationconfig.go index a0d84d786..735873500 100644 --- a/api/attestationconfigapi/attestationconfigapi.go +++ b/api/attestationconfig/attestationconfig.go @@ -20,4 +20,4 @@ Thus, existing config types (AWSNitroTPM, AzureSEVSNP, ...) can not be extended Instead, we need a separate type that wraps _all_ attestation types. In the codebase this is done using the AttestationCfg interface. The new type AttestationCfgGet needs to be located inside internal/config in order to implement UnmarshalJSON. */ -package attestationconfigapi +package attestationconfig diff --git a/api/attestationconfigapi/fetcher.go b/api/attestationconfig/fetcher.go similarity index 99% rename from api/attestationconfigapi/fetcher.go rename to api/attestationconfig/fetcher.go index d4f0dab02..278329abe 100644 --- a/api/attestationconfigapi/fetcher.go +++ b/api/attestationconfig/fetcher.go @@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH SPDX-License-Identifier: AGPL-3.0-only */ -package attestationconfigapi +package attestationconfig import ( "context" diff --git a/api/attestationconfigapi/fetcher_test.go b/api/attestationconfig/fetcher_test.go similarity index 99% rename from api/attestationconfigapi/fetcher_test.go rename to api/attestationconfig/fetcher_test.go index b3d737f54..6f4a04134 100644 --- a/api/attestationconfigapi/fetcher_test.go +++ b/api/attestationconfig/fetcher_test.go @@ -3,7 +3,7 @@ Copyright (c) Edgeless Systems GmbH SPDX-License-Identifier: AGPL-3.0-only */ -package attestationconfigapi +package attestationconfig import ( "bytes" diff --git a/api/attestationconfigapi/internal/cli/BUILD.bazel b/api/attestationconfig/internal/cli/BUILD.bazel similarity index 90% rename from api/attestationconfigapi/internal/cli/BUILD.bazel rename to api/attestationconfig/internal/cli/BUILD.bazel index 86381a8f5..e214d949e 100644 --- a/api/attestationconfigapi/internal/cli/BUILD.bazel +++ b/api/attestationconfig/internal/cli/BUILD.bazel @@ -16,11 +16,11 @@ go_library( "upload.go", "validargs.go", ], - importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli", + importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli", visibility = ["//visibility:private"], deps = [ - "//api/attestationconfigapi", - "//api/attestationconfigapi/internal/cli/client", + "//api/attestationconfig", + "//api/attestationconfig/internal/cli/client", "//internal/api/fetcher", "//internal/attestation/variant", "//internal/constants", diff --git a/api/attestationconfigapi/internal/cli/client/BUILD.bazel b/api/attestationconfig/internal/cli/client/BUILD.bazel similarity index 86% rename from api/attestationconfigapi/internal/cli/client/BUILD.bazel rename to api/attestationconfig/internal/cli/client/BUILD.bazel index 42401c463..6f9c96bee 100644 --- a/api/attestationconfigapi/internal/cli/client/BUILD.bazel +++ b/api/attestationconfig/internal/cli/client/BUILD.bazel @@ -7,10 +7,10 @@ go_library( "client.go", "reporter.go", ], - importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client", + importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client", visibility = ["//:__subpackages__"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/api/client", "//internal/attestation/variant", "//internal/sigstore", @@ -28,7 +28,7 @@ go_test( ], embed = [":client"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "@com_github_stretchr_testify//assert", ], ) diff --git a/api/attestationconfigapi/internal/cli/client/client.go b/api/attestationconfig/internal/cli/client/client.go similarity index 83% rename from api/attestationconfigapi/internal/cli/client/client.go rename to api/attestationconfig/internal/cli/client/client.go index 8590a3f44..3a43ee9a5 100644 --- a/api/attestationconfigapi/internal/cli/client/client.go +++ b/api/attestationconfig/internal/cli/client/client.go @@ -20,7 +20,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/aws-sdk-go/aws" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" apiclient "github.com/edgelesssys/constellation/v2/internal/api/client" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/sigstore" @@ -75,14 +75,14 @@ func (c Client) DeleteVersion(ctx context.Context, attestation variant.Variant, } // List returns the list of versions for the given attestation variant. -func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfigapi.List, error) { - versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfigapi.List{Variant: attestation}) +func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfig.List, error) { + versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfig.List{Variant: attestation}) if err != nil { var notFoundErr *apiclient.NotFoundError if errors.As(err, ¬FoundErr) { - return attestationconfigapi.List{Variant: attestation}, nil + return attestationconfig.List{Variant: attestation}, nil } - return attestationconfigapi.List{}, err + return attestationconfig.List{}, err } versions.Variant = attestation @@ -90,10 +90,10 @@ func (c Client) List(ctx context.Context, attestation variant.Variant) (attestat return versions, nil } -func (c Client) deleteVersion(versions attestationconfigapi.List, versionStr string) (ops []crudCmd, err error) { +func (c Client) deleteVersion(versions attestationconfig.List, versionStr string) (ops []crudCmd, err error) { versionStr = versionStr + ".json" ops = append(ops, deleteCmd{ - apiObject: attestationconfigapi.Entry{ + apiObject: attestationconfig.Entry{ Variant: versions.Variant, Version: versionStr, }, @@ -132,19 +132,19 @@ func (c Client) listCachedVersions(ctx context.Context, attestation variant.Vari return dates, nil } -func removeVersion(list attestationconfigapi.List, versionStr string) (removedVersions attestationconfigapi.List, err error) { +func removeVersion(list attestationconfig.List, versionStr string) (removedVersions attestationconfig.List, err error) { versions := list.List for i, v := range versions { if v == versionStr { if i == len(versions)-1 { - removedVersions = attestationconfigapi.List{List: versions[:i], Variant: list.Variant} + removedVersions = attestationconfig.List{List: versions[:i], Variant: list.Variant} } else { - removedVersions = attestationconfigapi.List{List: append(versions[:i], versions[i+1:]...), Variant: list.Variant} + removedVersions = attestationconfig.List{List: append(versions[:i], versions[i+1:]...), Variant: list.Variant} } return removedVersions, nil } } - return attestationconfigapi.List{}, fmt.Errorf("version %s not found in list %v", versionStr, versions) + return attestationconfig.List{}, fmt.Errorf("version %s not found in list %v", versionStr, versions) } type crudCmd interface { diff --git a/api/attestationconfigapi/internal/cli/client/client_test.go b/api/attestationconfig/internal/cli/client/client_test.go similarity index 59% rename from api/attestationconfigapi/internal/cli/client/client_test.go rename to api/attestationconfig/internal/cli/client/client_test.go index 42bf22ab5..75aef396b 100644 --- a/api/attestationconfigapi/internal/cli/client/client_test.go +++ b/api/attestationconfig/internal/cli/client/client_test.go @@ -8,7 +8,7 @@ package client import ( "testing" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/stretchr/testify/assert" ) @@ -16,19 +16,19 @@ func TestDeleteAzureSEVSNPVersions(t *testing.T) { sut := Client{ bucketID: "bucket", } - versions := attestationconfigapi.List{List: []string{"2023-01-01.json", "2021-01-01.json", "2019-01-01.json"}} + versions := attestationconfig.List{List: []string{"2023-01-01.json", "2021-01-01.json", "2019-01-01.json"}} ops, err := sut.deleteVersion(versions, "2021-01-01") assert := assert.New(t) assert.NoError(err) assert.Contains(ops, deleteCmd{ - apiObject: attestationconfigapi.Entry{ + apiObject: attestationconfig.Entry{ Version: "2021-01-01.json", }, }) assert.Contains(ops, putCmd{ - apiObject: attestationconfigapi.List{List: []string{"2023-01-01.json", "2019-01-01.json"}}, + apiObject: attestationconfig.List{List: []string{"2023-01-01.json", "2019-01-01.json"}}, }) } diff --git a/api/attestationconfigapi/internal/cli/client/reporter.go b/api/attestationconfig/internal/cli/client/reporter.go similarity index 88% rename from api/attestationconfigapi/internal/cli/client/reporter.go rename to api/attestationconfig/internal/cli/client/reporter.go index dcb734a86..03024279a 100644 --- a/api/attestationconfigapi/internal/cli/client/reporter.go +++ b/api/attestationconfig/internal/cli/client/reporter.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/api/client" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" ) @@ -28,7 +28,7 @@ const cachedVersionsSubDir = "cached-versions" var ErrNoNewerVersion = errors.New("input version is not newer than latest API version") func reportVersionDir(attestation variant.Variant) string { - return path.Join(attestationconfigapi.AttestationURLPath, attestation.String(), cachedVersionsSubDir) + return path.Join(attestationconfig.AttestationURLPath, attestation.String(), cachedVersionsSubDir) } // IsInputNewerThanOtherVersion compares the input version with the other version and returns true if the input version is newer. @@ -37,13 +37,13 @@ func IsInputNewerThanOtherVersion(variant variant.Variant, inputVersion, otherVe var result bool actionForVariant(variant, func() { - input := inputVersion.(attestationconfigapi.TDXVersion) - other := otherVersion.(attestationconfigapi.TDXVersion) + input := inputVersion.(attestationconfig.TDXVersion) + other := otherVersion.(attestationconfig.TDXVersion) result = isInputNewerThanOtherTDXVersion(input, other) }, func() { - input := inputVersion.(attestationconfigapi.SEVSNPVersion) - other := otherVersion.(attestationconfigapi.SEVSNPVersion) + input := inputVersion.(attestationconfig.SEVSNPVersion) + other := otherVersion.(attestationconfig.SEVSNPVersion) result = isInputNewerThanOtherSEVSNPVersion(input, other) }, ) @@ -64,18 +64,18 @@ func (c Client) UploadLatestVersion( var err error actionForVariant(attestationVariant, func() { - if _, ok := inputVersion.(attestationconfigapi.TDXVersion); !ok { + if _, ok := inputVersion.(attestationconfig.TDXVersion); !ok { err = fmt.Errorf("input version %q is not a TDX version", inputVersion) } - if _, ok := latestVersionInAPI.(attestationconfigapi.TDXVersion); !ok { + if _, ok := latestVersionInAPI.(attestationconfig.TDXVersion); !ok { err = fmt.Errorf("latest API version %q is not a TDX version", latestVersionInAPI) } }, func() { - if _, ok := inputVersion.(attestationconfigapi.SEVSNPVersion); !ok { + if _, ok := inputVersion.(attestationconfig.SEVSNPVersion); !ok { err = fmt.Errorf("input version %q is not a SNP version", inputVersion) } - if _, ok := latestVersionInAPI.(attestationconfigapi.SEVSNPVersion); !ok { + if _, ok := latestVersionInAPI.(attestationconfig.SEVSNPVersion); !ok { err = fmt.Errorf("latest API version %q is not a SNP version", latestVersionInAPI) } }, @@ -181,19 +181,19 @@ func (c Client) findMinVersion( actionForVariant(attestationVariant, func() { getMinimalVersion = func() (any, string, error) { - return findMinimalVersion[attestationconfigapi.TDXVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize) + return findMinimalVersion[attestationconfig.TDXVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize) } }, func() { getMinimalVersion = func() (any, string, error) { - return findMinimalVersion[attestationconfigapi.SEVSNPVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize) + return findMinimalVersion[attestationconfig.SEVSNPVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize) } }, ) return getMinimalVersion() } -func findMinimalVersion[T attestationconfigapi.TDXVersion | attestationconfigapi.SEVSNPVersion]( +func findMinimalVersion[T attestationconfig.TDXVersion | attestationconfig.SEVSNPVersion]( ctx context.Context, variant variant.Variant, versionDates []string, s3Client *client.Client, cacheWindowSize int, ) (T, string, error) { @@ -233,8 +233,8 @@ type apiVersionObject struct { version string `json:"-"` variant variant.Variant `json:"-"` cached bool `json:"-"` - snp attestationconfigapi.SEVSNPVersion - tdx attestationconfigapi.TDXVersion + snp attestationconfig.SEVSNPVersion + tdx attestationconfig.TDXVersion } func (a apiVersionObject) MarshalJSON() ([]byte, error) { @@ -266,7 +266,7 @@ func (a apiVersionObject) JSONPath() string { if a.cached { return path.Join(reportVersionDir(a.variant), a.version) } - return path.Join(attestationconfigapi.AttestationURLPath, a.variant.String(), a.version) + return path.Join(attestationconfig.AttestationURLPath, a.variant.String(), a.version) } // ValidateRequest validates the request. @@ -300,10 +300,10 @@ func (a apiVersionObject) getVersion() any { func (a *apiVersionObject) setVersion(version any) { actionForVariant(a.variant, func() { - a.tdx = version.(attestationconfigapi.TDXVersion) + a.tdx = version.(attestationconfig.TDXVersion) }, func() { - a.snp = version.(attestationconfigapi.SEVSNPVersion) + a.snp = version.(attestationconfig.SEVSNPVersion) }, ) } @@ -324,7 +324,7 @@ func actionForVariant( } // isInputNewerThanOtherSEVSNPVersion compares all version fields and returns false if any input field is older, or the versions are equal. -func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfigapi.SEVSNPVersion) bool { +func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfig.SEVSNPVersion) bool { if input == other { return false } @@ -344,7 +344,7 @@ func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfigapi.SEVSNP } // isInputNewerThanOtherSEVSNPVersion compares all version fields and returns false if any input field is older, or the versions are equal. -func isInputNewerThanOtherTDXVersion(input, other attestationconfigapi.TDXVersion) bool { +func isInputNewerThanOtherTDXVersion(input, other attestationconfig.TDXVersion) bool { if input == other { return false } diff --git a/api/attestationconfigapi/internal/cli/client/reporter_test.go b/api/attestationconfig/internal/cli/client/reporter_test.go similarity index 68% rename from api/attestationconfigapi/internal/cli/client/reporter_test.go rename to api/attestationconfig/internal/cli/client/reporter_test.go index 152776966..d808a381b 100644 --- a/api/attestationconfigapi/internal/cli/client/reporter_test.go +++ b/api/attestationconfig/internal/cli/client/reporter_test.go @@ -7,13 +7,13 @@ package client import ( "testing" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/stretchr/testify/assert" ) func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) { - newTestCfg := func() attestationconfigapi.SEVSNPVersion { - return attestationconfigapi.SEVSNPVersion{ + newTestCfg := func() attestationconfig.SEVSNPVersion { + return attestationconfig.SEVSNPVersion{ Microcode: 93, TEE: 0, SNP: 6, @@ -22,12 +22,12 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) { } testCases := map[string]struct { - latest attestationconfigapi.SEVSNPVersion - input attestationconfigapi.SEVSNPVersion + latest attestationconfig.SEVSNPVersion + input attestationconfig.SEVSNPVersion expect bool }{ "input is older than latest": { - input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion { + input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion { c.Microcode-- return c }(newTestCfg()), @@ -35,7 +35,7 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) { expect: false, }, "input has greater and smaller version field than latest": { - input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion { + input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion { c.Microcode++ c.Bootloader-- return c @@ -44,7 +44,7 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) { expect: false, }, "input is newer than latest": { - input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion { + input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion { c.TEE++ return c }(newTestCfg()), @@ -66,8 +66,8 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) { } func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { - newTestVersion := func() attestationconfigapi.TDXVersion { - return attestationconfigapi.TDXVersion{ + newTestVersion := func() attestationconfig.TDXVersion { + return attestationconfig.TDXVersion{ QESVN: 1, PCESVN: 2, TEETCBSVN: [16]byte{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, @@ -77,12 +77,12 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { } testCases := map[string]struct { - latest attestationconfigapi.TDXVersion - input attestationconfigapi.TDXVersion + latest attestationconfig.TDXVersion + input attestationconfig.TDXVersion expect bool }{ "input is older than latest": { - input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion { + input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion { c.QESVN-- return c }(newTestVersion()), @@ -90,7 +90,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { expect: false, }, "input has greater and smaller version field than latest": { - input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion { + input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion { c.QESVN++ c.PCESVN-- return c @@ -99,7 +99,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { expect: false, }, "input is newer than latest": { - input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion { + input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion { c.QESVN++ return c }(newTestVersion()), @@ -112,7 +112,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { expect: false, }, "tee tcb svn is newer": { - input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion { + input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion { c.TEETCBSVN[4]++ return c }(newTestVersion()), @@ -120,7 +120,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) { expect: true, }, "xfam is different": { - input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion { + input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion { c.XFAM[3]++ return c }(newTestVersion()), diff --git a/api/attestationconfigapi/internal/cli/compare.go b/api/attestationconfig/internal/cli/compare.go similarity index 97% rename from api/attestationconfigapi/internal/cli/compare.go rename to api/attestationconfig/internal/cli/compare.go index 046b3bde1..01de459ee 100644 --- a/api/attestationconfigapi/internal/cli/compare.go +++ b/api/attestationconfig/internal/cli/compare.go @@ -10,7 +10,7 @@ import ( "os" "slices" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client" + "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/file" "github.com/edgelesssys/constellation/v2/internal/verify" diff --git a/api/attestationconfigapi/internal/cli/delete.go b/api/attestationconfig/internal/cli/delete.go similarity index 95% rename from api/attestationconfigapi/internal/cli/delete.go rename to api/attestationconfig/internal/cli/delete.go index 4f5a17fc0..265524360 100644 --- a/api/attestationconfigapi/internal/cli/delete.go +++ b/api/attestationconfig/internal/cli/delete.go @@ -15,8 +15,8 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" + "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/logger" "github.com/edgelesssys/constellation/v2/internal/staticupload" @@ -50,7 +50,7 @@ func newDeleteCmd() *cobra.Command { } func runDelete(cmd *cobra.Command, args []string) (retErr error) { - log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi") + log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig") deleteCfg, err := newDeleteConfig(cmd, ([3]string)(args[:3])) if err != nil { @@ -86,7 +86,7 @@ func runRecursiveDelete(cmd *cobra.Command, args []string) (retErr error) { return fmt.Errorf("creating delete config: %w", err) } - log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi") + log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig") client, closeFn, err := staticupload.New(cmd.Context(), staticupload.Config{ Bucket: deleteCfg.bucket, Region: deleteCfg.region, @@ -102,7 +102,7 @@ func runRecursiveDelete(cmd *cobra.Command, args []string) (retErr error) { } }() - deletePath := path.Join(attestationconfigapi.AttestationURLPath, deleteCfg.variant.String()) + deletePath := path.Join(attestationconfig.AttestationURLPath, deleteCfg.variant.String()) return deleteEntryRecursive(cmd.Context(), deletePath, client, deleteCfg) } diff --git a/api/attestationconfigapi/internal/cli/e2e/test.sh.in b/api/attestationconfig/internal/cli/e2e/test.sh.in similarity index 100% rename from api/attestationconfigapi/internal/cli/e2e/test.sh.in rename to api/attestationconfig/internal/cli/e2e/test.sh.in diff --git a/api/attestationconfigapi/internal/cli/main.go b/api/attestationconfig/internal/cli/main.go similarity index 98% rename from api/attestationconfigapi/internal/cli/main.go rename to api/attestationconfig/internal/cli/main.go index ee1b0c354..a78519a4c 100644 --- a/api/attestationconfigapi/internal/cli/main.go +++ b/api/attestationconfig/internal/cli/main.go @@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only /* This package provides a CLI to interact with the Attestationconfig API, a sub API of the Resource API. -You can execute an e2e test by running: `bazel run //internal/api/attestationconfigapi:configapi_e2e_test`. +You can execute an e2e test by running: `bazel run //internal/api/attestationconfig:configapi_e2e_test`. The CLI is used in the CI pipeline. Manual actions that change the bucket's data shouldn't be necessary. The reporter CLI caches the observed version values in a dedicated caching directory and derives the latest API version from it. Any version update is then pushed to the API. diff --git a/api/attestationconfigapi/internal/cli/upload.go b/api/attestationconfig/internal/cli/upload.go similarity index 94% rename from api/attestationconfigapi/internal/cli/upload.go rename to api/attestationconfig/internal/cli/upload.go index 1283d617f..106d0f149 100644 --- a/api/attestationconfigapi/internal/cli/upload.go +++ b/api/attestationconfig/internal/cli/upload.go @@ -14,8 +14,8 @@ import ( "os" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" + "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client" "github.com/edgelesssys/constellation/v2/internal/api/fetcher" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/file" @@ -64,7 +64,7 @@ func envCheck(_ *cobra.Command, _ []string) error { func runUpload(cmd *cobra.Command, args []string) (retErr error) { ctx := cmd.Context() - log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi") + log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig") uploadCfg, err := newConfig(cmd, ([3]string)(args[:3])) if err != nil { @@ -103,7 +103,7 @@ func uploadReport( return fmt.Errorf("kind %s not supported", cfg.kind) } - apiFetcher := attestationconfigapi.NewFetcherWithCustomCDNAndCosignKey(cfg.url, cfg.cosignPublicKey) + apiFetcher := attestationconfig.NewFetcherWithCustomCDNAndCosignKey(cfg.url, cfg.cosignPublicKey) latestVersionInAPI, err := apiFetcher.FetchLatestVersion(ctx, cfg.variant) if err != nil { var notFoundErr *fetcher.NotFoundError @@ -149,8 +149,8 @@ func uploadReport( return nil } -func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfigapi.SEVSNPVersion { - return attestationconfigapi.SEVSNPVersion{ +func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfig.SEVSNPVersion { + return attestationconfig.SEVSNPVersion{ Bootloader: tcb.Bootloader, TEE: tcb.TEE, SNP: tcb.SNP, @@ -158,8 +158,8 @@ func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfigapi.S } } -func convertQuoteToTDXVersion(quote *tdx.QuoteV4) attestationconfigapi.TDXVersion { - return attestationconfigapi.TDXVersion{ +func convertQuoteToTDXVersion(quote *tdx.QuoteV4) attestationconfig.TDXVersion { + return attestationconfig.TDXVersion{ QESVN: binary.LittleEndian.Uint16(quote.Header.QeSvn), PCESVN: binary.LittleEndian.Uint16(quote.Header.PceSvn), QEVendorID: [16]byte(quote.Header.QeVendorId), diff --git a/api/attestationconfigapi/internal/cli/validargs.go b/api/attestationconfig/internal/cli/validargs.go similarity index 100% rename from api/attestationconfigapi/internal/cli/validargs.go rename to api/attestationconfig/internal/cli/validargs.go diff --git a/api/attestationconfigapi/version.go b/api/attestationconfig/version.go similarity index 99% rename from api/attestationconfigapi/version.go rename to api/attestationconfig/version.go index 13dd17254..36df5fb94 100644 --- a/api/attestationconfigapi/version.go +++ b/api/attestationconfig/version.go @@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH SPDX-License-Identifier: AGPL-3.0-only */ -package attestationconfigapi +package attestationconfig import ( "encoding/json" diff --git a/api/attestationconfigapi/version_test.go b/api/attestationconfig/version_test.go similarity index 98% rename from api/attestationconfigapi/version_test.go rename to api/attestationconfig/version_test.go index 1e5c51441..91cf134ec 100644 --- a/api/attestationconfigapi/version_test.go +++ b/api/attestationconfig/version_test.go @@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH SPDX-License-Identifier: AGPL-3.0-only */ -package attestationconfigapi +package attestationconfig import ( "testing" diff --git a/cli/internal/cmd/BUILD.bazel b/cli/internal/cmd/BUILD.bazel index 344cca2b6..6a7404ba8 100644 --- a/cli/internal/cmd/BUILD.bazel +++ b/cli/internal/cmd/BUILD.bazel @@ -55,7 +55,6 @@ go_library( "//cli/internal/libvirt", "//cli/internal/terraform", "//disk-mapper/recoverproto", - "//api/attestationconfigapi", "//internal/api/fetcher", "//internal/api/versionsapi", "//internal/atls", @@ -116,6 +115,7 @@ go_library( "//internal/attestation/azure/tdx", "@com_github_google_go_sev_guest//proto/sevsnp", "@com_github_google_go_tpm_tools//proto/attest", + "//api/attestationconfig", ] + select({ "@io_bazel_rules_go//go/platform:android_amd64": [ "@org_golang_x_sys//unix", @@ -154,7 +154,7 @@ go_test( ], embed = [":cmd"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//bootstrapper/initproto", "//cli/internal/cloudcmd", "//cli/internal/cmd/pathprefix", diff --git a/cli/internal/cmd/apply.go b/cli/internal/cmd/apply.go index 52c3441ef..ca5ae0676 100644 --- a/cli/internal/cmd/apply.go +++ b/cli/internal/cmd/apply.go @@ -21,7 +21,7 @@ import ( "strings" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd" "github.com/edgelesssys/constellation/v2/internal/api/versionsapi" "github.com/edgelesssys/constellation/v2/internal/atls" @@ -268,7 +268,7 @@ func runApply(cmd *cobra.Command, _ []string) error { defer cancel() cmd.SetContext(ctx) - return apply.apply(cmd, attestationconfigapi.NewFetcher(), upgradeDir) + return apply.apply(cmd, attestationconfig.NewFetcher(), upgradeDir) } type applyCmd struct { @@ -356,7 +356,7 @@ The control flow is as follows: └────────────────────┘ */ func (a *applyCmd) apply( - cmd *cobra.Command, configFetcher attestationconfigapi.Fetcher, upgradeDir string, + cmd *cobra.Command, configFetcher attestationconfig.Fetcher, upgradeDir string, ) error { // Validate inputs conf, stateFile, err := a.validateInputs(cmd, configFetcher) @@ -450,7 +450,7 @@ func (a *applyCmd) apply( return nil } -func (a *applyCmd) validateInputs(cmd *cobra.Command, configFetcher attestationconfigapi.Fetcher) (*config.Config, *state.State, error) { +func (a *applyCmd) validateInputs(cmd *cobra.Command, configFetcher attestationconfig.Fetcher) (*config.Config, *state.State, error) { // Read user's config and state file a.log.Debug(fmt.Sprintf("Reading config from %q", a.flags.pathPrefixer.PrefixPrintablePath(constants.ConfigFilename))) conf, err := config.New(a.fileHandler, constants.ConfigFilename, configFetcher, a.flags.force) diff --git a/cli/internal/cmd/configfetchmeasurements.go b/cli/internal/cmd/configfetchmeasurements.go index 58f00915e..07a427110 100644 --- a/cli/internal/cmd/configfetchmeasurements.go +++ b/cli/internal/cmd/configfetchmeasurements.go @@ -14,7 +14,7 @@ import ( "net/url" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/api/versionsapi" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" @@ -106,12 +106,12 @@ func runConfigFetchMeasurements(cmd *cobra.Command, _ []string) error { } cfm.log.Debug("Using flags", "insecure", cfm.flags.insecure, "measurementsURL", cfm.flags.measurementsURL, "signatureURL", cfm.flags.signatureURL) - fetcher := attestationconfigapi.NewFetcherWithClient(http.DefaultClient, constants.CDNRepositoryURL) + fetcher := attestationconfig.NewFetcherWithClient(http.DefaultClient, constants.CDNRepositoryURL) return cfm.configFetchMeasurements(cmd, fileHandler, fetcher) } func (cfm *configFetchMeasurementsCmd) configFetchMeasurements( - cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfigapi.Fetcher, + cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfig.Fetcher, ) error { if !cfm.canFetchMeasurements { cmd.PrintErrln("Fetching measurements is not supported in the OSS build of the Constellation CLI. Consult the documentation for instructions on where to download the enterprise version.") diff --git a/cli/internal/cmd/configfetchmeasurements_test.go b/cli/internal/cmd/configfetchmeasurements_test.go index 33becae92..ffc8b68d4 100644 --- a/cli/internal/cmd/configfetchmeasurements_test.go +++ b/cli/internal/cmd/configfetchmeasurements_test.go @@ -12,7 +12,7 @@ import ( "net/url" "testing" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/api/versionsapi" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" @@ -204,13 +204,13 @@ func (f stubVerifyFetcher) FetchAndVerifyMeasurements(_ context.Context, _ strin type stubAttestationFetcher struct{} -func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfigapi.Variant) (attestationconfigapi.Entry, error) { - return attestationconfigapi.Entry{ +func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfig.Variant) (attestationconfig.Entry, error) { + return attestationconfig.Entry{ SEVSNPVersion: testCfg, }, nil } -var testCfg = attestationconfigapi.SEVSNPVersion{ +var testCfg = attestationconfig.SEVSNPVersion{ Microcode: 93, TEE: 0, SNP: 6, diff --git a/cli/internal/cmd/iamupgradeapply.go b/cli/internal/cmd/iamupgradeapply.go index 244cdb075..ec49250fc 100644 --- a/cli/internal/cmd/iamupgradeapply.go +++ b/cli/internal/cmd/iamupgradeapply.go @@ -12,7 +12,7 @@ import ( "io" "path/filepath" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd" "github.com/edgelesssys/constellation/v2/cli/internal/terraform" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" @@ -68,7 +68,7 @@ func (f *iamUpgradeApplyFlags) parse(flags *pflag.FlagSet) error { type iamUpgradeApplyCmd struct { fileHandler file.Handler log debugLog - configFetcher attestationconfigapi.Fetcher + configFetcher attestationconfig.Fetcher flags iamUpgradeApplyFlags } @@ -76,7 +76,7 @@ func runIAMUpgradeApply(cmd *cobra.Command, _ []string) error { fileHandler := file.NewHandler(afero.NewOsFs()) upgradeID := generateUpgradeID(upgradeCmdKindIAM) upgradeDir := filepath.Join(constants.UpgradeDir, upgradeID) - configFetcher := attestationconfigapi.NewFetcher() + configFetcher := attestationconfig.NewFetcher() iamMigrateCmd, err := cloudcmd.NewIAMUpgrader( cmd.Context(), constants.TerraformIAMWorkingDir, diff --git a/cli/internal/cmd/iamupgradeapply_test.go b/cli/internal/cmd/iamupgradeapply_test.go index 2e62e6cdc..97e19984b 100644 --- a/cli/internal/cmd/iamupgradeapply_test.go +++ b/cli/internal/cmd/iamupgradeapply_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/cli/internal/terraform" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/v2/internal/config" @@ -170,6 +170,6 @@ type stubConfigFetcher struct { fetchLatestErr error } -func (s *stubConfigFetcher) FetchLatestVersion(context.Context, attestationconfigapi.Variant) (attestationconfigapi.Entry, error) { - return attestationconfigapi.Entry{}, s.fetchLatestErr +func (s *stubConfigFetcher) FetchLatestVersion(context.Context, attestationconfig.Variant) (attestationconfig.Entry, error) { + return attestationconfig.Entry{}, s.fetchLatestErr } diff --git a/cli/internal/cmd/miniup.go b/cli/internal/cmd/miniup.go index 113128c9a..a23753c08 100644 --- a/cli/internal/cmd/miniup.go +++ b/cli/internal/cmd/miniup.go @@ -12,7 +12,7 @@ import ( "os" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/cli/internal/libvirt" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/v2/internal/config" @@ -40,7 +40,7 @@ func newMiniUpCmd() *cobra.Command { type miniUpCmd struct { log debugLog - configFetcher attestationconfigapi.Fetcher + configFetcher attestationconfig.Fetcher fileHandler file.Handler flags rootFlags } @@ -53,7 +53,7 @@ func runUp(cmd *cobra.Command, _ []string) error { m := &miniUpCmd{ log: log, - configFetcher: attestationconfigapi.NewFetcher(), + configFetcher: attestationconfig.NewFetcher(), fileHandler: file.NewHandler(afero.NewOsFs()), } if err := m.flags.parse(cmd.Flags()); err != nil { diff --git a/cli/internal/cmd/recover.go b/cli/internal/cmd/recover.go index 02985ccaa..354ee507a 100644 --- a/cli/internal/cmd/recover.go +++ b/cli/internal/cmd/recover.go @@ -15,7 +15,7 @@ import ( "sync" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/disk-mapper/recoverproto" "github.com/edgelesssys/constellation/v2/internal/atls" "github.com/edgelesssys/constellation/v2/internal/attestation/choose" @@ -67,7 +67,7 @@ func (f *recoverFlags) parse(flags *pflag.FlagSet) error { type recoverCmd struct { log debugLog - configFetcher attestationconfigapi.Fetcher + configFetcher attestationconfig.Fetcher flags recoverFlags } @@ -80,7 +80,7 @@ func runRecover(cmd *cobra.Command, _ []string) error { newDialer := func(validator atls.Validator) *dialer.Dialer { return dialer.New(nil, validator, &net.Dialer{}) } - r := &recoverCmd{log: log, configFetcher: attestationconfigapi.NewFetcher()} + r := &recoverCmd{log: log, configFetcher: attestationconfig.NewFetcher()} if err := r.flags.parse(cmd.Flags()); err != nil { return err } diff --git a/cli/internal/cmd/status.go b/cli/internal/cmd/status.go index 10defcf32..f1649aed9 100644 --- a/cli/internal/cmd/status.go +++ b/cli/internal/cmd/status.go @@ -12,7 +12,7 @@ import ( "fmt" "strings" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/config" "github.com/edgelesssys/constellation/v2/internal/constants" @@ -59,7 +59,7 @@ func runStatus(cmd *cobra.Command, _ []string) error { return helmClient.Versions() } - fetcher := attestationconfigapi.NewFetcher() + fetcher := attestationconfig.NewFetcher() kubeClient, err := kubecmd.New(kubeConfig, log) if err != nil { return fmt.Errorf("setting up kubernetes client: %w", err) @@ -81,7 +81,7 @@ type statusCmd struct { // status queries the cluster for the relevant status information and returns the output string. func (s *statusCmd) status( cmd *cobra.Command, getHelmVersions func() (fmt.Stringer, error), - kubeClient kubeCmd, fetcher attestationconfigapi.Fetcher, + kubeClient kubeCmd, fetcher attestationconfig.Fetcher, ) error { conf, err := config.New(s.fileHandler, constants.ConfigFilename, fetcher, s.flags.force) var configValidationErr *config.ValidationError diff --git a/cli/internal/cmd/upgradecheck.go b/cli/internal/cmd/upgradecheck.go index 3382f50a0..116e0b2a2 100644 --- a/cli/internal/cmd/upgradecheck.go +++ b/cli/internal/cmd/upgradecheck.go @@ -16,7 +16,7 @@ import ( "sort" "strings" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd" "github.com/edgelesssys/constellation/v2/internal/api/fetcher" "github.com/edgelesssys/constellation/v2/internal/api/versionsapi" @@ -155,7 +155,7 @@ func runUpgradeCheck(cmd *cobra.Command, _ []string) error { log: log, } - return up.upgradeCheck(cmd, attestationconfigapi.NewFetcher()) + return up.upgradeCheck(cmd, attestationconfig.NewFetcher()) } type upgradeCheckCmd struct { @@ -169,7 +169,7 @@ type upgradeCheckCmd struct { } // upgradePlan plans an upgrade of a Constellation cluster. -func (u *upgradeCheckCmd) upgradeCheck(cmd *cobra.Command, fetcher attestationconfigapi.Fetcher) error { +func (u *upgradeCheckCmd) upgradeCheck(cmd *cobra.Command, fetcher attestationconfig.Fetcher) error { conf, err := config.New(u.fileHandler, constants.ConfigFilename, fetcher, u.flags.force) var configValidationErr *config.ValidationError if errors.As(err, &configValidationErr) { diff --git a/cli/internal/cmd/verify.go b/cli/internal/cmd/verify.go index c6f456a66..f55ff09e9 100644 --- a/cli/internal/cmd/verify.go +++ b/cli/internal/cmd/verify.go @@ -21,7 +21,7 @@ import ( "strconv" "strings" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/atls" azuretdx "github.com/edgelesssys/constellation/v2/internal/attestation/azure/tdx" "github.com/edgelesssys/constellation/v2/internal/attestation/choose" @@ -121,11 +121,11 @@ func runVerify(cmd *cobra.Command, _ []string) error { } v.log.Debug("Using flags", "clusterID", v.flags.clusterID, "endpoint", v.flags.endpoint, "ownerID", v.flags.ownerID) - fetcher := attestationconfigapi.NewFetcher() + fetcher := attestationconfig.NewFetcher() return v.verify(cmd, verifyClient, fetcher) } -func (c *verifyCmd) verify(cmd *cobra.Command, verifyClient verifyClient, configFetcher attestationconfigapi.Fetcher) error { +func (c *verifyCmd) verify(cmd *cobra.Command, verifyClient verifyClient, configFetcher attestationconfig.Fetcher) error { c.log.Debug(fmt.Sprintf("Loading configuration file from %q", c.flags.pathPrefixer.PrefixPrintablePath(constants.ConfigFilename))) conf, err := config.New(c.fileHandler, constants.ConfigFilename, configFetcher, c.flags.force) var configValidationErr *config.ValidationError diff --git a/debugd/internal/cdbg/cmd/BUILD.bazel b/debugd/internal/cdbg/cmd/BUILD.bazel index df82f2454..9eeef744a 100644 --- a/debugd/internal/cdbg/cmd/BUILD.bazel +++ b/debugd/internal/cdbg/cmd/BUILD.bazel @@ -9,7 +9,7 @@ go_library( importpath = "github.com/edgelesssys/constellation/v2/debugd/internal/cdbg/cmd", visibility = ["//debugd:__subpackages__"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//debugd/internal/debugd", "//debugd/internal/debugd/logcollector", "//debugd/internal/filetransfer", diff --git a/debugd/internal/cdbg/cmd/deploy.go b/debugd/internal/cdbg/cmd/deploy.go index 5ecdc8570..e7127a03d 100644 --- a/debugd/internal/cdbg/cmd/deploy.go +++ b/debugd/internal/cdbg/cmd/deploy.go @@ -17,7 +17,7 @@ import ( "sync" "time" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/debugd/internal/debugd" "github.com/edgelesssys/constellation/v2/debugd/internal/debugd/logcollector" "github.com/edgelesssys/constellation/v2/debugd/internal/filetransfer" @@ -71,7 +71,7 @@ func runDeploy(cmd *cobra.Command, _ []string) error { fileHandler := file.NewHandler(fs) streamer := streamer.New(fs) transfer := filetransfer.New(log, streamer, filetransfer.ShowProgress) - constellationConfig, err := config.New(fileHandler, constants.ConfigFilename, attestationconfigapi.NewFetcher(), force) + constellationConfig, err := config.New(fileHandler, constants.ConfigFilename, attestationconfig.NewFetcher(), force) var configValidationErr *config.ValidationError if errors.As(err, &configValidationErr) { cmd.PrintErrln(configValidationErr.LongMessage()) diff --git a/dev-docs/workflows/attestationconfigapi.md b/dev-docs/workflows/attestationconfigapi.md index 5da8eda35..ae48e36b3 100644 --- a/dev-docs/workflows/attestationconfigapi.md +++ b/dev-docs/workflows/attestationconfigapi.md @@ -8,10 +8,10 @@ This estimate might make manual intervention necessary when a global rollout did ### Manually delete a version ``` -COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfigapi/cli delete -- --version 2023-09-02-12-52 +COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfig/cli delete -- --version 2023-09-02-12-52 ``` ### Manually upload a version ``` -COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfigapi/cli -- --force --version 2023-09-02-12-52 --maa-claims-path "${path}" +COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfig/cli -- --force --version 2023-09-02-12-52 --maa-claims-path "${path}" ``` diff --git a/e2e/internal/upgrade/BUILD.bazel b/e2e/internal/upgrade/BUILD.bazel index b30dd70fd..95f4c4762 100644 --- a/e2e/internal/upgrade/BUILD.bazel +++ b/e2e/internal/upgrade/BUILD.bazel @@ -10,7 +10,7 @@ go_library( importpath = "github.com/edgelesssys/constellation/v2/e2e/internal/upgrade", visibility = ["//e2e:__subpackages__"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/config", "//internal/constants", "//internal/file", diff --git a/e2e/internal/upgrade/upgrade.go b/e2e/internal/upgrade/upgrade.go index cc58ab8db..f286a564e 100644 --- a/e2e/internal/upgrade/upgrade.go +++ b/e2e/internal/upgrade/upgrade.go @@ -36,7 +36,7 @@ import ( "time" "github.com/bazelbuild/rules_go/go/runfiles" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/config" "github.com/edgelesssys/constellation/v2/internal/constants" "github.com/edgelesssys/constellation/v2/internal/file" @@ -248,7 +248,7 @@ func workingDir(workspace string) (string, error) { // WriteUpgradeConfig writes the target versions to the config file. func WriteUpgradeConfig(require *require.Assertions, image string, kubernetes string, microservices string, configPath string) VersionContainer { fileHandler := file.NewHandler(afero.NewOsFs()) - attestationFetcher := attestationconfigapi.NewFetcher() + attestationFetcher := attestationconfig.NewFetcher() cfg, err := config.New(fileHandler, configPath, attestationFetcher, true) var cfgErr *config.ValidationError var longMsg string diff --git a/hack/gocoverage/main_test.go b/hack/gocoverage/main_test.go index 613e74dad..0d9ae7d28 100644 --- a/hack/gocoverage/main_test.go +++ b/hack/gocoverage/main_test.go @@ -75,7 +75,7 @@ ok github.com/edgelesssys/constellation/v2/disk-mapper/internal/systemd (cache ? github.com/edgelesssys/constellation/v2/image/upload [no test files] ? github.com/edgelesssys/constellation/v2/image/upload/internal/cmd [no test files] ? github.com/edgelesssys/constellation/v2/internal/api/client [no test files] -ok github.com/edgelesssys/constellation/v2/internal/api/attestationconfigapi (cached) coverage: 59.2% of statements +ok github.com/edgelesssys/constellation/v2/internal/api/attestationconfig (cached) coverage: 59.2% of statements ? github.com/edgelesssys/constellation/v2/internal/api/fetcher [no test files] ? github.com/edgelesssys/constellation/v2/internal/api/versionsapi/cli [no test files] ok github.com/edgelesssys/constellation/v2/internal/api/versionsapi (cached) coverage: 69.8% of statements diff --git a/hack/image-fetch/BUILD.bazel b/hack/image-fetch/BUILD.bazel index c3c33f97f..3ca305134 100644 --- a/hack/image-fetch/BUILD.bazel +++ b/hack/image-fetch/BUILD.bazel @@ -7,7 +7,7 @@ go_library( importpath = "github.com/edgelesssys/constellation/v2/hack/image-fetch", visibility = ["//visibility:private"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/cloud/cloudprovider", "//internal/config", "//internal/constants", diff --git a/hack/image-fetch/main.go b/hack/image-fetch/main.go index fd1e0110f..e233a5f23 100644 --- a/hack/image-fetch/main.go +++ b/hack/image-fetch/main.go @@ -19,7 +19,7 @@ import ( "path/filepath" "regexp" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/v2/internal/config" "github.com/edgelesssys/constellation/v2/internal/constants" @@ -39,7 +39,7 @@ func main() { ctx := context.Background() fh := file.NewHandler(afero.NewOsFs()) - attFetcher := attestationconfigapi.NewFetcher() + attFetcher := attestationconfig.NewFetcher() conf, err := config.New(fh, filepath.Join(cwd, constants.ConfigFilename), attFetcher, true) var configValidationErr *config.ValidationError if errors.As(err, &configValidationErr) { diff --git a/internal/config/BUILD.bazel b/internal/config/BUILD.bazel index 308a2e2e3..205e848c7 100644 --- a/internal/config/BUILD.bazel +++ b/internal/config/BUILD.bazel @@ -20,7 +20,7 @@ go_library( importpath = "github.com/edgelesssys/constellation/v2/internal/config", visibility = ["//:__subpackages__"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/api/versionsapi", "//internal/attestation/idkeydigest", "//internal/attestation/measurements", @@ -57,7 +57,7 @@ go_test( data = glob(["testdata/**"]), embed = [":config"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/attestation/measurements", "//internal/attestation/variant", "//internal/cloud/cloudprovider", diff --git a/internal/config/aws.go b/internal/config/aws.go index 43d139a2a..1b37a711e 100644 --- a/internal/config/aws.go +++ b/internal/config/aws.go @@ -10,7 +10,7 @@ import ( "context" "fmt" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" @@ -73,7 +73,7 @@ func (c *AWSSEVSNP) getToMarshallLatestWithResolvedVersions() AttestationCfg { } // FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them. -func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error { +func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error { // Only talk to the API if at least one version number is set to latest. if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) { return nil @@ -88,7 +88,7 @@ func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher return nil } -func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { +func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) { if c.BootloaderVersion.WantLatest { c.BootloaderVersion.Value = latest.Bootloader } diff --git a/internal/config/azure.go b/internal/config/azure.go index f5fa0b441..73e983aae 100644 --- a/internal/config/azure.go +++ b/internal/config/azure.go @@ -10,7 +10,7 @@ import ( "context" "fmt" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" @@ -74,7 +74,7 @@ func (c AzureSEVSNP) EqualTo(old AttestationCfg) (bool, error) { } // FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them. -func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error { +func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error { // Only talk to the API if at least one version number is set to latest. if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) { return nil @@ -89,7 +89,7 @@ func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetch return nil } -func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { +func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) { if c.BootloaderVersion.WantLatest { c.BootloaderVersion.Value = latest.Bootloader } @@ -180,7 +180,7 @@ func (c AzureTDX) EqualTo(other AttestationCfg) (bool, error) { } // FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them. -func (c *AzureTDX) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error { +func (c *AzureTDX) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error { // Only talk to the API if at least one version number is set to latest. if !(c.PCESVN.WantLatest || c.QESVN.WantLatest || c.TEETCBSVN.WantLatest || c.QEVendorID.WantLatest || c.XFAM.WantLatest) { return nil diff --git a/internal/config/config.go b/internal/config/config.go index 20989f5db..f303aa52b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -33,7 +33,7 @@ import ( en_translations "github.com/go-playground/validator/v10/translations/en" "gopkg.in/yaml.v3" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/api/versionsapi" "github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" @@ -461,7 +461,7 @@ func (e *UnsupportedAppRegistrationError) Error() string { // 2. For "latest" version values of the attestation variants fetch the version numbers. // 3. Read secrets from environment variables. // 4. Validate config. If `--force` is set the version validation will be disabled and any version combination is allowed. -func New(fileHandler file.Handler, name string, fetcher attestationconfigapi.Fetcher, force bool) (*Config, error) { +func New(fileHandler file.Handler, name string, fetcher attestationconfig.Fetcher, force bool) (*Config, error) { // Read config file c, err := fromFile(fileHandler, name) if err != nil { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index acb2d5f54..8bde3dbc4 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -21,7 +21,7 @@ import ( "go.uber.org/goleak" "gopkg.in/yaml.v3" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" @@ -1051,13 +1051,13 @@ func getConfigAsMap(conf *Config, t *testing.T) (res configMap) { type stubAttestationFetcher struct{} -func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfigapi.Variant) (attestationconfigapi.Entry, error) { - return attestationconfigapi.Entry{ +func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfig.Variant) (attestationconfig.Entry, error) { + return attestationconfig.Entry{ SEVSNPVersion: testCfg, }, nil } -var testCfg = attestationconfigapi.SEVSNPVersion{ +var testCfg = attestationconfig.SEVSNPVersion{ Microcode: 93, TEE: 0, SNP: 6, diff --git a/internal/config/gcp.go b/internal/config/gcp.go index 379971088..f61c4ee9b 100644 --- a/internal/config/gcp.go +++ b/internal/config/gcp.go @@ -10,7 +10,7 @@ import ( "context" "fmt" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" @@ -73,7 +73,7 @@ func (c *GCPSEVSNP) getToMarshallLatestWithResolvedVersions() AttestationCfg { } // FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them. -func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error { +func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error { // Only talk to the API if at least one version number is set to latest. if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) { return nil @@ -88,7 +88,7 @@ func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher return nil } -func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { +func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) { if c.BootloaderVersion.WantLatest { c.BootloaderVersion.Value = latest.Bootloader } diff --git a/internal/verify/verify.go b/internal/verify/verify.go index 27e5db853..2c6fc1002 100644 --- a/internal/verify/verify.go +++ b/internal/verify/verify.go @@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only Package verify provides the types for the verify report in JSON format. The package provides an interface for constellation verify and -the attestationconfigapi upload tool through JSON serialization. +the attestationconfig upload tool through JSON serialization. It exposes a CSP-agnostic interface for printing Reports that may include CSP-specific information. */ package verify diff --git a/terraform-provider-constellation/internal/provider/BUILD.bazel b/terraform-provider-constellation/internal/provider/BUILD.bazel index 0dc172530..7593191ca 100644 --- a/terraform-provider-constellation/internal/provider/BUILD.bazel +++ b/terraform-provider-constellation/internal/provider/BUILD.bazel @@ -14,7 +14,7 @@ go_library( importpath = "github.com/edgelesssys/constellation/v2/terraform-provider-constellation/internal/provider", visibility = ["//terraform-provider-constellation:__subpackages__"], deps = [ - "//api/attestationconfigapi", + "//api/attestationconfig", "//internal/api/versionsapi", "//internal/atls", "//internal/attestation/choose", diff --git a/terraform-provider-constellation/internal/provider/attestation_data_source.go b/terraform-provider-constellation/internal/provider/attestation_data_source.go index 102f28737..051e32a8f 100644 --- a/terraform-provider-constellation/internal/provider/attestation_data_source.go +++ b/terraform-provider-constellation/internal/provider/attestation_data_source.go @@ -12,7 +12,7 @@ import ( "fmt" "net/http" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" @@ -41,7 +41,7 @@ func NewAttestationDataSource() datasource.DataSource { // AttestationDataSource defines the data source implementation. type AttestationDataSource struct { client *http.Client - fetcher attestationconfigapi.Fetcher + fetcher attestationconfig.Fetcher rekor *sigstore.Rekor version string } @@ -73,7 +73,7 @@ func (d *AttestationDataSource) Configure(_ context.Context, req datasource.Conf d.version = providerData.Version.String() d.client = http.DefaultClient - d.fetcher = attestationconfigapi.NewFetcher() + d.fetcher = attestationconfig.NewFetcher() rekor, err := sigstore.NewRekor() if err != nil { resp.Diagnostics.AddError("constructing rekor client", err.Error()) @@ -172,7 +172,7 @@ func (d *AttestationDataSource) Read(ctx context.Context, req datasource.ReadReq insecureFetch := data.Insecure.ValueBool() - latestVersions := attestationconfigapi.Entry{} + latestVersions := attestationconfig.Entry{} if attestationVariant.Equal(variant.AWSSEVSNP{}) || attestationVariant.Equal(variant.AzureSEVSNP{}) || attestationVariant.Equal(variant.AzureTDX{}) || diff --git a/terraform-provider-constellation/internal/provider/convert.go b/terraform-provider-constellation/internal/provider/convert.go index a2f77096b..0f6e7478f 100644 --- a/terraform-provider-constellation/internal/provider/convert.go +++ b/terraform-provider-constellation/internal/provider/convert.go @@ -12,7 +12,7 @@ import ( "fmt" "strconv" - "github.com/edgelesssys/constellation/v2/api/attestationconfigapi" + "github.com/edgelesssys/constellation/v2/api/attestationconfig" "github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/variant" @@ -138,7 +138,7 @@ func convertFromTfAttestationCfg(tfAttestation attestationAttribute, attestation } // convertToTfAttestationCfg converts the constellation attestation config to the related terraform structs. -func convertToTfAttestation(attVar variant.Variant, latestVersions attestationconfigapi.Entry) (tfAttestation attestationAttribute, err error) { +func convertToTfAttestation(attVar variant.Variant, latestVersions attestationconfig.Entry) (tfAttestation attestationAttribute, err error) { tfAttestation = attestationAttribute{ Variant: attVar.String(), }