Search in sources :

Example 1 with VersionInfo

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

the class VersionApi method getCodeAsync.

/**
 * (asynchronously) get the code version
 *
 * @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
 * @http.response.details
 *     <table summary="Response Details" border="1">
 * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
 * <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
 * <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
 * </table>
 */
public okhttp3.Call getCodeAsync(final ApiCallback<VersionInfo> _callback) throws ApiException {
    okhttp3.Call localVarCall = getCodeValidateBeforeCall(_callback);
    Type localVarReturnType = new TypeToken<VersionInfo>() {
    }.getType();
    localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
    return localVarCall;
}
Also used : VersionInfo(io.kubernetes.client.openapi.models.VersionInfo) Type(java.lang.reflect.Type)

Example 2 with VersionInfo

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

the class VersionTest method testFailure.

@Test
public void testFailure() throws InterruptedException, IOException, ApiException {
    wireMockRule.stubFor(get(urlPathEqualTo("/version/")).willReturn(aResponse().withStatus(401).withHeader("Content-Type", "application/json").withBody("{}")));
    Version versionUtil = new Version(client);
    boolean thrown = false;
    try {
        VersionInfo versionInfo = versionUtil.getVersion();
    } catch (ApiException ex) {
        assertEquals(401, ex.getCode());
        thrown = true;
    }
    assertEquals(thrown, true);
    verify(getRequestedFor(urlPathEqualTo("/version/")).withHeader("Content-Type", equalTo("application/json")).withHeader("Accept", equalTo("application/json")));
}
Also used : VersionInfo(io.kubernetes.client.openapi.models.VersionInfo) ApiException(io.kubernetes.client.openapi.ApiException) Test(org.junit.Test)

Example 3 with VersionInfo

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

the class VersionTest method testUrl.

@Test
public void testUrl() throws InterruptedException, IOException, ApiException {
    wireMockRule.stubFor(get(urlPathEqualTo("/version/")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("{}")));
    Version versionUtil = new Version(client);
    try {
        VersionInfo versionInfo = versionUtil.getVersion();
    } catch (ApiException ex) {
    }
    verify(getRequestedFor(urlPathEqualTo("/version/")).withHeader("Content-Type", equalTo("application/json")).withHeader("Accept", equalTo("application/json")));
}
Also used : VersionInfo(io.kubernetes.client.openapi.models.VersionInfo) ApiException(io.kubernetes.client.openapi.ApiException) Test(org.junit.Test)

Example 4 with VersionInfo

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

the class VersionApi method getCodeWithHttpInfo.

/**
 * get the code version
 *
 * @return ApiResponse&lt;VersionInfo&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
 *     response body
 * @http.response.details
 *     <table summary="Response Details" border="1">
 * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
 * <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
 * <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
 * </table>
 */
public ApiResponse<VersionInfo> getCodeWithHttpInfo() throws ApiException {
    okhttp3.Call localVarCall = getCodeValidateBeforeCall(null);
    Type localVarReturnType = new TypeToken<VersionInfo>() {
    }.getType();
    return localVarApiClient.execute(localVarCall, localVarReturnType);
}
Also used : VersionInfo(io.kubernetes.client.openapi.models.VersionInfo) Type(java.lang.reflect.Type)

Aggregations

VersionInfo (io.kubernetes.client.openapi.models.VersionInfo)4 ApiException (io.kubernetes.client.openapi.ApiException)2 Type (java.lang.reflect.Type)2 Test (org.junit.Test)2