use of com.ibm.streamsx.rest.Instance in project streamsx.topology by IBMStreams.
the class RemoteDistributedStreamsContext method setSubmissionInstance.
static void setSubmissionInstance(AppEntity entity) throws IOException {
Instance cfgInstance = getConfigInstance(entity);
if (cfgInstance != null) {
StreamsConnection sc = cfgInstance.getStreamsConnection();
boolean verify = cfgInstance.getStreamsConnection().isVerify();
JsonObject deploy = deploy(entity.submission);
Function<Executor, String> authenticatorO = sc.getAuthenticator();
deploy.addProperty(ContextProperties.SSL_VERIFY, verify);
JsonObject service;
if (authenticatorO instanceof ICP4DAuthenticator) {
ICP4DAuthenticator authenticator = (ICP4DAuthenticator) authenticatorO;
service = authenticator.config(verify);
} else if (authenticatorO instanceof StandaloneAuthenticator) {
StandaloneAuthenticator authenticator = (StandaloneAuthenticator) authenticatorO;
service = authenticator.config(verify);
String buildServiceUrl = getConfigBuildServiceUrl(entity);
if (buildServiceUrl == null) {
buildServiceUrl = System.getenv(Util.STREAMS_BUILD_URL);
}
if (buildServiceUrl != null) {
// Copy so we don't affect instance. Version of gson we
// use lacks deepCopy() so we serialize / parse to copy.
String json = service.toString();
service = new JsonParser().parse(json).getAsJsonObject();
JsonObject connInfo = service.getAsJsonObject(CONNECTION_INFO);
if (connInfo.has(SERVICE_BUILD_ENDPOINT)) {
connInfo.remove(SERVICE_BUILD_ENDPOINT);
}
connInfo.addProperty(SERVICE_BUILD_ENDPOINT, buildServiceUrl);
}
} else {
throw new IllegalStateException("Invalid Instance for Streams V5: " + cfgInstance);
}
deploy.add(StreamsKeys.SERVICE_DEFINITION, service);
}
}
use of com.ibm.streamsx.rest.Instance in project streamsx.topology by IBMStreams.
the class RemoteEdgeContext method setSubmissionInstance.
static void setSubmissionInstance(AppEntity entity) throws IOException {
Instance cfgInstance = getConfigInstance(entity);
if (cfgInstance != null) {
StreamsConnection sc = cfgInstance.getStreamsConnection();
boolean verify = cfgInstance.getStreamsConnection().isVerify();
JsonObject deploy = deploy(entity.submission);
Function<Executor, String> authenticatorO = sc.getAuthenticator();
deploy.addProperty(ContextProperties.SSL_VERIFY, verify);
JsonObject service;
if (authenticatorO instanceof ICP4DAuthenticator) {
ICP4DAuthenticator authenticator = (ICP4DAuthenticator) authenticatorO;
service = authenticator.config(verify);
} else if (authenticatorO instanceof StandaloneAuthenticator) {
StandaloneAuthenticator authenticator = (StandaloneAuthenticator) authenticatorO;
service = authenticator.config(verify);
String buildServiceUrl = getConfigBuildServiceUrl(entity);
if (buildServiceUrl == null) {
buildServiceUrl = System.getenv(Util.STREAMS_BUILD_URL);
}
if (buildServiceUrl != null) {
// Copy so we don't affect instance. Version of gson we
// use lacks deepCopy() so we serialize / parse to copy.
String json = service.toString();
service = new JsonParser().parse(json).getAsJsonObject();
JsonObject connInfo = service.getAsJsonObject(CONNECTION_INFO);
if (connInfo.has(SERVICE_BUILD_ENDPOINT)) {
connInfo.remove(SERVICE_BUILD_ENDPOINT);
}
connInfo.addProperty(SERVICE_BUILD_ENDPOINT, buildServiceUrl);
}
} else {
throw new IllegalStateException("Invalid Instance for Streams V5: " + cfgInstance);
}
deploy.add(StreamsKeys.SERVICE_DEFINITION, service);
}
}
use of com.ibm.streamsx.rest.Instance in project streamsx.topology by IBMStreams.
the class AnalyticsServiceStreamsContext method getSasServiceBase.
/**
* Get the SAS OS version base.
*/
private static int getSasServiceBase(AppEntity entity) {
// Need to interrogate the service to figure out
// the os version of the service.
StreamingAnalyticsService sas;
try {
sas = sas(entity);
Instance instance = sas.getInstance();
ActiveVersion ver = instance.getActiveVersion();
// service force remote build.
return Integer.valueOf(ver.getMinimumOSBaseVersion());
} catch (IOException e) {
;
}
return -1;
}
use of com.ibm.streamsx.rest.Instance in project streamsx.topology by IBMStreams.
the class InstanceTest method testOfEndpoint_configured.
@Test
public void testOfEndpoint_configured() throws IOException {
assumeNotNull(System.getenv("CP4D_URL"));
assumeNotNull(System.getenv("STREAMS_INSTANCE_ID"));
Instance instance = Instance.ofEndpoint(null, null, null, null, sslVerify());
check(instance);
}
use of com.ibm.streamsx.rest.Instance in project streamsx.topology by IBMStreams.
the class StreamingAnalyticsConnectionTest method getTestService.
static StreamingAnalyticsService getTestService() throws IOException {
String serviceName = System.getenv("STREAMING_ANALYTICS_SERVICE_NAME");
String vcapServices = System.getenv("VCAP_SERVICES");
// if we don't have serviceName or vcapServices, skip the test
assumeNotNull(serviceName, vcapServices);
StreamingAnalyticsService service = StreamingAnalyticsService.of(null, null);
Instance instance = service.getInstance();
// bail if streaming analytics instance isn't up & running
assumeTrue(instance.getStatus().equals("running"));
return service;
}
Aggregations