use of com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation in project cloudant-java-sdk by IBM.
the class Cloudant method getCurrentThroughputInformation.
/**
* Retrieve the current provisioned throughput capacity consumption.
*
* View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current
* consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given
* second.
*
* @param getCurrentThroughputInformationOptions the {@link GetCurrentThroughputInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link CurrentThroughputInformation}
*/
public ServiceCall<CurrentThroughputInformation> getCurrentThroughputInformation(GetCurrentThroughputInformationOptions getCurrentThroughputInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/current/throughput"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getCurrentThroughputInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<CurrentThroughputInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<CurrentThroughputInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation in project cloudant-java-sdk by IBM.
the class CloudantTest method testGetCurrentThroughputInformationWOptions.
@Test
public void testGetCurrentThroughputInformationWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"throughput\": {\"query\": 0, \"read\": 0, \"write\": 0}}";
String getCurrentThroughputInformationPath = "/_api/v2/user/current/throughput";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the GetCurrentThroughputInformationOptions model
GetCurrentThroughputInformationOptions getCurrentThroughputInformationOptionsModel = new GetCurrentThroughputInformationOptions();
// Invoke operation with valid options model (positive test)
Response<CurrentThroughputInformation> response = cloudantService.getCurrentThroughputInformation(getCurrentThroughputInformationOptionsModel).execute();
assertNotNull(response);
CurrentThroughputInformation 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, getCurrentThroughputInformationPath);
}
use of com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation in project cloudant-java-sdk by IBM.
the class CurrentThroughputInformationTest method testCurrentThroughputInformation.
@Test
public void testCurrentThroughputInformation() throws Throwable {
CurrentThroughputInformation currentThroughputInformationModel = new CurrentThroughputInformation();
assertNull(currentThroughputInformationModel.getThroughput());
}
Aggregations