use of com.ibm.cloud.cloudant.v1.model.GetCapacityThroughputInformationOptions in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetCapacityThroughputInformationWOptions.
@Test
public void testGetCapacityThroughputInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"current\": {\"throughput\": {\"blocks\": 0, \"query\": 0, \"read\": 0, \"write\": 0}}, \"target\": {\"throughput\": {\"blocks\": 0, \"query\": 0, \"read\": 0, \"write\": 0}}}";
String getCapacityThroughputInformationPath = "/_api/v2/user/capacity/throughput";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetCapacityThroughputInformationOptions model
GetCapacityThroughputInformationOptions getCapacityThroughputInformationOptionsModel = new GetCapacityThroughputInformationOptions();
// Invoke operation with valid options model (positive test)
Response<CapacityThroughputInformation> response = cloudantService.getCapacityThroughputInformation(getCapacityThroughputInformationOptionsModel).execute();
assertNotNull(response);
CapacityThroughputInformation responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "GET");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, getCapacityThroughputInformationPath);
}
use of com.ibm.cloud.cloudant.v1.model.GetCapacityThroughputInformationOptions in project cloudant-java-sdk by IBM.
the class GetCapacityThroughputInformationOptionsTest method testGetCapacityThroughputInformationOptions.
@Test
public void testGetCapacityThroughputInformationOptions() throws Throwable {
GetCapacityThroughputInformationOptions getCapacityThroughputInformationOptionsModel = new GetCapacityThroughputInformationOptions();
assertNotNull(getCapacityThroughputInformationOptionsModel);
}
use of com.ibm.cloud.cloudant.v1.model.GetCapacityThroughputInformationOptions in project cloudant-java-sdk by IBM.
the class Cloudant method getCapacityThroughputInformation.
/**
* Retrieve provisioned throughput capacity information.
*
* View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the
* target provisioned throughput capacity.
*
* @param getCapacityThroughputInformationOptions the {@link GetCapacityThroughputInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link CapacityThroughputInformation}
*/
public ServiceCall<CapacityThroughputInformation> getCapacityThroughputInformation(GetCapacityThroughputInformationOptions getCapacityThroughputInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/capacity/throughput"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getCapacityThroughputInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<CapacityThroughputInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<CapacityThroughputInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations