use of io.kubernetes.client.models.V1Secret in project weblogic-kubernetes-operator by oracle.
the class Helpers method readSecretByReference.
/**
* Read a secret by its object reference.
*
* @param reference V1ObjectReference An object reference to the Secret you want to read.
* @param namespace The Namespace where Secret is defined.
* @return V1Secret The requested Secret.
* @throws ApiException if there is an API error.
*/
protected V1Secret readSecretByReference(V1ObjectReference reference, String namespace) throws ApiException {
LOGGER.entering();
if (reference.getNamespace() != null) {
namespace = reference.getNamespace();
}
V1Secret secret = coreApi.readNamespacedSecret(reference.getName(), namespace, "false", Boolean.TRUE, Boolean.TRUE);
LOGGER.exiting(secret);
return secret;
}
use of io.kubernetes.client.models.V1Secret in project weblogic-kubernetes-operator by oracle.
the class SecretHelperTest method createSecret.
// Create a named secret with username / password in specified name
private V1Secret createSecret(String name, String namespace) throws Exception {
CallBuilderFactory factory = new CallBuilderFactory(null);
try {
V1Secret existing = factory.create().readSecret(name, namespace);
if (existing != null)
return existing;
} catch (ApiException ignore) {
// Just ignore and try to create it
}
if (isVersion18)
return null;
V1Secret body = new V1Secret();
// Set the required api version and kind of resource
body.setApiVersion("v1");
body.setKind("Secret");
// Setup the standard object metadata
V1ObjectMeta meta = new V1ObjectMeta();
meta.setName(name);
meta.setNamespace(namespace);
body.setMetadata(meta);
Map<String, byte[]> data = new HashMap<String, byte[]>();
data.put(SecretHelper.ADMIN_SERVER_CREDENTIALS_USERNAME, USERNAME.getBytes());
data.put(SecretHelper.ADMIN_SERVER_CREDENTIALS_PASSWORD, PASSWORD.getBytes());
body.setData(data);
try {
return factory.create().createSecret(namespace, body);
} catch (Exception e) {
e.printStackTrace(System.out);
throw e;
}
}
use of io.kubernetes.client.models.V1Secret in project java by kubernetes-client.
the class CoreV1Api method replaceNamespacedSecretAsync.
/**
* (asynchronously)
* replace the specified Secret
* @param name name of the Secret (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 replaceNamespacedSecretAsync(String name, String namespace, V1Secret body, String pretty, final ApiCallback<V1Secret> 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 = replaceNamespacedSecretValidateBeforeCall(name, namespace, body, pretty, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<V1Secret>() {
}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
use of io.kubernetes.client.models.V1Secret in project java by kubernetes-client.
the class CoreV1Api method createNamespacedSecretWithHttpInfo.
/**
* create a Secret
* @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)
* @return ApiResponse<V1Secret>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<V1Secret> createNamespacedSecretWithHttpInfo(String namespace, V1Secret body, String pretty) throws ApiException {
com.squareup.okhttp.Call call = createNamespacedSecretValidateBeforeCall(namespace, body, pretty, null, null);
Type localVarReturnType = new TypeToken<V1Secret>() {
}.getType();
return apiClient.execute(call, localVarReturnType);
}
use of io.kubernetes.client.models.V1Secret in project java by kubernetes-client.
the class CoreV1Api method patchNamespacedSecretAsync.
/**
* (asynchronously)
* partially update the specified Secret
* @param name name of the Secret (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 patchNamespacedSecretAsync(String name, String namespace, Object body, String pretty, final ApiCallback<V1Secret> 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 = patchNamespacedSecretValidateBeforeCall(name, namespace, body, pretty, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<V1Secret>() {
}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
Aggregations