Skip to content

Commit

Permalink
Update query param for GLP
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-hpe committed Dec 11, 2024
1 parent d5e4f5e commit e598eb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion internal/acceptance_test/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func getHeadersAndQueryParamsAndIAMVersion() (map[string]string, map[string]stri
constants.LocationKey: os.Getenv("HPEGL_VMAAS_LOCATION"),
}
if iamVersion == constants.IamGlp {
queryParam[constants.WorkspaceKey] = os.Getenv("HPEGL_VMAAS_SPACE_NAME")
queryParam[constants.TenantIDKey] = os.Getenv("HPEGL_VMAAS_SPACE_NAME")
} else {
queryParam[constants.SpaceKey] = os.Getenv("HPEGL_VMAAS_SPACE_NAME")
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ func (i InitialiseClient) NewClient(r *schema.ResourceData) (interface{}, error)
queryParam := map[string]string{
constants.LocationKey: vmaasProviderSettings[constants.LOCATION].(string),
}
tenantID := ""
if iamVersion == constants.IamGlp {
queryParam[constants.WorkspaceKey] = vmaasProviderSettings[constants.SPACENAME].(string)
queryParam[constants.TenantIDKey] = vmaasProviderSettings[constants.SPACENAME].(string)
tenantID = vmaasProviderSettings[constants.SPACENAME].(string)
} else {
queryParam[constants.SpaceKey] = vmaasProviderSettings[constants.SPACENAME].(string)
tenantID = r.Get(constants.TenantID).(string)
}

// Create broker client
brokerHeaders := getHeaders()
tenantID := r.Get(constants.TenantID).(string)
brokerHeaders["X-Tenant-ID"] = tenantID
// We don't add default query params to broker client
brokerCfgForAPIClient := api_client.Configuration{
Expand Down
16 changes: 8 additions & 8 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const (
IamGlcs string = "glcs"
TenantID string = "tenant_id"

LOCATION = "location"
SPACENAME = "space_name"
APIURL = "api_url"
BROKERRURL = "broker_url"
INSECURE = "allow_insecure"
SpaceKey = "space"
WorkspaceKey = "workspaceID"
LocationKey = "location"
LOCATION = "location"
SPACENAME = "space_name"
APIURL = "api_url"
BROKERRURL = "broker_url"
INSECURE = "allow_insecure"
SpaceKey = "space"
TenantIDKey = "tenantID"
LocationKey = "location"

MockIAMKey = "TF_ACC_MOCK_IAM"
CmpSubjectKey = "TF_ACC_CMP_SUBJECT"
Expand Down

0 comments on commit e598eb5

Please sign in to comment.