use of com.ibm.watson.discovery.v1.model.Configuration in project java-sdk by watson-developer-cloud.
the class Discovery method createCredentials.
/**
* Create credentials.
*
* <p>Creates a set of credentials to connect to a remote source. Created credentials are used in
* a configuration to associate a collection with the remote source.
*
* <p>**Note:** All credentials are sent over an encrypted connection and encrypted at rest.
*
* @param createCredentialsOptions the {@link CreateCredentialsOptions} containing the options for
* the call
* @return a {@link ServiceCall} with a result of type {@link Credentials}
*/
public ServiceCall<Credentials> createCredentials(CreateCredentialsOptions createCredentialsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(createCredentialsOptions, "createCredentialsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("environment_id", createCredentialsOptions.environmentId());
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments/{environment_id}/credentials", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createCredentials");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("version", String.valueOf(this.version));
final JsonObject contentJson = new JsonObject();
if (createCredentialsOptions.sourceType() != null) {
contentJson.addProperty("source_type", createCredentialsOptions.sourceType());
}
if (createCredentialsOptions.credentialDetails() != null) {
contentJson.add("credential_details", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCredentialsOptions.credentialDetails()));
}
if (createCredentialsOptions.status() != null) {
contentJson.add("status", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCredentialsOptions.status()));
}
builder.bodyJson(contentJson);
ResponseConverter<Credentials> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Credentials>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.watson.discovery.v1.model.Configuration in project java-sdk by watson-developer-cloud.
the class Discovery method createGateway.
/**
* Create Gateway.
*
* <p>Create a gateway configuration to use with a remotely installed gateway.
*
* @param createGatewayOptions the {@link CreateGatewayOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a result of type {@link Gateway}
*/
public ServiceCall<Gateway> createGateway(CreateGatewayOptions createGatewayOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("environment_id", createGatewayOptions.environmentId());
RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments/{environment_id}/gateways", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("version", String.valueOf(this.version));
final JsonObject contentJson = new JsonObject();
if (createGatewayOptions.name() != null) {
contentJson.addProperty("name", createGatewayOptions.name());
}
builder.bodyJson(contentJson);
ResponseConverter<Gateway> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Gateway>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
use of com.ibm.watson.discovery.v1.model.Configuration in project java-sdk by watson-developer-cloud.
the class Discovery method deleteConfiguration.
/**
* Delete a configuration.
*
* <p>The deletion is performed unconditionally. A configuration deletion request succeeds even if
* the configuration is referenced by a collection or document ingestion. However, documents that
* have already been submitted for processing continue to use the deleted configuration. Documents
* are always processed with a snapshot of the configuration as it existed at the time the
* document was submitted.
*
* @param deleteConfigurationOptions the {@link DeleteConfigurationOptions} containing the options
* for the call
* @return a {@link ServiceCall} with a result of type {@link DeleteConfigurationResponse}
*/
public ServiceCall<DeleteConfigurationResponse> deleteConfiguration(DeleteConfigurationOptions deleteConfigurationOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(deleteConfigurationOptions, "deleteConfigurationOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("environment_id", deleteConfigurationOptions.environmentId());
pathParamsMap.put("configuration_id", deleteConfigurationOptions.configurationId());
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments/{environment_id}/configurations/{configuration_id}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteConfiguration");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.query("version", String.valueOf(this.version));
ResponseConverter<DeleteConfigurationResponse> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<DeleteConfigurationResponse>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations