Skip to content

Commit

Permalink
DSL Changes for batch/v1, policy/v1 and discovery/v1 resources
Browse files Browse the repository at this point in the history
+ Added `client.batch().v1()` and `client.batch().v1beta1()` DSL
+ Added `client.policy().v1()` and `client.policy().v1beta1()` DSL
+ Added `client.discovery.v1()` DSL
  • Loading branch information
rohanKanojia committed Apr 12, 2021
1 parent ae96030 commit 73e8fda
Show file tree
Hide file tree
Showing 48 changed files with 1,338 additions and 122 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@

#### New Features


#### _**Note**_: Breaking changes in the API
##### DSL Changes:
- `client.batch().jobs()` moved to `client.batch().v1().jobs()`
- `client.batch().cronjobs()` moved to `client.batch().v1().cronjobs()` or `client.batch().v1beta1().cronjobs()`
- `client.policy().podSecurityPolicies()` moved to `client.policy().v1beta1().podSecurityPolicies()`
- `client.policy().podDisruptionBudget()` moved to `client.policy().v1().podDisruptionBudget()` or `client.policy().v1beta1().podDisruptionBudget()`

##### Model Changes:
- Classes in `io.fabric8.kubernetes.api.model.batch` have been moved to `io.fabric8.kubernetes.api.model.batch.v1` and `io.fabric8.kubernetes.api.model.batch.v1beta1`
- Classes in `io.fabric8.kubernetes.api.model.policy` have been moved to `io.fabric8.kubernetes.api.model.policy.v1` and `io.fabric8.kubernetes.api.model.policy.v1beta1`


### 5.3.0 (2021-04-08)

#### Bugs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import io.fabric8.kubernetes.client.dsl.BatchAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.ScalableResource;
import io.fabric8.kubernetes.client.dsl.V1BatchAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1BatchAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.batch.v1beta1.CronJobOperationsImpl;
import io.fabric8.kubernetes.client.dsl.internal.batch.v1.JobOperationsImpl;
import okhttp3.OkHttpClient;
Expand All @@ -38,12 +40,12 @@ public BatchAPIGroupClient(OkHttpClient httpClient, final Config config) {
}

