Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hashicorp/terraform-plugin-framework v1.10.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
github.com/intercloud/autonomi-sdk v0.0.12
github.com/intercloud/autonomi-sdk v0.0.13
github.com/meilisearch/meilisearch-go v0.27.2
github.com/stretchr/testify v1.9.0
)
Expand Down
60 changes: 2 additions & 58 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/data_sources/access_products_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (d *accessProductsDataSource) Configure(_ context.Context, req datasource.C
return
}

catalogClient, ok := req.ProviderData.(*meilisearch.Client)
clients, ok := req.ProviderData.(models.Clients)
if !ok {
resp.Diagnostics.AddError(
"Unexpected Data Source Configure Type",
Expand All @@ -153,7 +153,7 @@ func (d *accessProductsDataSource) Configure(_ context.Context, req datasource.C
return
}

d.client = catalogClient
d.client = clients.CatalogClient
}

// Read refreshes the Terraform state with the latest data.
Expand Down
4 changes: 2 additions & 2 deletions internal/data_sources/cloud_products_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (d *cloudProductsDataSource) Configure(_ context.Context, req datasource.Co
return
}

catalogClient, ok := req.ProviderData.(*meilisearch.Client)
clients, ok := req.ProviderData.(models.Clients)
if !ok {
resp.Diagnostics.AddError(
"Unexpected Data Source Configure Type",
Expand All @@ -161,7 +161,7 @@ func (d *cloudProductsDataSource) Configure(_ context.Context, req datasource.Co
return
}

d.client = catalogClient
d.client = clients.CatalogClient
}

// Read refreshes the Terraform state with the latest data.
Expand Down
6 changes: 3 additions & 3 deletions internal/data_sources/filters/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestGetFiltersString(t *testing.T) {
Values: getValues([]string{"EQUINIX LD5"}),
},
},
expect: []string{"(location = \"EQUINIX FR5\" && locationTo = \"EQUINIX LD5\") or (locationTo = \"EQUINIX FR5\" && location = \"EQUINIX LD5\")"},
expect: []string{"(location = \"EQUINIX FR5\" AND locationTo = \"EQUINIX LD5\") OR (locationTo = \"EQUINIX FR5\" AND location = \"EQUINIX LD5\")"},
err: nil,
},
{
Expand All @@ -134,7 +134,7 @@ func TestGetFiltersString(t *testing.T) {
Values: getValues([]string{"EQUINIX LD5"}),
},
},
expect: []string{"(location = \"EQUINIX FR5\" && locationTo = \"EQUINIX LD5\") or (locationTo = \"EQUINIX FR5\" && location = \"EQUINIX LD5\")"},
expect: []string{"(location = \"EQUINIX FR5\" AND locationTo = \"EQUINIX LD5\") OR (locationTo = \"EQUINIX FR5\" AND location = \"EQUINIX LD5\")"},
err: nil,
},
{
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestGetFiltersString(t *testing.T) {
Values: getValues([]string{"EQUINIX AM2", "EQUINIX PA3"}),
},
},
expect: []string{"(location = \"EQUINIX FR5\" && locationTo = \"EQUINIX AM2\") or (locationTo = \"EQUINIX FR5\" && location = \"EQUINIX AM2\") or (location = \"EQUINIX FR5\" && locationTo = \"EQUINIX PA3\") or (locationTo = \"EQUINIX FR5\" && location = \"EQUINIX PA3\") or (location = \"EQUINIX AM2\" && locationTo = \"EQUINIX AM2\") or (location = \"EQUINIX AM2\" && locationTo = \"EQUINIX PA3\") or (locationTo = \"EQUINIX AM2\" && location = \"EQUINIX PA3\") or (location = \"EQUINIX SG1\" && locationTo = \"EQUINIX AM2\") or (locationTo = \"EQUINIX SG1\" && location = \"EQUINIX AM2\") or (location = \"EQUINIX SG1\" && locationTo = \"EQUINIX PA3\") or (locationTo = \"EQUINIX SG1\" && location = \"EQUINIX PA3\")"},
expect: []string{"(location = \"EQUINIX FR5\" AND locationTo = \"EQUINIX AM2\") OR (locationTo = \"EQUINIX FR5\" AND location = \"EQUINIX AM2\") OR (location = \"EQUINIX FR5\" AND locationTo = \"EQUINIX PA3\") OR (locationTo = \"EQUINIX FR5\" AND location = \"EQUINIX PA3\") OR (location = \"EQUINIX AM2\" AND locationTo = \"EQUINIX AM2\") OR (location = \"EQUINIX AM2\" AND locationTo = \"EQUINIX PA3\") OR (locationTo = \"EQUINIX AM2\" AND location = \"EQUINIX PA3\") OR (location = \"EQUINIX SG1\" AND locationTo = \"EQUINIX AM2\") OR (locationTo = \"EQUINIX SG1\" AND location = \"EQUINIX AM2\") OR (location = \"EQUINIX SG1\" AND locationTo = \"EQUINIX PA3\") OR (locationTo = \"EQUINIX SG1\" AND location = \"EQUINIX PA3\")"},
err: nil,
},
{
Expand Down
7 changes: 3 additions & 4 deletions internal/data_sources/filters/meilisearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,11 @@ func combineLocationPairs(locations, locationsTo []string) string {

for _, location := range locations {
for _, locationTo := range locationsTo {
result = append(result, fmt.Sprintf("(location = %s && locationTo = %s)", location, locationTo))
result = append(result, fmt.Sprintf("(location = %s AND locationTo = %s)", location, locationTo))
if location != locationTo {
result = append(result, fmt.Sprintf("(locationTo = %s && location = %s)", location, locationTo))
result = append(result, fmt.Sprintf("(locationTo = %s AND location = %s)", location, locationTo))
}
}
}

return strings.Join(result, " or ")
return strings.Join(result, " OR ")
}
4 changes: 2 additions & 2 deletions internal/data_sources/transport_products_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (d *transportProductsDataSource) Configure(_ context.Context, req datasourc
return
}

catalogClient, ok := req.ProviderData.(*meilisearch.Client)
clients, ok := req.ProviderData.(models.Clients)
if !ok {
resp.Diagnostics.AddError(
"Unexpected Data Source Configure Type",
Expand All @@ -161,7 +161,7 @@ func (d *transportProductsDataSource) Configure(_ context.Context, req datasourc
return
}

d.client = catalogClient
d.client = clients.CatalogClient
}

// Read refreshes the Terraform state with the latest data.
Expand Down