|
| 1 | +/** |
| 2 | + * Copyright (C) 2015 Red Hat, Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package io.fabric8.kubernetes.client.handlers; |
| 17 | + |
| 18 | +import io.fabric8.kubernetes.api.model.StorageClass; |
| 19 | +import io.fabric8.kubernetes.api.model.StorageClassBuilder; |
| 20 | +import io.fabric8.kubernetes.client.Config; |
| 21 | +import io.fabric8.kubernetes.client.ResourceHandler; |
| 22 | +import io.fabric8.kubernetes.client.Watch; |
| 23 | +import io.fabric8.kubernetes.client.Watcher; |
| 24 | +import io.fabric8.kubernetes.client.dsl.internal.StorageClassOperationsImpl; |
| 25 | +import okhttp3.OkHttpClient; |
| 26 | +import org.apache.felix.scr.annotations.Component; |
| 27 | +import org.apache.felix.scr.annotations.Service; |
| 28 | + |
| 29 | +import java.util.TreeMap; |
| 30 | +import java.util.concurrent.TimeUnit; |
| 31 | + |
| 32 | +@Component |
| 33 | +@Service |
| 34 | +public class StorageClassHandler implements ResourceHandler<StorageClass, StorageClassBuilder> { |
| 35 | + @Override |
| 36 | + public String getKind() { |
| 37 | + return StorageClass.class.getSimpleName(); |
| 38 | + } |
| 39 | + |
| 40 | + @Override |
| 41 | + public StorageClass create(OkHttpClient client, Config config, String namespace, StorageClass item) { |
| 42 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).create(); |
| 43 | + } |
| 44 | + |
| 45 | + @Override |
| 46 | + public StorageClass replace(OkHttpClient client, Config config, String namespace, StorageClass item) { |
| 47 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, true, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).replace(item); |
| 48 | + } |
| 49 | + |
| 50 | + @Override |
| 51 | + public StorageClass reload(OkHttpClient client, Config config, String namespace, StorageClass item) { |
| 52 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).fromServer().get(); |
| 53 | + } |
| 54 | + |
| 55 | + @Override |
| 56 | + public StorageClassBuilder edit(StorageClass item) { |
| 57 | + return new StorageClassBuilder(item); |
| 58 | + } |
| 59 | + |
| 60 | + @Override |
| 61 | + public Boolean delete(OkHttpClient client, Config config, String namespace, StorageClass item) { |
| 62 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).delete(item); |
| 63 | + } |
| 64 | + |
| 65 | + @Override |
| 66 | + public Watch watch(OkHttpClient client, Config config, String namespace, StorageClass item, Watcher<StorageClass> watcher) { |
| 67 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).watch(watcher); |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public Watch watch(OkHttpClient client, Config config, String namespace, StorageClass item, String resourceVersion, Watcher<StorageClass> watcher) { |
| 72 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).watch(resourceVersion, watcher); |
| 73 | + } |
| 74 | + |
| 75 | + @Override |
| 76 | + public StorageClass waitUntilReady(OkHttpClient client, Config config, String namespace, StorageClass item, long amount, TimeUnit timeUnit) throws InterruptedException { |
| 77 | + return new StorageClassOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap<String, String>(), new TreeMap<String, String>(), new TreeMap<String, String[]>(), new TreeMap<String, String[]>(), new TreeMap<String, String>()).waitUntilReady(amount, timeUnit); |
| 78 | + } |
| 79 | + |
| 80 | +} |
0 commit comments