public RollableScalableResourceOperation(OkHttpClient client, Config config, String apiVersionGroup, String apiVersionNumber, String resourceT, String namespace, String name, Boolean cascading, T item, String resourceVersion, Boolean reloadingFromServer, long gracePeriodSeconds, Map<String, String> labels, Map<String, String> labelsNot, Map<String, String[]> labelsIn, Map<String, String[]> labelsNotIn, Map<String, String> fields, Boolean rolling, long rollingTimeout, TimeUnit rollingTimeUnit) { super(client, config, ApiVersionUtil.apiGroup(item, apiVersionGroup), ApiVersionUtil.apiVersion(item, apiVersionNumber), resourceT, namespace, name, cascading, item, resourceVersion, reloadingFromServer, gracePeriodSeconds, labels, labelsNot, labelsIn, labelsNotIn, fields); this.rolling = rolling; this.rollingTimeout = rollingTimeout; this.rollingTimeUnit = rollingTimeUnit; reaper = new ScalableReaper(this); }
/** * Extracts apiGroupName from apiGroupVersion when in resource for apiGroupName/apiGroupVersion combination * @param item resource which is being used * @param apiGroup apiGroupName present if any * @return Just the apiGroupName part without apiGroupVersion */ public static <T> String apiGroup(T item, String apiGroup) { if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { return trimGroupOrNull(((HasMetadata) item).getApiVersion()); } else if (apiGroup != null && !apiGroup.isEmpty()) { return trimGroup(apiGroup); } return null; }
/** * Returns the api version falling back to the items apiGroupVersion if not null. * @param <T> * @param item * @param apiVersion * @return */ public static <T> String apiVersion(T item, String apiVersion) { if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { return trimVersion(((HasMetadata) item).getApiVersion()); } else if (apiVersion != null && !apiVersion.isEmpty()) { return trimVersion(apiVersion); } return null; }
protected BaseOperation(OkHttpClient client, Config config, String apiGroupName, String apiVersion, String resourceT, String namespace, String name, Boolean cascading, T item, String resourceVersion, Boolean reloadingFromServer, Class<T> type, Class<L> listType, Class<D> doneableType) { super(client, config, apiGroup(item, apiGroupName), apiVersion(item, apiVersion), resourceT, namespace, name(item, name)); this.cascading = cascading; this.item = item; this.resourceVersion = resourceVersion; this.reloadingFromServer = reloadingFromServer; this.type = type; this.listType = listType; this.doneableType = doneableType; this.reaper = null; this.gracePeriodSeconds = -1; this.labels = new TreeMap<>(); this.labelsNot = new TreeMap<>(); this.labelsIn = new TreeMap<>(); this.labelsNotIn = new TreeMap<>(); this.fields = new TreeMap<>(); }
protected BaseOperation(OkHttpClient client, Config config, String apiGroupName, String apiVersionNumber, String resourceT, String namespace, String name, Boolean cascading, T item, String resourceVersion, Boolean reloadingFromServer, long gracePeriodSeconds, Map<String, String> labels, Map<String, String> labelsNot, Map<String, String[]> labelsIn, Map<String, String[]> labelsNotIn, Map<String, String> fields) { super(client, config, apiGroup(item, apiGroupName), apiVersion(item, apiVersionNumber), resourceT, namespace, name(item, name)); this.cascading = cascading; this.item = item; this.reloadingFromServer = reloadingFromServer; this.type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; this.listType = (Class<L>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1]; this.doneableType = (Class<D>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[2]; this.reaper = null; this.resourceVersion = resourceVersion; this.gracePeriodSeconds = gracePeriodSeconds; this.labels = labels; this.labelsNot = labelsNot; this.labelsIn = labelsIn; this.labelsNotIn = labelsNotIn; this.fields = fields; }