Skip to content

Commit

Permalink
Incorporate ARM team feedback into v2024-08-12-preview API version (#…
Browse files Browse the repository at this point in the history
…4014)

* remove unused OCM resource types

* plural resource name, camelCase

* add new singleton rest endpoints for openshiftversion and pwirolesets

* update swagger generator to reflect singleton endpoints

* generated swagger

* add version params for the new singleton endpoints

* make generate

* correct camelCase openshiftMinorVersion -> openShiftMinorVersion

* add where: clauses to CI suppressions

* correct typo, make generate

* update the example path params for new singleton endpoints

* populate name and type for new openshift rolesets and versions

* Update generated clients

* update unit tests for name and type addition to version and roleset responses

* resolve comments for installVersionGet usage in swagger

---------

Co-authored-by: Rajdeep Singh Chauhan <[email protected]>
Co-authored-by: Tanmay Satam <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2025
1 parent 354cc86 commit 52794b1
Show file tree
Hide file tree
Showing 128 changed files with 1,833 additions and 9,327 deletions.
12 changes: 6 additions & 6 deletions .sha256sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
b9e1c53e7b02da3eefc7ce684206aaf26bcdea5c57c185abad9c7c6922ba347a swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2020-04-30/redhatopenshift.json
16028ea68957d5444a0ac4799498f167e4fdf75bbbdafff1fb36d0bc826ce34f swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/preview/2021-09-01-preview/redhatopenshift.json
a92373b9b2f50ea02b8c21ca930d6809b9c25f90fb8b203c0f5e222e0031a80d swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2022-04-01/redhatopenshift.json
c392d570595aef3f96b1a0510c5fbf99760a3728e0a7826670cb84746d59a507 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2022-09-04/redhatopenshift.json
695273c782d580c2c0d549c16ad5694cdffc0829c95fe587212afcb79a1e3566 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-04-01/redhatopenshift.json
e9b88ecfecd9c3486341993612ade38fa6a4678f1ae06faa69513655682d39fb swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/preview/2023-07-01-preview/redhatopenshift.json
22761c2f004997e339355a93953538ccb8b9954c931cf5296c5108946556ff10 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-09-04/redhatopenshift.json
a04c231ccd66c1a092e3d8e3aad02c2a0880be7643b5c11b42069d39749b8999 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/redhatopenshift.json
56b12adca2f9fe98053716433a3d6383adeed7dea8f477a58f9f9fbd7178fd3d swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/preview/2024-08-12-preview/redhatopenshift.json
44fce1fe1594d844d3d4fdb9d5eda154cb0d9ee07473c76575d5e9758a072df2 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2022-09-04/redhatopenshift.json
79c1c757c2cc7f3a50662e2d251b70e611c450ba2a292e1d57fcfb58c57cebc6 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-04-01/redhatopenshift.json
22301f3c13b15bb77cb58e941e704456ac8deaf27b8e3a3f0ce3074c4718cc99 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/preview/2023-07-01-preview/redhatopenshift.json
a515cc5d9ac3dccc5cdbd90472b0f68e3721de3b378876e3b8bc354ed6aa7d26 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-09-04/redhatopenshift.json
873786c7873fc88ccb06eca47fc700a40c256e0fe70ee599ae5ecd8db952f138 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/stable/2023-11-22/redhatopenshift.json
0a16a500e743fa44314dd914212b44530ed23a8ca1e416181cab53d90935e8e7 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/preview/2024-08-12-preview/redhatopenshift.json
2 changes: 2 additions & 0 deletions cmd/aro/update_ocp_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func appendOpenShiftVersions(ocpVersions []api.OpenShiftVersion, installStreams
Enabled: true,
Default: isDefault,
},
Name: fullVersion,
Type: api.OpenShiftVersionsType,
})
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/aro/update_role_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func updatePlatformWorkloadIdentityRoleSetsInCosmosDB(ctx context.Context, dbPla
ID: dbPlatformWorkloadIdentityRoleSets.NewUUID(),
PlatformWorkloadIdentityRoleSet: &api.PlatformWorkloadIdentityRoleSet{
Properties: doc,
Name: doc.OpenShiftVersion,
Type: api.PlatformWorkloadIdentityRoleSetsType,
},
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/api/admin/openshiftversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type OpenShiftVersion struct {
// Name of the resource.
Name string `json:"name,omitempty"`

// The resource type.
Type string `json:"type,omitempty" mutable:"case"`

// The properties for the OpenShiftVersion resource.
Properties OpenShiftVersionProperties `json:"properties,omitempty"`
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/api/admin/openshiftversion_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{}
InstallerPullspec: v.Properties.InstallerPullspec,
Enabled: v.Properties.Enabled,
},
Name: v.Name,
Type: v.Type,
}

