Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
import com.ibm.cloud.cloudant.v1.model.AllDocsResult;
import com.ibm.cloud.cloudant.v1.model.ApiKeysResult;
import com.ibm.cloud.cloudant.v1.model.BulkGetResult;
import com.ibm.cloud.cloudant.v1.model.CapacityDatabasesInformation;
import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation;
import com.ibm.cloud.cloudant.v1.model.ChangesResult;
import com.ibm.cloud.cloudant.v1.model.CorsInformation;
import com.ibm.cloud.cloudant.v1.model.CurrentDatabasesInformation;
import com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation;
import com.ibm.cloud.cloudant.v1.model.DatabaseInformation;
import com.ibm.cloud.cloudant.v1.model.DbUpdates;
Expand All @@ -45,8 +47,10 @@
import com.ibm.cloud.cloudant.v1.model.GetActivityTrackerEventsOptions;
import com.ibm.cloud.cloudant.v1.model.GetAllDbsOptions;
import com.ibm.cloud.cloudant.v1.model.GetAttachmentOptions;
import com.ibm.cloud.cloudant.v1.model.GetCapacityDatabasesInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCapacityThroughputInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCorsInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCurrentDatabasesInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCurrentThroughputInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetDatabaseInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetDbUpdatesOptions;
Expand Down Expand Up @@ -4418,6 +4422,68 @@ public ServiceCall<Ok> postActivityTrackerEvents(PostActivityTrackerEventsOption
return createServiceCall(builder.build(), responseConverter);
}

