Skip to content

Commit

Permalink
fix typos, use semver
Browse files Browse the repository at this point in the history
  • Loading branch information
cadenmarchese committed May 30, 2024
1 parent 1da7fb8 commit 0c47ee7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/api/admin/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ type PlatformWorkloadIdentityProfile struct {
PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty"`
}

// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to
// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to
type UpgradeableTo string

// PlatformWorkloadIdentity stores information representing a single workload identity.
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ type PlatformWorkloadIdentityProfile struct {
PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty"`
}

// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to
// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to
type UpgradeableTo string

// PlatformWorkloadIdentity stores information representing a single workload identity.
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v20240812preview/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ type PlatformWorkloadIdentityProfile struct {
PlatformWorkloadIdentities []PlatformWorkloadIdentity `json:"platformWorkloadIdentities,omitempty" mutable:"true"`
}

// UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to
// UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to
type UpgradeableTo string

// PlatformWorkloadIdentity stores information representing a single workload identity.
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/v20240812preview/openshiftcluster_validatestatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"net"
"net/http"
"net/url"
"regexp"
"strings"

azcorearm "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/coreos/go-semver/semver"

"github.com/Azure/ARO-RP/pkg/api"
"github.com/Azure/ARO-RP/pkg/api/util/immutable"
Expand Down Expand Up @@ -445,9 +445,9 @@ func (sv openShiftClusterStaticValidator) validatePlatformWorkloadIdentityProfil
}

if pwip.UpgradeableTo != nil {
matches, err := regexp.MatchString(`^4\.[0-9]{2}\.`, string(*pwip.UpgradeableTo))
if !matches || err != nil {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, fmt.Sprintf("%s.UpgradeableTo[%v]", path, *pwip.UpgradeableTo), "UpgradeableTo must be a valid OpenShift version.")
_, err := semver.NewVersion(string(*pwip.UpgradeableTo))
if err != nil {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, fmt.Sprintf("%s.UpgradeableTo[%v]", path, *pwip.UpgradeableTo), "UpgradeableTo must be a valid OpenShift version in the format 'x.y.z'.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ func TestOpenShiftClusterStaticValidateDelta(t *testing.T) {

func TestOpenShiftClusterStaticValidatePlatformWorkloadIdentityProfile(t *testing.T) {
validUpgradeableToValue := UpgradeableTo("4.14.29")
invalidUpgradeableToValue := UpgradeableTo("16.107.90")
invalidUpgradeableToValue := UpgradeableTo("16.107.invalid")

createTests := []*validateTest{
{
Expand Down Expand Up @@ -1345,7 +1345,7 @@ func TestOpenShiftClusterStaticValidatePlatformWorkloadIdentityProfile(t *testin
UpgradeableTo: &invalidUpgradeableToValue,
}
},
wantErr: `400: InvalidParameter: properties.platformWorkloadIdentityProfile.UpgradeableTo[16.107.90]: UpgradeableTo must be a valid OpenShift version.`,
wantErr: `400: InvalidParameter: properties.platformWorkloadIdentityProfile.UpgradeableTo[16.107.invalid]: UpgradeableTo must be a valid OpenShift version in the format 'x.y.z'.`,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ def __init__(
class PlatformWorkloadIdentityProfile(msrest.serialization.Model):
"""PlatformWorkloadIdentityProfile encapsulates all information that is specific to workload identity clusters.
:ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy
:ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity
cluster can be upgraded to.
:vartype upgradeable_to: str
:ivar platform_workload_identities:
Expand All @@ -1321,7 +1321,7 @@ def __init__(
**kwargs
):
"""
:keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy
:keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity
cluster can be upgraded to.
:paramtype upgradeable_to: str
:keyword platform_workload_identities:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ def __init__(
class PlatformWorkloadIdentityProfile(msrest.serialization.Model):
"""PlatformWorkloadIdentityProfile encapsulates all information that is specific to workload identity clusters.
:ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy
:ivar upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity
cluster can be upgraded to.
:vartype upgradeable_to: str
:ivar platform_workload_identities:
Expand All @@ -1433,7 +1433,7 @@ def __init__(
**kwargs
):
"""
:keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload idetntiy
:keyword upgradeable_to: UpgradeableTo stores a single OpenShift version a workload identity
cluster can be upgraded to.
:paramtype upgradeable_to: str
:keyword platform_workload_identities:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2607,7 +2607,7 @@
}
},
"UpgradeableTo": {
"description": "UpgradeableTo stores a single OpenShift version a workload idetntiy cluster can be upgraded to",
"description": "UpgradeableTo stores a single OpenShift version a workload identity cluster can be upgraded to",
"type": "string"
},
"UserAssignedIdentities": {
Expand Down

0 comments on commit 0c47ee7

Please sign in to comment.