if out.Name == "" {
out.Name = v.Properties.Version
}

if out.Type == "" {
out.Type = api.OpenShiftVersionsType
}

return out
Expand Down Expand Up @@ -52,4 +62,6 @@ func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShi
out.Properties.InstallerPullspec = new.Properties.InstallerPullspec
out.Properties.OpenShiftPullspec = new.Properties.OpenShiftPullspec
out.Properties.Version = new.Properties.Version
out.Name = new.Properties.Version
out.Type = api.OpenShiftVersionsType
}
3 changes: 3 additions & 0 deletions pkg/api/admin/platformworkloadidentityroleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type PlatformWorkloadIdentityRoleSet struct {
// Name of the resource.
Name string `json:"name,omitempty" mutable:"case"`

// The resource type.
Type string `json:"type,omitempty" mutable:"case"`

// The properties for the PlatformWorkloadIdentityRoleSet resource.
Properties PlatformWorkloadIdentityRoleSetProperties `json:"properties,omitempty"`
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/admin/platformworkloadidentityroleset_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func (c platformWorkloadIdentityRoleSetConverter) ToExternal(s *api.PlatformWork
OpenShiftVersion: s.Properties.OpenShiftVersion,
PlatformWorkloadIdentityRoles: make([]PlatformWorkloadIdentityRole, 0, len(s.Properties.PlatformWorkloadIdentityRoles)),
},
Name: s.Name,
Type: s.Type,
}

for _, r := range s.Properties.PlatformWorkloadIdentityRoles {
Expand Down Expand Up @@ -76,4 +78,6 @@ func (c platformWorkloadIdentityRoleSetConverter) ToInternal(_new interface{}, o

out.Properties.PlatformWorkloadIdentityRoles = append(out.Properties.PlatformWorkloadIdentityRoles, role)
}
out.Name = new.Properties.OpenShiftVersion
out.Type = api.PlatformWorkloadIdentityRoleSetsType
}
2 changes: 2 additions & 0 deletions pkg/api/openshiftversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ type OpenShiftVersionProperties struct {
Enabled bool `json:"enabled,omitempty"`
Default bool `json:"default,omitempty"`
}

const OpenShiftVersionsType = "Microsoft.RedHatOpenShift/OpenShiftVersion"
2 changes: 1 addition & 1 deletion pkg/api/openshiftversiondocument_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func ExampleOpenShiftVersionDocument() *OpenShiftVersionDocument {
ID: "00000000-0000-0000-0000-000000000000",
OpenShiftVersion: &OpenShiftVersion{
ID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/resourceProviderNamespace/resourceType/resourceName",
Name: "default",
Name: "4.10.20",
Type: "Microsoft.RedHatOpenShift/OpenShiftVersion",
Properties: OpenShiftVersionProperties{
Version: "4.10.20",
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/platformworkloadidentityroleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ type SecretLocation struct {
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
}

const PlatformWorkloadIdentityRoleSetsType = "Microsoft.RedHatOpenShift/PlatformWorkloadIdentityRoleSet"
12 changes: 12 additions & 0 deletions pkg/api/v20240812preview/openshiftversion_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{}
Properties: OpenShiftVersionProperties{
Version: v.Properties.Version,
},
Name: v.Name,
Type: v.Type,
}

if out.Name == "" {
out.Name = v.Properties.Version
}

if out.Type == "" {
out.Type = api.OpenShiftVersionsType
}

return out
Expand All @@ -47,4 +57,6 @@ func (c openShiftVersionConverter) ToExternalList(vers []*api.OpenShiftVersion)
func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) {
new := _new.(*OpenShiftVersion)
out.Properties.Version = new.Properties.Version
out.Name = new.Properties.Version
out.Type = api.OpenShiftVersionsType
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func (c platformWorkloadIdentityRoleSetConverter) ToExternal(s *api.PlatformWork
OpenShiftVersion: s.Properties.OpenShiftVersion,
PlatformWorkloadIdentityRoles: make([]PlatformWorkloadIdentityRole, 0, len(s.Properties.PlatformWorkloadIdentityRoles)),
},
Name: s.Name,
Type: s.Type,
}

for _, r := range s.Properties.PlatformWorkloadIdentityRoles {
Expand Down Expand Up @@ -68,4 +70,6 @@ func (c platformWorkloadIdentityRoleSetConverter) ToInternal(_new interface{}, o
}
out.Properties.PlatformWorkloadIdentityRoles = append(out.Properties.PlatformWorkloadIdentityRoles, role)
}
out.Name = new.Properties.OpenShiftVersion
out.Type = api.PlatformWorkloadIdentityRoleSetsType
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 52794b1

Please sign in to comment.