Skip to content

Commit 0cbe9e8

Browse files
committed
Refactor operations endpoint to always return all supported operations
1 parent c4ed7d6 commit 0cbe9e8

File tree

14 files changed

+299
-403
lines changed

14 files changed

+299
-403
lines changed

pkg/api/operation.go

+176-185
Original file line numberDiff line numberDiff line change
@@ -40,189 +40,180 @@ 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",
49-
},
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",
59-
},
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",
69-
},
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",
79-
},
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",
89-
},
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",
99-
},
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",
109-
},
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",
119-
},
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",
129-
},
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",
139-
},
140-
Origin: "user,system",
141-
}
142-
143-
var OperationSyncSetsRead = Operation{
144-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/read",
145-
Display: Display{
146-
Provider: "Azure Red Hat OpenShift",
147-
Resource: "syncSets",
148-
Operation: "Read OpenShift cluster sync set",
149-
},
150-
Origin: "user,system",
151-
}
152-
153-
var OperationSyncSetsWrite = Operation{
154-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/write",
155-
Display: Display{
156-
Provider: "Azure Red Hat OpenShift",
157-
Resource: "syncSets",
158-
Operation: "Write OpenShift cluster sync set",
159-
},
160-
Origin: "user,system",
161-
}
162-
163-
var OperationSyncSetsDelete = Operation{
164-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/delete",
165-
Display: Display{
166-
Provider: "Azure Red Hat OpenShift",
167-
Resource: "syncSets",
168-
Operation: "Delete OpenShift cluster sync set",
169-
},
170-
Origin: "user,system",
171-
}
172-
173-
var OperationMachinePoolsRead = Operation{
174-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/read",
175-
Display: Display{
176-
Provider: "Azure Red Hat OpenShift",
177-
Resource: "machinePools",
178-
Operation: "Read OpenShift cluster machine pool",
179-
},
180-
Origin: "user,system",
181-
}
182-
var OperationMachinePoolsWrite = Operation{
183-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/write",
184-
Display: Display{
185-
Provider: "Azure Red Hat OpenShift",
186-
Resource: "machinePools",
187-
Operation: "Write OpenShift cluster machine pool",
188-
},
189-
Origin: "user,system",
190-
}
191-
var OperationMachinePoolsDelete = Operation{
192-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/delete",
193-
Display: Display{
194-
Provider: "Azure Red Hat OpenShift",
195-
Resource: "machinePools",
196-
Operation: "Delete OpenShift cluster machine pool",
197-
},
198-
Origin: "user,system",
199-
}
200-
201-
var OperationSyncIdentityProvidersRead = Operation{
202-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/read",
203-
Display: Display{
204-
Provider: "Azure Red Hat OpenShift",
205-
Resource: "syncIdentityProviders",
206-
Operation: "Read OpenShift cluster sync identity provider",
207-
},
208-
Origin: "user,system",
209-
}
210-
var OperationSyncIdentityProvidersWrite = Operation{
211-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/write",
212-
Display: Display{
213-
Provider: "Azure Red Hat OpenShift",
214-
Resource: "syncIdentityProviders",
215-
Operation: "Write OpenShift cluster sync identity provider",
216-
},
217-
Origin: "user,system",
218-
}
219-
220-
var OperationSyncIdentityProvidersDelete = Operation{
221-
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/delete",
222-
Display: Display{
223-
Provider: "Azure Red Hat OpenShift",
224-
Resource: "syncIdentityProviders",
225-
Operation: "Delete OpenShift cluster sync identity provider",
226-
},
227-
Origin: "user,system",
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+
49+
Name: "Microsoft.RedHatOpenShift/locations/operationresults/read",
50+
Display: Display{
51+
Provider: "Azure Red Hat OpenShift",
52+
Resource: "locations/operationresults",
53+
Operation: "Read operation results",
54+
},
55+
Origin: "user,system",
56+
},
57+
{
58+
Name: "Microsoft.RedHatOpenShift/locations/operationsstatus/read",
59+
Display: Display{
60+
Provider: "Azure Red Hat OpenShift",
61+
Resource: "locations/operationsstatus",
62+
Operation: "Read operations status",
63+
},
64+
Origin: "user,system",
65+
},
66+
{
67+
Name: "Microsoft.RedHatOpenShift/operations/read",
68+
Display: Display{
69+
Provider: "Azure Red Hat OpenShift",
70+
Resource: "operations",
71+
Operation: "Read operations",
72+
},
73+
Origin: "user,system",
74+
},
75+
{
76+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/read",
77+
Display: Display{
78+
Provider: "Azure Red Hat OpenShift",
79+
Resource: "openShiftClusters",
80+
Operation: "Read OpenShift cluster",
81+
},
82+
Origin: "user,system",
83+
},
84+
{
85+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/write",
86+
Display: Display{
87+
Provider: "Azure Red Hat OpenShift",
88+
Resource: "openShiftClusters",
89+
Operation: "Write OpenShift cluster",
90+
},
91+
Origin: "user,system",
92+
},
93+
{
94+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/delete",
95+
Display: Display{
96+
Provider: "Azure Red Hat OpenShift",
97+
Resource: "openShiftClusters",
98+
Operation: "Delete OpenShift cluster",
99+
},
100+
Origin: "user,system",
101+
},
102+
{
103+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listCredentials/action",
104+
Display: Display{
105+
Provider: "Azure Red Hat OpenShift",
106+
Resource: "openShiftClusters",
107+
Operation: "List credentials of an OpenShift cluster",
108+
},
109+
Origin: "user,system",
110+
},
111+
{
112+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listAdminCredentials/action",
113+
Display: Display{
114+
Provider: "Azure Red Hat OpenShift",
115+
Resource: "openShiftClusters",
116+
Operation: "List Admin Kubeconfig of an OpenShift cluster",
117+
},
118+
Origin: "user,system",
119+
},
120+
{
121+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/detectors/read",
122+
Display: Display{
123+
Provider: "Azure Red Hat OpenShift",
124+
Resource: "openShiftClusters",
125+
Operation: "Get OpenShift Cluster Detector",
126+
},
127+
Origin: "user,system",
128+
},
129+
{
130+
Name: "Microsoft.RedHatOpenShift/locations/openshiftVersions/read",
131+
Display: Display{
132+
Provider: "Azure Red Hat OpenShift",
133+
Resource: "openshiftVersions",
134+
Operation: "Lists all OpenShift versions available to install in the specified location",
135+
},
136+
Origin: "user,system",
137+
},
138+
{
139+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/read",
140+
Display: Display{
141+
Provider: "Azure Red Hat OpenShift",
142+
Resource: "syncSets",
143+
Operation: "Read OpenShift cluster sync set",
144+
},
145+
Origin: "user,system",
146+
},
147+
{
148+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/write",
149+
Display: Display{
150+
Provider: "Azure Red Hat OpenShift",
151+
Resource: "syncSets",
152+
Operation: "Write OpenShift cluster sync set",
153+
},
154+
Origin: "user,system",
155+
},
156+
{
157+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/delete",
158+
Display: Display{
159+
Provider: "Azure Red Hat OpenShift",
160+
Resource: "syncSets",
161+
Operation: "Delete OpenShift cluster sync set",
162+
},
163+
Origin: "user,system",
164+
},
165+
{
166+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/read",
167+
Display: Display{
168+
Provider: "Azure Red Hat OpenShift",
169+
Resource: "machinePools",
170+
Operation: "Read OpenShift cluster machine pool",
171+
},
172+
Origin: "user,system",
173+
},
174+
{
175+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/write",
176+
Display: Display{
177+
Provider: "Azure Red Hat OpenShift",
178+
Resource: "machinePools",
179+
Operation: "Write OpenShift cluster machine pool",
180+
},
181+
Origin: "user,system",
182+
},
183+
{
184+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/delete",
185+
Display: Display{
186+
Provider: "Azure Red Hat OpenShift",
187+
Resource: "machinePools",
188+
Operation: "Delete OpenShift cluster machine pool",
189+
},
190+
Origin: "user,system",
191+
},
192+
{
193+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/read",
194+
Display: Display{
195+
Provider: "Azure Red Hat OpenShift",
196+
Resource: "syncIdentityProviders",
197+
Operation: "Read OpenShift cluster sync identity provider",
198+
},
199+
Origin: "user,system",
200+
},
201+
{
202+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/write",
203+
Display: Display{
204+
Provider: "Azure Red Hat OpenShift",
205+
Resource: "syncIdentityProviders",
206+
Operation: "Write OpenShift cluster sync identity provider",
207+
},
208+
Origin: "user,system",
209+
},
210+
{
211+
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/delete",
212+
Display: Display{
213+
Provider: "Azure Red Hat OpenShift",
214+
Resource: "syncIdentityProviders",
215+
Operation: "Delete OpenShift cluster sync identity provider",
216+
},
217+
Origin: "user,system",
218+
},
228219
}

pkg/api/register.go

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ type Version struct {
9191
OpenShiftVersionStaticValidator OpenShiftVersionStaticValidator
9292
PlatformWorkloadIdentityRoleSetConverter PlatformWorkloadIdentityRoleSetConverter
9393
PlatformWorkloadIdentityRoleSetStaticValidator PlatformWorkloadIdentityRoleSetStaticValidator
94-
OperationList OperationList
9594
SyncSetConverter SyncSetConverter
9695
MachinePoolConverter MachinePoolConverter
9796
SyncIdentityProviderConverter SyncIdentityProviderConverter

pkg/api/v20191231preview/register.go

-12
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
}

0 commit comments

Comments
 (0)