// tslint:disable /** * Copyright 2020 Splunk, Inc. * * 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. * * Machine Learning * Use the Machine Learning service in Splunk Cloud Services to deliver resource intensive machine learning workloads. The Machine Learning service covers model experimentation, training, inference, validation, scoring, and serving. * * OpenAPI spec version: v2beta1.1 (recommended default) * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { Workflow, WorkflowBuild, WorkflowBuildError, WorkflowBuildLog, WorkflowDeployment, WorkflowDeploymentError, WorkflowDeploymentLog, WorkflowInference, WorkflowRun, WorkflowRunError, WorkflowRunLog, WorkflowStreamDeployment, WorkflowsGetResponse, } from '../models'; import BaseApiService from "../../../../baseapiservice"; import { MLServiceExtensions } from "../../../../service_extensions/ml"; import { SplunkError, RequestStatus } from '../../../../client'; export const ML_SERVICE_PREFIX: string = '/ml/v2beta1'; export const ML_SERVICE_CLUSTER: string = 'api'; /** * Machine Learning * Version: v2beta1.1 * Use the Machine Learning service in Splunk Cloud Services to deliver resource intensive machine learning workloads. The Machine Learning service covers model experimentation, training, inference, validation, scoring, and serving. */ export class GeneratedMLService extends BaseApiService { getServiceCluster() : string { return ML_SERVICE_CLUSTER } getServicePrefix() : string { return ML_SERVICE_PREFIX; } /** * Creates a workflow configuration. * @param workflow Workflow configuration to be created. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Workflow */ public createWorkflow = (workflow: Workflow, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path = `/ml/v2beta1/workflows`; return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflow, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Workflow); } /** * Creates a workflow build. * @param id The workflow ID. * @param workflowBuild Input data used to build the workflow. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowBuild */ public createWorkflowBuild = (id: string, workflowBuild: WorkflowBuild, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds`(path_params); return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflowBuild, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowBuild); } /** * Creates a workflow deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param workflowDeployment Input data used to build the workflow deployment. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowDeployment */ public createWorkflowDeployment = (id: string, buildId: string, workflowDeployment: WorkflowDeployment, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments`(path_params); return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflowDeployment, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowDeployment); } /** * Creates a workflow inference request. * @param id The workflow ID. * @param buildId The workflow build ID. * @param deploymentId The workflow deployment ID. * @param workflowInference Input data to the inference request. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowInference */ public createWorkflowInference = (id: string, buildId: string, deploymentId: string, workflowInference: WorkflowInference, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, deploymentId: deploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments/${'deploymentId'}/inference`(path_params); return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflowInference, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowInference); } /** * Creates a workflow run. * @param id The workflow ID. * @param buildId The workflow build ID. * @param workflowRun Input data used to build the workflow. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowRun */ public createWorkflowRun = (id: string, buildId: string, workflowRun: WorkflowRun, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs`(path_params); return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflowRun, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowRun); } /** * Creates a workflow streaming deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param workflowStreamDeployment Configuration for the workflow streaming deployment. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowStreamDeployment */ public createWorkflowStreamDeployment = (id: string, buildId: string, workflowStreamDeployment: WorkflowStreamDeployment, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/stream-deployments`(path_params); return this.client.post(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), workflowStreamDeployment, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowStreamDeployment); } /** * Removes a workflow configuration. * @param id The workflow ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteWorkflow = (id: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id }; const path = this.template`/ml/v2beta1/workflows/${'id'}`(path_params); return this.client.delete(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes a workflow build. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteWorkflowBuild = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}`(path_params); return this.client.delete(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes a workflow deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param deploymentId The workflow deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteWorkflowDeployment = (id: string, buildId: string, deploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, deploymentId: deploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments/${'deploymentId'}`(path_params); return this.client.delete(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes a workflow run. * @param id The workflow ID. * @param buildId The workflow build ID. * @param runId The workflow run ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteWorkflowRun = (id: string, buildId: string, runId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, runId: runId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs/${'runId'}`(path_params); return this.client.delete(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes a workflow streaming deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param streamDeploymentId The workflow streaming deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteWorkflowStreamDeployment = (id: string, buildId: string, streamDeploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, streamDeploymentId: streamDeploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/stream-deployments/${'streamDeploymentId'}`(path_params); return this.client.delete(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Returns a workflow configuration. * @param id The workflow ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Workflow */ public getWorkflow = (id: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id }; const path = this.template`/ml/v2beta1/workflows/${'id'}`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Workflow); } /** * Returns the status of a workflow build. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowBuild */ public getWorkflowBuild = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowBuild); } /** * Returns a list of workflow errors. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowBuildError */ public getWorkflowBuildError = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/errors`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowBuildError); } /** * Returns the logs from a workflow build. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowBuildLog */ public getWorkflowBuildLog = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/logs`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowBuildLog); } /** * Returns the status of a workflow deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param deploymentId The workflow deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowDeployment */ public getWorkflowDeployment = (id: string, buildId: string, deploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, deploymentId: deploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments/${'deploymentId'}`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowDeployment); } /** * Returns a list of workflow deployment errors. * @param id The workflow ID. * @param buildId The workflow build ID. * @param deploymentId The workflow deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowDeploymentError */ public getWorkflowDeploymentError = (id: string, buildId: string, deploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, deploymentId: deploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments/${'deploymentId'}/errors`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowDeploymentError); } /** * Returns the logs from a workflow deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param deploymentId The workflow deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowDeploymentLog */ public getWorkflowDeploymentLog = (id: string, buildId: string, deploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, deploymentId: deploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments/${'deploymentId'}/logs`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowDeploymentLog); } /** * Returns the status of a workflow run. * @param id The workflow ID. * @param buildId The workflow build ID. * @param runId The workflow run ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowRun */ public getWorkflowRun = (id: string, buildId: string, runId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, runId: runId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs/${'runId'}`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowRun); } /** * Returns the errors for a workflow run. * @param id The workflow ID. * @param buildId The workflow build ID. * @param runId The workflow run ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowRunError */ public getWorkflowRunError = (id: string, buildId: string, runId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, runId: runId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs/${'runId'}/errors`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowRunError); } /** * Returns the logs for a workflow run. * @param id The workflow ID. * @param buildId The workflow build ID. * @param runId The workflow run ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowRunLog */ public getWorkflowRunLog = (id: string, buildId: string, runId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, runId: runId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs/${'runId'}/logs`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowRunLog); } /** * Returns the status of a workflow streaming deployment. * @param id The workflow ID. * @param buildId The workflow build ID. * @param streamDeploymentId The workflow streaming deployment ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return WorkflowStreamDeployment */ public getWorkflowStreamDeployment = (id: string, buildId: string, streamDeploymentId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { id: id, buildId: buildId, streamDeploymentId: streamDeploymentId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/stream-deployments/${'streamDeploymentId'}`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as WorkflowStreamDeployment); } /** * Returns a list of workflow builds. * @param id The workflow ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listWorkflowBuilds = (id: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path_params = { id: id }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns a list of workflow deployments. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listWorkflowDeployments = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/deployments`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns a list of workflow runs. * @param id The workflow ID. * @param buildId The workflow build ID. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listWorkflowRuns = (id: string, buildId: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path_params = { id: id, buildId: buildId }; const path = this.template`/ml/v2beta1/workflows/${'id'}/builds/${'buildId'}/runs`(path_params); return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns a list of workflow configurations. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listWorkflows = (args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/ml/v2beta1/workflows`; return this.client.get(ML_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } } export type MLService = GeneratedMLService & MLServiceExtensions; export const MLService = MLServiceExtensions(GeneratedMLService);