@Override
public MixedOperation<Job, JobList, ScalableResource<Job>> jobs() {
return new JobOperationsImpl(httpClient, getConfiguration());
public V1BatchAPIGroupDSL v1() {
return adapt(V1BatchAPIGroupClient.class);
}

@Override
public MixedOperation<CronJob, CronJobList, Resource<CronJob>> cronjobs() {
return new CronJobOperationsImpl(httpClient, getConfiguration());
public V1beta1BatchAPIGroupDSL v1beta1() {
return adapt(V1beta1BatchAPIGroupClient.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.client.dsl.DiscoveryAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1DiscoveryAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1DiscoveryAPIGroupDSL;
import okhttp3.OkHttpClient;

Expand All @@ -28,6 +29,11 @@ public DiscoveryAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public V1DiscoveryAPIGroupDSL v1() {
return adapt(V1DiscoveryAPIGroupClient.class);
}

@Override
public V1beta1DiscoveryAPIGroupDSL v1beta1() {
return adapt(V1beta1DiscoveryAPIGroupClient.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget;
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetList;
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodSecurityPolicy;
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodSecurityPolicyList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.PolicyAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.internal.policy.v1beta1.PodDisruptionBudgetOperationsImpl;
import io.fabric8.kubernetes.client.dsl.internal.policy.v1beta1.PodSecurityPolicyOperationsImpl;
import io.fabric8.kubernetes.client.dsl.V1PolicyAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1PolicyAPIGroupDSL;
import okhttp3.OkHttpClient;

public class PolicyAPIGroupClient extends BaseClient implements PolicyAPIGroupDSL {
Expand All @@ -33,12 +27,12 @@ public PolicyAPIGroupClient(OkHttpClient httpClient, final Config config) {
}

@Override
public MixedOperation<PodSecurityPolicy, PodSecurityPolicyList, Resource<PodSecurityPolicy>> podSecurityPolicies() {
return new PodSecurityPolicyOperationsImpl(httpClient, getConfiguration());
public V1PolicyAPIGroupDSL v1() {
return adapt(V1PolicyAPIGroupClient.class);
}

@Override
public MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, Resource<PodDisruptionBudget>> podDisruptionBudget() {
return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration());
public V1beta1PolicyAPIGroupDSL v1beta1() {
return adapt(V1beta1PolicyAPIGroupClient.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.batch.v1.CronJob;
import io.fabric8.kubernetes.api.model.batch.v1.CronJobList;
import io.fabric8.kubernetes.api.model.batch.v1.Job;
import io.fabric8.kubernetes.api.model.batch.v1.JobList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.ScalableResource;
import io.fabric8.kubernetes.client.dsl.V1BatchAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.batch.v1.CronJobOperationsImpl;
import io.fabric8.kubernetes.client.dsl.internal.batch.v1.JobOperationsImpl;
import okhttp3.OkHttpClient;

public class V1BatchAPIGroupClient extends BaseClient implements V1BatchAPIGroupDSL {
public V1BatchAPIGroupClient() {
super();
}

public V1BatchAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public MixedOperation<Job, JobList, ScalableResource<Job>> jobs() {
return new JobOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<CronJob, CronJobList, Resource<CronJob>> cronjobs() {
return new CronJobOperationsImpl(httpClient, getConfiguration());
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import okhttp3.OkHttpClient;

public class V1BatchAPIGroupExtensionAdapter extends APIGroupExtensionAdapter<V1BatchAPIGroupClient> {
@Override
protected String getAPIGroupName() {
return "batch/v1";
}

@Override
public Class<V1BatchAPIGroupClient> getExtensionType() {
return V1BatchAPIGroupClient.class;
}

@Override
protected V1BatchAPIGroupClient newInstance(Client client) {
return new V1BatchAPIGroupClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.discovery.v1.EndpointSlice;
import io.fabric8.kubernetes.api.model.discovery.v1.EndpointSliceList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1DiscoveryAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.discovery.v1.EndpointSliceOperationsImpl;
import okhttp3.OkHttpClient;

public class V1DiscoveryAPIGroupClient extends BaseClient implements V1DiscoveryAPIGroupDSL {
public V1DiscoveryAPIGroupClient() {
super();
}

public V1DiscoveryAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public MixedOperation<EndpointSlice, EndpointSliceList, Resource<EndpointSlice>> endpointSlices() {
return new EndpointSliceOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import okhttp3.OkHttpClient;

public class V1DiscoveryAPIGroupExtensionAdapter extends APIGroupExtensionAdapter<V1DiscoveryAPIGroupClient> {
@Override
protected String getAPIGroupName() {
return "discovery/v1";
}

@Override
public Class<V1DiscoveryAPIGroupClient> getExtensionType() {
return V1DiscoveryAPIGroupClient.class;
}

@Override
protected V1DiscoveryAPIGroupClient newInstance(Client client) {
return new V1DiscoveryAPIGroupClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudget;
import io.fabric8.kubernetes.api.model.policy.v1.PodDisruptionBudgetList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1PolicyAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.policy.v1.PodDisruptionBudgetOperationsImpl;
import okhttp3.OkHttpClient;

public class V1PolicyAPIGroupClient extends BaseClient implements V1PolicyAPIGroupDSL {
public V1PolicyAPIGroupClient() {
super();
}

public V1PolicyAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, Resource<PodDisruptionBudget>> podDisruptionBudget() {
return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import okhttp3.OkHttpClient;

public class V1PolicyAPIGroupExtensionAdapter extends APIGroupExtensionAdapter<V1PolicyAPIGroupClient> {
@Override
protected String getAPIGroupName() {
return "policy/v1";
}

@Override
public Class<V1PolicyAPIGroupClient> getExtensionType() {
return V1PolicyAPIGroupClient.class;
}

@Override
protected V1PolicyAPIGroupClient newInstance(Client client) {
return new V1PolicyAPIGroupClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.batch.v1beta1.CronJob;
import io.fabric8.kubernetes.api.model.batch.v1beta1.CronJobList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1beta1BatchAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.internal.batch.v1beta1.CronJobOperationsImpl;
import okhttp3.OkHttpClient;

public class V1beta1BatchAPIGroupClient extends BaseClient implements V1beta1BatchAPIGroupDSL {
public V1beta1BatchAPIGroupClient() {
super();
}

public V1beta1BatchAPIGroupClient(OkHttpClient httpClient, final Config config) {
super(httpClient, config);
}

@Override
public MixedOperation<CronJob, CronJobList, Resource<CronJob>> cronjobs() {
return new CronJobOperationsImpl(httpClient, getConfiguration());
}
}
Loading

0 comments on commit 73e8fda

Please sign in to comment.