Skip to content

Commit

Permalink
Merge pull request #4248 from hashicorp/refactor/importer-rest-api-specs
Browse files Browse the repository at this point in the history
`tools/importer-rest-api-specs`: refactoring the `terraform` package to use the standard SDK Types
  • Loading branch information
tombuildsstuff authored Jul 3, 2024
2 parents 9b90324 + 327916f commit c920ae2
Show file tree
Hide file tree
Showing 120 changed files with 4,987 additions and 5,579 deletions.
1 change: 1 addition & 0 deletions config/resources/chaosstudio.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ service "ChaosStudio" {
website_subcategory = "Chaos Studio"
description = "Manages a Chaos Studio Target"
generate_create = false
generate_update = false
overrides "name" {
updated_name = "target_type"
description = "The name of the Chaos Studio Target. This has the format of [publisher]-[targetType] e.g. `Microsoft-StorageAccount`. For supported values please see this Target Type column in [this table](https://learn.microsoft.com/azure/chaos-studio/chaos-studio-fault-providers)."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package dataworkarounds

import (
"fmt"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/pandora/tools/data-api-sdk/v1/models"
importerModels "github.com/hashicorp/pandora/tools/importer-rest-api-specs/models"
Expand Down
10 changes: 0 additions & 10 deletions tools/importer-rest-api-specs/components/parser/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/pandora/tools/data-api-sdk/v1/models"
importerModels "github.com/hashicorp/pandora/tools/importer-rest-api-specs/models"
"github.com/hashicorp/pandora/tools/sdk/resourcemanager"
)

func ParseSwaggerFileForTesting(t *testing.T, file string, serviceName *string) (*importerModels.AzureApiDefinition, error) {
Expand Down Expand Up @@ -66,7 +65,6 @@ func validateParsedApiResourceMatches(t *testing.T, expected importerModels.Azur
validateMapsMatch(t, expected.Models, actual.Models, "Models", validateParsedSDKModelsMatch)
validateMapsMatch(t, expected.Operations, actual.Operations, "Operations", validateParsedOperationsMatch)
validateMapsMatch(t, expected.ResourceIds, actual.ResourceIds, "Resource IDs", validateParsedResourceIDsMatch)
validateObjectsMatch(t, expected.Terraform, actual.Terraform, "Terraform", validateParsedTerraformDetailsMatch)
}

func validateParsedConstantsMatch(t *testing.T, expected, actual models.SDKConstant, constantName string) {
Expand Down Expand Up @@ -213,14 +211,6 @@ func validateParsedResourceIDSegmentsMatch(t *testing.T, expected, actual models
}
}

func validateParsedTerraformDetailsMatch(t *testing.T, expected, actual resourcemanager.TerraformDetails, _ string) {
if len(expected.Resources) > 0 || len(actual.Resources) > 0 {
// At this time we don't implement Terraform Resource comparisons since we're not expecting
// these to be present as a result of the Swagger Parser (these are the next stage).
t.Fatalf("unimplemented: Terraform Resource comparisons")
}
}

func validateIntegersMatch(t *testing.T, expected, actual int, key string) {
if expected != actual {
t.Fatalf("expected %q to be %d but got %d", key, expected, actual)
Expand Down
4 changes: 0 additions & 4 deletions tools/importer-rest-api-specs/components/parser/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ func normalizeAzureApiResource(input importerModels.AzureApiResource) importerMo
Models: normalizedModels,
Operations: normalizedOperations,
ResourceIds: normalizedResourceIds,

// TF Processing is handled elsewhere, so this should be nil in `input`
// but let's be explicit here since it's another packages responsibility.
Terraform: nil,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func removeUnusedItems(resources map[string]importerModels.AzureApiResource) map
Models: details.Models,
Operations: details.Operations,
ResourceIds: resourceIdsForThisResource,
Terraform: details.Terraform,
}
}

Expand Down

This file was deleted.

159 changes: 0 additions & 159 deletions tools/importer-rest-api-specs/components/terraform/populate.go

This file was deleted.

Loading

0 comments on commit c920ae2

Please sign in to comment.