Search in sources :

Example 11 with V1ConfigMap

use of io.kubernetes.client.models.V1ConfigMap in project java by kubernetes-client.

the class CoreV1Api method patchNamespacedConfigMapAsync.

/**
 *  (asynchronously)
 * partially update the specified ConfigMap
 * @param name name of the ConfigMap (required)
 * @param namespace object name and auth scope, such as for teams and projects (required)
 * @param body  (required)
 * @param pretty If 'true', then the output is pretty printed. (optional)
 * @param callback The callback to be executed when the API call finishes
 * @return The request call
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call patchNamespacedConfigMapAsync(String name, String namespace, Object body, String pretty, final ApiCallback<V1ConfigMap> callback) throws ApiException {
    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {

            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };
        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {

            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }
    com.squareup.okhttp.Call call = patchNamespacedConfigMapValidateBeforeCall(name, namespace, body, pretty, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<V1ConfigMap>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}
Also used : ProgressResponseBody(io.kubernetes.client.ProgressResponseBody) Type(java.lang.reflect.Type) ProgressRequestBody(io.kubernetes.client.ProgressRequestBody) V1ConfigMap(io.kubernetes.client.models.V1ConfigMap)

Example 12 with V1ConfigMap

use of io.kubernetes.client.models.V1ConfigMap in project java by kubernetes-client.

the class CoreV1ApiTest method replaceNamespacedConfigMapTest.

/**
 * replace the specified ConfigMap
 *
 * @throws ApiException
 *          if the Api call fails
 */
@Test
public void replaceNamespacedConfigMapTest() throws ApiException {
    String name = null;
    String namespace = null;
    V1ConfigMap body = null;
    String pretty = null;
    V1ConfigMap response = api.replaceNamespacedConfigMap(name, namespace, body, pretty);
// TODO: test validations
}
Also used : V1ConfigMap(io.kubernetes.client.models.V1ConfigMap) Test(org.junit.Test)

Example 13 with V1ConfigMap

use of io.kubernetes.client.models.V1ConfigMap in project weblogic-kubernetes-operator by oracle.

the class CreateDomainGeneratedFilesBaseTest method generatesCorrect_traefikConfigMap.

@Test
public void generatesCorrect_traefikConfigMap() throws Exception {
    // The config map contains a 'traefik.toml' property that has a lot of text
    // that we don't want to duplicate in the test.  However, part of the text
    // is computed from the inputs, so we want to validate that part of the info.
    // First, if it's present, extract the trafik.toml value from the config map
    // then empty it out.
    // Second, make sure the rest of the config map is as expected.
    // Third, make sure that the traefik.tom value contains the expected
    // expansion of the input properties.
    V1ConfigMap actual = getActualTraefikConfigMap();
    String actualTraefikToml = getThenEmptyConfigMapDataValue(actual, PROPERTY_TRAEFIK_TOML);
    // don't allOf since we want to make sure the second assertThat is only called if the first one passes
    assertThat(actual, yamlEqualTo(getExpectedTraefikConfigMap()));
    assertThatActualTraefikTomlIsCorrect(actualTraefikToml);
}
Also used : V1ConfigMap(io.kubernetes.client.models.V1ConfigMap) Test(org.junit.Test)

Example 14 with V1ConfigMap

use of io.kubernetes.client.models.V1ConfigMap in project weblogic-kubernetes-operator by oracle.

the class CreateDomainGeneratedFilesBaseTest method generatesCorrect_createWeblogicDomainConfigMap.

@Test
public void generatesCorrect_createWeblogicDomainConfigMap() throws Exception {
    // The config map contains several properties that contain shell and wlst scripts
    // that we don't want to duplicate in the test.  However, part of their text
    // is computed from the inputs, so we want to validate that part of the info.
    // First, if it's present, extract these values from the config map
    // then empty them out.
    // Second, make sure the rest of the config map is as expected.
    // Third, make sure that these values contains the expected
    // expansion of the input properties.
    V1ConfigMap actual = getActualCreateWeblogicDomainJobConfigMap();
    // TBD - should 'expected' be a clone since we're going to modify it?
    // Since all the other test don't use getActualCreateWeblogicDomainJobConfigMap(),
    // it's currently safe to not clone it.
    String actualUtilitySh = getThenEmptyConfigMapDataValue(actual, PROPERTY_UTILITY_SH);
    String actualCreateDomainJobSh = getThenEmptyConfigMapDataValue(actual, PROPERTY_CREATE_DOMAIN_JOB_SH);
    String actualReadDomainSecretPy = getThenEmptyConfigMapDataValue(actual, PROPERTY_READ_DOMAIN_SECRET_PY);
    String actualCreateDomainScriptSh = getThenEmptyConfigMapDataValue(actual, PROPERTY_CREATE_DOMAIN_SCRIPT_SH);
    String actualCreateDomainPy = getThenEmptyConfigMapDataValue(actual, PROPERTY_CREATE_DOMAIN_PY);
    // don't allOf since we want to make sure the later assertThats are only called if the first one passes
    assertThat(actual, yamlEqualTo(getExpectedCreateWeblogicDomainJobConfigMap()));
    assertThatActualUtilityShIsCorrect(actualUtilitySh);
    assertThatActualCreateDomainJobShIsCorrect(actualCreateDomainJobSh);
    assertThatActualReadDomainSecretPyIsCorrect(actualReadDomainSecretPy);
    assertThatActualCreateDomainScriptShIsCorrect(actualCreateDomainScriptSh);
    assertThatActualCreateDomainPyIsCorrect(actualCreateDomainPy);
}
Also used : V1ConfigMap(io.kubernetes.client.models.V1ConfigMap) Test(org.junit.Test)

Aggregations

V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)14 Type (java.lang.reflect.Type)8 Test (org.junit.Test)6 ProgressRequestBody (io.kubernetes.client.ProgressRequestBody)4 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)4