Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor operations endpoint to always return all supported operations #4030

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
361 changes: 176 additions & 185 deletions pkg/api/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,189 +40,180 @@ type Display struct {
}

// Common operations defined which can be used within the registration of the APIs
var OperationResultsRead = Operation{
Name: "Microsoft.RedHatOpenShift/locations/operationresults/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "locations/operationresults",
Operation: "Read operation results",
},
Origin: "user,system",
}

var OperationStatusRead = Operation{
Name: "Microsoft.RedHatOpenShift/locations/operationsstatus/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "locations/operationsstatus",
Operation: "Read operations status",
},
Origin: "user,system",
}

var OperationRead = Operation{
Name: "Microsoft.RedHatOpenShift/operations/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "operations",
Operation: "Read operations",
},
Origin: "user,system",
}

var OperationOpenShiftClusterRead = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Read OpenShift cluster",
},
Origin: "user,system",
}

var OperationOpenShiftClusterWrite = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Write OpenShift cluster",
},
Origin: "user,system",
}

var OperationOpenShiftClusterDelete = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Delete OpenShift cluster",
},
Origin: "user,system",
}

var OperationOpenShiftClusterListCredentials = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listCredentials/action",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "List credentials of an OpenShift cluster",
},
Origin: "user,system",
}

var OperationOpenShiftClusterListAdminCredentials = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listAdminCredentials/action",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "List Admin Kubeconfig of an OpenShift cluster",
},
Origin: "user,system",
}

var OperationOpenShiftClusterGetDetectors = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/detectors/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Get OpenShift Cluster Detector",
},
Origin: "user,system",
}

var OperationListInstallVersions = Operation{
Name: "Microsoft.RedHatOpenShift/locations/listInstallVersions/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "listInstallVersions",
Operation: "Lists all OpenShift versions available to install in the specified location",
},
Origin: "user,system",
}

var OperationSyncSetsRead = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Read OpenShift cluster sync set",
},
Origin: "user,system",
}

var OperationSyncSetsWrite = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Write OpenShift cluster sync set",
},
Origin: "user,system",
}

var OperationSyncSetsDelete = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Delete OpenShift cluster sync set",
},
Origin: "user,system",
}

var OperationMachinePoolsRead = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Read OpenShift cluster machine pool",
},
Origin: "user,system",
}
var OperationMachinePoolsWrite = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Write OpenShift cluster machine pool",
},
Origin: "user,system",
}
var OperationMachinePoolsDelete = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Delete OpenShift cluster machine pool",
},
Origin: "user,system",
}

var OperationSyncIdentityProvidersRead = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Read OpenShift cluster sync identity provider",
},
Origin: "user,system",
}
var OperationSyncIdentityProvidersWrite = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Write OpenShift cluster sync identity provider",
},
Origin: "user,system",
}

var OperationSyncIdentityProvidersDelete = Operation{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Delete OpenShift cluster sync identity provider",
},
Origin: "user,system",
// NOTE: The set of operations specified in the response payload must not vary with each API version of the operations API.
// The Resource Provider service should always return all the operations that are supported across all the API versions of its resource types.
// https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/proxy-api-reference.md#exposing-available-operations
var AllOperations = []Operation{
{

Name: "Microsoft.RedHatOpenShift/locations/operationresults/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "locations/operationresults",
Operation: "Read operation results",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/locations/operationsstatus/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "locations/operationsstatus",
Operation: "Read operations status",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/operations/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "operations",
Operation: "Read operations",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Read OpenShift cluster",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Write OpenShift cluster",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Delete OpenShift cluster",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listCredentials/action",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "List credentials of an OpenShift cluster",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/listAdminCredentials/action",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "List Admin Kubeconfig of an OpenShift cluster",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/detectors/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openShiftClusters",
Operation: "Get OpenShift Cluster Detector",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/locations/openshiftVersions/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "openshiftVersions",
Operation: "Lists all OpenShift versions available to install in the specified location",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Read OpenShift cluster sync set",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Write OpenShift cluster sync set",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncSets",
Operation: "Delete OpenShift cluster sync set",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Read OpenShift cluster machine pool",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Write OpenShift cluster machine pool",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "machinePools",
Operation: "Delete OpenShift cluster machine pool",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/read",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Read OpenShift cluster sync identity provider",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/write",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Write OpenShift cluster sync identity provider",
},
Origin: "user,system",
},
{
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/delete",
Display: Display{
Provider: "Azure Red Hat OpenShift",
Resource: "syncIdentityProviders",
Operation: "Delete OpenShift cluster sync identity provider",
},
Origin: "user,system",
},
}
1 change: 0 additions & 1 deletion pkg/api/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ type Version struct {
OpenShiftVersionStaticValidator OpenShiftVersionStaticValidator
PlatformWorkloadIdentityRoleSetConverter PlatformWorkloadIdentityRoleSetConverter
PlatformWorkloadIdentityRoleSetStaticValidator PlatformWorkloadIdentityRoleSetStaticValidator
OperationList OperationList
SyncSetConverter SyncSetConverter
MachinePoolConverter MachinePoolConverter
SyncIdentityProviderConverter SyncIdentityProviderConverter
Expand Down
12 changes: 0 additions & 12 deletions pkg/api/v20191231preview/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,5 @@ func init() {
OpenShiftClusterConverter: openShiftClusterConverter{},
OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{},
OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{},
OperationList: api.OperationList{
Operations: []api.Operation{
api.OperationResultsRead,
api.OperationStatusRead,
api.OperationRead,
api.OperationOpenShiftClusterRead,
api.OperationOpenShiftClusterWrite,
api.OperationOpenShiftClusterDelete,
api.OperationOpenShiftClusterListCredentials,
api.OperationOpenShiftClusterGetDetectors,
},
},
}
}
Loading
Loading