@Beta public class LeonardoMlService extends Object
LeonardoMlFoundation
.
Be aware that this class is in Beta (as indicated by the annotation) and therefore subject to breaking changes.
Constructor and Description |
---|
LeonardoMlService(ScpCfService mlService)
Create an instance with the ML service information provided.
|
Modifier and Type | Method and Description |
---|---|
static LeonardoMlService |
create(String cfServiceType,
String serviceUrlKey)
Generic creation of a service instance.
|
<R> R |
invoke(org.apache.http.client.methods.HttpRequestBase request,
Function<org.apache.http.HttpResponse,R> resultProcessor)
Invokes the given request against the service and returns results.
|
public LeonardoMlService(@Nonnull ScpCfService mlService)
mlService
- service information - ideally provided from LeonardoMlFoundation
's methods.IllegalArgumentException
- if there is no service location info available in given service or if it is not a URI.create(String, String)
@Nonnull public static LeonardoMlService create(@Nonnull String cfServiceType, @Nonnull String serviceUrlKey) throws CloudPlatformException
cfServiceType
- the Cloud Foundry service type to look for in the environmentserviceUrlKey
- the name of the URL entry for the specific service in the credentials section of the Cloud Foundry
service information.CloudPlatformException
- if the service cannot be found or required information is missing@Nullable public <R> R invoke(@Nonnull org.apache.http.client.methods.HttpRequestBase request, @Nonnull Function<org.apache.http.HttpResponse,R> resultProcessor) throws MlServiceFailureException, CloudPlatformException
R
- result typerequest
- the request prepared with request entity. Target url can be anything and will be set by this class.resultProcessor
- will be invoked with the request response for reading and returning the result. An exception thrown by
the processor will be passed through.MlServiceFailureException
- if the service invocation failsCloudPlatformException
- if there is a problem authorizing the accessCopyright © 2018 SAP SE. All rights reserved.