/**
* Retrieve maximum allowed database count.
*
* Retrieves the maximum number of databases currently allowed in the instance.
*
* @param getCapacityDatabasesInformationOptions the {@link GetCapacityDatabasesInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link CapacityDatabasesInformation}
*/
public ServiceCall<CapacityDatabasesInformation> getCapacityDatabasesInformation(GetCapacityDatabasesInformationOptions getCapacityDatabasesInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/capacity/databases"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getCapacityDatabasesInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<CapacityDatabasesInformation> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<CapacityDatabasesInformation>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Retrieve maximum allowed database count.
*
* Retrieves the maximum number of databases currently allowed in the instance.
*
* @return a {@link ServiceCall} with a result of type {@link CapacityDatabasesInformation}
*/
public ServiceCall<CapacityDatabasesInformation> getCapacityDatabasesInformation() {
return getCapacityDatabasesInformation(null);
}

/**
* Retrieve current database count.
*
* Retrieves the current number of databases that exist in the instance.
*
* @param getCurrentDatabasesInformationOptions the {@link GetCurrentDatabasesInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link CurrentDatabasesInformation}
*/
public ServiceCall<CurrentDatabasesInformation> getCurrentDatabasesInformation(GetCurrentDatabasesInformationOptions getCurrentDatabasesInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/current/databases"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getCurrentDatabasesInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<CurrentDatabasesInformation> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<CurrentDatabasesInformation>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Retrieve current database count.
*
* Retrieves the current number of databases that exist in the instance.
*
* @return a {@link ServiceCall} with a result of type {@link CurrentDatabasesInformation}
*/
public ServiceCall<CurrentDatabasesInformation> getCurrentDatabasesInformation() {
return getCurrentDatabasesInformation(null);
}

/**
* Retrieve the current provisioned throughput capacity consumption.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Schema for information about maximum total database count.
*/
public class CapacityDatabasesInformation extends GenericModel {

protected CapacityDatabasesInformationCurrent current;

protected CapacityDatabasesInformation() { }

/**
* Gets the current.
*
* Schema for information about the current database capacity.
*
* @return the current
*/
public CapacityDatabasesInformationCurrent getCurrent() {
return current;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Schema for information about the current database capacity.
*/
public class CapacityDatabasesInformationCurrent extends GenericModel {

protected DatabasesCountInformation databases;

protected CapacityDatabasesInformationCurrent() { }

/**
* Gets the databases.
*
* Schema for databases count.
*
* @return the databases
*/
public DatabasesCountInformation getDatabases() {
return databases;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Schema for information about the current database counts.
*/
public class CurrentDatabasesInformation extends GenericModel {

protected DatabasesCountInformation databases;

protected CurrentDatabasesInformation() { }

/**
* Gets the databases.
*
* Schema for databases count.
*
* @return the databases
*/
public DatabasesCountInformation getDatabases() {
return databases;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Schema for databases count.
*/
public class DatabasesCountInformation extends GenericModel {

protected Long total;

protected DatabasesCountInformation() { }

/**
* Gets the total.
*
* The total number of databases.
*
* @return the total
*/
public Long getTotal() {
return total;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* The getCapacityDatabasesInformation options.
*/
public class GetCapacityDatabasesInformationOptions extends GenericModel {

/**
* Construct a new instance of GetCapacityDatabasesInformationOptions.
*/
public GetCapacityDatabasesInformationOptions() {
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.cloudant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* The getCurrentDatabasesInformation options.
*/
public class GetCurrentDatabasesInformationOptions extends GenericModel {

/**
* Construct a new instance of GetCurrentDatabasesInformationOptions.
*/
public GetCurrentDatabasesInformationOptions() {
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.ibm.cloud.cloudant.v1.model.BulkGetResult;
import com.ibm.cloud.cloudant.v1.model.BulkGetResultDocument;
import com.ibm.cloud.cloudant.v1.model.BulkGetResultItem;
import com.ibm.cloud.cloudant.v1.model.CapacityDatabasesInformation;
import com.ibm.cloud.cloudant.v1.model.CapacityDatabasesInformationCurrent;
import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation;
import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformationCurrent;
import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformationTarget;
Expand All @@ -35,11 +37,13 @@
import com.ibm.cloud.cloudant.v1.model.ChangesResultItem;
import com.ibm.cloud.cloudant.v1.model.ContentInformationSizes;
import com.ibm.cloud.cloudant.v1.model.CorsInformation;
import com.ibm.cloud.cloudant.v1.model.CurrentDatabasesInformation;
import com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation;
import com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformationThroughput;
import com.ibm.cloud.cloudant.v1.model.DatabaseInformation;
import com.ibm.cloud.cloudant.v1.model.DatabaseInformationCluster;
import com.ibm.cloud.cloudant.v1.model.DatabaseInformationProps;
import com.ibm.cloud.cloudant.v1.model.DatabasesCountInformation;
import com.ibm.cloud.cloudant.v1.model.DbEvent;
import com.ibm.cloud.cloudant.v1.model.DbUpdates;
import com.ibm.cloud.cloudant.v1.model.DbsInfoResult;
Expand Down Expand Up @@ -70,8 +74,10 @@
import com.ibm.cloud.cloudant.v1.model.GetActivityTrackerEventsOptions;
import com.ibm.cloud.cloudant.v1.model.GetAllDbsOptions;
import com.ibm.cloud.cloudant.v1.model.GetAttachmentOptions;
import com.ibm.cloud.cloudant.v1.model.GetCapacityDatabasesInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCapacityThroughputInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCorsInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCurrentDatabasesInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetCurrentThroughputInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetDatabaseInformationOptions;
import com.ibm.cloud.cloudant.v1.model.GetDbUpdatesOptions;
Expand Down Expand Up @@ -3271,6 +3277,46 @@ public void testPostActivityTrackerEvents() throws Exception {
}

@Test(dependsOnMethods = { "testPostActivityTrackerEvents" })
public void testGetCapacityDatabasesInformation() throws Exception {
try {
GetCapacityDatabasesInformationOptions getCapacityDatabasesInformationOptions = new GetCapacityDatabasesInformationOptions();

// Invoke operation
Response<CapacityDatabasesInformation> response = service.getCapacityDatabasesInformation(getCapacityDatabasesInformationOptions).execute();
// Validate response
assertNotNull(response);
assertEquals(response.getStatusCode(), 200);

CapacityDatabasesInformation capacityDatabasesInformationResult = response.getResult();
assertNotNull(capacityDatabasesInformationResult);

} catch (ServiceResponseException e) {
fail(String.format("Service returned status code %d: %s%nError details: %s",
e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()));
}
}

@Test(dependsOnMethods = { "testGetCapacityDatabasesInformation" })
public void testGetCurrentDatabasesInformation() throws Exception {
try {
GetCurrentDatabasesInformationOptions getCurrentDatabasesInformationOptions = new GetCurrentDatabasesInformationOptions();

// Invoke operation
Response<CurrentDatabasesInformation> response = service.getCurrentDatabasesInformation(getCurrentDatabasesInformationOptions).execute();
// Validate response
assertNotNull(response);
assertEquals(response.getStatusCode(), 200);

CurrentDatabasesInformation currentDatabasesInformationResult = response.getResult();
assertNotNull(currentDatabasesInformationResult);

} catch (ServiceResponseException e) {
fail(String.format("Service returned status code %d: %s%nError details: %s",
e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()));
}
}

@Test(dependsOnMethods = { "testGetCurrentDatabasesInformation" })
public void testGetCurrentThroughputInformation() throws Exception {
try {
GetCurrentThroughputInformationOptions getCurrentThroughputInformationOptions = new GetCurrentThroughputInformationOptions();
Expand Down
Loading