use of com.ibm.cloud.cloudant.v1.Cloudant in project cloudant-java-sdk by IBM.
the class Cloudant method getMembershipInformation.
/**
* Retrieve cluster membership information.
*
* Displays the nodes that are part of the cluster as `cluster_nodes`. The field, `all_nodes`, displays all nodes this
* node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a
* cluster.
*
* @param getMembershipInformationOptions the {@link GetMembershipInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link MembershipInformation}
*/
public ServiceCall<MembershipInformation> getMembershipInformation(GetMembershipInformationOptions getMembershipInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_membership"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getMembershipInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<MembershipInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<MembershipInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.Cloudant in project cloudant-java-sdk by IBM.
the class Cloudant method getIndexesInformation.
/**
* Retrieve information about all indexes.
*
* When you make a GET request to `/db/_index`, you get a list of all indexes used by Cloudant Query in the database,
* including the primary index. In addition to the information available through this API, indexes are also stored in
* the `indexes` property of design documents.
*
* @param getIndexesInformationOptions the {@link GetIndexesInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link IndexesInformation}
*/
public ServiceCall<IndexesInformation> getIndexesInformation(GetIndexesInformationOptions getIndexesInformationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getIndexesInformationOptions, "getIndexesInformationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("db", getIndexesInformationOptions.db());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{db}/_index", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getIndexesInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<IndexesInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<IndexesInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.Cloudant in project cloudant-java-sdk by IBM.
the class Cloudant method getSchedulerJobs.
/**
* Retrieve replication scheduler jobs.
*
* Retrieves information about replications that were created via `/_replicate` endpoint, as well as those created
* from replication documents. It doesn't include replications that completed or failed to start because replication
* documents were malformed. Each job description includes source and target information, replication ID, history of
* recent events, and other information.
*
* @param getSchedulerJobsOptions the {@link GetSchedulerJobsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link SchedulerJobsResult}
*/
public ServiceCall<SchedulerJobsResult> getSchedulerJobs(GetSchedulerJobsOptions getSchedulerJobsOptions) {
if (getSchedulerJobsOptions == null) {
getSchedulerJobsOptions = new GetSchedulerJobsOptions.Builder().build();
}
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_scheduler/jobs"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getSchedulerJobs");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getSchedulerJobsOptions.limit() != null) {
builder.query("limit", String.valueOf(getSchedulerJobsOptions.limit()));
}
if (getSchedulerJobsOptions.skip() != null) {
builder.query("skip", String.valueOf(getSchedulerJobsOptions.skip()));
}
ResponseConverter<SchedulerJobsResult> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<SchedulerJobsResult>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.Cloudant in project cloudant-java-sdk by IBM.
the class Cloudant method putCorsConfiguration.
/**
* Modify CORS configuration.
*
* Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your
* account.
*
* @param putCorsConfigurationOptions the {@link PutCorsConfigurationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Ok}
*/
public ServiceCall<Ok> putCorsConfiguration(PutCorsConfigurationOptions putCorsConfigurationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(putCorsConfigurationOptions, "putCorsConfigurationOptions cannot be null");
RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/config/cors"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "putCorsConfiguration");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.add("origins", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(putCorsConfigurationOptions.origins()));
if (putCorsConfigurationOptions.allowCredentials() != null) {
contentJson.addProperty("allow_credentials", putCorsConfigurationOptions.allowCredentials());
}
if (putCorsConfigurationOptions.enableCors() != null) {
contentJson.addProperty("enable_cors", putCorsConfigurationOptions.enableCors());
}
builder.bodyJson(contentJson);
ResponseConverter<Ok> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Ok>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.cloud.cloudant.v1.Cloudant in project cloudant-java-sdk by IBM.
the class Cloudant method getCorsInformation.
/**
* Retrieve CORS configuration information.
*
* Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the
* server interact to determine whether or not to allow the request.
*
* @param getCorsInformationOptions the {@link GetCorsInformationOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link CorsInformation}
*/
public ServiceCall<CorsInformation> getCorsInformation(GetCorsInformationOptions getCorsInformationOptions) {
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/_api/v2/user/config/cors"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("cloudant", "v1", "getCorsInformation");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<CorsInformation> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<CorsInformation>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations