Skip to content

Commit

Permalink
making it more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslaw-pieszka committed Jul 22, 2024
1 parent c07b62a commit d95bb7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions internal/provider/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ func (p *AWSTrialInputProvider) region() string {
if p.ProvisioningParameters.PlatformRegion != "" {
abstractRegion, found := p.PlatformRegionMapping[p.ProvisioningParameters.PlatformRegion]
if found {
return toAWSSpecific[abstractRegion]
return *toAWSSpecific[abstractRegion]
}
}
if p.ProvisioningParameters.Parameters.Region != nil && *p.ProvisioningParameters.Parameters.Region != "" {
return toAWSSpecific[*p.ProvisioningParameters.Parameters.Region]
return *toAWSSpecific[*p.ProvisioningParameters.Parameters.Region]
}
return DefaultAWSTrialRegion
}
12 changes: 6 additions & 6 deletions internal/provider/aws_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ var europeAWS = "eu-west-1"
var usAWS = "us-east-1"
var asiaAWS = "ap-southeast-1"

var toAWSSpecific = map[string]string{
string(broker.Europe): europeAWS,
string(broker.Us): usAWS,
string(broker.Asia): asiaAWS,
var toAWSSpecific = map[string]*string{
string(broker.Europe): &europeAWS,
string(broker.Us): &usAWS,
string(broker.Asia): &asiaAWS,
}

type (
Expand Down Expand Up @@ -262,13 +262,13 @@ func (p *AWSTrialInput) ApplyParameters(input *gqlschema.ClusterConfigInput, pp
if pp.PlatformRegion != "" {
abstractRegion, found := p.PlatformRegionMapping[pp.PlatformRegion]
if found {
r := toAWSSpecific[abstractRegion]
r := *toAWSSpecific[abstractRegion]
updateRegionWithZones(input, r)
}
}

if params.Region != nil && *params.Region != "" {
r := toAWSSpecific[*params.Region]
r := *toAWSSpecific[*params.Region]
updateRegionWithZones(input, r)
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ func (p *GCPTrialInputProvider) region() string {
if p.ProvisioningParameters.PlatformRegion != "" {
abstractRegion, found := p.PlatformRegionMapping[p.ProvisioningParameters.PlatformRegion]
if found {
return toGCPSpecific[abstractRegion]
return *toGCPSpecific[abstractRegion]
}
}

if p.ProvisioningParameters.Parameters.Region != nil && *p.ProvisioningParameters.Parameters.Region != "" {
return toGCPSpecific[*p.ProvisioningParameters.Parameters.Region]
return *toGCPSpecific[*p.ProvisioningParameters.Parameters.Region]
}

return DefaultGCPRegion
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/gcp_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ var europeGcp = "europe-west3"
var usGcp = "us-central1"
var asiaGcp = "asia-south1"

var toGCPSpecific = map[string]string{
string(broker.Europe): europeGcp,
string(broker.Us): usGcp,
string(broker.Asia): asiaGcp,
var toGCPSpecific = map[string]*string{
string(broker.Europe): &europeGcp,
string(broker.Us): &usGcp,
string(broker.Asia): &asiaGcp,
}

type (
Expand Down Expand Up @@ -128,13 +128,13 @@ func (p *GcpTrialInput) ApplyParameters(input *gqlschema.ClusterConfigInput, pp
if pp.PlatformRegion != "" {
abstractRegion, found := p.PlatformRegionMapping[pp.PlatformRegion]
if found {
region = toGCPSpecific[abstractRegion]
region = *toGCPSpecific[abstractRegion]
}
}

// if the user provides a region - use this one
if params.Region != nil && *params.Region != "" {
region = toGCPSpecific[*params.Region]
region = *toGCPSpecific[*params.Region]
}

// region is not empty - it means override the default one
Expand Down

0 comments on commit d95bb7d

Please sign in to comment.