Skip to content

Commit

Permalink
Add missing OpenShift Resources in authorization.openshift.io apiGroup
Browse files Browse the repository at this point in the history
Add DSL support for the following resources:
- ResourceAccessReview : `client.resourceAccessReviews()`
- LocalSubjectAccessReview : `client.localSubjectAccessReviews()`
- ClusterRole : `client.cluserRoles()`
- LocalResourceAccessReview : `client.localResourceAccessReviews()`
- SubjectRulesReview : `client.subjectRulesReviews()`
- SelfSubjectRulesReview : `client.selfSubjectRulesReviews()`
- RoleBindingRestrictions: `client.roleBindingRestrictions()`

Related to #2949
  • Loading branch information
rohanKanojia authored and manusa committed May 20, 2021
1 parent 019c9ee commit ed08377
Show file tree
Hide file tree
Showing 17 changed files with 1,107 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#### Dependency Upgrade

#### New Features
* Fix #3133: Add DSL Support for `authorization.openshift.io/v1` resources in OpenShiftClient

### 5.4.0 (2021-05-19)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ type Schema struct {
OpenshiftRoleBinding authapi.RoleBinding
OpenshiftRoleBindingList authapi.RoleBindingList
OpenshiftRoleBindingRestriction authapi.RoleBindingRestriction
OpenShiftRoleBindingRestrictionList authapi.RoleBindingRestrictionList
OpenshiftRoleBindingRestrictionSpec authapi.RoleBindingRestrictionSpec
LocalSubjectAccessReview authapi.LocalSubjectAccessReview
LocalResourceAccessReview authapi.LocalResourceAccessReview
ResourceAccessReview authapi.ResourceAccessReview
ResourceAccessReviewResponse authapi.ResourceAccessReviewResponse
SubjectAccessReview authapi.SubjectAccessReview
SubjectAccessReviewResponse authapi.SubjectAccessReviewResponse
SubjectRulesReview authapi.SubjectRulesReview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@
import io.fabric8.openshift.api.model.RangeAllocation;
import io.fabric8.openshift.api.model.RangeAllocationList;
import io.fabric8.openshift.api.model.ResourceAccessReview;
import io.fabric8.openshift.api.model.ResourceAccessReviewResponse;
import io.fabric8.openshift.api.model.Role;
import io.fabric8.openshift.api.model.RoleBinding;
import io.fabric8.openshift.api.model.RoleBindingList;
import io.fabric8.openshift.api.model.RoleBindingRestriction;
import io.fabric8.openshift.api.model.RoleBindingRestrictionList;
import io.fabric8.openshift.api.model.RoleBindingRestrictionSpec;
import io.fabric8.openshift.api.model.RoleList;
import io.fabric8.openshift.api.model.Route;
Expand Down Expand Up @@ -206,6 +208,7 @@
"OAuthClientList",
"OAuthList",
"ObjectMeta",
"OpenShiftRoleBindingRestrictionList",
"OpenshiftClusterRole",
"OpenshiftClusterRoleBinding",
"OpenshiftClusterRoleBindingList",
Expand Down Expand Up @@ -233,6 +236,7 @@
"RangeAllocation",
"RangeAllocationList",
"ResourceAccessReview",
"ResourceAccessReviewResponse",
"RootPaths",
"Route",
"RouteList",
Expand Down Expand Up @@ -416,6 +420,8 @@ public class KubeSchema {
private OAuthList oAuthList;
@JsonProperty("ObjectMeta")
private io.fabric8.kubernetes.api.model.ObjectMeta objectMeta;
@JsonProperty("OpenShiftRoleBindingRestrictionList")
private RoleBindingRestrictionList openShiftRoleBindingRestrictionList;
@JsonProperty("OpenshiftClusterRole")
private ClusterRole openshiftClusterRole;
@JsonProperty("OpenshiftClusterRoleBinding")
Expand Down Expand Up @@ -470,6 +476,8 @@ public class KubeSchema {
private RangeAllocationList rangeAllocationList;
@JsonProperty("ResourceAccessReview")
private ResourceAccessReview resourceAccessReview;
@JsonProperty("ResourceAccessReviewResponse")
private ResourceAccessReviewResponse resourceAccessReviewResponse;
@JsonProperty("RootPaths")
private RootPaths rootPaths;
@JsonProperty("Route")
Expand Down Expand Up @@ -597,6 +605,7 @@ public KubeSchema() {
* @param openshiftClusterRoleScopeRestriction
* @param project
* @param oAuth
* @param openShiftRoleBindingRestrictionList
* @param clusterOperator
* @param podSecurityPolicyReview
* @param authenticationList
Expand All @@ -615,6 +624,7 @@ public KubeSchema() {
* @param oAuthClientAuthorization
* @param localResourceAccessReview
* @param imageStreamTagList
* @param resourceAccessReviewResponse
* @param openshiftRoleList
* @param dNSZone
* @param buildConfigList
Expand Down Expand Up @@ -651,7 +661,7 @@ public KubeSchema() {
* @param imageTag
* @param user
*/
public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, APIServer aPIServer, APIServerList aPIServerList, AggregationRule aggregationRule, AppliedClusterResourceQuota appliedClusterResourceQuota, AppliedClusterResourceQuotaList appliedClusterResourceQuotaList, Authentication authentication, AuthenticationList authenticationList, BaseKubernetesList baseKubernetesList, BuildConfigList buildConfigList, BuildList buildList, BuildRequest buildRequest, ClusterNetwork clusterNetwork, ClusterNetworkList clusterNetworkList, ClusterOperator clusterOperator, ClusterOperatorList clusterOperatorList, ClusterResourceQuota clusterResourceQuota, ClusterResourceQuotaList clusterResourceQuotaList, ClusterVersion clusterVersion, ClusterVersionList clusterVersionList, Config config, ConfigMapFileReference configMapFileReference, Console console, ConsoleList consoleList, CreateOptions createOptions, DNS dns, DNSList dNSList, DNSZone dNSZone, DeleteOptions deleteOptions, DeploymentConfig deploymentConfig, DeploymentConfigList deploymentConfigList, EgressNetworkPolicy egressNetworkPolicy, EgressNetworkPolicyList egressNetworkPolicyList, FeatureGate featureGate, FeatureGateList featureGateList, GetOptions getOptions, Group group, GroupList groupList, Identity identity, IdentityList identityList, ImageList imageList, ImageStreamImage imageStreamImage, ImageStreamImport imageStreamImport, ImageStreamList imageStreamList, ImageStreamMapping imageStreamMapping, ImageStreamTagList imageStreamTagList, ImageTag imageTag, ImageTagList imageTagList, Info info, Infrastructure infrastructure, InfrastructureList infrastructureList, Ingress ingress, IngressList ingressList, ListOptions listOptions, LocalResourceAccessReview localResourceAccessReview, LocalSubjectAccessReview localSubjectAccessReview, NetNamespace netNamespace, NetNamespaceList netNamespaceList, Network network, NetworkList networkList, OAuth oAuth, OAuthAccessToken oAuthAccessToken, OAuthAccessTokenList oAuthAccessTokenList, OAuthAuthorizeToken oAuthAuthorizeToken, OAuthAuthorizeTokenList oAuthAuthorizeTokenList, OAuthClient oAuthClient, OAuthClientAuthorization oAuthClientAuthorization, OAuthClientAuthorizationList oAuthClientAuthorizationList, OAuthClientList oAuthClientList, OAuthList oAuthList, io.fabric8.kubernetes.api.model.ObjectMeta objectMeta, ClusterRole openshiftClusterRole, ClusterRoleBinding openshiftClusterRoleBinding, ClusterRoleBindingList openshiftClusterRoleBindingList, ClusterRoleList openshiftClusterRoleList, ClusterRoleScopeRestriction openshiftClusterRoleScopeRestriction, Role openshiftRole, RoleBinding openshiftRoleBinding, RoleBindingList openshiftRoleBindingList, RoleBindingRestriction openshiftRoleBindingRestriction, RoleBindingRestrictionSpec openshiftRoleBindingRestrictionSpec, RoleList openshiftRoleList, OperatorHub operatorHub, OperatorHubList operatorHubList, Patch patch, PatchOptions patchOptions, PodSecurityPolicyReview podSecurityPolicyReview, PodSecurityPolicySelfSubjectReview podSecurityPolicySelfSubjectReview, PodSecurityPolicySubjectReview podSecurityPolicySubjectReview, Project project, ProjectList projectList, ProjectRequest projectRequest, Proxy proxy, ProxyList proxyList, Quantity quantity, RangeAllocation rangeAllocation, RangeAllocationList rangeAllocationList, ResourceAccessReview resourceAccessReview, RootPaths rootPaths, Route route, RouteList routeList, Scheduler scheduler, SchedulerList schedulerList, SecretNameReference secretNameReference, SecurityContextConstraints securityContextConstraints, SecurityContextConstraintsList securityContextConstraintsList, SelfSubjectRulesReview selfSubjectRulesReview, Status status, SubjectAccessReview subjectAccessReview, SubjectAccessReviewResponse subjectAccessReviewResponse, SubjectRulesReview subjectRulesReview, TLSProfileSpec tLSProfileSpec, TagEvent tagEvent, Template template, TemplateList templateList, String time, TokenReview tokenReview, TypeMeta typeMeta, UpdateOptions updateOptions, User user, UserList userList) {
public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, APIServer aPIServer, APIServerList aPIServerList, AggregationRule aggregationRule, AppliedClusterResourceQuota appliedClusterResourceQuota, AppliedClusterResourceQuotaList appliedClusterResourceQuotaList, Authentication authentication, AuthenticationList authenticationList, BaseKubernetesList baseKubernetesList, BuildConfigList buildConfigList, BuildList buildList, BuildRequest buildRequest, ClusterNetwork clusterNetwork, ClusterNetworkList clusterNetworkList, ClusterOperator clusterOperator, ClusterOperatorList clusterOperatorList, ClusterResourceQuota clusterResourceQuota, ClusterResourceQuotaList clusterResourceQuotaList, ClusterVersion clusterVersion, ClusterVersionList clusterVersionList, Config config, ConfigMapFileReference configMapFileReference, Console console, ConsoleList consoleList, CreateOptions createOptions, DNS dns, DNSList dNSList, DNSZone dNSZone, DeleteOptions deleteOptions, DeploymentConfig deploymentConfig, DeploymentConfigList deploymentConfigList, EgressNetworkPolicy egressNetworkPolicy, EgressNetworkPolicyList egressNetworkPolicyList, FeatureGate featureGate, FeatureGateList featureGateList, GetOptions getOptions, Group group, GroupList groupList, Identity identity, IdentityList identityList, ImageList imageList, ImageStreamImage imageStreamImage, ImageStreamImport imageStreamImport, ImageStreamList imageStreamList, ImageStreamMapping imageStreamMapping, ImageStreamTagList imageStreamTagList, ImageTag imageTag, ImageTagList imageTagList, Info info, Infrastructure infrastructure, InfrastructureList infrastructureList, Ingress ingress, IngressList ingressList, ListOptions listOptions, LocalResourceAccessReview localResourceAccessReview, LocalSubjectAccessReview localSubjectAccessReview, NetNamespace netNamespace, NetNamespaceList netNamespaceList, Network network, NetworkList networkList, OAuth oAuth, OAuthAccessToken oAuthAccessToken, OAuthAccessTokenList oAuthAccessTokenList, OAuthAuthorizeToken oAuthAuthorizeToken, OAuthAuthorizeTokenList oAuthAuthorizeTokenList, OAuthClient oAuthClient, OAuthClientAuthorization oAuthClientAuthorization, OAuthClientAuthorizationList oAuthClientAuthorizationList, OAuthClientList oAuthClientList, OAuthList oAuthList, io.fabric8.kubernetes.api.model.ObjectMeta objectMeta, RoleBindingRestrictionList openShiftRoleBindingRestrictionList, ClusterRole openshiftClusterRole, ClusterRoleBinding openshiftClusterRoleBinding, ClusterRoleBindingList openshiftClusterRoleBindingList, ClusterRoleList openshiftClusterRoleList, ClusterRoleScopeRestriction openshiftClusterRoleScopeRestriction, Role openshiftRole, RoleBinding openshiftRoleBinding, RoleBindingList openshiftRoleBindingList, RoleBindingRestriction openshiftRoleBindingRestriction, RoleBindingRestrictionSpec openshiftRoleBindingRestrictionSpec, RoleList openshiftRoleList, OperatorHub operatorHub, OperatorHubList operatorHubList, Patch patch, PatchOptions patchOptions, PodSecurityPolicyReview podSecurityPolicyReview, PodSecurityPolicySelfSubjectReview podSecurityPolicySelfSubjectReview, PodSecurityPolicySubjectReview podSecurityPolicySubjectReview, Project project, ProjectList projectList, ProjectRequest projectRequest, Proxy proxy, ProxyList proxyList, Quantity quantity, RangeAllocation rangeAllocation, RangeAllocationList rangeAllocationList, ResourceAccessReview resourceAccessReview, ResourceAccessReviewResponse resourceAccessReviewResponse, RootPaths rootPaths, Route route, RouteList routeList, Scheduler scheduler, SchedulerList schedulerList, SecretNameReference secretNameReference, SecurityContextConstraints securityContextConstraints, SecurityContextConstraintsList securityContextConstraintsList, SelfSubjectRulesReview selfSubjectRulesReview, Status status, SubjectAccessReview subjectAccessReview, SubjectAccessReviewResponse subjectAccessReviewResponse, SubjectRulesReview subjectRulesReview, TLSProfileSpec tLSProfileSpec, TagEvent tagEvent, Template template, TemplateList templateList, String time, TokenReview tokenReview, TypeMeta typeMeta, UpdateOptions updateOptions, User user, UserList userList) {
super();
this.aPIGroup = aPIGroup;
this.aPIGroupList = aPIGroupList;
Expand Down Expand Up @@ -725,6 +735,7 @@ public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, APIServer aPISer
this.oAuthClientList = oAuthClientList;
this.oAuthList = oAuthList;
this.objectMeta = objectMeta;
this.openShiftRoleBindingRestrictionList = openShiftRoleBindingRestrictionList;
this.openshiftClusterRole = openshiftClusterRole;
this.openshiftClusterRoleBinding = openshiftClusterRoleBinding;
this.openshiftClusterRoleBindingList = openshiftClusterRoleBindingList;
Expand Down Expand Up @@ -752,6 +763,7 @@ public KubeSchema(APIGroup aPIGroup, APIGroupList aPIGroupList, APIServer aPISer
this.rangeAllocation = rangeAllocation;
this.rangeAllocationList = rangeAllocationList;
this.resourceAccessReview = resourceAccessReview;
this.resourceAccessReviewResponse = resourceAccessReviewResponse;
this.rootPaths = rootPaths;
this.route = route;
this.routeList = routeList;
Expand Down Expand Up @@ -1497,6 +1509,16 @@ public void setObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta objectMeta)
this.objectMeta = objectMeta;
}

@JsonProperty("OpenShiftRoleBindingRestrictionList")
public RoleBindingRestrictionList getOpenShiftRoleBindingRestrictionList() {
return openShiftRoleBindingRestrictionList;
}

@JsonProperty("OpenShiftRoleBindingRestrictionList")
public void setOpenShiftRoleBindingRestrictionList(RoleBindingRestrictionList openShiftRoleBindingRestrictionList) {
this.openShiftRoleBindingRestrictionList = openShiftRoleBindingRestrictionList;
}

@JsonProperty("OpenshiftClusterRole")
public ClusterRole getOpenshiftClusterRole() {
return openshiftClusterRole;
Expand Down Expand Up @@ -1767,6 +1789,16 @@ public void setResourceAccessReview(ResourceAccessReview resourceAccessReview) {
this.resourceAccessReview = resourceAccessReview;
}

@JsonProperty("ResourceAccessReviewResponse")
public ResourceAccessReviewResponse getResourceAccessReviewResponse() {
return resourceAccessReviewResponse;
}

@JsonProperty("ResourceAccessReviewResponse")
public void setResourceAccessReviewResponse(ResourceAccessReviewResponse resourceAccessReviewResponse) {
this.resourceAccessReviewResponse = resourceAccessReviewResponse;
}

@JsonProperty("RootPaths")
public RootPaths getRootPaths() {
return rootPaths;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@

package io.fabric8.openshift.api.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.LabelSelector;
import io.fabric8.kubernetes.api.model.LocalObjectReference;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"evalutionError",
"groups",
"namespace",
"users"
})
@ToString
@EqualsAndHashCode
@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
@BuildableReference(ObjectMeta.class),
@BuildableReference(LabelSelector.class),
@BuildableReference(Container.class),
@BuildableReference(PodTemplateSpec.class),
@BuildableReference(ResourceRequirements.class),
@BuildableReference(IntOrString.class),
@BuildableReference(ObjectReference.class),
@BuildableReference(LocalObjectReference.class),
@BuildableReference(PersistentVolumeClaim.class)
})
public class ResourceAccessReviewResponse implements KubernetesResource
{

/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
private String apiVersion = "authorization.openshift.io/v1";
@JsonProperty("evalutionError")
private String evalutionError;
@JsonProperty("groups")
private List<String> groups = new ArrayList<String>();
/**
*
* (Required)
*
*/
@JsonProperty("kind")
private String kind = "ResourceAccessReviewResponse";
@JsonProperty("namespace")
private String namespace;
@JsonProperty("users")
private List<String> users = new ArrayList<String>();
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

/**
* No args constructor for use in serialization
*
*/
public ResourceAccessReviewResponse() {
}

/**
*
* @param evalutionError
* @param apiVersion
* @param kind
* @param namespace
* @param groups
* @param users
*/
public ResourceAccessReviewResponse(String apiVersion, String evalutionError, List<String> groups, String kind, String namespace, List<String> users) {
super();
this.apiVersion = apiVersion;
this.evalutionError = evalutionError;
this.groups = groups;
this.kind = kind;
this.namespace = namespace;
this.users = users;
}

/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
public String getApiVersion() {
return apiVersion;
}

/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}

@JsonProperty("evalutionError")
public String getEvalutionError() {
return evalutionError;
}

@JsonProperty("evalutionError")
public void setEvalutionError(String evalutionError) {
this.evalutionError = evalutionError;
}

@JsonProperty("groups")
public List<String> getGroups() {
return groups;
}

@JsonProperty("groups")
public void setGroups(List<String> groups) {
this.groups = groups;
}

/**
*
* (Required)
*
*/
@JsonProperty("kind")
public String getKind() {
return kind;
}

/**
*
* (Required)
*
*/
@JsonProperty("kind")
public void setKind(String kind) {
this.kind = kind;
}

@JsonProperty("namespace")
public String getNamespace() {
return namespace;
}

@JsonProperty("namespace")
public void setNamespace(String namespace) {
this.namespace = namespace;
}

@JsonProperty("users")
public List<String> getUsers() {
return users;
}

@JsonProperty("users")
public void setUsers(List<String> users) {
this.users = users;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}
Loading

0 comments on commit ed08377

Please sign in to comment.