Skip to content

Commit ff0f3d1

Browse files
authored
Merge pull request #4030 from Azure/bvesel/fix-operations-endpoint
Refactor operations endpoint to always return all supported operations
2 parents 756cbfd + 0a0fdb9 commit ff0f3d1

File tree

14 files changed

+195
-251
lines changed

14 files changed

+195
-251
lines changed

pkg/api/operation.go

Lines changed: 92 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -40,112 +40,107 @@ type Display struct {
4040
}
4141

4242
// Common operations defined which can be used within the registration of the APIs
43-
var OperationResultsRead = Operation{
44-
Name: "Microsoft.RedHatOpenShift/locations/operationresults/read",
45-
Display: Display{
46-
Provider: "Azure Red Hat OpenShift",
47-
Resource: "locations/operationresults",
48-
Operation: "Read operation results",
43+
// NOTE: The set of operations specified in the response payload must not vary with each API version of the operations API.
44+
// The Resource Provider service should always return all the operations that are supported across all the API versions of its resource types.
45+
// https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/proxy-api-reference.md#exposing-available-operations
46+
var AllOperations = []Operation{
47+
{
48+
Name: "Microsoft.RedHatOpenShift/locations/operationresults/read",
49+
Display: Display{
50+
Provider: "Azure Red Hat OpenShift",
51+
Resource: "locations/operationresults",
52+
Operation: "Read operation results",
53+
},
54+
Origin: "user,system",
4955
},
50-
Origin: "user,system",
51-
}
52-
53-
var OperationStatusRead = Operation{
54-
Name: "Microsoft.RedHatOpenShift/locations/operationsstatus/read",
55-
Display: Display{
56-
Provider: "Azure Red Hat OpenShift",
57-
Resource: "locations/operationsstatus",
58-
Operation: "Read operations status",
56+
{
57+
Name: "Microsoft.RedHatOpenShift/locations/operationsstatus/read",
58+
Display: Display{
59+
Provider: "Azure Red Hat OpenShift",
60+
Resource: "locations/operationsstatus",
61+
Operation: "Read operations status",
62+
},
63+
Origin: "user,system",
5964
},
60-
Origin: "user,system",
61-
}
62-
63-
var OperationRead = Operation{
64-
Name: "Microsoft.RedHatOpenShift/operations/read",
65-
Display: Display{
66-
Provider: "Azure Red Hat OpenShift",
67-
Resource: "operations",
68-
Operation: "Read operations",
65+
{
66+
Name: "Microsoft.RedHatOpenShift/operations/read",
67+
Display: Display{
68+
Provider: "Azure Red Hat OpenShift",
69+
Resource: "operations",
70+
Operation: "Read operations",
71+
},
72+
Origin: "user,system",
6973
},
70-
Origin: "user,system",
71-
}
72-
73-
var OperationOpenShiftClusterRead = Operation{
74-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/read",
75-
Display: Display{
76-
Provider: "Azure Red Hat OpenShift",
77-
Resource: "openShiftClusters",
78-
Operation: "Read OpenShift cluster",
74+
{
75+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/read",
76+
Display: Display{
77+
Provider: "Azure Red Hat OpenShift",
78+
Resource: "openShiftClusters",
79+
Operation: "Read OpenShift cluster",
80+
},
81+
Origin: "user,system",
7982
},
80-
Origin: "user,system",
81-
}
82-
83-
var OperationOpenShiftClusterWrite = Operation{
84-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/write",
85-
Display: Display{
86-
Provider: "Azure Red Hat OpenShift",
87-
Resource: "openShiftClusters",
88-
Operation: "Write OpenShift cluster",
83+
{
84+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/write",
85+
Display: Display{
86+
Provider: "Azure Red Hat OpenShift",
87+
Resource: "openShiftClusters",
88+
Operation: "Write OpenShift cluster",
89+
},
90+
Origin: "user,system",
8991
},
90-
Origin: "user,system",
91-
}
92-
93-
var OperationOpenShiftClusterDelete = Operation{
94-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/delete",
95-
Display: Display{
96-
Provider: "Azure Red Hat OpenShift",
97-
Resource: "openShiftClusters",
98-
Operation: "Delete OpenShift cluster",
92+
{
93+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/delete",
94+
Display: Display{
95+
Provider: "Azure Red Hat OpenShift",
96+
Resource: "openShiftClusters",
97+
Operation: "Delete OpenShift cluster",
98+
},
99+
Origin: "user,system",
99100
},
100-
Origin: "user,system",
101-
}
102-
103-
var OperationOpenShiftClusterListCredentials = Operation{
104-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listCredentials/action",
105-
Display: Display{
106-
Provider: "Azure Red Hat OpenShift",
107-
Resource: "openShiftClusters",
108-
Operation: "List credentials of an OpenShift cluster",
101+
{
102+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listCredentials/action",
103+
Display: Display{
104+
Provider: "Azure Red Hat OpenShift",
105+
Resource: "openShiftClusters",
106+
Operation: "List credentials of an OpenShift cluster",
107+
},
108+
Origin: "user,system",
109109
},
110-
Origin: "user,system",
111-
}
112-
113-
var OperationOpenShiftClusterListAdminCredentials = Operation{
114-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listAdminCredentials/action",
115-
Display: Display{
116-
Provider: "Azure Red Hat OpenShift",
117-
Resource: "openShiftClusters",
118-
Operation: "List Admin Kubeconfig of an OpenShift cluster",
110+
{
111+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listAdminCredentials/action",
112+
Display: Display{
113+
Provider: "Azure Red Hat OpenShift",
114+
Resource: "openShiftClusters",
115+
Operation: "List Admin Kubeconfig of an OpenShift cluster",
116+
},
117+
Origin: "user,system",
119118
},
120-
Origin: "user,system",
121-
}
122-
123-
var OperationOpenShiftClusterGetDetectors = Operation{
124-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/detectors/read",
125-
Display: Display{
126-
Provider: "Azure Red Hat OpenShift",
127-
Resource: "openShiftClusters",
128-
Operation: "Get OpenShift Cluster Detector",
119+
{
120+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/detectors/read",
121+
Display: Display{
122+
Provider: "Azure Red Hat OpenShift",
123+
Resource: "openShiftClusters",
124+
Operation: "Get OpenShift Cluster Detector",
125+
},
126+
Origin: "user,system",
129127
},
130-
Origin: "user,system",
131-
}
132-
133-
var OperationListInstallVersions = Operation{
134-
Name: "Microsoft.RedHatOpenShift/locations/listInstallVersions/read",
135-
Display: Display{
136-
Provider: "Azure Red Hat OpenShift",
137-
Resource: "listInstallVersions",
138-
Operation: "Lists all OpenShift versions available to install in the specified location",
128+
{
129+
Name: "Microsoft.RedHatOpenShift/locations/listPlatformWorkloadIdentityRoleSets/read",
130+
Display: Display{
131+
Provider: "Azure Red Hat OpenShift",
132+
Resource: "listPlatformWorkloadIdentityRoleSets",
133+
Operation: "Lists all PlatformWorkloadIdentityRoleSets available in the specified location",
134+
},
135+
Origin: "user,system",
139136
},
140-
Origin: "user,system",
141-
}
142-
143-
var OperationListPlatformWorkloadIdentityRoleSets = Operation{
144-
Name: "Microsoft.RedHatOpenShift/locations/listPlatformWorkloadIdentityRoleSets/read",
145-
Display: Display{
146-
Provider: "Azure Red Hat OpenShift",
147-
Resource: "listPlatformWorkloadIdentityRoleSets",
148-
Operation: "Lists all PlatformWorkloadIdentityRoleSets available in the specified location",
137+
{
138+
Name: "Microsoft.RedHatOpenShift/locations/openshiftVersions/read",
139+
Display: Display{
140+
Provider: "Azure Red Hat OpenShift",
141+
Resource: "openshiftVersions",
142+
Operation: "Lists all OpenShift versions available to install in the specified location",
143+
},
144+
Origin: "user,system",
149145
},
150-
Origin: "user,system",
151146
}

pkg/api/v20191231preview/register.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,5 @@ func init() {
2020
OpenShiftClusterConverter: openShiftClusterConverter{},
2121
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
23-
OperationList: api.OperationList{
24-
Operations: []api.Operation{
25-
api.OperationResultsRead,
26-
api.OperationStatusRead,
27-
api.OperationRead,
28-
api.OperationOpenShiftClusterRead,
29-
api.OperationOpenShiftClusterWrite,
30-
api.OperationOpenShiftClusterDelete,
31-
api.OperationOpenShiftClusterListCredentials,
32-
api.OperationOpenShiftClusterGetDetectors,
33-
},
34-
},
3523
}
3624
}

pkg/api/v20200430/register.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,5 @@ func init() {
2020
OpenShiftClusterConverter: openShiftClusterConverter{},
2121
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
23-
OperationList: api.OperationList{
24-
Operations: []api.Operation{
25-
api.OperationResultsRead,
26-
api.OperationStatusRead,
27-
api.OperationRead,
28-
api.OperationOpenShiftClusterRead,
29-
api.OperationOpenShiftClusterWrite,
30-
api.OperationOpenShiftClusterDelete,
31-
api.OperationOpenShiftClusterListCredentials,
32-
api.OperationOpenShiftClusterGetDetectors,
33-
},
34-
},
3523
}
3624
}

pkg/api/v20210901preview/register.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,5 @@ func init() {
2121
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
24-
OperationList: api.OperationList{
25-
Operations: []api.Operation{
26-
api.OperationResultsRead,
27-
api.OperationStatusRead,
28-
api.OperationRead,
29-
api.OperationOpenShiftClusterRead,
30-
api.OperationOpenShiftClusterWrite,
31-
api.OperationOpenShiftClusterDelete,
32-
api.OperationOpenShiftClusterListCredentials,
33-
api.OperationOpenShiftClusterListAdminCredentials,
34-
api.OperationOpenShiftClusterGetDetectors,
35-
},
36-
},
3724
}
3825
}

pkg/api/v20220401/register.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,5 @@ func init() {
2121
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
24-
OperationList: api.OperationList{
25-
Operations: []api.Operation{
26-
api.OperationResultsRead,
27-
api.OperationStatusRead,
28-
api.OperationRead,
29-
api.OperationOpenShiftClusterRead,
30-
api.OperationOpenShiftClusterWrite,
31-
api.OperationOpenShiftClusterDelete,
32-
api.OperationOpenShiftClusterListCredentials,
33-
api.OperationOpenShiftClusterListAdminCredentials,
34-
api.OperationOpenShiftClusterGetDetectors,
35-
},
36-
},
3724
}
3825
}

pkg/api/v20220904/register.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,5 @@ func init() {
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
2424
OpenShiftVersionConverter: openShiftVersionConverter{},
25-
OperationList: api.OperationList{
26-
Operations: []api.Operation{
27-
api.OperationResultsRead,
28-
api.OperationStatusRead,
29-
api.OperationRead,
30-
api.OperationOpenShiftClusterRead,
31-
api.OperationOpenShiftClusterWrite,
32-
api.OperationOpenShiftClusterDelete,
33-
api.OperationOpenShiftClusterListCredentials,
34-
api.OperationOpenShiftClusterListAdminCredentials,
35-
api.OperationListInstallVersions,
36-
api.OperationOpenShiftClusterGetDetectors,
37-
},
38-
},
3925
}
4026
}

pkg/api/v20230401/register.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,5 @@ func init() {
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
2424
OpenShiftVersionConverter: openShiftVersionConverter{},
25-
OperationList: api.OperationList{
26-
Operations: []api.Operation{
27-
api.OperationResultsRead,
28-
api.OperationStatusRead,
29-
api.OperationRead,
30-
api.OperationOpenShiftClusterRead,
31-
api.OperationOpenShiftClusterWrite,
32-
api.OperationOpenShiftClusterDelete,
33-
api.OperationOpenShiftClusterListCredentials,
34-
api.OperationOpenShiftClusterListAdminCredentials,
35-
api.OperationListInstallVersions,
36-
api.OperationOpenShiftClusterGetDetectors,
37-
},
38-
},
3925
}
4026
}

pkg/api/v20230701preview/register.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,5 @@ func init() {
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
2424
OpenShiftVersionConverter: openShiftVersionConverter{},
25-
OperationList: api.OperationList{
26-
Operations: []api.Operation{
27-
api.OperationResultsRead,
28-
api.OperationStatusRead,
29-
api.OperationRead,
30-
api.OperationOpenShiftClusterRead,
31-
api.OperationOpenShiftClusterWrite,
32-
api.OperationOpenShiftClusterDelete,
33-
api.OperationOpenShiftClusterListCredentials,
34-
api.OperationOpenShiftClusterListAdminCredentials,
35-
api.OperationListInstallVersions,
36-
api.OperationOpenShiftClusterGetDetectors,
37-
},
38-
},
3925
}
4026
}

pkg/api/v20230904/register.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,5 @@ func init() {
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
2424
OpenShiftVersionConverter: openShiftVersionConverter{},
25-
OperationList: api.OperationList{
26-
Operations: []api.Operation{
27-
api.OperationResultsRead,
28-
api.OperationStatusRead,
29-
api.OperationRead,
30-
api.OperationOpenShiftClusterRead,
31-
api.OperationOpenShiftClusterWrite,
32-
api.OperationOpenShiftClusterDelete,
33-
api.OperationOpenShiftClusterListCredentials,
34-
api.OperationOpenShiftClusterListAdminCredentials,
35-
api.OperationListInstallVersions,
36-
api.OperationOpenShiftClusterGetDetectors,
37-
},
38-
},
3925
}
4026
}

pkg/api/v20231122/register.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,5 @@ func init() {
2222
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
2323
OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{},
2424
OpenShiftVersionConverter: openShiftVersionConverter{},
25-
OperationList: api.OperationList{
26-
Operations: []api.Operation{
27-
api.OperationResultsRead,
28-
api.OperationStatusRead,
29-
api.OperationRead,
30-
api.OperationOpenShiftClusterRead,
31-
api.OperationOpenShiftClusterWrite,
32-
api.OperationOpenShiftClusterDelete,
33-
api.OperationOpenShiftClusterListCredentials,
34-
api.OperationOpenShiftClusterListAdminCredentials,
35-
api.OperationListInstallVersions,
36-
api.OperationOpenShiftClusterGetDetectors,
37-
},
38-
},
3925
}
4026
}

0 commit comments

Comments
 (0)