From 3bdbccfa6c92da41647a956c721735fa0ef5f0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20R=C3=B6hrig?= <54274238+jridfe@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:52:15 +0100 Subject: [PATCH] Release 1.0.0 (#1) * Release 1.0.0 * Enable DCO bot --- .abapgit.xml | 19 + .github/dco.yml | 4 + README.md | 481 +- src/package.devc.xml | 10 + src/zcl_ibmx_service.clas.abap | 2142 +++ src/zcl_ibmx_service.clas.xml | 204 + src/zcl_ibmx_service_arch.clas.abap | 566 + src/zcl_ibmx_service_arch.clas.xml | 144 + src/zcl_ibmx_service_ext.clas.abap | 1182 ++ src/zcl_ibmx_service_ext.clas.xml | 120 + src/zcl_ibmx_util.clas.abap | 611 + src/zcl_ibmx_util.clas.xml | 60 + src/zcl_ibmx_watsonx_ai_ml_v1.clas.abap | 5199 +++++++ src/zcl_ibmx_watsonx_ai_ml_v1.clas.xml | 114 + src/zcl_ibmx_wml_v4.clas.abap | 15717 +++++++++++++++++++++ src/zcl_ibmx_wml_v4.clas.xml | 504 + src/zcx_ibmx_service_exception.clas.abap | 80 + src/zcx_ibmx_service_exception.clas.xml | 25 + src/zibmx.msag.xml | 416 + src/zibmx_config.tabl.xml | 87 + src/zibmx_dom_stringvalue.doma.xml | 14 + src/zibmx_token.tabl.xml | 141 + src/zibmx_ty_instance_uid.dtel.xml | 24 + src/zibmx_ty_stringvalue.dtel.xml | 23 + src/zif_ibmx_service_arch.intf.abap | 154 + src/zif_ibmx_service_arch.intf.xml | 15 + 26 files changed, 28054 insertions(+), 2 deletions(-) create mode 100644 .abapgit.xml create mode 100644 .github/dco.yml create mode 100644 src/package.devc.xml create mode 100644 src/zcl_ibmx_service.clas.abap create mode 100644 src/zcl_ibmx_service.clas.xml create mode 100644 src/zcl_ibmx_service_arch.clas.abap create mode 100644 src/zcl_ibmx_service_arch.clas.xml create mode 100644 src/zcl_ibmx_service_ext.clas.abap create mode 100644 src/zcl_ibmx_service_ext.clas.xml create mode 100644 src/zcl_ibmx_util.clas.abap create mode 100644 src/zcl_ibmx_util.clas.xml create mode 100644 src/zcl_ibmx_watsonx_ai_ml_v1.clas.abap create mode 100644 src/zcl_ibmx_watsonx_ai_ml_v1.clas.xml create mode 100644 src/zcl_ibmx_wml_v4.clas.abap create mode 100644 src/zcl_ibmx_wml_v4.clas.xml create mode 100644 src/zcx_ibmx_service_exception.clas.abap create mode 100644 src/zcx_ibmx_service_exception.clas.xml create mode 100644 src/zibmx.msag.xml create mode 100644 src/zibmx_config.tabl.xml create mode 100644 src/zibmx_dom_stringvalue.doma.xml create mode 100644 src/zibmx_token.tabl.xml create mode 100644 src/zibmx_ty_instance_uid.dtel.xml create mode 100644 src/zibmx_ty_stringvalue.dtel.xml create mode 100644 src/zif_ibmx_service_arch.intf.abap create mode 100644 src/zif_ibmx_service_arch.intf.xml diff --git a/.abapgit.xml b/.abapgit.xml new file mode 100644 index 0000000..9727f9c --- /dev/null +++ b/.abapgit.xml @@ -0,0 +1,19 @@ + + + + + E + /src/ + PREFIX + + /.gitignore + /LICENSE + /README.md + /package.json + /.travis.yml + /.gitlab-ci.yml + /abaplint.json + + + + diff --git a/.github/dco.yml b/.github/dco.yml new file mode 100644 index 0000000..de6cd3b --- /dev/null +++ b/.github/dco.yml @@ -0,0 +1,4 @@ +# This enables DCO bot for you, please take a look https://github.com/probot/dco +# for more details. +require: + members: false diff --git a/README.md b/README.md index e06c383..f506091 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,479 @@ -# abap-sdk-btp-x -tbd + + +# ABAP SDK for IBM watsonx, using SAP BTP ABAP Environment + +[![License](https://img.shields.io/badge/License-Apache2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) + +ABAP® client library to use the [Watson Machine Learning][wml] and the +[watsonx.ai][wxai] APIs. + +This is a community SDK written by ABAPers for the ABAPers in the Open +Source community, to provide easy usage of IBM® +watsonx services in innovation initiatives using the +SAP® Business Technology Platform ABAP Environment. It is +the choice and responsibility of application developers how this +community SDK is used. + +Additionally, as the ABAP SDK is a community release it is not updated +with the same schedule as IBM-supported SDKs. Please see more +information in [Support and Feedback](#support-and-feedback). + +# Choose ABAP SDK release for the applicable ABAP Runtime + +| [abap-sdk-nwas-x](https://github.com/IBM/abap-sdk-nwas-x) | **abap-sdk-btp-x** | +|---|---| +| for SAP NetWeaver® AS ABAP 7.50+ | for SAP BTP ABAP Environment | +| tested on SAP Business Suite and SAP S/4HANA on-premises edition | tested with SAP BTP ABAP Environment 2402 | +| | `this repository` | + +--- + +
+ Table of Contents + +- [Announcements](#announcements) + - [Major version 1.0.0 released](#major-version-100-released) +- [Before you begin](#before-you-begin) +- [Installation](#installation) +- [SSL Certificates](#ssl-certificates) +- [Credentials](#credentials) +- [Configuration table](#configuration-table) +- [IAM Authentication](#iam-authentication) +- [Usage](#usage) + - [Examples](#examples) +- [API Reference](#api-reference) +- [Support and Feedback](#support-and-feedback) +- [License](#license) + +
+ +## Announcements + +### Major version 1.0.0 released + +Version v1.0.0 of the SDK has been released. + +## Before you begin + +* You need an [IBM Cloud][ibm_cloud_onboarding] account. + +## Installation + +The client library is provided as abapGit repository. Proceed as +follows to clone the ABAP SDK code to your SAP system. + +1. Install the [abapGit Plug-In][abapgit_plugin] for ADT. +2. Use abapGit to clone the ABAP SDK Git repository into your SAP + system. +3. Assign the ABAP SDK to the package `ZIBMX` when performing setup of + the abapGit repository. + +## SSL Certificates + +Communication between SAP and the IBM Cloud is secured by the +Transport Layer Security (TLS) protocol, also known as Secure Sockets +Layer (SSL). SSL requires certificates that must be stored in the SAP +BTP Certificate Trust List, which can be maintained +through the SAP BTP ABAP Environment dashboard. Ensure +that the *DigiCert Global Root CA* certificate is installed. + +## Credentials + +Before you can access a specific service from your SAP system, you +must create a service instance in the IBM Cloud and +[obtain an API key](https://cloud.ibm.com/docs/account?topic=account-userapikey&interface=ui). +The API key can be shared among multiple end users of the SAP system, but +you must ensure that the selected plan is sufficient to support the expected +number of calls or the expected data volume. + +All currently supported services support IAM authentication (see +below). Service credentials consist of an API key and a URL. Both the +API key and the URL are character values that need to be provided as parameters +`i_apikey` and `i_url` to method `zcl_ibmx_service_ext=>get_instance`. + +You can store the values with your application, but it is suggested to +do that in an encrypted format. Using cloud services usually creates +costs based on usage for the owner of the service instance, and anyone +with the credentials can use the service instance at the owner's +expenses. If you want to distribute the costs over multiple cost +centers, you need to create a service instance and provide service +credentials for each cost center separately. + +## Configuration table + +Service credentials and other parameters that must be specified at +watsonx service wrapper ABAP class instantiation can also be provided +in table `ZIBMX_CONFIG`. This table has three keys: + +| Table Key | Description | +|:------------ |:-------------------------------------------------------------------------------------------------------------------------------------- | +| SERVICE | The ABAP class name without prefix ZCL_IBMX_ | +| INSTANCE_UID | ID chosen by application developer that must be provided by application as parameter to method `zcl_ibmx_service_ext=>get_instance()` | +| PARAM | The parameter name | + +
+ List of configuration parameters in table ZIBMX_CONFIG + +| Parameter Name | Default Value | Description | +|:----------------- |:----------------- |:--------------------------------------------------------------------------- | +| URL | service-dependent | watsonx service url | +| APIKEY | | watsonx service API keys | +| AUTH_NAME | service-dependent | Authorization, `IAM` or `basicAuth` | + +
+ +## IAM Authentication + +Identity and Access Management (IAM) is a bearer-token based +authentication method. Token management is either performed by the +ABAP SDK or must be implemented by the SDK user.
If a value for +`i_apikey` is provided by the caller in method +`zcl_ibmx_service_ext=>get_instance()`, the ABAP SDK generates a +bearer-token under the cover when needed and refreshes it when it is +about to expire.
If `i_apikey` is not provided for method +`zcl_ibmx_service_ext=>get_instance()`, the ABAP SDK user must +implement an individual token management. Before a service method is +called the first time, a valid bearer-token must be provided to the +watsonx service wrapper ABAP class instance as follows: + +```abap + lo_service_class->set_bearer_token( i_bearer_token = '...' ). +``` + +Afterwards, service methods can be called as long as the provided +token is valid. When the token has expired, the method above must be +called again with a new (refreshed) bearer-token as parameter. + +## Usage + +The client library is delivered as package *ZIBMX*. Once the Git +Repository has been cloned to the SAP system, a watsonx service +instance is wrapped by an ABAP class instance.
The following +watsonx services are currently supported: + +| Service | ABAP Class Name | +|:------------------------------ |:----------------------------------- | +| Watson Machine Learning | ZCL_IBMX_WML_V4 | +| watsonx.ai | ZCL_IBMX_WATSONX_AI_ML_V1 | + +Using the client library requires two steps: + +1. Create an instance of the watsonx service wrapper ABAP class by + calling method `zcl_ibmx_service_ext=>get_instance`. + +```abap + data: + lo_service_class type . + + zcl_ibmx_service_ext=>get_instance( + exporting + i_url = + i_apikey = + ... + importing + eo_instance = lo_service_class ). +``` + +2. Call the watsonx service API endpoint by invoking the corresponding + class method. + +```abap + try. + lo_service_class->method( + exporting + is_input = ... + importing + es_output = ... ). + catch zcx_ibmx_service_exception into data(lo_service_exception). + ... + endtry. +``` + +### Examples + +
+ Watson Machine Learning Example + +```abap +* Z_WML_DEMO +* This sample code deploys arbitrary Python code as Python function on a watsonx deployment space +* and calls the deployed function. +* It also returns a CURL command that can be called to invoke the function endpoint url. +* +* Copy this code into +* - an ABAP report and remove all comment prefixes "[PRG] +* - a Console Application (RAP) and remove all comment prefixes "[RAP] +* Adjust credentials and run code. + + constants: + " Prerequisite: watsonx deployment space must be created and id specified here: + c_url type string value `https://eu-de.ml.cloud.ibm.com`, " <- ADJUST + c_apikey type string value `X7ZiqsaYv9X...OAYFxxhAno`, " <- ADJUST + c_space_id type string value `78f395be-...-a1d1abb8644b`, " <- ADJUST + c_function_name type string value `demo-python-function`, + c_serving_name type string value `abapsdk_test`, + c_version type string value `2023-07-07`. + + " convert Python function code to GZIP file (ZIP with file header 0x04034b50 is not supported) + try. + data(lx_code) = zcl_ibmx_service=>convert_string_to_utf8( + i_string = + `def score(input_data):` && cl_abap_char_utilities=>newline && + ` # some Python code` && cl_abap_char_utilities=>newline && + ` return {'predictions': [{'values': [['SUCCESS (ABAP SDK used for deployment)']]}]}` + ). + + cl_abap_gzip=>compress_binary_with_header( + exporting + raw_in = lx_code + importing + gzip_out = data(lx_gzipfile) + ). + catch cx_root into data(lo_zip_exception). + "[RAP] out->write( lo_zip_exception->get_longtext( ) ). exit. + "[PRG] message lo_zip_exception type 'E'. + endtry. + + " instantiate Watson Machine Learning wrapper class (explicit type declaration is required) + data: lo_wml type ref to zcl_ibmx_wml_v4. + zcl_ibmx_service_ext=>get_instance( + exporting + i_url = c_url + i_apikey = c_apikey + i_version = c_version + importing + eo_instance = lo_wml ). + + " create Python function as asset in watsonx deployment space + try. + lo_wml->functions_create( + exporting + i_functionentityrequest = value zcl_ibmx_wml_v4=>t_function_entity_request( + name = c_function_name + space_id = c_space_id + type = `Python` + software_spec = value zcl_ibmx_wml_v4=>t_software_spec_rel( + name = `runtime-23.1-py3.10` + ) + ) + importing + e_response = data(ls_result_create) + ). + catch zcx_ibmx_service_exception into data(lo_create_exception). + "[RAP] out->write( lo_create_exception->get_longtext( ) ). exit. + "[PRG] message lo_create_exception type 'E'. + endtry. + data(lv_function_id) = ls_result_create-metadata-id. + + " upload Python function code + try. + lo_wml->functions_upload_code( + exporting + i_function_id = lv_function_id + i_space_id = c_space_id + i_upload_code = lx_gzipfile + i_contenttype = 'application/gzip' + importing + e_response = data(ls_result_upload) + ). + catch zcx_ibmx_service_exception into data(lo_upload_exception). + "[RAP] out->write( lo_upload_exception->get_longtext( ) ). exit. + "[PRG] message lo_upload_exception type 'E'. + endtry. + + " deploy Python function + try. + lo_wml->deployments_create( + exporting + i_deploymententityrequest = value zcl_ibmx_wml_v4=>t_deployment_entity_request( + space_id = c_space_id + name = `Deployment for ` && c_function_name + asset = value zcl_ibmx_wml_v4=>t_rel( + id = lv_function_id + ) + hardware_spec = value zcl_ibmx_wml_v4=>t_hardware_spec( + name = 'S' + ) + online = value zcl_ibmx_wml_v4=>t_online_request( + parameters = value zcl_ibmx_wml_v4=>t_online_parameters( + serving_name = c_serving_name + ) + ) + ) + importing + e_response = data(ls_deployment_result) + ). + catch zcx_ibmx_service_exception into data(lo_deployment_exception). + " http status 400 (bad request) -> delete existing deployment, if exists, and retry + "[RAP] out->write( lo_deployment_exception->get_longtext( ) ). exit. + "[PRG] message lo_deployment_exception type 'E'. + endtry. + data(lv_deployment_id) = ls_deployment_result-metadata-id. + + " wait until deployment is initialized + do 20 times. + try. + lo_wml->deployments_get( + exporting + i_space_id = c_space_id + i_deployment_id = lv_deployment_id + importing + e_response = data(ls_deployment) + ). + catch zcx_ibmx_service_exception into data(lo_deployment_get_exception). + "[RAP] out->write( lo_deployment_get_exception->get_longtext( ) ). exit. + "[PRG] message lo_deployment_get_exception type 'E'. + endtry. + if not ls_deployment-entity-status-state eq 'initializing'. + exit. + endif. + wait up to 5 seconds. + enddo. + + " call Python function endpoint with dummy input data + try. + lo_wml->deployments_compute_predict( + exporting + i_deployment_id = lv_deployment_id + i_syncscoringdata = value zcl_ibmx_wml_v4=>t_sync_scoring_data( + input_data = value #( + ( value zcl_ibmx_wml_v4=>t_sync_scoring_data_item( + fields = value #( ( `dummy` ) ) + values = value #( ( value #( ( ref #( `dummy` ) ) ) ) ) + ) ) ) ) + importing + e_response = data(ls_function_response) + ). + catch zcx_ibmx_service_exception into data(lo_predict_exception). + "[RAP] out->write( lo_predict_exception->get_longtext( ) ). exit. + "[PRG] message lo_predict_exception type 'E'. + endtry. + + " extract message from function response + try. + data(lr_msg) = ls_function_response-predictions[ 1 ]-values[ 1 ][ 1 ]. + assign lr_msg->* to field-symbol(). + catch cx_sy_itab_line_not_found into data(lo_line_not_found_exception). + "[RAP] out->write( lo_line_not_found_exception->get_longtext( ) ). exit. + "[PRG] message lo_line_not_found_exception type 'E'. + endtry. + + " compile CURL command to test deployment endpoint + data(lv_curl_command) = + `curl -X POST -H "Authorization: Bearer ${IAM_ACCESS_TOKEN}" ` + && `-d '{ "input_data": [{"fields": ["dummy"], "values": [["dummy"]]}] }' ` + && `"` && ls_deployment-entity-status-inference[ 1 ]-url && `?version=` && c_version && `"`. + + " write success message + data(lv_msg) = `Received message "` && && `" from deployed Python function. Try CURL command below.`. + "[RAP] out->write( lv_msg ). + "[RAP] out->write( lv_curl_command ). + "[PRG] write: lv_msg. + "[PRG] write: / lv_curl_command. +``` + +
+ +
+ watsonx.ai Example + +```abap +* Z_WATSONX_AI_DEMO +* This sample code runs text generation with a watsonx.ai foundation model. +* +* Copy this code into +* - an ABAP report and remove all comment prefixes "[PRG] +* - a Console Application (RAP) and remove all comment prefixes "[RAP] +* Adjust credentials and run code. + + " instantiate watsonx.ai wrapper class (explicit type declaration is required) + data: lo_watsonx_ai type ref to zcl_ibmx_watsonx_ai_ml_v1. + zcl_ibmx_service_ext=>get_instance( + exporting + i_url = 'https://eu-de.ml.cloud.ibm.com' " <- ADJUST + i_apikey = 'X7ZiqsanCt1sYv...ENYbFFfOAtAno' " <- ADJUST + i_version = '2023-05-29' + importing + eo_instance = lo_watsonx_ai ). + + " run text generation + try. + data(lv_prompt) = `The highest mountain in Europe is`. + lo_watsonx_ai->text_generation( + exporting + i_textgenrequest = value zcl_ibmx_watsonx_ai_ml_v1=>t_text_gen_request( + + " prompt + input = lv_prompt + + " model parameters + model_id = 'ibm/granite-13b-chat-v2' + parameters = value zcl_ibmx_watsonx_ai_ml_v1=>t_text_gen_parameters( + decoding_method = 'greedy' + max_new_tokens = 20 + repetition_penalty = '1.05' + stop_sequences = value #( ( `. ` ) ) " stop after first sentence + ) + + project_id = '3e606d0c-...-4e459b7c38' " <- ADJUST + ) + importing + e_response = data(ls_generated_document) ). + catch zcx_ibmx_service_exception into data(lo_service_exception). + "[RAP] out->write( lo_service_exception->get_longtext( ) ). exit. + "[PRG] message lo_service_exception type 'E'. + endtry. + + " display generated text + "[RAP] out->write( lv_prompt ). + "[PRG] write lv_prompt. + loop at ls_generated_document-results into data(ls_result). + "[RAP] out->write( ls_result-generated_text ). + "[PRG] write / ls_result-generated_text. + endloop. +``` + +
+ +## API Reference + +GitHub Pages contain the [ABAP Client Library for watsonx API Reference](https://IBM.github.io/abap-sdk-nwas-x/). + +## Support and Feedback + +The ABAP SDK is a community SDK for IBM watsonx, created by the IBM watsonx +development community and SAP's ABAP development community – written by +ABAPers from IBM Systems. Therefore, as a community release it is not +updated with the same schedule as IBM-supported SDKs and does not include +support by IBM. + +The code in this repository is generated from the OpenAPI specs of the +supported services. Hence, pull requests must not be integrated directly +into the code. If you would like to request a new feature or report a +bug, please raise an issue instead of sending a pull request. + +## License + +This library is licensed under the [Apache 2.0 license][license]. + +[wml]: https://cloud.ibm.com/apidocs/machine-learning +[wxai]: https://cloud.ibm.com/apidocs/watsonx-ai +[ibm_cloud]: https://cloud.ibm.com/ +[ibm_cloud_onboarding]: https://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-ABAP +[license]: http://www.apache.org/licenses/LICENSE-2.0 +[abapgit]: https://github.com/larshp/abapGit +[abapgit_docs]: https://docs.abapgit.org/ +[abapgit_plugin]: https://eclipse.abapgit.org/updatesite/ diff --git a/src/package.devc.xml b/src/package.devc.xml new file mode 100644 index 0000000..487cfdb --- /dev/null +++ b/src/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + ABAP SDK for IBM watsonx + + + + diff --git a/src/zcl_ibmx_service.clas.abap b/src/zcl_ibmx_service.clas.abap new file mode 100644 index 0000000..8501447 --- /dev/null +++ b/src/zcl_ibmx_service.clas.abap @@ -0,0 +1,2142 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +class ZCL_IBMX_SERVICE definition + public + inheriting from ZCL_IBMX_SERVICE_ARCH + create public . + +public section. + + types DATA_REFERENCE type ref to DATA . + types: + fieldname(30) type c . + types BOOLEAN type ZIF_IBMX_SERVICE_ARCH~BOOLEAN . + types CHAR type ZIF_IBMX_SERVICE_ARCH~CHAR . + types DATE type STRING . + types TIME type STRING . + types INTEGER type I . + types SHORT type INT2 . + types LONG type INT8 . + types FLOAT type F . + types DOUBLE type F . + types NUMBER type F . + types FILE type XSTRING . + types BINARY type XSTRING . + types JSONOBJECT type ref to DATA . + types MAP type ref to DATA . + types: + "!

+ datetime(27) type c . + types TT_STRING type ZIF_IBMX_SERVICE_ARCH~TT_STRING . + types: + tt_boolean type standard table of ZIF_IBMX_service_arch~boolean with non-unique default key . + types: + tt_char type standard table of ZIF_IBMX_service_arch~char with non-unique default key . + types: + tt_integer type standard table of integer with non-unique default key . + types: + tt_short type standard table of short with non-unique default key . + types: + tt_long type standard table of long with non-unique default key . + types: + tt_float type standard table of float with non-unique default key . + types: + tt_double type standard table of double with non-unique default key . + types: + tt_number type standard table of number with non-unique default key . + types: + tt_file type standard table of file with non-unique default key . + types: + tt_jsonobject type standard table of jsonobject with non-unique default key . + types: + t_array type standard table of jsonobject with non-unique default key . + types: + begin of ts_map_file, + key type string, + data type file, + end of ts_map_file . + types: + tt_map_file type standard table of ts_map_file with non-unique default key . + types: + begin of ts_file_with_metadata, + filename type string, + content_type type string, + data type xstring, + end of ts_file_with_metadata . + types: + tt_file_with_metadata type standard table of ts_file_with_metadata with non-unique default key . + types TS_FORM_PART type ZIF_IBMX_SERVICE_ARCH~TS_FORM_PART . + types TT_FORM_PART type ZIF_IBMX_SERVICE_ARCH~TT_FORM_PART . + + constants C_BOOLEAN_FALSE type BOOLEAN value SPACE ##NO_TEXT. + constants C_BOOLEAN_TRUE type BOOLEAN value 'X' ##NO_TEXT. + constants C_TRIBOOL_FALSE type BOOLEAN value '-' ##NO_TEXT. + constants C_DEFAULT type STRING value 'DEFAULT' ##NO_TEXT. + constants C_SUBRC_UNKNOWN type SY-SUBRC value 999999 ##NO_TEXT. + constants C_MSGID type SY-MSGID value 'ZIBMX' ##NO_TEXT. + constants C_I_ZERO type I value -2147481648 ##NO_TEXT. + constants C_I8_ZERO type INT8 value -9223372036854775608 ##NO_TEXT. + constants C_F_ZERO type F value '-2147481.648' ##NO_TEXT. + constants C_BLANK type STRING value '&#!-#&__%$X' ##NO_TEXT. + constants: + begin of c_empty, + _ type string value c_blank, + end of c_empty . + constants: + begin of c_datatype, + string type char value 'g', + struct type char value 'v', + end of c_datatype . + data P_REQUEST_PROP_DEFAULT type TS_REQUEST_PROP . + data P_DEBUG_MODE type CHAR value SPACE ##NO_TEXT. + data P_VERSION type STRING . + + "!

Returns a blank value.

+ "! + "! @parameter I_CHECK_ONLY | Only check if value is blank. + "! @parameter I_FIELD | Field to check, use if I_CHECK_ONLY = c_boolean_true. + "! @parameter C_FIELD | Field to check and update, use if I_CHECK_ONLY = c_boolean_false. + "! @parameter E_IS_BLANK | = c_boolean_true if C_FIELD was Internal table of component names. + "! + class-methods BLANK_VALUE + importing + value(I_CHECK_ONLY) type BOOLEAN default C_BOOLEAN_FALSE + !I_FIELD type ANY optional + changing + !C_FIELD type ANY optional + returning + value(E_IS_BLANK) type BOOLEAN . + "!

Raises an exception.

+ "! + "! @parameter I_MSGNO | Message number. + "! @parameter I_MSGV1 | Substitution for 1st placeholder in message. + "! @parameter I_MSGV2 | Substitution for 2nd placeholder in message. + "! @parameter I_MSGV3 | Substitution for 3rd placeholder in message. + "! @parameter I_MSGV4 | Substitution for 4th placeholder in message. + "! @parameter I_TEXT | Message text; specify if message number is not specified. + "! @parameter I_SUBRC | Return code being returned. + "! @parameter I_PREVIOUS | Exception that has been captured before. + "! @parameter I_HTTP_STATUS | HTTP status code if exception is triggered by HTTP error + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised. + "! + class-methods RAISE_EXCEPTION + importing + !I_MSGNO type SY-MSGNO optional + !I_MSGV1 type STRING optional + !I_MSGV2 type STRING optional + !I_MSGV3 type STRING optional + !I_MSGV4 type STRING optional + !I_TEXT type STRING optional + !I_SUBRC type SY-SUBRC default C_SUBRC_UNKNOWN + !I_PREVIOUS type ref to CX_ROOT optional + !I_HTTP_STATUS type TS_HTTP_STATUS optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Returns field type and length of a given parameter.

+ "! + "! @parameter I_FIELD | Field of type that is supposed to be determined. + "! @parameter E_TECHNICAL_TYPE | Technical type (= base type) of I_FIELD. + "! @parameter E_RELATIVE_TYPE | Relative type (= data type) of I_FIELD. + "! @parameter E_LENGTH | Length of type of I_FIELD. + "! + class-methods GET_FIELD_TYPE + importing + !I_FIELD type ANY + exporting + !E_TECHNICAL_TYPE type ZIF_IBMX_SERVICE_ARCH~CHAR + !E_RELATIVE_TYPE type STRING + !E_LENGTH type I . + "!

Returns component names of a given structure.

+ "! + "! @parameter I_STRUCTURE | Structure with components. + "! @parameter E_COMPONENTS | Internal table of component names. + "! + class-methods GET_COMPONENTS + importing + !I_STRUCTURE type ANY + exporting + value(E_COMPONENTS) type ZIF_IBMX_SERVICE_ARCH~TT_STRING . + "!

Parses a JSON string into an ABAP structure.

+ "! + "! @parameter I_JSON | JSON string. + "! @parameter I_DICTIONARY | Dictionary for mapping of identifier names. + "! @parameter C_ABAP | ABAP structure to be filled + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + class-methods PARSE_JSON + importing + !I_JSON type STRING + !I_DICTIONARY type ANY optional + changing + value(C_ABAP) type ANY + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Method for internal use.

+ "! + methods GET_REQUEST_PROP + importing + !I_AUTH_METHOD type STRING default C_DEFAULT + returning + value(E_REQUEST_PROP) type TS_REQUEST_PROP . + "!

Returns data type of a given parameter.

+ "! + "! @parameter I_FIELD | Field of type that is supposed to be determined. + "! @parameter E_DATATYPE | Technical type (= base type) of I_FIELD. + "! + class-methods GET_DATATYPE + importing + !I_FIELD type ANY + returning + value(E_DATATYPE) type ZIF_IBMX_SERVICE_ARCH~CHAR . + "!

Unescape unicode codepoints to characters in a string

, + "! e.g. '\u0041 b \u0063' -> 'A b c' + "! + "! @parameter I_IN | String with unicode codepoints. + "! @parameter E_OUT | Unescaped string. + "! + class-methods UNESCAPE_UNICODE + importing + !I_IN type STRING + returning + value(E_OUT) type STRING . + "!

Returns the file extension for a mime type

, + "! e.g. 'text/plain' -> 'txt' + "! + "! @parameter I_MIME_TYPE | MIME type. + "! @parameter E_EXTENSION | File extension (without leading dot). + "! + class-methods GET_FILE_EXTENSION + importing + value(I_MIME_TYPE) type STRING + returning + value(E_EXTENSION) type STRING . + "!

Moves a referenced data structure to an ABAP structure.

+ "! + "! @parameter I_DATA_REFERENCE | Reference to data object. + "! @parameter E_ABAP | ABAP structure to be filled. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + class-methods MOVE_DATA_REFERENCE_TO_ABAP + importing + !I_DATA_REFERENCE type DATA_REFERENCE + exporting + value(E_ABAP) type ANY + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Method for internal use.

+ "! + class-methods ADD_QUERY_PARAMETER + importing + !I_PARAMETER type STRING + !I_VALUE type STRING + !I_IS_BOOLEAN type BOOLEAN default C_BOOLEAN_FALSE + changing + !C_URL type TS_URL . + "!

Method for internal use.

+ "! + class-methods ADD_HEADER_PARAMETER + importing + !I_PARAMETER type STRING + !I_VALUE type STRING + !I_IS_BOOLEAN type BOOLEAN default C_BOOLEAN_FALSE + changing + !C_HEADERS type ZIF_IBMX_SERVICE_ARCH~TS_REQUEST_PROP-HEADERS . + "!

Method for internal use.

+ "! + class-methods GET_FULL_URL + importing + !I_URL type TS_URL + returning + value(E_URL) type STRING . + "!

Returns the service name.

+ "! + "! @parameter E_APPNAME | Name of the service. + "! + methods GET_APPNAME + returning + value(E_APPNAME) type STRING . + "!

Method for internal use.

+ "! + class-methods NORMALIZE_URL + changing + !C_URL type TS_URL . + "!

Extracts a JSON string from an ABAP structure.

+ "! + "! @parameter I_NAME | Name of component to be extracted. + "! @parameter I_VALUE | ABAP structure to be converted to JSON string. + "! @parameter I_DICTIONARY | Dictionary to be used for mapping ABAP identifiers to JSON keys. + "! @parameter I_REQUIRED_FIELDS | + "! Dictionary of required fields.
+ "! If a field is required, an initial value appears as initial value in JSON structure. + "! Otherwise it is omitted in JSON string. + "! @parameter I_LOWER_CASE | If set to C_BOOLEAN_TRUE all keys in JSON string will be lower case. + "! @parameter E_JSON | JSON string. + "! + class-methods ABAP_TO_JSON + importing + !I_NAME type STRING optional + !I_VALUE type ANY + !I_DICTIONARY type ANY optional + !I_REQUIRED_FIELDS type ANY optional + !I_LOWER_CASE type BOOLEAN default C_BOOLEAN_TRUE + returning + value(E_JSON) type STRING . + "!

Throws an exception, if HTTP response indicates an error.

+ "! + "! @parameter I_RESPONSE | HTTP response to be checked. + "! @parameter I_URL | URL that the request has been sent to. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods CHECK_HTTP_RESPONSE + importing + !I_RESPONSE type TO_REST_RESPONSE optional + !I_URL type TS_URL optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Class constructor.

+ "! + "! @parameter I_URL | URL of the service. + "! @parameter I_HOST | Host of the service. I_URL and I_HOST can be used synonymously. + "! @parameter I_PROXY_HOST | Proxy server, not applicable on SAP Cloud Platform. + "! @parameter I_PROXY_PORT | Proxy server port, not applicable on SAP Cloud Platform. + "! @parameter I_USERNAME | User name to authenticate on service. + "! @parameter I_PASSWORD | User password to authenticate on service. + "! @parameter I_APIKEY | API key password to authenticate on service. + "! @parameter I_ACCESS_TOKEN | Access token to authenticate on service. + "! @parameter I_SSL_ID | ID of PSE, not applicable on SAP Cloud Platform. + "! @parameter I_DEBUG_MODE | not used. + "! + methods CONSTRUCTOR + importing + !I_URL type STRING optional + !I_HOST type STRING optional + !I_PROXY_HOST type STRING optional + !I_PROXY_PORT type STRING optional + !I_USERNAME type STRING optional + !I_PASSWORD type STRING optional + !I_APIKEY type STRING optional + !I_ACCESS_TOKEN type TS_ACCESS_TOKEN optional + !I_SSL_ID type ZIF_IBMX_SERVICE_ARCH~TY_SSL_ID optional + !I_DEBUG_MODE type CHAR default SPACE . + "!

Method for internal use.

+ "! + methods GET_REST_CLIENT + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_CLIENT) type TS_CLIENT + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Method for internal use.

+ "! + methods GET_ACCESS_TOKEN + importing + !I_REQUEST_PROP type TS_REQUEST_PROP optional + returning + value(E_ACCESS_TOKEN) type TS_ACCESS_TOKEN + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sends a HTTP DELETE request.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_DELETE + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sets an access token explicitly.

+ "! + "! @parameter I_ACCESS_TOKEN | Access token. + "! + methods SET_ACCESS_TOKEN + importing + !I_ACCESS_TOKEN type TS_ACCESS_TOKEN . + "!

Sends a HTTP GET request.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_GET + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sends a HTTP POST request.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_POST + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sends a HTTP PATCH request.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_PATCH + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sends a HTTP POST request with multipart body.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter IT_FORM_PART | Internal table of form parts in request body. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_POST_MULTIPART + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + !IT_FORM_PART type TT_FORM_PART + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Sends a HTTP PUT request.

+ "! + "! @parameter I_REQUEST_PROP | Request properties. + "! @parameter E_RESPONSE | Response returned by service. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods HTTP_PUT + importing + !I_REQUEST_PROP type TS_REQUEST_PROP + returning + value(E_RESPONSE) type TO_REST_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . +protected section. + + "!

Method for internal use.

+ methods adjust_request_prop + changing + !c_request_prop type ts_request_prop . + "!

Method for internal use.

+ class-methods merge_structure + importing + !i_alternative type any + changing + !c_base type any . + "!

Method for internal use.

+ methods set_default_query_parameters + changing + !c_url type ts_url . + "!

Method for internal use.

+ methods set_uri_and_authorization + importing + !i_client type ts_client + !i_request_prop type ts_request_prop + returning + value(e_uri) type string + raising + ZCX_IBMX_service_exception . +private section. +ENDCLASS. + + + +CLASS ZCL_IBMX_SERVICE IMPLEMENTATION. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>ABAP_TO_JSON +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_NAME TYPE STRING(optional) +* | [--->] I_VALUE TYPE ANY +* | [--->] I_DICTIONARY TYPE ANY(optional) +* | [--->] I_REQUIRED_FIELDS TYPE ANY(optional) +* | [--->] I_LOWER_CASE TYPE BOOLEAN (default =C_BOOLEAN_TRUE) +* | [<-()] E_JSON TYPE STRING +* +-------------------------------------------------------------------------------------- + method abap_to_json. + + data: + lv_json type string, + lv_json_comp type string, + lv_json_num(24) type c, + lv_sep(1) type c, + lv_name type string, + lv_name_uc type string, + lv_type type char, + lv_type_length type i, + lt_compname type tt_string, + lv_name_in_dict type boolean, + lv_relative_type type string, + lv_pattern type string, + lv_str type string, + lv_is_blank type boolean. + field-symbols: + type any, + type string, + type any, + type i, + type int8, + type f, + type any table, + type string, + type string. + + + get_field_type( + exporting + i_field = i_value + importing + e_technical_type = lv_type + e_relative_type = lv_relative_type + e_length = lv_type_length ). + if lv_type eq ZIF_IBMX_service_arch~c_datatype-dataref or lv_type eq ZIF_IBMX_service_arch~c_datatype-objectref. + if i_value is initial. + lv_json = '{}'. + else. + assign i_value->* to . + get_field_type( + exporting + i_field = + importing + e_technical_type = lv_type + e_relative_type = lv_relative_type + e_length = lv_type_length ). + endif. + else. + assign i_value to . + endif. + + + if lv_type ne ZIF_IBMX_service_arch~c_datatype-dataref and lv_type ne ZIF_IBMX_service_arch~c_datatype-objectref and + lv_type ne ZIF_IBMX_service_arch~c_datatype-struct and lv_type ne ZIF_IBMX_service_arch~c_datatype-struct_deep and + lv_type ne ZIF_IBMX_service_arch~c_datatype-itab. + " simple type + + if lv_type eq 'C' or lv_type eq 'N' or lv_type eq 'g'. + " char type + lv_str = . + + if lv_relative_type eq 'BOOLEAN' or + lv_relative_type eq 'ABAP_BOOL' or + lv_relative_type eq 'BOOL' or + lv_relative_type eq 'TRIBOOL' or + lv_relative_type eq 'BOOLE_D' or + lv_relative_type eq 'BOOLE' or + lv_relative_type eq 'XFELD'. + if lv_str = c_blank(lv_type_length). + lv_json = `null`. + elseif lv_str eq c_boolean_true. + lv_json = `true`. + elseif lv_str eq c_boolean_false. + lv_json = `false`. + else. + lv_json = lv_str. + endif. + else. + + if ( lv_type_length = 0 and lv_str eq c_blank ) or ( lv_type_length > 0 and lv_str eq c_blank(lv_type_length) ). + " parameter is blank, not initial (i.e. null) + lv_str = ''. + else. + replace all occurrences of '\' in lv_str with '\\'. + replace all occurrences of '"' in lv_str with '\"'. + replace all occurrences of cl_abap_char_utilities=>cr_lf in lv_str with '\n'. + replace all occurrences of cl_abap_char_utilities=>newline in lv_str with '\n'. + replace all occurrences of cl_abap_char_utilities=>backspace in lv_str with '\b'. + endif. + " quote value + lv_json = `"` && lv_str && `"`. + endif. + + else. + + do 1 times. " to allow exit command + + " special handling for optional parameters explicitly set to initial + if lv_type eq 'I'. + assign to . + if = c_i_zero. + lv_json_num = '0'. + exit. + endif. + elseif lv_type eq '8'. + assign to . + if = c_i8_zero. + lv_json_num = '0'. + exit. + endif. + elseif lv_type eq 'F'. + assign to . + if = c_f_zero. + lv_json_num = '0'. + exit. + endif. + endif. + + lv_json_num = conv #( ). + condense lv_json_num no-gaps. + enddo. + lv_json = lv_json_num. + endif. + + elseif lv_type eq ZIF_IBMX_service_arch~c_datatype-struct or lv_type eq ZIF_IBMX_service_arch~c_datatype-struct_deep. + " structure + + lv_json = lv_json && `{`. + clear lv_sep. + + lv_is_blank = blank_value( + exporting + i_check_only = c_boolean_true + i_field = ). + + if lv_is_blank eq c_boolean_false. + get_components( + exporting + i_structure = + importing + e_components = lt_compname ). + + loop at lt_compname assigning . + assign component of structure to . + if sy-subrc <> 0. + continue. + endif. + + " do not add property if not required and corresponding abap field is initial + if is initial and not i_required_fields is initial. + assign component lv_relative_type of structure i_required_fields to . + if sy-subrc <> 0. + continue. + endif. + lv_pattern = `*|` && && `|*`. + if not cp lv_pattern. + continue. + endif. + endif. + + lv_name = . + + " check if key name exists in abap names dictionary + lv_name_in_dict = c_boolean_false. + try. + assign component lv_name of structure i_dictionary to . + if sy-subrc = 0. + lv_name = . + lv_name_in_dict = c_boolean_true. + endif. + catch cx_sy_assign_cast_illegal_cast cx_sy_assign_cast_unknown_type cx_sy_assign_out_of_range. + endtry. + + if lv_name_in_dict eq c_boolean_false and i_lower_case eq c_boolean_true. + " convert name to lower case + translate lv_name to lower case. + endif. + " add property (recursively) + lv_json_comp = abap_to_json( i_name = lv_name i_value = i_lower_case = i_lower_case i_dictionary = i_dictionary i_required_fields = i_required_fields ). + lv_json = lv_json && lv_sep && lv_json_comp. + lv_sep = ','. + endloop. + endif. + + lv_json = lv_json && `}`. + + elseif lv_type eq ZIF_IBMX_service_arch~c_datatype-itab. + " internal table + + lv_json = lv_json && `[`. + clear lv_sep. + assign to . + + lv_is_blank = c_boolean_false. + if lines( ) = 1. + lv_is_blank = blank_value( + exporting + i_check_only = c_boolean_true + i_field = ). + endif. + + if lv_is_blank eq c_boolean_false. + loop at assigning . + lv_json_comp = abap_to_json( i_value = i_lower_case = i_lower_case i_dictionary = i_dictionary i_required_fields = i_required_fields ). + lv_json = lv_json && lv_sep && lv_json_comp. + lv_sep = ','. + endloop. + endif. + + lv_json = lv_json && `]`. + + endif. + + if not i_name is initial. + lv_name_in_dict = c_boolean_false. + lv_name = i_name. + if not i_dictionary is initial. + assign component i_name of structure i_dictionary to . + if sy-subrc = 0. + lv_name = . + lv_name_in_dict = c_boolean_true. + endif. + endif. + if lv_name_in_dict eq c_boolean_false and i_lower_case eq c_boolean_true. + " convert name to lower case + translate lv_name to lower case. + endif. + e_json = `"` && lv_name && `": ` && lv_json. + else. + e_json = lv_json. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>ADD_HEADER_PARAMETER +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PARAMETER TYPE STRING +* | [--->] I_VALUE TYPE STRING +* | [--->] I_IS_BOOLEAN TYPE BOOLEAN (default =C_BOOLEAN_FALSE) +* | [<-->] C_HEADERS TYPE ZIF_IBMX_SERVICE_ARCH~TS_REQUEST_PROP-HEADERS +* +-------------------------------------------------------------------------------------- + method add_header_parameter. + + data: + ls_header type line of ZIF_IBMX_service_arch~ts_request_prop-headers, + lv_value type string. + + if i_is_boolean eq c_boolean_true. + if i_value eq c_boolean_true. + lv_value = 'true'. + else. + lv_value = 'false'. + endif. + else. + lv_value = i_value. + endif. + condense lv_value. " remove trailing spaces + + ls_header-name = i_parameter. + ls_header-value = lv_value. + append ls_header to c_headers. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>ADD_QUERY_PARAMETER +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PARAMETER TYPE STRING +* | [--->] I_VALUE TYPE STRING +* | [--->] I_IS_BOOLEAN TYPE BOOLEAN (default =C_BOOLEAN_FALSE) +* | [<-->] C_URL TYPE TS_URL +* +-------------------------------------------------------------------------------------- + method add_query_parameter. + + data: + lv_param type string. + + if i_is_boolean eq c_boolean_true. + if i_value eq c_boolean_true. + lv_param = 'true'. + else. + lv_param = 'false'. + endif. + else. + lv_param = i_value. + endif. + condense lv_param. " remove trailing spaces + lv_param = i_parameter && `=` && lv_param. + + if c_url-querystring is initial. + c_url-querystring = lv_param. + else. + c_url-querystring = c_url-querystring && `&` && lv_param. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Protected Method ZCL_IBMX_SERVICE->ADJUST_REQUEST_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [<-->] C_REQUEST_PROP TYPE TS_REQUEST_PROP +* +-------------------------------------------------------------------------------------- + method adjust_request_prop. + + data: + ls_request_prop_openapi type ts_request_prop. + + merge_structure( + exporting + i_alternative = p_request_prop_default + changing + c_base = c_request_prop ). + + " Separate protocol, host and path in url + normalize_url( + changing + c_url = c_request_prop-url ). + + " Set defaults for some unspecified properties + if c_request_prop-url-protocol is initial. + c_request_prop-url-protocol = 'http' ##NO_TEXT. + endif. + if c_request_prop-auth_headername is initial. + c_request_prop-auth_headername = 'Authorization' ##NO_TEXT. + endif. + + " Allow basic authentication with apikey + if c_request_prop-auth_basic eq c_boolean_true. + if c_request_prop-username is initial and c_request_prop-password is initial and not c_request_prop-apikey is initial. + c_request_prop-username = 'apikey' ##NO_TEXT. + c_request_prop-password = c_request_prop-apikey. + endif. + endif. + + " Correct authentication location + if ( c_request_prop-auth_basic ne c_boolean_false or + c_request_prop-auth_oauth ne c_boolean_false or + c_request_prop-auth_apikey ne c_boolean_false ) and + not ( c_request_prop-auth_header eq c_boolean_true or + c_request_prop-auth_query eq c_boolean_true or + c_request_prop-auth_body eq c_boolean_true ). + c_request_prop-auth_header = c_boolean_true. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->CHECK_HTTP_RESPONSE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_RESPONSE TYPE TO_REST_RESPONSE(optional) +* | [--->] I_URL TYPE TS_URL(optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method check_http_response. + + data: + lv_http_status type ts_http_status, + lv_full_url type string, + ls_url type ts_url, + lv_strlen type i, + lv_code type string, + lo_service_exception type ref to ZCX_IBMX_service_exception. + + lv_http_status = get_http_status( i_rest_response = i_response ). + lv_code = lv_http_status-code. + shift lv_code left deleting leading space. + if lv_code ne '200' and " ok + lv_code ne '201' and " ok with response + lv_code ne '202' and " Accepted (asynchronous function call) + lv_code ne '204'. " Deleted + + ls_url = i_url. + merge_structure( + exporting + i_alternative = p_request_prop_default-url + changing + c_base = ls_url ). + lv_full_url = get_full_url( ls_url ). + + try. + raise_exception( + i_msgno = '003' " HTTP Status: &1 (&2) + i_msgv1 = lv_code + i_msgv2 = lv_http_status-reason + i_msgv3 = lv_full_url + i_http_status = lv_http_status ). + catch ZCX_IBMX_service_exception into lo_service_exception. + lo_service_exception->p_msg_json = lv_http_status-json. + endtry. + + raise exception lo_service_exception. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->CONSTRUCTOR +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_URL TYPE STRING(optional) +* | [--->] I_HOST TYPE STRING(optional) +* | [--->] I_PROXY_HOST TYPE STRING(optional) +* | [--->] I_PROXY_PORT TYPE STRING(optional) +* | [--->] I_USERNAME TYPE STRING(optional) +* | [--->] I_PASSWORD TYPE STRING(optional) +* | [--->] I_APIKEY TYPE STRING(optional) +* | [--->] I_ACCESS_TOKEN TYPE TS_ACCESS_TOKEN(optional) +* | [--->] I_SSL_ID TYPE ZIF_IBMX_SERVICE_ARCH~TY_SSL_ID(optional) +* | [--->] I_DEBUG_MODE TYPE CHAR (default =SPACE) +* +-------------------------------------------------------------------------------------- + method constructor. + + data: + lv_host type string. + + super->constructor( ). + + " use i_url and i_host synonymously + if not i_url is initial. + lv_host = i_url. + else. + lv_host = i_host. + endif. + + p_request_prop_default-url-host = lv_host. + p_request_prop_default-username = i_username. + p_request_prop_default-password = i_password. + p_request_prop_default-apikey = i_apikey. + p_request_prop_default-access_token = i_access_token. + + p_debug_mode = i_debug_mode. + + normalize_url( + changing + c_url = p_request_prop_default-url ). + + if not i_proxy_host is supplied. + + get_default_proxy( + exporting + i_url = p_request_prop_default-url + importing + e_proxy_host = p_request_prop_default-proxy_host + e_proxy_port = p_request_prop_default-proxy_port ). + + else. + p_request_prop_default-proxy_host = i_proxy_host. + if not i_proxy_port is initial. + p_request_prop_default-proxy_port = i_proxy_port. + else. + p_request_prop_default-proxy_port = '8080'. + endif. + endif. + + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->GET_ACCESS_TOKEN +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP(optional) +* | [<-()] E_ACCESS_TOKEN TYPE TS_ACCESS_TOKEN +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_access_token. + + e_access_token = p_request_prop_default-access_token. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->GET_APPNAME +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_APPNAME TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_appname. + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>GET_COMPONENTS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_STRUCTURE TYPE ANY +* | [<---] E_COMPONENTS TYPE ZIF_IBMX_SERVICE_ARCH~TT_STRING +* +-------------------------------------------------------------------------------------- + method get_components. + + data: + lo_abap_struc type ref to cl_abap_structdescr, + lt_comp type cl_abap_structdescr=>component_table. + + field-symbols: + type line of cl_abap_structdescr=>component_table. + + lo_abap_struc ?= cl_abap_structdescr=>describe_by_data( i_structure ). + lt_comp = lo_abap_struc->get_components( ). + + clear e_components[]. + loop at lt_comp assigning . + append -name to e_components. + endloop. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>GET_DATATYPE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FIELD TYPE ANY +* | [<-()] E_DATATYPE TYPE ZIF_IBMX_SERVICE_ARCH~CHAR +* +-------------------------------------------------------------------------------------- + method get_datatype. + + get_field_type( + exporting + i_field = i_field + importing + e_technical_type = e_datatype ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>GET_FIELD_TYPE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FIELD TYPE ANY +* | [<---] E_TECHNICAL_TYPE TYPE ZIF_IBMX_SERVICE_ARCH~CHAR +* | [<---] E_RELATIVE_TYPE TYPE STRING +* | [<---] E_LENGTH TYPE I +* +-------------------------------------------------------------------------------------- + method get_field_type. + data: + lo_abap_type type ref to cl_abap_typedescr, + lo_typedescr type ref to cl_abap_typedescr. + + call method cl_abap_typedescr=>describe_by_data + exporting + p_data = i_field + receiving + p_descr_ref = lo_typedescr. + + e_technical_type = lo_typedescr->type_kind. + + if e_relative_type is requested. + if e_technical_type eq ZIF_IBMX_service_arch~c_datatype-objectref. + data lo_refdescr type ref to cl_abap_refdescr. + lo_refdescr ?= cl_abap_typedescr=>describe_by_data( i_field ). + lo_abap_type ?= lo_refdescr->get_referenced_type( ). + else. + lo_abap_type = cl_abap_typedescr=>describe_by_data( i_field ). + endif. + e_relative_type = lo_abap_type->get_relative_name( ). + endif. + + if e_length is requested. + if e_technical_type eq ZIF_IBMX_service_arch~c_datatype-c or + e_technical_type eq ZIF_IBMX_service_arch~c_datatype-n. + data(lo_elemdescr) = cast cl_abap_elemdescr( lo_typedescr ). + if lo_elemdescr->output_length > 0. + e_length = lo_elemdescr->output_length. + else. + e_length = lo_typedescr->length. + endif. + else. + e_length = 0. + endif. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>GET_FILE_EXTENSION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MIME_TYPE TYPE STRING +* | [<-()] E_EXTENSION TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_file_extension. + + data: + lv_mime_type type string, + lv_ext type string, + lv_len type i. + + translate i_mime_type to lower case. + + case i_mime_type. + when 'text/plain'. e_extension = 'txt'. + when 'image/jpeg'. e_extension = 'jpg'. + when 'application/octet-stream'. e_extension = 'bin'. + when others. + e_extension = 'dat'. + "find regex '([^/]*)$' in i_mime_type submatches lv_ext. + data(l_subrc) = find_regex( + exporting + i_regex = '([^/]*)$' + i_in = i_mime_type + changing + c_submatch1 = lv_ext ). + if l_subrc = 0. + lv_len = strlen( lv_ext ). + if lv_len >= 2 and lv_len <= 4. + e_extension = lv_ext. + endif. + endif. + endcase. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>GET_FULL_URL +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_URL TYPE TS_URL +* | [<-()] E_URL TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_full_url. + + data: + lv_url type string. + + if not i_url-host cp 'http*'. + if i_url-protocol is initial. + lv_url = 'http://'. + else. + lv_url = i_url-protocol && `://`. + endif. + endif. + + lv_url = lv_url && i_url-host && i_url-path_base && i_url-path. + + if not i_url-querystring is initial. + lv_url = lv_url && `?` && i_url-querystring. + endif. + + e_url = lv_url. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->GET_REQUEST_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT) +* | [<-()] E_REQUEST_PROP TYPE TS_REQUEST_PROP +* +-------------------------------------------------------------------------------------- + method get_request_prop. + + e_request_prop-url-protocol = 'http'. + e_request_prop-auth_headername = ''. + e_request_prop-auth_basic = c_boolean_false. + e_request_prop-auth_oauth = c_boolean_false. + e_request_prop-auth_apikey = c_boolean_false. + e_request_prop-auth_query = c_boolean_false. + e_request_prop-auth_header = c_boolean_false. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->GET_REST_CLIENT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_CLIENT TYPE TS_CLIENT +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_rest_client. + + data: + ls_header type ts_header, + ls_request_prop type ts_request_prop, + lv_url type string. + + ls_request_prop = i_request_prop. + adjust_request_prop( + changing + c_request_prop = ls_request_prop ). + + " create http client instance + lv_url = ls_request_prop-url-protocol && `://` && ls_request_prop-url-host. + create_client_by_url( + exporting + i_url = lv_url + i_request_prop = ls_request_prop + importing + e_client = e_client ). + + " set URI and authorization + lv_url = set_uri_and_authorization( i_client = e_client i_request_prop = ls_request_prop ). + + " set request uri + set_request_uri( i_client = e_client i_uri = lv_url ). + + " set 'Content-Type' header + if not i_request_prop-header_content_type is initial. + set_request_header( i_client = e_client i_name = ZIF_IBMX_service_arch~c_header_content_type i_value = ls_request_prop-header_content_type ). + endif. + + " set 'Accept' header + if not i_request_prop-header_accept is initial. + set_request_header( i_client = e_client i_name = ZIF_IBMX_service_arch~c_header_accept i_value = ls_request_prop-header_accept ). + endif. + + " set additional headers + if not ls_request_prop-headers is initial. + loop at ls_request_prop-headers into ls_header. + set_request_header( i_client = e_client i_name = ls_header-name i_value = ls_header-value ). + endloop. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_delete. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " execute DELETE request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_delete ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_get. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " execute GET request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_get ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_PATCH +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_patch. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " set request body + if not i_request_prop-body is initial. + set_request_body_cdata( i_client = lo_client i_data = i_request_prop-body ). + endif. + if not i_request_prop-body_bin is initial. + set_request_body_xdata( i_client = lo_client i_data = i_request_prop-body_bin ). + endif. + + " execute PATCH request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_patch ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_POST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_post. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " set request body + if not i_request_prop-body is initial. + set_request_body_cdata( i_client = lo_client i_data = i_request_prop-body ). + endif. + if not i_request_prop-body_bin is initial. + set_request_body_xdata( i_client = lo_client i_data = i_request_prop-body_bin ). + endif. + + " error: querystring of a POST request is not sent to server if the request body is empty + " workaround: set an empty json object for request body + if i_request_prop-body is initial and i_request_prop-body_bin is initial. + set_request_body_cdata( i_client = lo_client i_data = `{}` ). + set_request_header( i_client = lo_client i_name = ZIF_IBMX_service_arch~c_header_content_type i_value = ZIF_IBMX_service_arch~c_mediatype-appl_json ). + endif. + + " execute POST request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_post ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_POST_MULTIPART +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [--->] IT_FORM_PART TYPE TT_FORM_PART +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_post_multipart. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " set request body (multipart) + add_form_part( i_client = lo_client it_form_part = it_form_part ). + + " execute POST request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_post ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->HTTP_PUT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_RESPONSE TYPE TO_REST_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method http_put. + + data: + lo_client type ts_client. + + " create REST client + lo_client = get_rest_client( i_request_prop = i_request_prop ). + + " set request body + if not i_request_prop-body is initial. + set_request_body_cdata( i_client = lo_client i_data = i_request_prop-body ). + endif. + if not i_request_prop-body_bin is initial. + set_request_body_xdata( i_client = lo_client i_data = i_request_prop-body_bin ). + endif. + + " execute PUT request + e_response = execute( i_client = lo_client i_method = ZIF_IBMX_service_arch~c_method_put ). + + " check response + check_http_response( + i_response = e_response + i_url = i_request_prop-url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>BLANK_VALUE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_CHECK_ONLY TYPE BOOLEAN (default =C_BOOLEAN_FALSE) +* | [--->] I_FIELD TYPE ANY(optional) +* | [<-->] C_FIELD TYPE ANY(optional) +* | [<-()] E_IS_BLANK TYPE BOOLEAN +* +-------------------------------------------------------------------------------------- +method blank_value. + + data: + lv_check_result type boolean, + lv_is_blank type boolean value c_boolean_true, + lv_type type char, + lv_type_length type i, + lt_compname type tt_string, + lv_relative_type type string, + lv_str type string, + lr_data type ref to data. + + field-symbols: + type any, + type any, + type string, + type any, + type any table, + type i, + type int8, + type f. + + if i_check_only eq c_boolean_true and i_field is supplied. + create data lr_data like i_field. + assign lr_data->* to . + = i_field. + else. + assign c_field to . + endif. + + get_field_type( + exporting + i_field = + importing + e_technical_type = lv_type + e_relative_type = lv_relative_type + e_length = lv_type_length ). + + if lv_type eq ZIF_IBMX_service_arch~c_datatype-dataref or lv_type eq ZIF_IBMX_service_arch~c_datatype-objectref. + " data reference + + if is bound. + assign ->* to . + get_field_type( + exporting + i_field = + importing + e_technical_type = lv_type + e_relative_type = lv_relative_type ). + if lv_type eq ZIF_IBMX_service_arch~c_datatype-struct or lv_type eq ZIF_IBMX_service_arch~c_datatype-struct_deep. + + get_components( + exporting + i_structure = + importing + e_components = lt_compname ). + + if lines( lt_compname ) = 1. + read table lt_compname assigning index 1. + assign component of structure to . + if eq '_' and eq c_blank and lines( lt_compname ) = 1. + " empty json object + e_is_blank = c_boolean_true. + return. + endif. + endif. + endif. + endif. + + lv_is_blank = c_boolean_false. + + create data like c_empty. + assign ->* to . + = c_empty. + + + elseif lv_type eq ZIF_IBMX_service_arch~c_datatype-struct or lv_type eq ZIF_IBMX_service_arch~c_datatype-struct_deep. + " structure + + assign to . + + get_components( + exporting + i_structure = + importing + e_components = lt_compname ). + + loop at lt_compname assigning . + assign component of structure to . + if sy-subrc <> 0. + continue. + endif. + + lv_check_result = blank_value( + exporting + i_check_only = i_check_only + changing + c_field = ). + if lv_check_result eq c_boolean_false. + lv_is_blank = c_boolean_false. + if i_check_only eq c_boolean_true. + exit. + endif. + endif. + + endloop. + + elseif lv_type eq ZIF_IBMX_service_arch~c_datatype-itab. + " internal table + + assign to . + + if lines( ) = 1. + loop at assigning . " loop (single step) since index operation is allowed + lv_check_result = blank_value( + exporting + i_check_only = i_check_only + changing + c_field = ). + if lv_check_result eq c_boolean_true. + e_is_blank = c_boolean_true. + return. + endif. + endloop. + endif. + + lv_is_blank = c_boolean_false. + + if i_check_only eq c_boolean_false. + clear . + + create data lr_data like line of . + assign lr_data->* to . + blank_value( changing c_field = ). + insert into table . + + endif. + + else. + " simple type + + assign to . + + if lv_type eq 'C' or lv_type eq 'N' or lv_type eq 'g'. + lv_str = . + if not ( ( lv_type_length > 0 and lv_str eq c_blank(lv_type_length) ) or ( lv_type_length = 0 and lv_str eq c_blank ) ). + lv_is_blank = c_boolean_false. + if i_check_only eq c_boolean_false. + = c_blank. + endif. + endif. + + elseif lv_type eq 'I'. + assign to . + if not = c_i_zero. + lv_is_blank = c_boolean_false. + if i_check_only eq c_boolean_false. + = c_i_zero. + endif. + endif. + elseif lv_type eq '8'. + assign to . + if not = c_i8_zero. + lv_is_blank = c_boolean_false. + if i_check_only eq c_boolean_false. + = c_i8_zero. + endif. + endif. + elseif lv_type eq 'F'. + assign to . + if not = c_f_zero. + lv_is_blank = c_boolean_false. + if i_check_only eq c_boolean_false. + = c_f_zero. + endif. + endif. + endif. + + endif. " data type + + e_is_blank = lv_is_blank. + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Protected Method ZCL_IBMX_SERVICE=>MERGE_STRUCTURE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_ALTERNATIVE TYPE ANY +* | [<-->] C_BASE TYPE ANY +* +-------------------------------------------------------------------------------------- + method merge_structure. + + data: + lv_type type char, + lt_compname type tt_string. + + field-symbols: + type any, + type any, + type standard table, + type standard table, + type string. + + get_components( + exporting + i_structure = c_base + importing + e_components = lt_compname ). + + loop at lt_compname assigning . + assign component of structure c_base to . + check sy-subrc = 0. + get_field_type( + exporting + i_field = + importing + e_technical_type = lv_type ). + if lv_type eq ZIF_IBMX_service_arch~c_datatype-struct or lv_type eq ZIF_IBMX_service_arch~c_datatype-struct_deep. + assign component of structure i_alternative to . + check sy-subrc = 0. + merge_structure( + exporting + i_alternative = + changing + c_base = ). + else. + if is initial. + if lv_type eq ZIF_IBMX_service_arch~c_datatype-itab. + assign component of structure c_base to . + check sy-subrc = 0. + assign component of structure i_alternative to . + check sy-subrc = 0. + if not is initial. + append lines of to . + endif. + else. + assign component of structure i_alternative to . + check sy-subrc = 0. + = . + endif. + endif. + endif. + endloop. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>MOVE_DATA_REFERENCE_TO_ABAP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DATA_REFERENCE TYPE DATA_REFERENCE +* | [<---] E_ABAP TYPE ANY +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method move_data_reference_to_abap. + + data: + lt_compname type tt_string, + lv_compname type string, + lv_index type i, + lv_rowno type i, + begin of ls_stack, + name type string, + ref type ref to data, + struct type ref to data, + type type char, + end of ls_stack, + ls_stack_new like ls_stack, + lt_stack like standard table of ls_stack, + lr_ref type ref to data. + field-symbols: + type data, + type standard table, + type standard table, + type any, + type any, + type any, + type any, + type ref to data, + type any. + + + clear ls_stack-name. + ls_stack-ref = i_data_reference. + ls_stack-struct = ref #( e_abap ). + get_field_type( + exporting + i_field = e_abap + importing + e_technical_type = ls_stack-type ). + append ls_stack to lt_stack. + + do. + lv_index = lines( lt_stack ). + if lv_index <= 0. exit. endif. + read table lt_stack into ls_stack index lv_index. + + if ls_stack-type eq 'u' or ls_stack-type eq 'v'. " structure + assign ls_stack-struct->* to . + assign ls_stack-ref->* to . + get_components( + exporting + i_structure = + importing + e_components = lt_compname ). + loop at lt_compname into lv_compname. + assign component lv_compname of structure to . + ls_stack_new-name = lv_compname. + ls_stack_new-struct = ref #( ). + assign component lv_compname of structure to . + if sy-subrc = 0. + ls_stack_new-ref = . + get_field_type( + exporting + i_field = + importing + e_technical_type = ls_stack_new-type ). + append ls_stack_new to lt_stack. + endif. + endloop. + + else. + + if ls_stack-type eq 'h'. " internal table + assign ls_stack-struct->* to . + assign ls_stack-ref->* to . + loop at assigning . + ls_stack_new-ref = . + create data ls_stack_new-struct like line of . + assign ls_stack_new-struct->* to . + + append to . " append copies data + lv_rowno = lines( ). + read table assigning index lv_rowno. " -> re-read row for reference + ls_stack_new-struct = ref #( ). + + get_field_type( + exporting + i_field = + importing + e_technical_type = ls_stack_new-type ). + clear ls_stack_new-name. + append ls_stack_new to lt_stack. + endloop. + + else. + assign ls_stack-struct->* to . + if ls_stack-type eq 'l' or ls_stack-type eq 'r'. " reference + = ls_stack-ref. + + else. " simple type + assign ls_stack-ref->* to . + = . + endif. + endif. + endif. + + delete lt_stack index lv_index. + + enddo. + + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>NORMALIZE_URL +* +-------------------------------------------------------------------------------------------------+ +* | [<-->] C_URL TYPE TS_URL +* +-------------------------------------------------------------------------------------- + method normalize_url. + + check not c_url is initial. + + data(lv_protocol) = c_url-protocol. + if not lv_protocol is initial and lv_protocol np '*://'. + lv_protocol = lv_protocol && '://'. + endif. + + data(lv_host) = c_url-host. + if c_url-host cp 'http:*' or c_url-host cp 'https:*'. + clear lv_protocol. + endif. + shift lv_host right deleting trailing '/'. + if not c_url-path_base is initial. + shift c_url-path_base left deleting leading '/'. + lv_host = lv_host && '/' && c_url-path_base. + shift lv_host right deleting trailing '/'. + endif. + shift lv_host left deleting leading space. + + data(lv_path) = c_url-path. + if not lv_path is initial. + if lv_path np '/*'. + lv_path = '/' && lv_path. + endif. + endif. + + data(lv_url_full) = lv_protocol && lv_host && lv_path. + shift lv_url_full right deleting trailing '/'. + shift lv_url_full left deleting leading space. + + clear: c_url-protocol, c_url-host, c_url-path_base, c_url-path. " do not clear other components + "find regex '^(http.?:\/\/)?([^\/]*)(.*)$' in lv_url_full submatches c_url-protocol c_url-host c_url-path. + find_regex( + exporting + i_regex = '^(http.?:\/\/)?([^\/]*)(.*)$' + i_in = lv_url_full + changing + c_submatch1 = c_url-protocol + c_submatch2 = c_url-host + c_submatch3 = c_url-path ). + + shift c_url-protocol right deleting trailing '/'. + shift c_url-protocol right deleting trailing ':'. + shift c_url-protocol left deleting leading space. + + " split path into base_path and path + if not lv_host is initial. + find lv_host in lv_url_full match offset data(lv_offset) match length data(lv_length). + if sy-subrc = 0. + data(lv_strlen_url) = strlen( lv_url_full ). + data(lv_strlen_path) = strlen( c_url-path ). + data(lv_splitpoint) = lv_strlen_path - ( lv_strlen_url - lv_offset - lv_length ). + c_url-path_base = c_url-path+0(lv_splitpoint). + c_url-path = c_url-path+lv_splitpoint. + endif. + endif. + + return. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>PARSE_JSON +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JSON TYPE STRING +* | [--->] I_DICTIONARY TYPE ANY(optional) +* | [<-->] C_ABAP TYPE ANY +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method parse_json. + + data: + lv_json type string, + lt_dictionary type ZIF_IBMX_service_arch~tt_string, + lv_dictionary type string, + lv_orgname type string, + lv_abapname type string, + lv_regex type string, + lo_json type ref to /ui2/cl_json, + lv_msg type string, + lr_exception type ref to cx_sy_move_cast_error. + field-symbols: + type string. + + if not i_json is initial. + + lv_json = i_json. + + if i_dictionary is supplied. + get_components( + exporting + i_structure = i_dictionary + importing + e_components = lt_dictionary ). + + loop at lt_dictionary into lv_dictionary. + assign component lv_dictionary of structure i_dictionary to . + lv_orgname = . + translate lv_orgname to upper case. + if lv_dictionary ne lv_orgname. + lv_regex = `"` && && `"\s*:`. + lv_abapname = `"` && lv_dictionary && `":`. + "replace all occurrences of regex lv_regex in lv_json with lv_abapname. + find_regex( + exporting + i_regex = lv_regex + i_with = lv_abapname + changing + c_in = lv_json ). + endif. + endloop. + + endif. + + " copy code to execute /ui2/cl_json=>deserialize( exporting json = lv_json changing data = c_abap ) and catch exception + create object lo_json. + try. + lo_json->deserialize_int( exporting json = lv_json changing data = c_abap ). + catch cx_sy_move_cast_error into lr_exception. + ZCL_IBMX_service=>raise_exception( + exporting + i_msgno = 20 ). + endtry. + + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>RAISE_EXCEPTION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MSGNO TYPE SY-MSGNO(optional) +* | [--->] I_MSGV1 TYPE STRING(optional) +* | [--->] I_MSGV2 TYPE STRING(optional) +* | [--->] I_MSGV3 TYPE STRING(optional) +* | [--->] I_MSGV4 TYPE STRING(optional) +* | [--->] I_TEXT TYPE STRING(optional) +* | [--->] I_SUBRC TYPE SY-SUBRC (default =C_SUBRC_UNKNOWN) +* | [--->] I_PREVIOUS TYPE REF TO CX_ROOT(optional) +* | [--->] I_HTTP_STATUS TYPE TS_HTTP_STATUS(optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method raise_exception. + + data: + ls_msg like if_t100_message=>t100key, + lv_charval(11) type c, + lo_service_exception type ref to ZCX_IBMX_service_exception. + + ls_msg-msgid = c_msgid. + + if not i_msgno is initial. + ls_msg-msgno = i_msgno. + ls_msg-attr1 = i_msgv1. + ls_msg-attr2 = i_msgv2. + ls_msg-attr3 = i_msgv3. + ls_msg-attr4 = i_msgv4. + else. + if not i_text is initial. + if i_subrc <> c_subrc_unknown. + lv_charval = conv #( i_subrc ). + ls_msg-attr2 = lv_charval. + ls_msg-msgno = '001'. " &1: return code &2 + else. + ls_msg-msgno = '000'. " &1 + endif. + ls_msg-attr1 = i_text. + else. + ls_msg-msgno = '002'. " An exception has occurred, reason code &1. + lv_charval = conv #( i_subrc ). + ls_msg-attr1 = lv_charval. + endif. + endif. + + if ls_msg-attr4 is initial and not i_http_status-json is initial. + data: + begin of ls_error, + error type string, + description type string, + end of ls_error. + parse_json( + exporting + i_json = i_http_status-json + changing + c_abap = ls_error ). + if not ls_error-error is initial. + ls_msg-attr4 = unescape_unicode( ls_error-error ). + elseif not ls_error-description is initial. + ls_msg-attr4 = unescape_unicode( ls_error-description ). + else. + ls_msg-attr4 = unescape_unicode( i_http_status-json ). + endif. + endif. + + raise exception type ZCX_IBMX_service_exception + message id c_msgid type 'E' number ls_msg-msgno with ls_msg-attr1 ls_msg-attr2 ls_msg-attr3 ls_msg-attr4. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE->SET_ACCESS_TOKEN +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_ACCESS_TOKEN TYPE TS_ACCESS_TOKEN +* +-------------------------------------------------------------------------------------- + method set_access_token. + + p_request_prop_default-access_token = i_access_token. + if p_request_prop_default-access_token-token_type is initial. + p_request_prop_default-access_token-token_type = 'Bearer'. + endif. + if p_request_prop_default-access_token-expires_ts = 0. + p_request_prop_default-access_token-expires_ts = '99991231235959' ##LITERAL. " avoid token being refreshed by sdk + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Protected Method ZCL_IBMX_SERVICE->SET_DEFAULT_QUERY_PARAMETERS +* +-------------------------------------------------------------------------------------------------+ +* | [<-->] C_URL TYPE TS_URL +* +-------------------------------------------------------------------------------------- + method set_default_query_parameters. + + if not p_version is initial. + add_query_parameter( + exporting + i_parameter = `version` + i_value = p_version + changing + c_url = c_url ). + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Protected Method ZCL_IBMX_SERVICE->SET_URI_AND_AUTHORIZATION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_CLIENT TYPE TS_CLIENT +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP +* | [<-()] E_URI TYPE STRING +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method set_uri_and_authorization. + + data: + ls_url type ts_url, + lv_url type string. + + ls_url = i_request_prop-url. + + " OAuth authorization + if i_request_prop-auth_oauth eq c_boolean_true. " = not ( c_boolean_false or c_tribool_false ) + data: + ls_access_token type ts_access_token, + lv_full_token type string. + ls_access_token = get_access_token( i_request_prop = i_request_prop ). + if not ls_access_token-token_type is initial. + concatenate ls_access_token-token_type ls_access_token-access_token into lv_full_token separated by space. + else. + lv_full_token = ls_access_token-access_token. + endif. + if i_request_prop-auth_header eq c_boolean_true. + set_request_header( i_client = i_client i_name = i_request_prop-auth_headername i_value = lv_full_token ). + endif. + + " Basic authentication + elseif i_request_prop-auth_basic eq c_boolean_true or i_request_prop-auth_apikey eq c_boolean_true. + data: + lv_username type string, + lv_password type string. + if i_request_prop-auth_apikey eq c_boolean_true. + lv_username = 'apikey' ##NO_TEXT. + lv_password = i_request_prop-apikey. + else. + lv_username = i_request_prop-username. + lv_password = i_request_prop-password. + endif. + if i_request_prop-auth_header eq c_boolean_true. + set_authentication_basic( i_client = i_client i_username = lv_username i_password = lv_password ). + elseif i_request_prop-auth_query eq c_boolean_true. + if i_request_prop-auth_apikey eq c_boolean_true. + add_query_parameter( + exporting + i_parameter = 'apiKey' ##NO_TEXT + i_value = lv_password + changing + c_url = ls_url ). + else. + add_query_parameter( + exporting + i_parameter = 'username' ##NO_TEXT + i_value = lv_username + changing + c_url = ls_url ). + add_query_parameter( + exporting + i_parameter = 'password' ##NO_TEXT + i_value = lv_password + changing + c_url = ls_url ). + endif. + elseif i_request_prop-auth_body eq c_boolean_true. + data: + lv_body type string. + if i_request_prop-auth_apikey eq c_boolean_true. + lv_body = `{ "userid": "apikey", "password": "` && i_request_prop-apikey && `" }` ##NO_TEXT. + else. + lv_body = `{ "userid": "` && i_request_prop-username && `", "password": "` && i_request_prop-password && `" }` ##NO_TEXT. + endif. + set_request_body_cdata( i_client = i_client i_data = lv_body ). + set_request_header( i_client = i_client i_name = ZIF_IBMX_service_arch~c_header_content_type i_value = ZIF_IBMX_service_arch~c_mediatype-appl_json ). + endif. + endif. + + e_uri = get_full_url( ls_url ). + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE=>UNESCAPE_UNICODE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_IN TYPE STRING +* | [<-()] E_OUT TYPE STRING +* +-------------------------------------------------------------------------------------- + method unescape_unicode. + + data: + lv_match type string, + lv_cp_str type string, + lv_cp_hex(4) type x, + lv_ucchar(1) type c. + + field-symbols: + like lv_ucchar. + + e_out = i_in. + + do. + "find regex '(\\u[A-Fa-f0-9]{4})' in e_out ignoring case submatches lv_match ##NO_TEXT. + data(l_subrc) = find_regex( + exporting + i_regex = '(\\u[A-Fa-f0-9]{4})' + i_ignoring_case = 'X' + i_in = e_out + changing + c_submatch1 = lv_match ) ##NO_TEXT. + if l_subrc <> 0. + exit. + endif. + + lv_cp_str = lv_match+2. + translate lv_cp_str to upper case. + lv_cp_hex = lv_cp_str. + + assign lv_cp_hex to casting. + lv_ucchar = . + + replace all occurrences of lv_match in e_out with lv_ucchar. + + enddo. + + endmethod. +ENDCLASS. diff --git a/src/zcl_ibmx_service.clas.xml b/src/zcl_ibmx_service.clas.xml new file mode 100644 index 0000000..0e7aa4a --- /dev/null +++ b/src/zcl_ibmx_service.clas.xml @@ -0,0 +1,204 @@ + + + + + + ZCL_IBMX_SERVICE + E + ABAP SDK for IBM Watson - Service Class + 1 + X + X + X + + + + ZCL_IBMX_SERVICE + ABAP_TO_JSON + E + Extracts a JSON string from an ABAP structure. + + + ZCL_IBMX_SERVICE + ADD_HEADER_PARAMETER + E + Method for internal use. + + + ZCL_IBMX_SERVICE + ADD_QUERY_PARAMETER + E + Method for internal use. + + + ZCL_IBMX_SERVICE + ADJUST_REQUEST_PROP + E + Method for internal use. + + + ZCL_IBMX_SERVICE + CHECK_HTTP_RESPONSE + E + Throws an exception, if HTTP response indicates an error. + + + ZCL_IBMX_SERVICE + CONSTRUCTOR + E + Class constructor. + + + ZCL_IBMX_SERVICE + DATETIME + E + DateTime type, format 2018-10-23T15:18:18.914xxxZ + + + ZCL_IBMX_SERVICE + GET_ACCESS_TOKEN + E + Method for internal use. + + + ZCL_IBMX_SERVICE + GET_APPNAME + E + Returns the service name. + + + ZCL_IBMX_SERVICE + GET_COMPONENTS + E + Returns component names of a given structure. + + + ZCL_IBMX_SERVICE + GET_DATATYPE + E + Returns data type of a given parameter. + + + ZCL_IBMX_SERVICE + GET_FIELD_TYPE + E + Returns field type and length of a given parameter. + + + ZCL_IBMX_SERVICE + GET_FILE_EXTENSION + E + Returns the file extension for a mime type + + + ZCL_IBMX_SERVICE + GET_FULL_URL + E + Method for internal use. + + + ZCL_IBMX_SERVICE + GET_REQUEST_PROP + E + Method for internal use. + + + ZCL_IBMX_SERVICE + GET_REST_CLIENT + E + Method for internal use. + + + ZCL_IBMX_SERVICE + HTTP_DELETE + E + Sends a HTTP DELETE request. + + + ZCL_IBMX_SERVICE + HTTP_GET + E + Sends a HTTP GET request. + + + ZCL_IBMX_SERVICE + HTTP_POST + E + Sends a HTTP POST request. + + + ZCL_IBMX_SERVICE + HTTP_PATCH + E + Sends a HTTP PATCH request. + + + ZCL_IBMX_SERVICE + HTTP_POST_MULTIPART + E + Sends a HTTP POST request with multipart body. + + + ZCL_IBMX_SERVICE + HTTP_PUT + E + Sends a HTTP PUT request. + + + ZCL_IBMX_SERVICE + MERGE_STRUCTURE + E + Method for internal use. + + + ZCL_IBMX_SERVICE + MOVE_DATA_REFERENCE_TO_ABAP + E + Moves a referenced data structure to an ABAP structure. + + + ZCL_IBMX_SERVICE + NORMALIZE_URL + E + Method for internal use. + + + ZCL_IBMX_SERVICE + PARSE_JSON + E + Parses a JSON string into an ABAP structure. + + + ZCL_IBMX_SERVICE + RAISE_EXCEPTION + E + Raises an exception. + + + ZCL_IBMX_SERVICE + SET_ACCESS_TOKEN + E + Sets an access token explicitly. + + + ZCL_IBMX_SERVICE + SET_DEFAULT_QUERY_PARAMETERS + E + Method for internal use. + + + ZCL_IBMX_SERVICE + SET_URI_AND_AUTHORIZATION + E + Method for internal use. + + + ZCL_IBMX_SERVICE + UNESCAPE_UNICODE + E + Unescape unicode codepoints to characters in a string + + + + + \ No newline at end of file diff --git a/src/zcl_ibmx_service_arch.clas.abap b/src/zcl_ibmx_service_arch.clas.abap new file mode 100644 index 0000000..a064680 --- /dev/null +++ b/src/zcl_ibmx_service_arch.clas.abap @@ -0,0 +1,566 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +CLASS ZCL_IBMX_SERVICE_ARCH DEFINITION + PUBLIC + CREATE PUBLIC . + + PUBLIC SECTION. + + INTERFACES ZIF_IBMX_SERVICE_ARCH . + + TYPES to_http_client TYPE REF TO if_web_http_client . + TYPES to_rest_request TYPE REF TO if_web_http_request . + TYPES to_rest_response TYPE REF TO if_web_http_response . + TYPES to_form_part TYPE REF TO if_web_http_request . + TYPES: + BEGIN OF ts_client, + http TYPE to_http_client, + request TYPE to_rest_request, + END OF ts_client . + TYPES: + BEGIN OF ts_http_status, + code TYPE n LENGTH 3, + reason TYPE string, + json TYPE string, + END OF ts_http_status . + TYPES ts_header TYPE ZIF_IBMX_SERVICE_ARCH~ts_header . + TYPES tt_header TYPE ZIF_IBMX_SERVICE_ARCH~tt_header . + TYPES ts_url TYPE ZIF_IBMX_SERVICE_ARCH~ts_url . + TYPES ts_access_token TYPE ZIF_IBMX_SERVICE_ARCH~ts_access_token . + TYPES ts_request_prop TYPE ZIF_IBMX_SERVICE_ARCH~ts_request_prop . + + "!

Returns the user's time zone.

+ "! + "! @parameter E_TIMEZONE | user's time zone + "! + CLASS-METHODS get_timezone + RETURNING + VALUE(e_timezone) TYPE ZIF_IBMX_SERVICE_ARCH~ty_timezone . + "!

Returns an ABAP module identifier.

+ "! + "! @parameter E_PROGNAME | ABAP module identifier + "! + CLASS-METHODS get_progname + RETURNING + VALUE(e_progname) TYPE string . + "!

Decodes base64 encoded data to binary.

+ "! + "! @parameter I_BASE64 | Base64-encoded binary + "! @parameter E_BINARY | Binary data + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + CLASS-METHODS base64_decode + IMPORTING + !i_base64 TYPE string + RETURNING + VALUE(e_binary) TYPE xstring + RAISING + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Returns a HTTP/REST client based on an URL.

+ "! + "! @parameter I_URL | URL + "! @parameter I_REQUEST_PROP | Request parameters + "! @parameter E_CLIENT | HTTP/REST client + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + CLASS-METHODS create_client_by_url + IMPORTING + !i_url TYPE string + !i_request_prop TYPE ts_request_prop + EXPORTING + !e_client TYPE ts_client + RAISING + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Returns the default proxy host and port.

+ "! + "! @parameter I_URL | target URL + "! @parameter E_PROXY_HOST | Proxy host + "! @parameter E_PROXY_PORT | Proxy port + "! + CLASS-METHODS get_default_proxy + IMPORTING + !i_url TYPE ts_url OPTIONAL + EXPORTING + !e_proxy_host TYPE string + !e_proxy_port TYPE string . + "!

Sets request header for basic authentication.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_USERNAME | User name + "! @parameter I_PASSWORD | Password + "! + CLASS-METHODS set_authentication_basic + IMPORTING + !i_client TYPE ts_client + !i_username TYPE string + !i_password TYPE string . + "!

Sets a HTTP header.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_NAME | Header field name + "! @parameter I_VALUE | Header field value + "! + CLASS-METHODS set_request_header + IMPORTING + !i_client TYPE ts_client + !i_name TYPE string + !i_value TYPE string . + "!

Sets the URI for a HTTP request.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_URI | URI + "! + CLASS-METHODS set_request_uri + IMPORTING + !i_client TYPE ts_client + !i_uri TYPE string . + "!

Generates a multi-part request body.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter IT_FORM_PART | Table of form parts + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + METHODS add_form_part + IMPORTING + !i_client TYPE ts_client + !it_form_part TYPE ZIF_IBMX_SERVICE_ARCH~tt_form_part + RAISING + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Executes a HTTP request.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_METHOD | HTTP method (GET,POST,PUT,DELETE) + "! @parameter E_RESPONSE | Response of the request + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + CLASS-METHODS execute + IMPORTING + !i_client TYPE ts_client + !i_method TYPE ZIF_IBMX_SERVICE_ARCH~char + RETURNING + VALUE(e_response) TYPE to_rest_response + RAISING + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Reads character data from a HTTP response.

+ "! + "! @parameter I_RESPONSE | HTTP response + "! @parameter E_DATA | Character data + "! + CLASS-METHODS get_response_string + IMPORTING + !i_response TYPE REF TO if_web_http_response + RETURNING + VALUE(e_data) TYPE string . + "!

Set character data for the body of a HTTP request.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_DATA | Character data + "! + CLASS-METHODS set_request_body_cdata + IMPORTING + !i_client TYPE ts_client + !i_data TYPE string . + "!

Set binary data for the body of a HTTP request.

+ "! + "! @parameter I_CLIENT | HTTP/REST client + "! @parameter I_DATA | Binary data + "! + CLASS-METHODS set_request_body_xdata + IMPORTING + !i_client TYPE ts_client + !i_data TYPE xstring . + "!

Reads binary data from a HTTP response.

+ "! + "! @parameter I_RESPONSE | HTTP response + "! @parameter E_DATA | Binary data + "! + CLASS-METHODS get_response_binary + IMPORTING + !i_response TYPE REF TO if_web_http_response + RETURNING + VALUE(e_data) TYPE xstring . + "!

Returns a HTTP response header.

+ "! + "! @parameter I_RESPONSE | HTTP/REST response + "! @parameter I_HEADER_FIELD | Header field name + "! @parameter E_VALUE | Header field value + "! + CLASS-METHODS get_response_header + IMPORTING + !i_response TYPE to_rest_response + !i_header_field TYPE string + RETURNING + VALUE(e_value) TYPE string . + "!

Returns the status of a REST response.

+ "! + "! @parameter I_REST_RESPONSE | HTTP/REST response + "! @parameter E_STATUS | HTTP status + "! + CLASS-METHODS get_http_status + IMPORTING + !i_rest_response TYPE REF TO if_web_http_response + RETURNING + VALUE(e_status) TYPE ts_http_status . + "!

Converts STRING data to UTF8 encoded XSTRING.

+ "! + "! @parameter I_STRING | STRING data + "! @parameter E_UTF8 | UTF8-encoded data + "! + CLASS-METHODS convert_string_to_utf8 + IMPORTING + !i_string TYPE string + RETURNING + VALUE(e_utf8) TYPE xstring + RAISING + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Finds (and replaces) a regular expression.

+ "! + "! @parameter I_REGEX | Regular expression + "! @parameter I_WITH | Replacement (if omitted, FIND is performed) + "! @parameter I_ALL_OCCURRENCES | 'X' if ALL OCCURRENCES OF should be used + "! @parameter I_IGNORING_CASE | 'X', if IGNORING CASE should be used + "! @parameter I_IN | String to be searched + "! @parameter E_OFFSET | Returns position of occurrence + "! @parameter C_SUBMATCH1 | 1st submatch + "! @parameter C_SUBMATCH2 | 2nd submatch + "! @parameter C_SUBMATCH3 | 3rd submatch + "! @parameter C_IN | String to be searched and returned + "! @parameter E_SUBRC | sy-subrc of FIND / REPLACE + "! + CLASS-METHODS find_regex + IMPORTING + !i_regex TYPE string + !i_with TYPE string OPTIONAL + !i_all_occurrences TYPE ZIF_IBMX_SERVICE_ARCH=>boolean DEFAULT 'X' + !i_ignoring_case TYPE ZIF_IBMX_SERVICE_ARCH=>boolean OPTIONAL + !i_in TYPE string OPTIONAL + EXPORTING + !e_offset TYPE int4 + CHANGING + !c_submatch1 TYPE string OPTIONAL + !c_submatch2 TYPE string OPTIONAL + !c_submatch3 TYPE string OPTIONAL + !c_in TYPE string OPTIONAL + RETURNING + VALUE(e_subrc) TYPE sysubrc . + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS ZCL_IBMX_SERVICE_ARCH IMPLEMENTATION. + + + METHOD base64_decode. + + e_binary = cl_web_http_utility=>decode_x_base64( i_base64 ). + +* if sy-subrc <> 0. +* ZCL_IBMX_SERVICE=>raise_exception( i_msgno = '030' ). " Decoding of base64 string failed +* endif. + + ENDMETHOD. + + + METHOD convert_string_to_utf8. + + CALL METHOD cl_web_http_utility=>encode_utf8 + EXPORTING + unencoded = i_string + RECEIVING + encoded = e_utf8 + EXCEPTIONS + OTHERS = 1. + IF sy-subrc <> 0. + ZCL_IBMX_SERVICE=>raise_exception( i_text = 'Cannot convert string to UTF-8' ) ##NO_TEXT. + ENDIF. + + ENDMETHOD. + + + METHOD create_client_by_url. + + DATA: + lv_text TYPE string. + + TRY. + "create http destination by url + DATA(lo_http_destination) = + cl_http_destination_provider=>create_by_url( i_url ). + CATCH cx_http_dest_provider_error. + ENDTRY. + + "create HTTP client by destination + TRY. + e_client-http = cl_web_http_client_manager=>create_by_http_destination( lo_http_destination ) . + CATCH cx_web_http_client_error. + lv_text = `HTTP client cannot be created: ` && lv_text ##NO_TEXT. + ZCL_IBMX_SERVICE=>raise_exception( i_text = lv_text ). + ENDTRY. + + e_client-request = e_client-http->get_http_request( ). + + ENDMETHOD. + + + METHOD execute. + + DATA: + lo_request TYPE REF TO if_web_http_request, + lv_method TYPE string, + lv_text TYPE string, + lo_exception TYPE REF TO cx_web_http_client_error. + + TRY. + CASE i_method. + WHEN ZIF_IBMX_SERVICE_ARCH~c_method_get. + lv_method = 'GET'. + e_response = i_client-http->execute( if_web_http_client=>get ). + WHEN ZIF_IBMX_SERVICE_ARCH~c_method_post. + lv_method = 'POST'. + e_response = i_client-http->execute( if_web_http_client=>post ). + WHEN ZIF_IBMX_SERVICE_ARCH~c_method_put. + lv_method = 'PUT'. + e_response = i_client-http->execute( if_web_http_client=>put ). + WHEN ZIF_IBMX_SERVICE_ARCH~c_method_patch. + lv_method = 'PATCH'. + e_response = i_client-http->execute( if_web_http_client=>patch ). + WHEN ZIF_IBMX_SERVICE_ARCH~c_method_delete. + lv_method = 'DELETE'. + e_response = i_client-http->execute( if_web_http_client=>delete ). + WHEN others. + lv_method = ZIF_IBMX_SERVICE_ARCH~c_not_supported. + ENDCASE. + + CATCH cx_web_http_client_error INTO lo_exception. + lv_text = lo_exception->get_text( ). + lv_text = `HTTP ` && lv_method && ` request failed: ` && lv_text ##NO_TEXT. + ZCL_IBMX_SERVICE=>raise_exception( i_text = lv_text i_previous = lo_exception ). + ENDTRY. + + IF lv_method EQ ZIF_IBMX_SERVICE_ARCH~c_not_supported. + ZCL_IBMX_SERVICE=>raise_exception( i_text = ZIF_IBMX_SERVICE_ARCH~c_not_supported ). + ENDIF. + + ENDMETHOD. + + + METHOD add_form_part. + + DATA: + ls_form_part TYPE ZIF_IBMX_SERVICE_ARCH~ts_form_part, + lo_part TYPE REF TO if_web_http_request. + + LOOP AT it_form_part INTO ls_form_part. + + lo_part = i_client-request->add_multipart( ). + + IF NOT ls_form_part-content_type IS INITIAL. + lo_part->set_header_field( i_name = `Content-Type` i_value = ls_form_part-content_type ) ##NO_TEXT. + ENDIF. + + IF NOT ls_form_part-content_disposition IS INITIAL. + lo_part->set_header_field( i_name = `Content-Disposition` i_value = ls_form_part-content_disposition ) ##NO_TEXT. + ELSE. + lo_part->set_header_field( i_name = `Content-Disposition` i_value = `form-data; name="unnamed"` ) ##NO_TEXT. + ENDIF. + + IF NOT ls_form_part-xdata IS INITIAL. + DATA(lv_length) = xstrlen( ls_form_part-xdata ). + lo_part->set_binary( i_data = ls_form_part-xdata i_offset = 0 i_length = lv_length ). + ENDIF. + + IF NOT ls_form_part-cdata IS INITIAL. + lo_part->set_text( i_text = ls_form_part-cdata ). + ENDIF. + + ENDLOOP. + + ENDMETHOD. + + + METHOD get_default_proxy. + + ENDMETHOD. + + + METHOD get_http_status. + DATA: ls_status TYPE if_web_http_response=>http_status. + + ls_status = i_rest_response->get_status( ). + e_status-code = ls_status-code. + e_status-reason = ls_status-reason. + TRY. + e_status-json = i_rest_response->get_text( ). + CATCH cx_web_message_error. + " response may be binary -> ignore + e_status-json = ''. + ENDTRY. + ENDMETHOD. + + + METHOD get_progname. + +* e_progname = sy-cprog. + + ENDMETHOD. + + + METHOD get_response_binary. + + e_data = i_response->get_binary( ). + + ENDMETHOD. + + + METHOD get_response_header. + + e_value = i_response->get_header_field( i_name = i_header_field ). + + ENDMETHOD. + + + METHOD get_response_string. + + e_data = i_response->get_text( ). + + ENDMETHOD. + + + METHOD get_timezone. + +* e_timezone = sy-zonlo. + + ENDMETHOD. + + + METHOD set_authentication_basic. + + i_client-request->set_authorization_basic( + EXPORTING + i_username = i_username + i_password = i_password + ). + + ENDMETHOD. + + + METHOD set_request_body_cdata. + + i_client-request->set_text( i_text = i_data ). + + ENDMETHOD. + + + METHOD set_request_body_xdata. + + i_client-request->set_binary( i_data = i_data ). + + ENDMETHOD. + + + METHOD set_request_header. + + i_client-request->set_header_field( i_name = i_name i_value = i_value ) . + + ENDMETHOD. + + + METHOD set_request_uri. + + DATA: + lo_request TYPE REF TO if_web_http_request. + + i_client-request->set_uri_path( i_uri_path = i_uri ). + + ENDMETHOD. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMC_SERVICE_ARCH=>FIND_REGEX +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REGEX TYPE STRING +* | [--->] I_WITH TYPE STRING(optional) +* | [--->] I_ALL_OCCURRENCES TYPE BOOLEAN (default ='X') +* | [--->] I_IGNORING_CASE TYPE BOOLEAN(optional) +* | [--->] I_IN TYPE STRING(optional) +* | [<---] E_OFFSET TYPE INT4 +* | [<-->] C_SUBMATCH1 TYPE STRING(optional) +* | [<-->] C_SUBMATCH2 TYPE STRING(optional) +* | [<-->] C_SUBMATCH3 TYPE STRING(optional) +* | [<-->] C_IN TYPE STRING +* | [<-()] E_SUBRC TYPE SYSUBRC +* +-------------------------------------------------------------------------------------- + METHOD find_regex. + + DATA: + l_in TYPE string. + + IF NOT i_with IS SUPPLIED. + " FIND + IF i_in IS SUPPLIED. + l_in = i_in. + ELSE. + l_in = c_in. + ENDIF. + IF c_submatch3 IS SUPPLIED. + IF i_ignoring_case EQ 'X'. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset IGNORING CASE SUBMATCHES c_submatch1 c_submatch2 c_submatch3. + ELSE. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset SUBMATCHES c_submatch1 c_submatch2 c_submatch3. + ENDIF. + ELSEIF c_submatch2 IS SUPPLIED. + IF i_ignoring_case EQ 'X'. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset IGNORING CASE SUBMATCHES c_submatch1 c_submatch2. + ELSE. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset SUBMATCHES c_submatch1 c_submatch2. + ENDIF. + ELSEIF c_submatch1 IS SUPPLIED. + IF i_ignoring_case EQ 'X'. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset IGNORING CASE SUBMATCHES c_submatch1. + ELSE. + FIND PCRE i_regex IN l_in MATCH OFFSET e_offset SUBMATCHES c_submatch1. + ENDIF. + ELSE. + IF i_ignoring_case EQ 'X'. + FIND PCRE i_regex IN c_in MATCH OFFSET e_offset IGNORING CASE. + ELSE. + FIND PCRE i_regex IN c_in MATCH OFFSET e_offset. + ENDIF. + ENDIF. + + ELSE. + " REPLACE + e_offset = 0. + IF i_all_occurrences EQ 'X'. + IF i_ignoring_case EQ 'X'. + REPLACE ALL OCCURRENCES OF PCRE i_regex IN c_in WITH i_with IGNORING CASE. + ELSE. + REPLACE ALL OCCURRENCES OF PCRE i_regex IN c_in WITH i_with. + ENDIF. + ELSE. + IF i_ignoring_case EQ 'X'. + REPLACE FIRST OCCURRENCE OF PCRE i_regex IN c_in WITH i_with IGNORING CASE. + ELSE. + REPLACE FIRST OCCURRENCE OF PCRE i_regex IN c_in WITH i_with. + ENDIF. + ENDIF. + + ENDIF. + + e_subrc = sy-subrc. + + ENDMETHOD. +ENDCLASS. diff --git a/src/zcl_ibmx_service_arch.clas.xml b/src/zcl_ibmx_service_arch.clas.xml new file mode 100644 index 0000000..2abcc3c --- /dev/null +++ b/src/zcl_ibmx_service_arch.clas.xml @@ -0,0 +1,144 @@ + + + + + + ZCL_IBMX_SERVICE_ARCH + E + IBM Watson SDK Platform-specifics + 1 + X + X + X + + + + ZCL_IBMX_SERVICE_ARCH + ADD_FORM_PART + E + Generates a multi-part request body. + + + ZCL_IBMX_SERVICE_ARCH + BASE64_DECODE + E + Decodes base64 encoded data to binary. + + + ZCL_IBMX_SERVICE_ARCH + CONVERT_STRING_TO_UTF8 + E + Converts STRING data to UTF8 encoded XSTRING. + + + ZCL_IBMX_SERVICE_ARCH + CREATE_CLIENT_BY_URL + E + Returns a HTTP/REST client based on an URL. + + + ZCL_IBMX_SERVICE_ARCH + EXECUTE + E + Executes a HTTP request. + + + ZCL_IBMX_SERVICE_ARCH + FIND_REGEX + E + Finds (and replaces) a regular expression. + + + ZCL_IBMX_SERVICE_ARCH + GET_DEFAULT_PROXY + E + Returns the default proxy host and port. + + + ZCL_IBMX_SERVICE_ARCH + GET_HTTP_STATUS + E + Returns the status of a REST response. + + + ZCL_IBMX_SERVICE_ARCH + GET_PROGNAME + E + Returns an ABAP module identifier. + + + ZCL_IBMX_SERVICE_ARCH + GET_RESPONSE_BINARY + E + Reads binary data from a HTTP response. + + + ZCL_IBMX_SERVICE_ARCH + GET_RESPONSE_HEADER + E + Returns a HTTP response header. + + + ZCL_IBMX_SERVICE_ARCH + GET_RESPONSE_STRING + E + Reads character data from a HTTP response. + + + ZCL_IBMX_SERVICE_ARCH + GET_REST_REQUEST + E + Returns a request object from a HTTP client object. + + + ZCL_IBMX_SERVICE_ARCH + GET_TIMEZONE + E + Returns the user's time zone. + + + ZCL_IBMX_SERVICE_ARCH + SET_AUTHENTICATION_BASIC + E + Sets request header for basic authentication. + + + ZCL_IBMX_SERVICE_ARCH + SET_REQUEST_BODY_CDATA + E + Set character data for the body of a HTTP request. + + + ZCL_IBMX_SERVICE_ARCH + SET_REQUEST_BODY_XDATA + E + Set binary data for the body of a HTTP request. + + + ZCL_IBMX_SERVICE_ARCH + SET_REQUEST_HEADER + E + Sets a HTTP header. + + + ZCL_IBMX_SERVICE_ARCH + SET_REQUEST_URI + E + Sets the URI for a HTTP request. + + + ZCL_IBMX_SERVICE_ARCH + TO_HTTP_CLIENT + E + HTTP Client Control Block + + + ZCL_IBMX_SERVICE_ARCH + TO_REST_CLIENT + E + REST HTTP Client + + + + + \ No newline at end of file diff --git a/src/zcl_ibmx_service_ext.clas.abap b/src/zcl_ibmx_service_ext.clas.abap new file mode 100644 index 0000000..0d929fa --- /dev/null +++ b/src/zcl_ibmx_service_ext.clas.abap @@ -0,0 +1,1182 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +class ZCL_IBMX_SERVICE_EXT definition + public + inheriting from ZCL_IBMX_SERVICE + create public . + +public section. + + types: + ty_instance_id(32) type c . + types: + ty_servicename(30) type c . + types: + ty_image_format(3) type c . + types TY_IMAGE_CLASS type STRING . + types: + begin of ts_oauth_prop, + url type ts_url, + username type string, + password type string, + apikey type string, + end of ts_oauth_prop . + + constants C_FIELD_NONE type FIELDNAME value '###' ##NO_TEXT. + constants C_FORMAT_JPG type TY_IMAGE_FORMAT value 'jpg' ##NO_TEXT. + constants C_FORMAT_PNG type TY_IMAGE_FORMAT value 'png' ##NO_TEXT. + constants C_FORMAT_GIF type TY_IMAGE_FORMAT value 'gif' ##NO_TEXT. + constants C_FORMAT_TIF type TY_IMAGE_FORMAT value 'tif' ##NO_TEXT. + constants C_FORMAT_ZIP type TY_IMAGE_FORMAT value 'zip' ##NO_TEXT. + constants C_FORMAT_ALL type TY_IMAGE_FORMAT value '*' ##NO_TEXT. + constants C_FORMAT_UNKNOWN type TY_IMAGE_FORMAT value '###' ##NO_TEXT. + constants C_TOKEN_GENERATION_NEVER type CHAR value 'N' ##NO_TEXT. + constants C_TOKEN_GENERATION_ALWAYS type CHAR value 'A' ##NO_TEXT. + constants C_TOKEN_GENERATION_AUTO type CHAR value SPACE ##NO_TEXT. + constants C_IAM_TOKEN_HOST type STRING value 'iam.cloud.ibm.com' ##NO_TEXT. + constants C_IAM_TOKEN_PATH type STRING value '/identity/token' ##NO_TEXT. + constants C_WATSONX_TOKEN_PATH type STRING value '/icp4d-api/v1/authorize' ##NO_TEXT. + constants C_ICP4D_TOKEN_PATH type STRING value '/v1/preauth/validateAuth' ##NO_TEXT. + data P_INSTANCE_ID type TY_INSTANCE_ID . + data P_SERVICENAME type TY_SERVICENAME . + + "!

Returns the bearer token, if available.

+ "! + "! @parameter E_BEARER_TOKEN | Access token. + "! + methods GET_BEARER_TOKEN + returning + value(E_BEARER_TOKEN) type STRING . + "!

Returns the SDK built date.

+ "! + "! @parameter E_SDK_VERSION_DATE | Built data in format YYYYMMDD. + "! + methods GET_SDK_VERSION_DATE + returning + value(E_SDK_VERSION_DATE) type STRING . + "!

Method for internal use.

+ "! + methods SET_BEARER_TOKEN + importing + !I_BEARER_TOKEN type STRING . + "!

Retrieves a value of a configuration parameter

from table ZIBMX_CONFIG. + "! + "! @parameter I_DEFAULT | Default value, if configuration parameter is not found. + "! @parameter I_PARAM | Configuration parameter name. + "! + methods GET_CONFIG_VALUE + importing + !I_DEFAULT type ZIBMX_CONFIG-VALUE optional + !I_PARAM type ZIBMX_CONFIG-PARAM + returning + value(E_VALUE) type ZIBMX_CONFIG-VALUE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Factory method to instantiate a service wrapper class.

+ "! + "! @parameter I_INSTANCE_ID | + "! Value of field INSTANCE_UID in table ZIBMX_CONFIG. + "! Service credentials are read from table ZIBMX_CONFIG with key SERVICE = Name of service wrapper class without prefix ZCL_IBMX_ and INSTANCE_UID. + "! @parameter I_URL | URL of the service. + "! @parameter I_HOST | Host of the service. I_URL and I_HOST can be used synonymously. + "! @parameter I_USERNAME | User password to authenticate on service. + "! @parameter I_PASSWORD | User password to authenticate on service. + "! @parameter I_PROXY_HOST | Proxy server, not applicable on SAP Cloud Platform. + "! @parameter I_PROXY_PORT | Proxy server port, not applicable on SAP Cloud Platform. + "! @parameter I_APIKEY | API key password to authenticate on service. + "! @parameter I_AUTH_METHOD | Authentication method. Possible values are "IAM", "ICP4D", "basicAuth", "NONE". + "! @parameter I_OAUTH_PROP | Credentials to generate token for OAuth authentication. + "! @parameter I_TOKEN_GENERATION | Method for access token refresh:
+ "! C_TOKEN_GENERATION_NEVER - Access token is not refreshed. + "! C_TOKEN_GENERATION_ALWAYS - Access to token is refreshed for each service call. + "! C_TOKEN_GENERATION_AUTO - Access to token is refreshed just before it expires. + "! @parameter I_REQUEST_HEADERS | List of headers sent with every request, format 'Header1=Value1;Header2=Value2'. + "! @parameter I_VERSION | Value of query parameter VERSION. + "! + class-methods GET_INSTANCE + importing + !I_INSTANCE_ID type TY_INSTANCE_ID optional + !I_URL type STRING optional + !I_HOST type STRING optional + !I_USERNAME type STRING optional + !I_PASSWORD type STRING optional + !I_PROXY_HOST type STRING optional + !I_PROXY_PORT type STRING optional + !I_APIKEY type STRING optional + !I_AUTH_METHOD type STRING default C_DEFAULT + !I_OAUTH_PROP type TS_OAUTH_PROP optional + !I_ACCESS_TOKEN type TS_ACCESS_TOKEN optional + !I_TOKEN_GENERATION type CHAR default C_TOKEN_GENERATION_AUTO + !I_REQUEST_HEADERS type STRING optional + !I_VERSION type STRING optional + exporting + value(EO_INSTANCE) type ANY . + "!

Compresses multiple images from an internal table

to a one or more xstrings in ZIP format. + "! + "! @parameter IT_EXAMPLES | Internal table of images. + "! @parameter IV_FIELD_CLASS | + "! Field in IT_EXAMPLES that contains the file class. + "! All records in IT_EXAMPLES with same class will be compress into one ZIP xstring. + "! @parameter IV_FIELD_FILENAME | Field in IT_EXAMPLES that contains the filename for the image. + "! @parameter IV_FIELD_IMAGE | Field in IT_EXAMPLES that contains the image. + "! @parameter IV_IMAGE_FORMAT | Format of the image. Possible values are + "! C_FORMAT_JPG, C_FORMAT_PNG, C_FORMAT_GIF, C_FORMAT_TIF, C_FORMAT_ALL. + "! @parameter IV_IMAGE_NAME | Name of the image. + "! @parameter ET_ZIPDATA | Internal table containing a compressed ZIP xstring for each image class. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + class-methods GET_ZIPDATA + importing + !IT_EXAMPLES type ANY TABLE + !IV_FIELD_CLASS type FIELDNAME default C_FIELD_NONE + !IV_FIELD_FILENAME type FIELDNAME optional + !IV_FIELD_IMAGE type FIELDNAME optional + !IV_IMAGE_FORMAT type TY_IMAGE_FORMAT optional + !IV_IMAGE_NAME type STRING optional + exporting + !ET_ZIPDATA type TT_MAP_FILE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + methods GET_ACCESS_TOKEN + redefinition . + methods GET_REQUEST_PROP + redefinition . +protected section. +private section. + + data P_OAUTH_PROP type TS_OAUTH_PROP . + data P_TOKEN_GENERATION type CHAR . + + "!

Method for internal use.

+ "! + class-methods ADD_CONFIG_PROP + importing + !I_SERVICENAME type TY_SERVICENAME + !I_INSTANCE_ID type TY_INSTANCE_ID optional + changing + !C_REQUEST_PROP type ANY . + "!

Method for internal use.

+ "! + class-methods ADD_IMAGE_TO_ZIP + importing + !IS_TABLELINE type ANY + !IO_ZIP type ref to CL_ABAP_ZIP + !IV_BASE64 type BOOLEAN + !IV_FILENAME type STRING optional + !IV_FIELD_IMAGE type FIELDNAME + !IV_FIELD_FILENAME type FIELDNAME optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Method for internal use.

+ "! + class-methods GET_FIELD_DATA + importing + !IS_TABLELINE type ANY + !IV_FIELD_CLASS type FIELDNAME optional + !IV_FIELD_FILENAME type FIELDNAME optional + !IV_FIELD_IMAGE type FIELDNAME optional + exporting + !EV_FIELD_CLASS type FIELDNAME + !EV_FIELD_FILENAME type FIELDNAME + !EV_FIELD_IMAGE type FIELDNAME + !EV_FIELD_IMAGE_BASE64 type FIELDNAME + raising + ZCX_IBMX_SERVICE_EXCEPTION . +ENDCLASS. + + + +CLASS ZCL_IBMX_SERVICE_EXT IMPLEMENTATION. + + +* ---------------------------------------------------------------------------------------+ +* | Static Private Method ZCL_IBMX_SERVICE_EXT=>ADD_CONFIG_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SERVICENAME TYPE TY_SERVICENAME +* | [--->] I_INSTANCE_ID TYPE TY_INSTANCE_ID(optional) +* | [<-->] C_REQUEST_PROP TYPE ANY +* +-------------------------------------------------------------------------------------- + method add_config_prop. + + data: + lt_compname type tt_string, + lv_type type char, + ls_config type ZIBMX_config, + lt_config type standard table of ZIBMX_config, + lt_ref type standard table of ref to data, + lr_data type ref to data, + lv_index type i value 0, + ls_url type ts_url value is initial. + + field-symbols: + type any, + type any, + type string, + type any. + + " read config table + if not i_instance_id is initial. + select * + from ZIBMX_config + where service = @i_servicename and + instance_uid = @i_instance_id + into table @lt_config. + else. + select * + from ZIBMX_config + where service = @i_servicename and + instance_uid = @space + into table @lt_config. + endif. + + " quit, if no relevant entry in config table exists + check sy-subrc = 0. + + " change config parameter "URL" to "HOST" + ls_config-param = 'HOST'. + modify lt_config from ls_config transporting param where param = 'URL'. + + " perform breadth-first search on c_request_prop to allow setting values on deeper levels, + " e.g. HOST -> c_request_prop-url-host + lr_data = ref #( c_request_prop ). + append lr_data to lt_ref. + + do. + lv_index = lv_index + 1. + read table lt_ref into lr_data index lv_index. + if sy-subrc <> 0. + exit. + endif. + assign lr_data->* to . + + get_components( + exporting + i_structure = + importing + e_components = lt_compname ). + + loop at lt_compname assigning . + assign component of structure to . + check sy-subrc = 0. + get_field_type( + exporting + i_field = + importing + e_technical_type = lv_type ). + if lv_type eq ZIF_IBMX_service_arch~c_datatype-struct or + lv_type eq ZIF_IBMX_service_arch~c_datatype-struct_deep. + lr_data = ref #( ). + append lr_data to lt_ref. + else. + if is initial. + read table lt_config into ls_config with key param = ##WARN_OK. + if sy-subrc = 0. + condense ls_config-value. + = ls_config-value. + endif. + endif. + endif. + endloop. + + enddo. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Private Method ZCL_IBMX_SERVICE_EXT=>ADD_IMAGE_TO_ZIP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] IS_TABLELINE TYPE ANY +* | [--->] IO_ZIP TYPE REF TO CL_ABAP_ZIP +* | [--->] IV_BASE64 TYPE BOOLEAN +* | [--->] IV_FILENAME TYPE STRING(optional) +* | [--->] IV_FIELD_IMAGE TYPE FIELDNAME +* | [--->] IV_FIELD_FILENAME TYPE FIELDNAME(optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method add_image_to_zip. + data: + lx_image type xstring, + lv_filename type string. + field-symbols: + type any, + type any. + + if not iv_filename is initial. + lv_filename = iv_filename. + else. + assign component iv_field_filename of structure is_tableline to . + lv_filename = conv #( ). " type conversion + if lv_filename is initial. + raise_exception( i_msgno = '056' ). + endif. + endif. + + assign component iv_field_image of structure is_tableline to . + + if iv_base64 eq c_boolean_true. + + lx_image = base64_decode( i_base64 = ). + + io_zip->add( + name = lv_filename + content = lx_image ). + + else. + + io_zip->add( + name = lv_filename + content = ). + + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->GET_ACCESS_TOKEN +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REQUEST_PROP TYPE TS_REQUEST_PROP(optional) +* | [<-()] E_ACCESS_TOKEN TYPE TS_ACCESS_TOKEN +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_access_token. + data: + lo_response type to_rest_response, + lv_grand_urlencoded type string, + lv_key_urlencoded type string, + lv_json type string, + lv_seconds type i, + lv_timestamp type timestamp, + ls_token type ZIBMX_token value is initial, + ls_timestamp type timestamp, + begin of ls_token_classic, + token type string, + end of ls_token_classic. + + if not i_request_prop-access_token-access_token is initial. + ls_token-access_token = p_request_prop_default-access_token-access_token. + ls_token-token_type = p_request_prop_default-access_token-token_type. + ls_token-expires_ts = p_request_prop_default-access_token-expires_ts. + else. + + select single * + from ZIBMX_token + where service = @p_servicename and + instance_uid = @p_instance_id + into @ls_token. + + endif. + + " check if access token has expired + get time stamp field ls_timestamp. + if ls_timestamp >= ls_token-expires_ts. + clear ls_token. + endif. + + " (re)new token unless it is still valid + if ls_token-access_token is initial and p_token_generation ne c_token_generation_never. + + data: + ls_token_request_prop type ts_request_prop. + + ls_token_request_prop-url = p_oauth_prop-url. + " set to tribool_false to distinguish between false and inital + ls_token_request_prop-auth_basic = c_tribool_false. + ls_token_request_prop-auth_oauth = c_tribool_false. + ls_token_request_prop-auth_apikey = c_tribool_false. + ls_token_request_prop-header_accept = ZCL_IBMX_service=>ZIF_IBMX_service_arch~c_mediatype-appl_json. + + + if i_request_prop-auth_name eq 'IAM' or i_request_prop-auth_name eq 'BearerToken' ##NO_TEXT. + + " write urlencoded parameters + if not ls_token-refresh_token is initial. + lv_grand_urlencoded = escape( val = 'refresh_token' format = cl_abap_format=>e_uri_full ) ##NO_TEXT. + lv_key_urlencoded = escape( val = ls_token-refresh_token format = cl_abap_format=>e_uri_full ). + ls_token_request_prop-body = `grant_type=` && lv_grand_urlencoded && `&refresh_token=` && lv_key_urlencoded ##NO_TEXT. + else. + if not p_oauth_prop-apikey is initial. + lv_grand_urlencoded = escape( val = 'urn:ibm:params:oauth:grant-type:apikey' format = cl_abap_format=>e_uri_full ) ##NO_TEXT. + lv_key_urlencoded = escape( val = p_oauth_prop-apikey format = cl_abap_format=>e_uri_full ). + ls_token_request_prop-body = `grant_type=` && lv_grand_urlencoded && `&apikey=` && lv_key_urlencoded ##NO_TEXT. + elseif not p_oauth_prop-password is initial. + lv_grand_urlencoded = escape( val = 'urn:ibm:params:oauth:grant-type:password' format = cl_abap_format=>e_uri_full ) ##NO_TEXT. + lv_key_urlencoded = escape( val = p_oauth_prop-password format = cl_abap_format=>e_uri_full ). + ls_token_request_prop-body = `grant_type=` && lv_grand_urlencoded && `&username=` && p_oauth_prop-username && `&password=` && p_oauth_prop-password ##NO_TEXT. + else. + ls_token_request_prop-username = p_oauth_prop-username. + ls_token_request_prop-password = p_oauth_prop-password. + ls_token_request_prop-apikey = p_oauth_prop-apikey. + endif. + endif. + ls_token_request_prop-header_content_type = ZCL_IBMX_service=>ZIF_IBMX_service_arch~c_mediatype-appl_www_form_urlencoded. + + " execute HTTP POST request + lo_response = http_post( i_request_prop = ls_token_request_prop ). + + " receive response json + lv_json = get_response_string( lo_response ). + + " call json parser (ignore properties that do not exist in abap structure) + parse_json( + exporting + i_json = lv_json + changing + c_abap = ls_token ). + + else. + + if i_request_prop-auth_body eq c_boolean_true. + + " POST request having username/password in body (e.g. for Db2 Warehouse) + ls_token_request_prop-body = `{ "userid": "` && p_oauth_prop-username && `", "password": "` && p_oauth_prop-password && `" }` ##NO_TEXT. + ls_token_request_prop-header_content_type = ZCL_IBMX_service=>ZIF_IBMX_service_arch~c_mediatype-appl_json. + + " execute HTTP POST request + lo_response = http_post( i_request_prop = ls_token_request_prop ). + + else. + + ls_token_request_prop-username = p_oauth_prop-username. + ls_token_request_prop-password = p_oauth_prop-password. + ls_token_request_prop-apikey = p_oauth_prop-apikey. + ls_token_request_prop-url = p_oauth_prop-url. + ls_token_request_prop-auth_basic = c_boolean_true. + + " execute HTTP GET request + lo_response = http_get( i_request_prop = ls_token_request_prop ). + + " receive response json + lv_json = get_response_string( lo_response ). + + if i_request_prop-auth_name eq 'ICP4D' ##NO_TEXT. + + " parse expected response: + " { "username": "joe", "role": "User", "uid": "1003", + " "accessToken": "eyJhbGc...1AjT_w", + " "messageCode": "success", "message": "success" } + data: + begin of ls_access_token_icp4d, + accesstoken type string, + end of ls_access_token_icp4d. + parse_json( + exporting + i_json = lv_json + changing + c_abap = ls_access_token_icp4d ). + + ls_token-access_token = ls_access_token_icp4d-accesstoken. + ls_token-expires_in = 12 * 3600. + + else. + + " call json parser + parse_json( + exporting + i_json = lv_json + changing + c_abap = ls_token_classic ). + + ls_token-access_token = ls_token_classic-token. + ls_token-expires_in = 3600. + + endif. + + ls_token-token_type = 'Bearer' ##NO_TEXT. + + endif. + + endif. + + + " calculate expiration time + if ls_token-expires_in > 0. + get time stamp field lv_timestamp. + lv_seconds = ls_token-expires_in - 300. " subtract 5 minutes to be save + ls_token-expires_ts = cl_abap_tstmp=>add( tstmp = lv_timestamp secs = lv_seconds ) ##TYPE. + endif. + + ls_token-service = p_servicename. + ls_token-instance_uid = p_instance_id. + + if p_token_generation eq c_token_generation_auto. + modify ZIBMX_token from @ls_token. + commit work. + endif. + + endif. + + " fill returning parameter + move-corresponding ls_token to e_access_token ##ENH_OK. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->GET_BEARER_TOKEN +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_BEARER_TOKEN TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_bearer_token. + + data: + ls_access_token type ts_access_token. + + try. + ls_access_token = get_access_token( ). + catch ZCX_IBMX_service_exception. + clear ls_access_token. + endtry. + + + if ls_access_token-token_type eq 'Bearer'. + e_bearer_token = ls_access_token-access_token. + else. + clear e_bearer_token. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->GET_CONFIG_VALUE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEFAULT TYPE ZIBMX_CONFIG-VALUE(optional) +* | [--->] I_PARAM TYPE ZIBMX_CONFIG-PARAM +* | [<-()] E_VALUE TYPE ZIBMX_CONFIG-VALUE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_config_value. + + + select single value + from ZIBMX_config + where param = @i_param and + service = @p_servicename and + instance_uid = @p_instance_id + into @e_value. + + if sy-subrc <> 0. + select single value + from ZIBMX_config + where param = @i_param and + service = @p_servicename and + instance_uid = @space + into @e_value. + + if sy-subrc <> 0. + if i_default is supplied. + e_value = i_default. + else. + raise exception type ZCX_IBMX_service_exception. + endif. + endif. + + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Private Method ZCL_IBMX_SERVICE_EXT=>GET_FIELD_DATA +* +-------------------------------------------------------------------------------------------------+ +* | [--->] IS_TABLELINE TYPE ANY +* | [--->] IV_FIELD_CLASS TYPE FIELDNAME(optional) +* | [--->] IV_FIELD_FILENAME TYPE FIELDNAME(optional) +* | [--->] IV_FIELD_IMAGE TYPE FIELDNAME(optional) +* | [<---] EV_FIELD_CLASS TYPE FIELDNAME +* | [<---] EV_FIELD_FILENAME TYPE FIELDNAME +* | [<---] EV_FIELD_IMAGE TYPE FIELDNAME +* | [<---] EV_FIELD_IMAGE_BASE64 TYPE FIELDNAME +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_field_data. + + data: + begin of ls_comp, + name type string, + type type char, + length type i, + end of ls_comp, + lt_comp like standard table of ls_comp, + lt_compname type tt_string, + lv_msg1 type string. + field-symbols: + type any. + + get_components( + exporting + i_structure = is_tableline + importing + e_components = lt_compname ). + + loop at lt_compname into ls_comp-name. + assign component ls_comp-name of structure is_tableline to . + get_field_type( + exporting + i_field = + importing + e_technical_type = ls_comp-type + e_length = ls_comp-length ). + append ls_comp to lt_comp. + endloop. + + clear: ev_field_class, ev_field_filename, ev_field_image, ev_field_image_base64. + + if ev_field_class is requested. + if not iv_field_class is initial. + " field that contains class name is explicit specified + ev_field_class = iv_field_class. + else. + " field CLASS + read table lt_comp with key name = 'CLASS' into ls_comp. + if sy-subrc = 0 and + ( ls_comp-type eq 'C' or ls_comp-type eq 'g' or ls_comp-type eq 'N' ). " character type + ev_field_class = ls_comp-name. + else. + " first field of character type and length 3 or more contains class name + loop at lt_comp into ls_comp where ( type eq 'C' or type eq 'N' ) and length >= 3 and + name ne 'FILENAME' and name ne 'IMAGE' and name ne 'IMAGE_BASE64'. + ev_field_class = ls_comp-name. + exit. + endloop. + endif. + if ev_field_class is initial. + " first field of type string contains class name + loop at lt_comp into ls_comp where type eq 'g' and + name ne 'FILENAME' and name ne 'IMAGE' and name ne 'IMAGE_BASE64'. + ev_field_class = ls_comp-name. + exit. + endloop. + endif. + endif. + endif. + + + if ev_field_filename is requested. + if not iv_field_filename is initial. + " field that contains image name is explicit specified + ev_field_filename = iv_field_filename. + else. + read table lt_comp with key name = 'FILENAME' into ls_comp. + if sy-subrc = 0 and + ( ls_comp-type eq 'C' or ls_comp-type eq 'g' or ls_comp-type eq 'N' ). + ev_field_filename = ls_comp-name. + else. + " first field of character type and length 6 or more contains image name + loop at lt_comp into ls_comp where ( type eq 'C' or type eq 'N' ) and length >= 6 and + name ne ev_field_class and name ne 'IMAGE' and name ne 'IMAGE_BASE64'. + ev_field_filename = ls_comp-name. + exit. + endloop. + endif. + if ev_field_filename is initial. + " first field of type string contains image name + loop at lt_comp into ls_comp where type eq 'g' and name ne ev_field_class. + ev_field_filename = ls_comp-name. + exit. + endloop. + endif. + endif. + endif. + + + if ev_field_image is requested. + if not iv_field_image is initial. + " field that contains image data is explicit specified + + " check image field data type to determine encoding + read table lt_comp into ls_comp with key name = iv_field_image. + if sy-subrc <> 0. + lv_msg1 = conv #( ev_field_image ). " type conversion + raise_exception( + i_msgno = '054' " Field &1 is missing or has incompatible type. + i_msgv1 = lv_msg1 ). + endif. + if ls_comp-type eq 'g'. + " image is base64 encoded + ev_field_image_base64 = iv_field_image. + else. + " image in binary data + ev_field_image = iv_field_image. + endif. + + else. + read table lt_comp with key name = 'IMAGE' into ls_comp. + if sy-subrc <> 0. + read table lt_comp with key name = 'IMAGE_BASE64' into ls_comp. + endif. + if sy-subrc = 0 and + ( ls_comp-type eq 'y' or ls_comp-type eq 'g' ). " xstring or string + if ls_comp-type eq 'g'. + ev_field_image_base64 = ls_comp-name. + else. + ev_field_image = ls_comp-name. + endif. + else. + " first field of type xstring contains image data (binary) + loop at lt_comp into ls_comp where type eq 'y' and + name ne ev_field_class and name ne ev_field_filename. + ev_field_image = ls_comp-name. + exit. + endloop. + endif. + if ev_field_image is initial. + " first field of type string contains image data (base64 encoded) + loop at lt_comp into ls_comp where type eq 'g' and + name ne ev_field_class and name ne ev_field_filename. + ev_field_image_base64 = ls_comp-name. + exit. + endloop. + endif. + endif. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE_EXT=>GET_INSTANCE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_INSTANCE_ID TYPE TY_INSTANCE_ID(optional) +* | [--->] I_URL TYPE STRING(optional) +* | [--->] I_HOST TYPE STRING(optional) +* | [--->] I_USERNAME TYPE STRING(optional) +* | [--->] I_PASSWORD TYPE STRING(optional) +* | [--->] I_PROXY_HOST TYPE STRING(optional) +* | [--->] I_PROXY_PORT TYPE STRING(optional) +* | [--->] I_APIKEY TYPE STRING(optional) +* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT) +* | [--->] I_OAUTH_PROP TYPE TS_OAUTH_PROP(optional) +* | [--->] I_ACCESS_TOKEN TYPE TS_ACCESS_TOKEN(optional) +* | [--->] I_TOKEN_GENERATION TYPE CHAR (default =C_TOKEN_GENERATION_AUTO) +* | [--->] I_REQUEST_HEADERS TYPE STRING(optional) +* | [--->] I_VERSION TYPE STRING(optional) +* | [<---] EO_INSTANCE TYPE ANY +* +-------------------------------------------------------------------------------------- + method get_instance. + data: + lv_classname type string, + ls_request_prop type ts_request_prop, + lo_instance type ref to ZCL_IBMX_service_ext, + lt_headerstr type tt_string, + lv_headerstr type string, + ls_header type ts_header, + lv_str type string. + + " instantiate object of type of exporting parameter + get_field_type( + exporting + i_field = eo_instance + importing + e_relative_type = lv_classname ). + + create object eo_instance type (lv_classname) + exporting + i_url = i_url + i_host = i_host + i_proxy_host = i_proxy_host + i_proxy_port = i_proxy_port + i_username = i_username + i_password = i_password + i_apikey = i_apikey. + + lo_instance ?= eo_instance. + + " Set service name (= class name without namespace and prefix 'CL_') + if lv_classname cp 'Z*'. + "find first occurrence of regex 'ZCL_[^_]*_([^\/]*)$' in lv_classname submatches lo_instance->p_servicename. + find_regex( + exporting + i_regex = 'ZCL_[^_]*_([^\/]*)$' + i_all_occurrences = space + i_in = lv_classname + changing + c_submatch1 = lv_str ). + lo_instance->p_servicename = conv #( lv_str ). + else. + "find first occurrence of regex 'CL_([^\/]*)$' in lv_classname submatches lo_instance->p_servicename. + find_regex( + exporting + i_regex = 'CL_([^\/]*)$' + i_all_occurrences = space + i_in = lv_classname + changing + c_submatch1 = lv_str ). + lo_instance->p_servicename = conv #( lv_str ). + endif. + if lo_instance->p_servicename is initial. + "find first occurrence of regex '([^\/]*)$' in lv_classname submatches lo_instance->p_servicename. + find_regex( + exporting + i_regex = '([^\/]*)$' + i_all_occurrences = space + i_in = lv_classname + changing + c_submatch1 = lv_str ). + lo_instance->p_servicename = conv #( lv_str ). + if lo_instance->p_servicename is initial. + lo_instance->p_servicename = lv_classname. + endif. + endif. + + " Set default request headers + split i_request_headers at ';' into table lt_headerstr. + if sy-subrc = 0. + loop at lt_headerstr into lv_headerstr. + split lv_headerstr at '=' into ls_header-name ls_header-value. + if sy-subrc = 0. + append ls_header to lo_instance->p_request_prop_default-headers. + endif. + endloop. + endif. + + " Set instance ID + if not i_instance_id is initial. + lo_instance->p_instance_id = i_instance_id. + else. + lo_instance->p_instance_id = get_progname( ). + endif. + + " Merge properties from config table for this service and instance + add_config_prop( + exporting + i_servicename = lo_instance->p_servicename + i_instance_id = lo_instance->p_instance_id + changing + c_request_prop = lo_instance->p_request_prop_default ). + + normalize_url( changing c_url = lo_instance->p_request_prop_default-url ). + + " Merge properties from config table for this service type + add_config_prop( + exporting + i_servicename = lo_instance->p_servicename + changing + c_request_prop = lo_instance->p_request_prop_default ). + + normalize_url( changing c_url = lo_instance->p_request_prop_default-url ). + + " Get service default properties + ls_request_prop = lo_instance->get_request_prop( i_auth_method = i_auth_method ). + merge_structure( + exporting + i_alternative = ls_request_prop + changing + c_base = lo_instance->p_request_prop_default ). + + " Ensure that OAuth is set in case IAM is used. + if lo_instance->p_request_prop_default-auth_name eq 'IAM'. + lo_instance->p_request_prop_default-auth_oauth = c_boolean_true. + endif. + + " Set OAuth properties + lo_instance->p_oauth_prop = i_oauth_prop. + normalize_url( + changing + c_url = lo_instance->p_oauth_prop-url ). + if ls_request_prop-auth_name eq 'IAM' or ls_request_prop-auth_name eq 'ICP4D' or ls_request_prop-auth_name eq 'BearerToken' ##NO_TEXT. + if lo_instance->p_oauth_prop-url-host is initial. + lo_instance->p_oauth_prop-url-protocol = 'https' ##NO_TEXT. + if ls_request_prop-auth_name eq 'IAM' or ls_request_prop-auth_name eq 'BearerToken' ##NO_TEXT. + lo_instance->p_oauth_prop-url-host = c_iam_token_host. + else. + lo_instance->p_oauth_prop-url-host = lo_instance->p_request_prop_default-url-host. + endif. + endif. + if lo_instance->p_oauth_prop-url-path_base is initial and lo_instance->p_oauth_prop-url-path is initial. + " Set path_base (not path), otherwise the default service path_base would be added, which is not correct + if ls_request_prop-auth_name eq 'IAM' or ls_request_prop-auth_name eq 'BearerToken' ##NO_TEXT. + lo_instance->p_oauth_prop-url-path_base = c_iam_token_path. + elseif ls_request_prop-auth_name eq 'WATSONX'. + lo_instance->p_oauth_prop-url-path_base = c_watsonx_token_path. + else. + lo_instance->p_oauth_prop-url-path_base = c_icp4d_token_path. + endif. + endif. + if lo_instance->p_oauth_prop-password is initial and lo_instance->p_oauth_prop-apikey is initial. + lo_instance->p_oauth_prop-username = lo_instance->p_request_prop_default-username. + lo_instance->p_oauth_prop-password = lo_instance->p_request_prop_default-password. + lo_instance->p_oauth_prop-apikey = lo_instance->p_request_prop_default-apikey. + endif. + endif. + + if not i_access_token-access_token is initial. + lo_instance->p_token_generation = c_token_generation_never. + lo_instance->set_access_token( i_access_token = i_access_token ). + else. + lo_instance->p_token_generation = i_token_generation. + endif. + + lo_instance->p_version = i_version. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->GET_REQUEST_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT) +* | [<-()] E_REQUEST_PROP TYPE TS_REQUEST_PROP +* +-------------------------------------------------------------------------------------- + method get_request_prop. + data: + lv_auth_method type string. + + e_request_prop = super->get_request_prop( i_auth_method = i_auth_method ). + + lv_auth_method = i_auth_method. + if lv_auth_method eq c_default. + lv_auth_method = 'IAM'. + endif. + if lv_auth_method is initial. + e_request_prop-auth_basic = c_boolean_false. + e_request_prop-auth_oauth = c_boolean_false. + e_request_prop-auth_apikey = c_boolean_false. + elseif lv_auth_method eq 'IAM'. + e_request_prop-auth_name = 'IAM'. + e_request_prop-auth_type = 'apiKey'. + e_request_prop-auth_headername = 'Authorization'. + e_request_prop-auth_header = c_boolean_true. + elseif lv_auth_method eq 'ICP4D'. + e_request_prop-auth_name = 'ICP4D'. + e_request_prop-auth_type = 'apiKey'. + e_request_prop-auth_headername = 'Authorization'. + e_request_prop-auth_header = c_boolean_true. + elseif lv_auth_method eq 'basicAuth'. + e_request_prop-auth_name = 'basicAuth'. + e_request_prop-auth_type = 'http'. + e_request_prop-auth_basic = c_boolean_true. + endif. + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->GET_SDK_VERSION_DATE +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_SDK_VERSION_DATE TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_sdk_version_date. + + e_sdk_version_date = '20240325'. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_SERVICE_EXT=>GET_ZIPDATA +* +-------------------------------------------------------------------------------------------------+ +* | [--->] IT_EXAMPLES TYPE ANY TABLE +* | [--->] IV_FIELD_CLASS TYPE FIELDNAME (default =C_FIELD_NONE) +* | [--->] IV_FIELD_FILENAME TYPE FIELDNAME(optional) +* | [--->] IV_FIELD_IMAGE TYPE FIELDNAME(optional) +* | [--->] IV_IMAGE_FORMAT TYPE TY_IMAGE_FORMAT(optional) +* | [--->] IV_IMAGE_NAME TYPE STRING(optional) +* | [<---] ET_ZIPDATA TYPE TT_MAP_FILE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- + method get_zipdata. + + constants: + c_class_all type string value '#ALL#'. + + data: + lv_field_class type fieldname, + lv_field_filename type fieldname, + lv_field_image type fieldname, + lv_field_image_base64 type fieldname, + lv_field_image_act type fieldname, + lv_base64 type boolean, + lr_data type ref to data, + ls_zipdata type ts_map_file, + lv_image_count type i, + lv_class type ty_image_class, + lt_classes type standard table of ty_image_class, + lv_filename type string, + lv_filename_suffix(4) type n value 0, + lo_zip type ref to cl_abap_zip value is initial, + lv_image_name type string, + lv_image_format type ty_image_format. + field-symbols: + type any, + type any, + type any, + type any. + + create data lr_data like line of it_examples. + assign lr_data->* to . + + " determine field with filename + if iv_field_filename is initial or iv_field_filename eq c_field_none. + if not iv_image_name is initial. + lv_field_filename = c_field_none. + lv_image_name = iv_image_name. + endif. + else. + lv_field_filename = iv_field_filename. + clear: lv_image_name, lv_image_format. + endif. + + " get field names + get_field_data( + exporting + is_tableline = + iv_field_class = iv_field_class + iv_field_filename = lv_field_filename + iv_field_image = iv_field_image + importing + ev_field_class = lv_field_class + ev_field_filename = lv_field_filename + ev_field_image = lv_field_image + ev_field_image_base64 = lv_field_image_base64 ). + + " reset field name for filename if explicitly set to 'none'. + if lv_field_filename eq c_field_none. + clear lv_field_filename. + endif. + + + if iv_field_class eq c_field_none. + " do not separate into different classes + append c_class_all to lt_classes. + else. + " compile list of different classes + loop at it_examples assigning . + assign component lv_field_class of structure to . + append to lt_classes. + endloop. + sort lt_classes. + delete adjacent duplicates from lt_classes. + endif. + + " determine default image format + if iv_image_format is initial or + iv_image_format eq c_format_all or + iv_image_format eq c_format_unknown. + lv_image_format = c_format_jpg. + else. + lv_image_format = iv_image_format. + endif. + translate lv_image_format to lower case. + + + " generate a zip data xstring per class + loop at lt_classes into lv_class. + check not lv_class is initial. + + create object lo_zip. + + lv_image_count = 0. + + loop at it_examples assigning . + if lv_class ne c_class_all. + assign component lv_field_class of structure to . + check eq lv_class. + endif. + + " determine filename + clear lv_filename. + if not lv_field_filename is initial. + assign component lv_field_filename of structure to . + if sy-subrc = 0. + " remove path from filename + "find regex '([^/\\]*)$' in submatches lv_filename. + find_regex( + exporting + i_regex = '([^/\\]*)$' + i_in = + changing + c_submatch1 = lv_filename ). + endif. + endif. + + " if valid filename was not found, use the default + if lv_filename np '*+.+++'. + if lv_filename is initial. + if lv_image_name is initial. + lv_filename = lv_class && lv_filename_suffix && `.` && lv_image_format. + else. + lv_filename = lv_image_name && lv_filename_suffix && `.` && lv_image_format. + endif. + else. + lv_filename = lv_filename && `.` && lv_image_format. + endif. + lv_filename_suffix = lv_filename_suffix + 1. + endif. + + " determine image encoding + if lv_field_image is initial. + lv_field_image_act = lv_field_image_base64. + lv_base64 = c_boolean_true. + elseif lv_field_image_base64 is initial. + lv_field_image_act = lv_field_image. + lv_base64 = c_boolean_false. + else. + assign component lv_field_image of structure to . + if not is initial. + lv_field_image_act = lv_field_image. + lv_base64 = c_boolean_false. + else. + lv_field_image_act = lv_field_image_base64. + lv_base64 = c_boolean_true. + endif. + endif. + + " add image to zip data + add_image_to_zip( + exporting + io_zip = lo_zip + is_tableline = + iv_filename = lv_filename + iv_field_image = lv_field_image_act + iv_base64 = lv_base64 ). + + lv_image_count = lv_image_count + 1. + + endloop. + + if lv_image_count > 0. + + ls_zipdata-key = lv_class. + ls_zipdata-data = lo_zip->save( ). + append ls_zipdata to et_zipdata. + + endif. + + endloop. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_SERVICE_EXT->SET_BEARER_TOKEN +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_BEARER_TOKEN TYPE STRING +* +-------------------------------------------------------------------------------------- + method set_bearer_token. + + data: + ls_access_token type ts_access_token. + + ls_access_token-token_type = 'Bearer' ##NO_TEXT. + ls_access_token-access_token = i_bearer_token. + try. + set_access_token( i_access_token = ls_access_token ). + catch ZCX_IBMX_service_exception ##NO_HANDLER. + endtry. + + endmethod. +ENDCLASS. diff --git a/src/zcl_ibmx_service_ext.clas.xml b/src/zcl_ibmx_service_ext.clas.xml new file mode 100644 index 0000000..1df0f96 --- /dev/null +++ b/src/zcl_ibmx_service_ext.clas.xml @@ -0,0 +1,120 @@ + + + + + + ZCL_IBMX_SERVICE_EXT + E + Extended REST API service class + 1 + X + X + X + + + + ZCL_IBMX_SERVICE_EXT + ADD_CONFIG_PROP + E + Method for internal use. + + + ZCL_IBMX_SERVICE_EXT + ADD_IMAGE_TO_ZIP + E + Method for internal use. + + + ZCL_IBMX_SERVICE_EXT + C_FIELD_NONE + E + Field Name + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_ALL + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_GIF + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_JPG + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_PNG + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_TIF + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_UNKNOWN + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + C_FORMAT_ZIP + E + Image encoding (jpg, png, ...) + + + ZCL_IBMX_SERVICE_EXT + GET_BEARER_TOKEN + E + Returns the bearer token, if available. + + + ZCL_IBMX_SERVICE_EXT + GET_CONFIG_VALUE + E + Retrieves a value of a configuration parameter + + + ZCL_IBMX_SERVICE_EXT + GET_FIELD_DATA + E + Method for internal use. + + + ZCL_IBMX_SERVICE_EXT + GET_INSTANCE + E + Factory method to instantiate a service specific wrapper cla + + + ZCL_IBMX_SERVICE_EXT + GET_SDK_VERSION_DATE + E + Returns the SDK built date. + + + ZCL_IBMX_SERVICE_EXT + GET_ZIPDATA + E + Compresses multiple images from an internal table + + + ZCL_IBMX_SERVICE_EXT + SET_BEARER_TOKEN + E + Method for internal use. + + + + + \ No newline at end of file diff --git a/src/zcl_ibmx_util.clas.abap b/src/zcl_ibmx_util.clas.abap new file mode 100644 index 0000000..e2a96a8 --- /dev/null +++ b/src/zcl_ibmx_util.clas.abap @@ -0,0 +1,611 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +class ZCL_IBMX_util definition + public + final + create public . + +public section. + + + "! Converts an internal table to JSON string in table schema format. + "! E.g.: '{"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}' + "! + "! @parameter I_ITAB | Internal table to be converted. + "! @parameter I_DICTIONARY | Dictionary to be used for mapping ABAP identifiers to JSON keys. + "! @parameter I_LOWER_CASE | If set to C_BOOLEAN_TRUE all keys in JSON string will be lower case. + "! @parameter IT_EXCLUDED_FIELDS | Internal table of table fields in I_ITAB that should not occur in result. + "! @parameter E_JSON | JSON string. + "! + class-methods itab_to_tableschema + importing + !i_itab type any table + !i_dictionary type any optional + !i_lower_case type ZCL_IBMX_service=>boolean default ZCL_IBMX_service=>c_boolean_false + !it_excluded_fields type ZCL_IBMX_service=>tt_string optional + returning + value(e_json) type string . + "! Converts a JSON string in table schema format to an internal table. + "! E.g.: '{"tableschema_key": {"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}}' + "! + "! @parameter I_JSON | JSON string. + "! @parameter I_TABLESCHEMA_KEY | Key in JSON string that holds the table schema. + "! @parameter E_ITAB | Internal table containing converted data. + "! + class-methods tableschema_to_itab + importing + !i_json type string + !i_tableschema_key type string optional + exporting + !e_itab type any table . + "! Converts a timestamp in UTC to a timestamp in local time. + "! + "! @parameter IV_TIMESTAMP | Timestamp (UTC). + "! @parameter EV_LOCAL | Timestamp (local time). + "! + class-methods convert_timestamp_to_local + importing + !iv_timestamp type timestamp + returning + value(ev_local) type string . + "! Determine MIME type from a file name, e.g. 'docu.txt' -> 'text_/plain'. + "! + "! @parameter I_FILENAME | Filename with extension. + "! @parameter E_MIMETYPE | MIME type. + "! + class-methods get_mimetype_from_extension + importing + !i_filename type string + returning + value(e_mimetype) type string . + "! Converts a timestamp in UTC to a timestamp in another timezone. + "! + "! @parameter I_TIMESTAMP | Timestamp (UTC). + "! @parameter I_TIMEZONE | Time zone + "! @parameter E_TIMESTAMP | Timestamp in give time zone. + "! + class-methods utc_to_timezone + importing + !i_timestamp type timestamp + !i_timezone type ZIF_IBMX_service_arch=>ty_timezone optional + returning + value(e_timestamp) type timestamp . + "! Converts datetime format to a timestamp, i.e. yyyy-mm-ddThh:mm:ssZ -> YYYYMMDDHHMMSS + "! + "! @parameter I_DATETIME | Input in datetime format. + "! @parameter E_TIMESTAMP | Timestamp. + "! + class-methods convert_datetime_to_timestamp + importing + !i_datetime type ZCL_IBMX_service=>datetime + returning + value(e_timestamp) type timestamp . + "! Converts a timestamp to datetime format, i.e. YYYYMMDDHHMMSS -> yyyy-mm-ddThh:mm:ssZ + "! + "! @parameter I_TIMESTAMP | Timestamp. + "! @parameter E_DATETIME | Datetime format. + "! + class-methods convert_timestamp_to_datetime + importing + !i_timestamp type timestamp + returning + value(e_datetime) type ZCL_IBMX_service=>datetime . +protected section. +private section. +ENDCLASS. + + + +CLASS ZCL_IBMX_UTIL IMPLEMENTATION. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>CONVERT_DATETIME_TO_TIMESTAMP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DATETIME TYPE ZCL_IBMX_SERVICE=>DATETIME +* | [<-()] E_TIMESTAMP TYPE TIMESTAMP +* +-------------------------------------------------------------------------------------- + method convert_datetime_to_timestamp. + + constants: + c_zero type timestamp value '0'. " avoid conversion at runtime + + " check if input string applies to schema yyyy-mm-ddThh:mm:ssZ + if i_datetime cp '++++-++-++T++:++:++*'. + try. + e_timestamp = + i_datetime(4) * 10000000000 + i_datetime+5(2) * 100000000 + i_datetime+8(2) * 1000000 + + i_datetime+11(2) * 10000 + i_datetime+14(2) * 100 + i_datetime+17(2). + catch cx_sy_conversion_no_number. + " invalid input + e_timestamp = c_zero. + endtry. + else. + " invalid input + e_timestamp = c_zero. + endif. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>CONVERT_TIMESTAMP_TO_DATETIME +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TIMESTAMP TYPE TIMESTAMP +* | [<-()] E_DATETIME TYPE ZCL_IBMX_SERVICE=>DATETIME +* +-------------------------------------------------------------------------------------- + method convert_timestamp_to_datetime. + + data: + lv_year(4) type n, + lv_month(2) type n, + lv_day(2) type n, + lv_hour(2) type n, + lv_min(2) type n, + lv_sec(2) type n, + lv_rest type timestamp. + + lv_rest = i_timestamp. + lv_year = lv_rest div 10000000000. + lv_rest = lv_rest - ( lv_year * 10000000000 ). + lv_month = lv_rest div 100000000. + lv_rest = lv_rest - ( lv_month * 100000000 ). + lv_day = lv_rest div 1000000. + lv_rest = lv_rest - ( lv_day * 1000000 ). + lv_hour = lv_rest div 10000. + lv_rest = lv_rest - ( lv_hour * 10000 ). + lv_min = lv_rest div 100. + lv_rest = lv_rest - ( lv_min * 100 ). + lv_sec = lv_rest div 1. " type conversion + + concatenate lv_year '-' lv_month '-' lv_day 'T' lv_hour ':' lv_min ':' lv_sec 'Z' into e_datetime. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>CONVERT_TIMESTAMP_TO_LOCAL +* +-------------------------------------------------------------------------------------------------+ +* | [--->] IV_TIMESTAMP TYPE TIMESTAMP +* | [<-()] EV_LOCAL TYPE STRING +* +-------------------------------------------------------------------------------------- + method convert_timestamp_to_local. + + data: + lv_dats type d, + lv_tims type t, + lv_timezone type ZIF_IBMX_service_arch=>ty_timezone, + lv_datc(10) type c, + lv_timc(8) type c. + + " split timestamp to date and time according to time zone + lv_timezone = ZCL_IBMX_service_arch=>get_timezone( ). + convert time stamp iv_timestamp time zone lv_timezone + into date lv_dats time lv_tims. + + " write date and time to string using local date/time format + lv_datc = conv #( lv_dats ). + lv_timc = conv #( lv_tims ). + concatenate lv_datc lv_timc into ev_local separated by space. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>GET_MIMETYPE_FROM_EXTENSION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FILENAME TYPE STRING +* | [<-()] E_MIMETYPE TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_mimetype_from_extension. + data: + l_extension type string. + + if i_filename is initial. + e_mimetype = ZIF_IBMX_service_arch=>c_mediatype-all. + exit. + endif. + + "find regex '\.([^\.]*)$' in i_filename submatches l_extension. + data(l_subrc) = ZCL_IBMX_service=>find_regex( + exporting + i_regex = '\.([^\.]*)$' + i_in = i_filename + changing + c_submatch1 = l_extension ). + if l_subrc <> 0. + l_extension = i_filename. + endif. + + translate l_extension to lower case. + + case l_extension. + when 'jpg' or 'jpeg'. e_mimetype = ZIF_IBMX_service_arch=>c_mediatype-image_jpeg. + when 'png'. e_mimetype = ZIF_IBMX_service_arch=>c_mediatype-image_png. + when 'txt'. e_mimetype = ZIF_IBMX_service_arch=>c_mediatype-text_plain. + when 'csv'. e_mimetype = ZIF_IBMX_service_arch=>c_mediatype-text_csv. + when others. e_mimetype = `application/` && l_extension ##NO_TEXT. + endcase. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>ITAB_TO_TABLESCHEMA +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_ITAB TYPE ANY TABLE +* | [--->] I_DICTIONARY TYPE ANY(optional) +* | [--->] I_LOWER_CASE TYPE ZCL_IBMX_SERVICE=>BOOLEAN (default =ZCL_IBMX_SERVICE=>C_BOOLEAN_FALSE) +* | [--->] IT_EXCLUDED_FIELDS TYPE ZCL_IBMX_SERVICE=>TT_STRING(optional) +* | [<-()] E_JSON TYPE STRING +* +-------------------------------------------------------------------------------------- + method itab_to_tableschema. + " Converts an internal table to a JSON object string with keys "fields" and "values". + " Example: I_ITAB = | PET | NUMBER | + " ------------------- + " | Cat | 5 | + " | Rabbit | 2 | + " --> E_JSON = '{"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}' + " Field names are mapped according to I_DICTIONARY. + " Example: BEGIN OF i_dictionary, + " PET type string value 'MyPet', + " END OF i_dictionary. + " --> E_JSON = '{"fields": ["MyPet", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}' + " Field names are translated to lower case, if I_LOWER_CASE = ZCL_IBMX_service=>c_boolean_true. + " Field types must be elementary or table of elementary. + " Field names in table IT_EXCLUDED_FIELDS are skipped and will not appear in the JSON string. + + data: + lt_comp type cl_abap_structdescr=>component_table, + ls_comp like line of lt_comp, + lo_datadescr type ref to cl_abap_datadescr, + lo_tabledesc type ref to cl_abap_tabledescr, + lo_struct type ref to cl_abap_structdescr, + lv_fieldname type string, + lv_sep1(1) type c, + lv_sep2(1) type c, + lv_sep3(1) type c. + + field-symbols: + type any, + type any, + type any table, + type string. + + " the following data type are character-like, thus the according values must be quoted + data(lc_character_types) = + cl_abap_datadescr=>typekind_char && + cl_abap_datadescr=>typekind_clike && + cl_abap_datadescr=>typekind_csequence && + cl_abap_datadescr=>typekind_string && + cl_abap_datadescr=>typekind_date && + cl_abap_datadescr=>typekind_time && + cl_abap_datadescr=>typekind_num. + + " get internal table fields + lo_tabledesc ?= cl_abap_tabledescr=>describe_by_data( i_itab ). + lo_struct ?= lo_tabledesc->get_table_line_type( ). + lt_comp = lo_struct->get_components( ). + + " append field names to JSON string + e_json = `{"fields": [` ##NO_TEXT. + clear lv_sep1. + loop at lt_comp into ls_comp. + read table it_excluded_fields with key table_line = ls_comp-name transporting no fields. + if sy-subrc = 0. continue. endif. + lv_fieldname = ls_comp-name. + if i_dictionary is supplied. + assign component ls_comp-name of structure i_dictionary to . + if sy-subrc = 0. + lv_fieldname = . + endif. + endif. + if i_lower_case eq ZCL_IBMX_service=>c_boolean_true. + translate lv_fieldname to lower case. + endif. + e_json = e_json && lv_sep1 && `"` && lv_fieldname && `"`. + lv_sep1 = `,`. + endloop. + + " append values to JSON string + e_json = e_json && `], "values": [` ##NO_TEXT. + + clear lv_sep1. + loop at i_itab assigning . " loop on itab records + clear lv_sep2. + e_json = e_json && lv_sep1 && `[`. + loop at lt_comp into ls_comp. " loop on record fields + read table it_excluded_fields with key table_line = ls_comp-name transporting no fields. + if sy-subrc = 0. continue. endif. + + if ls_comp-type->type_kind eq cl_abap_datadescr=>typekind_table. + + " field type is subtable, get line type + assign component ls_comp-name of structure to . + lo_tabledesc ?= cl_abap_tabledescr=>describe_by_data( ). + lo_datadescr = lo_tabledesc->get_table_line_type( ). + + " add field values of subtable to JSON string + clear lv_sep3. + e_json = e_json && lv_sep2 && `[`. + loop at assigning . + if lo_datadescr->type_kind ca lc_character_types. + e_json = e_json && lv_sep3 && `"` && && `"`. + else. + e_json = e_json && lv_sep3 && . + endif. + lv_sep3 = `,`. + endloop. + e_json = e_json && `]`. + + else. + + " field type is elementary, add field value to JSON string + assign component ls_comp-name of structure to . + if ls_comp-type->type_kind ca lc_character_types. + e_json = e_json && lv_sep2 && `"` && && `"`. + else. + e_json = e_json && lv_sep2 && . + endif. + + endif. + + lv_sep2 = `,`. + endloop. + + e_json = e_json && `]`. + lv_sep1 = `,`. + endloop. + + e_json = e_json && `]}` ##NO_TEXT. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>TABLESCHEMA_TO_ITAB +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JSON TYPE STRING +* | [--->] I_TABLESCHEMA_KEY TYPE STRING(optional) +* | [<---] E_ITAB TYPE ANY TABLE +* +-------------------------------------------------------------------------------------- + method tableschema_to_itab. + + data: + lt_comp type cl_abap_structdescr=>component_table, + ls_comp like line of lt_comp, + lv_field type string, + lt_field type standard table of string, + lv_fieldname type string, + lv_tabix type i, + lv_tableschema_key type string, + lo_structdescr type ref to cl_abap_structdescr, + lo_datadescr type ref to cl_abap_datadescr, + lo_tabledescr type ref to cl_abap_tabledescr, + lr_values type ref to data, + lr_comp type ref to data, + lr_data type ref to data, + lv_json type string. + + field-symbols: + type ref to data, + type any table, + type any, + type any, + type any table, + type any, + type any, + type ref to data, + type any table, + type any table, + type any, + type any table, + type any table. + + " dynamically create data structure: + " begin of , + " tableschema_key type ref to data, + " end of . + if i_tableschema_key is initial. + lv_json = `{ "tableschema_key": ` && i_json && ` }` ##NO_TEXT. + lv_tableschema_key = `tableschema_key` ##NO_TEXT. + else. + lv_json = i_json. + lv_tableschema_key = i_tableschema_key. + endif. + ls_comp-name = lv_tableschema_key. + ls_comp-type ?= cl_abap_datadescr=>describe_by_data( lr_data ). + append ls_comp to lt_comp. + lo_structdescr = cl_abap_structdescr=>create( lt_comp ). + create data lr_data type handle lo_structdescr. + assign lr_data->* to . + + " parse JSON + try. + ZCL_IBMX_service=>parse_json( + exporting + i_json = lv_json + "i_dictionary = c_abapname_dictionary + changing + c_abap = ). + catch ZCX_IBMX_service_exception. + return. + endtry. + assign component lv_tableschema_key of structure to . + assign ->* to . + + + + unassign . + assign component 'VALUES' of structure to . + + " I_JSON does not have table schema on highest level, check if any subkey has + " check all components + lo_structdescr ?= cl_abap_structdescr=>describe_by_data( ). + clear lt_comp[]. + lt_comp = lo_structdescr->get_components( ). + + loop at lt_comp into ls_comp. + assign component ls_comp-name of structure to . + lo_datadescr ?= cl_abap_datadescr=>describe_by_data_ref( ). + if lo_datadescr->type_kind eq cl_abap_datadescr=>typekind_table. + assign ->* to . + loop at assigning ##GEN_OK. + exit. + endloop. + endif. + assign ->* to . + assign component 'VALUES' of structure to . + if sy-subrc = 0. + assign to . + exit. + endif. + + endloop. + + + if not is assigned. + return. + endif. + + assign ->* to . + assign component 'FIELDS' of structure to . + if sy-subrc = 0. + assign ->* to . + loop at assigning ##GEN_OK. + assign ->* to . + append to lt_field. + endloop. + else. + data(lv_count) = lines( ). + data(lv_index) = 0. + while lv_index < lv_count. + lv_fieldname = `FIELD` && lv_index. + lv_index = lv_index + 1. + append lv_fieldname to lt_field. + endwhile. + endif. + + + " get data fields; read first values for reference + if lines( ) < 1. return. endif. + loop at into lr_data. + assign lr_data->* to . + exit. + endloop. + + clear lt_comp[]. + loop at into lr_values. + + " field name + lv_tabix = lv_tabix + 1. + read table lt_field index lv_tabix into lv_field. + if sy-subrc <> 0. + lv_field = `C` && lv_tabix. + endif. + ls_comp-name = lv_field. + + " read data type + assign lr_values->* to . + lo_datadescr ?= cl_abap_datadescr=>describe_by_data( ). + + if lo_datadescr->type_kind = cl_abap_structdescr=>typekind_table. + + " data type is internal table (of references) + " -> create new internal table layout w/o references + lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ). + lo_datadescr = lo_tabledescr->get_table_line_type( ). + if lo_datadescr->type_kind = cl_abap_datadescr=>typekind_dref. + assign to . + loop at into lr_comp. exit. endloop. " read first table record + lo_datadescr ?= cl_abap_datadescr=>describe_by_data_ref( lr_comp ). + endif. + ls_comp-type = cl_abap_tabledescr=>create( p_line_type = lo_datadescr ). + + else. + ls_comp-type = lo_datadescr. + endif. + + append ls_comp to lt_comp. + endloop. + + " create data structure + lo_structdescr = cl_abap_structdescr=>create( lt_comp ). + create data lr_data type handle lo_structdescr. + assign lr_data->* to . + create data lr_data like table of . + assign lr_data->* to . + + + " populate data structure + loop at into lr_data. + assign lr_data->* to . + if not is assigned. + create data lr_data type handle lo_structdescr. + assign lr_data->* to . + endif. + lv_tabix = 0. + loop at into lr_values. + lv_tabix = lv_tabix + 1. + read table lt_comp index lv_tabix into ls_comp. + case ls_comp-type->type_kind. + when cl_abap_structdescr=>typekind_table. + assign component ls_comp-name of structure to . + assign lr_values->* to . + loop at into lr_data. + assign lr_data->* to . + insert into table . + endloop. + when others. + assign component ls_comp-name of structure to . + assign lr_values->* to . + = . + endcase. + endloop. + + insert into table . + unassign . " force data creation at next loop step + + endloop. + + move-corresponding to e_itab. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Static Public Method ZCL_IBMX_UTIL=>UTC_TO_TIMEZONE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TIMESTAMP TYPE TIMESTAMP +* | [--->] I_TIMEZONE TYPE ZIF_IBMX_SERVICE_ARCH=>TY_TIMEZONE(optional) +* | [<-()] E_TIMESTAMP TYPE TIMESTAMP +* +-------------------------------------------------------------------------------------- + method utc_to_timezone. + + data: + lv_timezone type ZIF_IBMX_service_arch=>ty_timezone, + lv_date type d, + lv_time type t. + + if i_timezone is initial. + lv_timezone = ZCL_IBMX_service_arch=>get_timezone( ). + else. + lv_timezone = i_timezone. + endif. + + convert time stamp i_timestamp time zone lv_timezone into date lv_date time lv_time. + convert date lv_date time lv_time into time stamp e_timestamp time zone 'UTC'. + + endmethod. +ENDCLASS. diff --git a/src/zcl_ibmx_util.clas.xml b/src/zcl_ibmx_util.clas.xml new file mode 100644 index 0000000..42caf77 --- /dev/null +++ b/src/zcl_ibmx_util.clas.xml @@ -0,0 +1,60 @@ + + + + + + ZCL_IBMX_UTIL + E + Utilities to connect to IBM Watson + 1 + X + X + X + + + + ZCL_IBMX_UTIL + CONVERT_DATETIME_TO_TIMESTAMP + E + Converts a DATETIME String to type TIMESTAMP + + + ZCL_IBMX_UTIL + CONVERT_TIMESTAMP_TO_DATETIME + E + Converts a DATETIME String to type TIMESTAMP + + + ZCL_IBMX_UTIL + CONVERT_TIMESTAMP_TO_LOCAL + E + Converts a UTF timestamp to a local timestamp + + + ZCL_IBMX_UTIL + GET_MIMETYPE_FROM_EXTENSION + E + Returns mime type for a given extension + + + ZCL_IBMX_UTIL + ITAB_TO_TABLESCHEMA + E + Converts an internal table to table schema JSON format + + + ZCL_IBMX_UTIL + TABLESCHEMA_TO_ITAB + E + Converts a JSON string in table schema format to an itab + + + ZCL_IBMX_UTIL + UTC_TO_TIMEZONE + E + Converts an UTC timestamp to the specified timezone + + + + + \ No newline at end of file diff --git a/src/zcl_ibmx_watsonx_ai_ml_v1.clas.abap b/src/zcl_ibmx_watsonx_ai_ml_v1.clas.abap new file mode 100644 index 0000000..56a1bc7 --- /dev/null +++ b/src/zcl_ibmx_watsonx_ai_ml_v1.clas.abap @@ -0,0 +1,5199 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +"!

watsonx.ai

+"! No documentation available.
+class ZCL_IBMX_WATSONX_AI_ML_V1 DEFINITION + public + inheriting from ZCL_IBMX_SERVICE_EXT + create public . + +public section. + types: + "! No documentation available. + begin of T_ERROR_ITEM, + "! A simple code that should convey the general sense of the error. + CODE type STRING, + "! The message that describes the error. + MESSAGE type STRING, + "! A reference to a more detailed explanation when available. + MORE_INFO type STRING, + end of T_ERROR_ITEM. + types: + "!

+ "! The data returned when an error is encountered.

+ begin of T_ERROR, + "! An identifier that can be used to trace the request. + TRACE type STRING, + "! The list of errors. + ERRORS type STANDARD TABLE OF T_ERROR_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_ERROR. + types: + "!

+ "! The context for prompt tuning metrics.

+ begin of T_PRMPT_TUNING_METRICS_CONTEXT, + "! The location where the prompt tuning metrics are stored. + METRICS_LOCATION type STRING, + end of T_PRMPT_TUNING_METRICS_CONTEXT. + types: + "!

+ "! Provides extra information for this training stage in the

+ "! context of auto-ml. + begin of T_METRICS_CONTEXT, + "! The deployment that created the metrics. + DEPLOYMENT_ID type STRING, + "! The context for prompt tuning metrics. + PROMPT_TUNING type T_PRMPT_TUNING_METRICS_CONTEXT, + end of T_METRICS_CONTEXT. + types: + "!

+ "! Optional messages related to the deployment.

+ begin of T_MESSAGE, + "! The level of the message, normally one of `debug`, `info` or `warning`. + LEVEL type STRING, + "! The message. + TEXT type STRING, + end of T_MESSAGE. + types: + "!

+ "! A metric.

+ begin of T_TRAINING_METRIC, + "! A timestamp for the metrics. + TIMESTAMP type DATETIME, + "! The iteration number. + ITERATION type INTEGER, + "! The metrics. + ML_METRICS type MAP, + "! Provides extra information for this training stage in the context of auto-ml. + CONTEXT type T_METRICS_CONTEXT, + end of T_TRAINING_METRIC. + types: + "!

+ "! Status of the training job.

+ begin of T_TRAINING_STATUS, + "! Date and Time in which current training state has started. + RUNNING_AT type DATETIME, + "! Date and Time in which training had completed. + COMPLETED_AT type DATETIME, + "! Current state of training. + STATE type STRING, + "! Optional messages related to the deployment. + MESSAGE type T_MESSAGE, + "! Metrics that can be returned by an operation. + METRICS type STANDARD TABLE OF T_TRAINING_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! The data returned when an error is encountered. + FAILURE type T_ERROR, + end of T_TRAINING_STATUS. + types: + "!

+ "! The schema of the expected data, see


+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + begin of T_DATA_SCHEMA, + "! An id to identify a schema. + ID type STRING, + "! A name for the schema. + NAME type STRING, + "! The fields that describe the data schema. + FIELDS type STANDARD TABLE OF JSONOBJECT WITH NON-UNIQUE DEFAULT KEY, + "! The type of the schema, can be ignored or set to `struct` or `DataFrame`. + TYPE type STRING, + end of T_DATA_SCHEMA. + types: + "!

+ "! Information related to the revision.

+ begin of T_RESOURCE_COMMIT_INFO, + "! The time when the revision was committed. + COMMITTED_AT type DATETIME, + "! The message that was provided when the revision was created. + COMMIT_MESSAGE type STRING, + end of T_RESOURCE_COMMIT_INFO. + types: + "!

+ "! A warning message.

+ begin of T_WARNING, + "! The message. + MESSAGE type STRING, + "! An `id` associated with the message. + ID type STRING, + "! Additional key-value pairs that depend on the specific warning. + ADDITIONAL_PROPERTIES type JSONOBJECT, + end of T_WARNING. + types: + "!

+ "! Optional details coming from the service and related to the

+ "! API call or the associated resource. + begin of T_TRAIN_RSRC_COLLECTION_SYS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING WITH NON-UNIQUE DEFAULT KEY, + end of T_TRAIN_RSRC_COLLECTION_SYS. + types: + "!

+ "! Contains a set of fields specific to each connection. See

+ "! here for [details about specifying connections](#datareferences). + T_DATA_CONNECTION type JSONOBJECT. + types: + "!

+ "! A reference to data.

+ begin of T_OBJECT_LOCATION, + "! Item identification inside a collection. + ID type STRING, + "! The data source type like `connection_asset` or `data_asset`. + TYPE type STRING, + "! Contains a set of fields specific to each connection.
+ "! See here for [details about specifying connections](#datareferences). + CONNECTION type T_DATA_CONNECTION, + "! Contains a set of fields that describe the location of the data with respect to + "! the `connection`. + LOCATION type MAP, + end of T_OBJECT_LOCATION. + types: + "!

+ "! The model id of the base model for this prompt tuning.

+ begin of T_BASE_MODEL, + "! The model id of the base model. + MODEL_ID type STRING, + end of T_BASE_MODEL. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_RESOURCE_META, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_RESOURCE_META. + types: + "!

+ "! A reference to data with an optional data schema. If

+ "! necessary, it is possible to provide a data connection that contains just the + "! data schema. + begin of T_DATA_CONNECTION_REFERENCE, + "! Optional item identification inside a collection. + ID type STRING, + "! The data source type like `connection_asset` or `data_asset`. If the data + "! connection contains just a schema then this field is not required. + TYPE type STRING, + "! Contains a set of fields specific to each connection.
+ "! See here for [details about specifying connections](#datareferences). + CONNECTION type T_DATA_CONNECTION, + "! Contains a set of fields that describe the location of the data with respect to + "! the `connection`. + LOCATION type MAP, + "! The schema of the expected data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json)
+ "! for the schema definition. + SCHEMA type T_DATA_SCHEMA, + end of T_DATA_CONNECTION_REFERENCE. + types: + "!

+ "! Properties to control the prompt tuning.

+ begin of T_PROMPT_TUNING, + "! The model id of the base model for this prompt tuning. + BASE_MODEL type T_BASE_MODEL, + "! The task that is targeted for this model. + TASK_ID type STRING, + "! Type of Peft (Parameter-Efficient Fine-Tuning) config to build. + TUNING_TYPE type STRING, + "! Number of epochs to tune the prompt vectors, this affects the quality of the + "! trained model. + NUM_EPOCHS type INTEGER, + "! Learning rate to be used while tuning prompt vectors. + LEARNING_RATE type NUMBER, + "! Number of steps to be used for gradient accumulation. Gradient accumulation + "! refers to a method of collecting gradient for configured number of steps + "! instead of updating the model variables at every step and then applying the + "! update to model variables. This can be used as a tool to overcome smaller batch + "! size limitation. Often also referred in conjunction with "effective batch + "! size". + ACCUMULATE_STEPS type INTEGER, + "! Verbalizer template to be used for formatting data at train and inference time. + "! This template may use brackets to indicate where fields from the data model + "! must be rendered. + VERBALIZER type STRING, + "! The batch size is a number of samples processed before the model is updated. + BATCH_SIZE type INTEGER, + "! Maximum length of input tokens being considered. + MAX_INPUT_TOKENS type INTEGER, + "! Maximum length of output tokens being predicted. + MAX_OUTPUT_TOKENS type INTEGER, + "! The `text` method requires `init_text` to be set. + INIT_METHOD type STRING, + "! Initialization text to be used if `init_method` is set to `text` otherwise this + "! will be ignored. + INIT_TEXT type STRING, + end of T_PROMPT_TUNING. + types: + "!

+ "! Status of the training job.

+ begin of T_TRAINING_RESOURCE_ENTITY, + "! Properties to control the prompt tuning. + PROMPT_TUNING type T_PROMPT_TUNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! If set to `true` then the result of the training, if successful, will be + "! uploaded to the repository as a model. + AUTO_UPDATE_MODEL type BOOLEAN, + "! The training results. Normally this is specified as `type=container` which + "! means
+ "! that it is stored in the space or project. Note that the training will add + "! some
+ "! fields that point to the training status, the model request and the assets.
+ "!
+ "! The `model_request_path` is the request body that should be used when creating + "! the
+ "! trained model in the API, if this model is to be deployed. If + "! `auto_update_model`
+ "! was set to `true` then this file is not needed. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! Status of the training job. + STATUS type T_TRAINING_STATUS, + end of T_TRAINING_RESOURCE_ENTITY. + types: + "!

+ "! Training resource.

+ begin of T_TRAINING_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! Status of the training job. + ENTITY type T_TRAINING_RESOURCE_ENTITY, + end of T_TRAINING_RESOURCE. + types: + "!

+ "! The reference to the first item in the current page.

+ begin of T_PAGINATION_FIRST, + "! The uri of the first resource returned. + HREF type STRING, + end of T_PAGINATION_FIRST. + types: + "!

+ "! A reference to the first item of the next page, if any.

+ begin of T_PAGINATION_NEXT, + "! The uri of the next set of resources. + HREF type STRING, + end of T_PAGINATION_NEXT. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_TRAINING_RESOURCE_COLLECTION, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! The training resources. + RESOURCES type STANDARD TABLE OF T_TRAINING_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_TRAIN_RSRC_COLLECTION_SYS, + end of T_TRAINING_RESOURCE_COLLECTION. + types: + "!

+ "! The number of epochs is the number of complete passes

+ "! through the training dataset. The quality depends on the number of epochs. + begin of T_TRAINING_NUM_EPOCHS, + "! The default value. + DEFAULT type INTEGER, + "! The minimum value. + MIN type INTEGER, + "! The maximum value. + MAX type INTEGER, + end of T_TRAINING_NUM_EPOCHS. + types: + "!

+ "! The properties specific to masking. If this object exists,

+ "! even if it is empty, then masking will be applied. + begin of T_MASK_PROPERTIES, + "! If this field is `true` then the entity value, that contains the text that was + "! masked, will also be removed from the output. + REMOVE_ENTITY_VALUE type BOOLEAN, + end of T_MASK_PROPERTIES. + types: + "!

+ "! The properties specific to PII.

+ begin of T_PII_PROPERTIES, + "! The properties specific to masking. If this object exists,
+ "! even if it is empty, then masking will be applied. + MASK type T_MASK_PROPERTIES, + end of T_PII_PROPERTIES. + types: + "!

+ "! The lifecycle details.

+ begin of T_LIFE_CYCLE_STATE, + "! The possible lifecycle stages, in order, are described below:
+ "!
+ "! - `available`: this means that the model is available for use.
+ "! - `deprecated`: this means that the model is still available but the model will + "! be removed soon, so an alternative model should be used.
+ "! - `constricted`: this means that the model is still available for inferencing + "! but cannot be used for training or in a deployment. The model will be removed + "! soon so an alternative model should be used.
+ "! - `withdrawn`: this means that the model is no longer available, check the + "! `alternative_model_ids` to see what it can be replaced by. + ID type STRING, + "! An optional label that may be used in the UI. + LABEL type STRING, + "! The date (ISO 8601 format YYYY-MM-DD) when this lifecycle stage starts. + START_DATE type DATE, + "! Alternative models, or model versions, that can be used instead of this model. + ALTERNATIVE_MODEL_IDS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A link to the documentation specifying details on the lifecycle plan for this + "! model. + URL type STRING, + end of T_LIFE_CYCLE_STATE. + types: + "!

+ "! The limits that may be set per request.

+ begin of T_CONSUMPTIONS_LIMIT, + "! The hard limit on the call time for a request, if set. + CALL_TIME type STRING, + "! The hard limit on the number of input tokens for a request, if set. A value of + "! zero will disable this feature. + MAX_INPUT_TOKENS type INTEGER, + "! The hard limit on the number of output tokens for a request, if set. A value of + "! zero will disable this feature. + MAX_OUTPUT_TOKENS type INTEGER, + end of T_CONSUMPTIONS_LIMIT. + types: + "!

+ "! Initialization methods for a training.

+ begin of T_TRAINING_INIT_METHOD, + "! The supported initialization methods. + SUPPORTED type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The default value, which will be one of the values from the `supported` field. + DEFAULT type STRING, + end of T_TRAINING_INIT_METHOD. + types: + "!

+ "! Maximum length of output tokens being predicted.

+ begin of T_TRAINING_MAX_OUTPUT_TOKENS, + "! The default value. + DEFAULT type INTEGER, + "! The minimum value. + MIN type INTEGER, + "! The maximum value. + MAX type INTEGER, + end of T_TRAINING_MAX_OUTPUT_TOKENS. + types: + "!

+ "! Learning rate to be used for training.

+ begin of T_TRAINING_LEARNING_RATE, + "! The default value. + DEFAULT type NUMBER, + "! The minimum value. + MIN type NUMBER, + "! The maximum value. + MAX type NUMBER, + end of T_TRAINING_LEARNING_RATE. + types: + "!

+ "! The batch size is a number of samples processed before the

+ "! model is updated. + begin of T_TRAINING_BATCH_SIZE, + "! The default value. + DEFAULT type INTEGER, + "! The minimum value. + MIN type INTEGER, + "! The maximum value. + MAX type INTEGER, + end of T_TRAINING_BATCH_SIZE. + types: + "!

+ "! Number of virtual tokens to be used for training. In prompt

+ "! tuning we are essentially learning the embedded representations for soft + "! prompts, which are known as virtual tokens, via back propagation for a specific + "! task(s) while keeping the rest of the model fixed. `num_virtual_tokens` is the + "! number of dimensions for these virtual tokens. + begin of T_TRAINING_NUM_VIRTUAL_TOKENS, + "! The possible values for the number of virtual tokens. + SUPPORTED type STANDARD TABLE OF INTEGER WITH NON-UNIQUE DEFAULT KEY, + "! The default number of virtual tokens. + DEFAULT type INTEGER, + end of T_TRAINING_NUM_VIRTUAL_TOKENS. + types: + "!

+ "! Number of steps to be used for gradient accumulation.

+ "! Gradient accumulation refers to a method of collecting gradient for configured + "! number of steps instead of updating the model variables at every step and then + "! applying the update to model variables. This can be used as a tool to overcome + "! smaller batch size limitation. Often also referred in conjunction with + "! "effective batch size". + begin of T_TRAINING_ACCUMULATED_STEPS, + "! The default value. + DEFAULT type INTEGER, + "! The minimum value. + MIN type INTEGER, + "! The maximum value. + MAX type INTEGER, + end of T_TRAINING_ACCUMULATED_STEPS. + types: + "!

+ "! Datatype to use for training of the underlying text

+ "! generation model. If no value is provided, we pull from torch_dtype in config. + "! If an in memory resource is provided which does not match the specified data + "! type, the model underpinning the resource will be converted in place to the + "! correct torch dtype. + begin of T_TRAINING_TORCH_DTYPE, + "! The datatype. + DEFAULT type STRING, + end of T_TRAINING_TORCH_DTYPE. + types: + "!

+ "! Verbalizer template to be used for formatting data at train

+ "! and inference time. This template may use brackets to indicate where fields + "! from the data model TrainGenerationRecord must be rendered. + begin of T_TRAINING_VERBALIZER, + "! The default verbalizer. + DEFAULT type STRING, + end of T_TRAINING_VERBALIZER. + types: + "!

+ "! Maximum length of input tokens being considered.

+ begin of T_TRAINING_MAX_INPUT_TOKENS, + "! The default value. + DEFAULT type INTEGER, + "! The minimum value. + MIN type INTEGER, + "! The maximum value. + MAX type INTEGER, + end of T_TRAINING_MAX_INPUT_TOKENS. + types: + "!

+ "! Initialization text to be used if init_method is set to

+ "! `text`, otherwise this will be ignored. + begin of T_TRAINING_INIT_TEXT, + "! Initialization text. + DEFAULT type STRING, + end of T_TRAINING_INIT_TEXT. + types: + "!

+ "! Training parameters for a given model.

+ begin of T_TRAINING_PARAMETERS, + "! Initialization methods for a training. + INIT_METHOD type T_TRAINING_INIT_METHOD, + "! Initialization text to be used if init_method is set to `text`, otherwise this + "! will be ignored. + INIT_TEXT type T_TRAINING_INIT_TEXT, + "! Number of virtual tokens to be used for training.
+ "! In prompt tuning we are essentially learning the embedded representations for + "! soft prompts,
+ "! which are known as virtual tokens, via back propagation for a specific task(s) + "! while keeping
+ "! the rest of the model fixed. `num_virtual_tokens` is the number of dimensions + "! for these virtual tokens. + NUM_VIRTUAL_TOKENS type T_TRAINING_NUM_VIRTUAL_TOKENS, + "! The number of epochs is the number of complete passes through the training + "! dataset.
+ "! The quality depends on the number of epochs. + NUM_EPOCHS type T_TRAINING_NUM_EPOCHS, + "! Verbalizer template to be used for formatting data at train and inference + "! time.
+ "! This template may use brackets to indicate where fields from the data model
+ "! TrainGenerationRecord must be rendered. + VERBALIZER type T_TRAINING_VERBALIZER, + "! The batch size is a number of samples processed before the model is updated. + BATCH_SIZE type T_TRAINING_BATCH_SIZE, + "! Maximum length of input tokens being considered. + MAX_INPUT_TOKENS type T_TRAINING_MAX_INPUT_TOKENS, + "! Maximum length of output tokens being predicted. + MAX_OUTPUT_TOKENS type T_TRAINING_MAX_OUTPUT_TOKENS, + "! Datatype to use for training of the underlying text generation model.
+ "! If no value is provided, we pull from torch_dtype in config.
+ "! If an in memory resource is provided which does not match the specified data + "! type,
+ "! the model underpinning the resource will be converted in place to the correct + "! torch dtype. + TORCH_DTYPE type T_TRAINING_TORCH_DTYPE, + "! Number of steps to be used for gradient accumulation.
+ "! Gradient accumulation refers to a method of collecting gradient for configured + "! number of steps
+ "! instead of updating the model variables at every step and then applying the + "! update to model variables.
+ "! This can be used as a tool to overcome smaller batch size limitation.
+ "! Often also referred in conjunction with "effective batch size". + ACCUMULATE_STEPS type T_TRAINING_ACCUMULATED_STEPS, + "! Learning rate to be used for training. + LEARNING_RATE type T_TRAINING_LEARNING_RATE, + end of T_TRAINING_PARAMETERS. + types: + "!

+ "! The ratings for this task for this model.

+ begin of T_TASK_RATING, + "! A metric that indicates the cost expected to be incurred by the model's + "! support of an inference task, in terms of resource consumption and processing + "! time, on a scale of 1 to 5, where 5 is the least cost and 1 is the most cost. A + "! missing value means that the cost is not known. + COST type INTEGER, + "! A metric that indicates the quality of the model's support of an inference + "! task, on a scale of 1 to 5, where 5 is the best support and 1 is poor support. + "! A missing value means that the quality is not known. + QUALITY type INTEGER, + end of T_TASK_RATING. + types: + "!

+ "! The attributes of the task for this model.

+ begin of T_TASK_DESCRIPTION, + "! The `id` of the task. + ID type STRING, + "! The ratings for this task for this model. + RATINGS type T_TASK_RATING, + "! The tags for a given task. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_TASK_DESCRIPTION. + types: + "!

+ "! A minor or patch version for the model.

+ begin of T_FOUNDATION_MODEL_VERSION, + "! The version of the model. This must follow semantic versioning semantics. + VERSION type STRING, + "! The date (ISO 8601 format YYYY-MM-DD) when this version first became available. + AVAILABLE_DATE type DATE, + end of T_FOUNDATION_MODEL_VERSION. + types: + "!

+ "! The limits that are applied for the model, for all the

+ "! plans. + begin of T_MODEL_LIMITS, + "! This is the maximum allowed value for the number of tokens in the input prompt + "! plus the number of tokens in the output generated by the model. + MAX_SEQUENCE_LENGTH type INTEGER, + "! This is the maximum number of records that can be accepted when training this + "! model. + TRAINING_DATA_MAX_RECORDS type INTEGER, + end of T_MODEL_LIMITS. + types: + "!

+ "! Limits per plan that may be set per request.

+ begin of T_FOUNDATION_MODEL_LIMITS, + "! The limits that may be set per request. + LITE type T_CONSUMPTIONS_LIMIT, + end of T_FOUNDATION_MODEL_LIMITS. + types: + "!

+ "! A supported foundation model.

+ begin of T_FOUNDATION_MODEL, + "! The id of the foundation model. + MODEL_ID type STRING, + "! A short label that will be displayed in the UI. + LABEL type STRING, + "! The provider of the model. + PROVIDER type STRING, + "! The organization or person that tuned this model. + TUNED_BY type STRING, + "! A short description of the model suitable for a title. + SHORT_DESCRIPTION type STRING, + "! A longer description of the model, that may be used if no `description_url` is + "! provided. + LONG_DESCRIPTION type STRING, + "! Limits per plan that may be set per request. + LIMITS type T_FOUNDATION_MODEL_LIMITS, + "! Deprecated: please use `tasks` instead. + TASK_IDS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The tasks that are supported by this model. + TASKS type STANDARD TABLE OF T_TASK_DESCRIPTION WITH NON-UNIQUE DEFAULT KEY, + "! The tier of the model, depending on the `tier` the billing will be different, + "! refer to the plan for the details. + TIER type STRING, + "! Specifies the provider of this model. + SOURCE type STRING, + "! The minimum number of examples required for the model. + MIN_SHOT_SIZE type INTEGER, + "! The number of parameters used for the model, it will accept `m` for million, `b` + "! for billion and `t` for trillion. + NUMBER_PARAMS type STRING, + "! The limits that are applied for the model, for all the plans. + MODEL_LIMITS type T_MODEL_LIMITS, + "! The information related to the lifecycle of this model. + LIFECYCLE type STANDARD TABLE OF T_LIFE_CYCLE_STATE WITH NON-UNIQUE DEFAULT KEY, + "! Training parameters for a given model. + TRAINING_PARAMETERS type T_TRAINING_PARAMETERS, + "! The information related to the minor versions of this model. + VERSIONS type STANDARD TABLE OF T_FOUNDATION_MODEL_VERSION WITH NON-UNIQUE DEFAULT KEY, + end of T_FOUNDATION_MODEL. + types: + "!

+ "! The prompt variables.

+ T_PROMPT_VARIABLES type MAP. + types: + "!

+ "! A range of text.

+ begin of T_MODERATION_TEXT_RANGE, + "! The start index of the range. + START type INTEGER, + "! The end index of the range. The end index is exclusive meaning that the + "! character at this index will not be included in the range. + END type INTEGER, + end of T_MODERATION_TEXT_RANGE. + types: + "!

+ "! A specific moderation result.

+ begin of T_MODERATION_RESULT, + "! the probability that this is a real match. + SCORE type FLOAT, + "! This defines if this was found in the input (`true`) or the output (`false`). + INPUT type BOOLEAN, + "! A range of text. + POSITION type T_MODERATION_TEXT_RANGE, + "! The entity that was identified by the moderation. + ENTITY type STRING, + "! The text that was identified for this entity.
+ "!
+ "! This field may be removed if requested in the moderation request body. + WORD type STRING, + end of T_MODERATION_RESULT. + types: + "!

+ "! The result of any detected moderations.

+ begin of T_MODERATION_RESULTS, + "! The HAP results. + HAP type STANDARD TABLE OF T_MODERATION_RESULT WITH NON-UNIQUE DEFAULT KEY, + "! The PII results. + PII type STANDARD TABLE OF T_MODERATION_RESULT WITH NON-UNIQUE DEFAULT KEY, + end of T_MODERATION_RESULTS. + types: + "!

+ "! A warning message.

+ begin of T_WARNING_TG, + "! The message. + MESSAGE type STRING, + "! An `id` associated with the message. + ID type STRING, + "! A reference to a more detailed explanation when available. + MORE_INFO type STRING, + end of T_WARNING_TG. + types: + "!

+ "! The top tokens.

+ begin of T_TEXT_GEN_TOP_TOKEN_INFO, + "! The token text. + TEXT type STRING, + "! The natural log of probability for the token. + LOGPROB type NUMBER, + end of T_TEXT_GEN_TOP_TOKEN_INFO. + types: + "!

+ "! The generated token.

+ begin of T_TEXT_GEN_TOKEN_INFO, + "! The token text. + TEXT type STRING, + "! The natural log of probability for the token. + LOGPROB type NUMBER, + "! The rank of the token relative to the other tokens. + RANK type INTEGER, + "! The top tokens. + TOP_TOKENS type STANDARD TABLE OF T_TEXT_GEN_TOP_TOKEN_INFO WITH NON-UNIQUE DEFAULT KEY, + end of T_TEXT_GEN_TOKEN_INFO. + types: + "! No documentation available. + begin of T_TEXT_GEN_RESULT, + "! The text that was generated by the model. + GENERATED_TEXT type STRING, + "! The number of generated tokens. + GENERATED_TOKEN_COUNT type INTEGER, + "! The number of input tokens consumed. + INPUT_TOKEN_COUNT type INTEGER, + "! The reason why the call stopped, can be one of:
+ "! - not_finished - Possibly more tokens to be streamed.
+ "! - max_tokens - Maximum requested tokens reached.
+ "! - eos_token - End of sequence token encountered.
+ "! - cancelled - Request canceled by the client.
+ "! - time_limit - Time limit reached.
+ "! - stop_sequence - Stop sequence encountered.
+ "! - token_limit - Token limit reached.
+ "! - error - Error encountered.
+ "!
+ "! Note that these values will be lower-cased so test for values case insensitive. + STOP_REASON type STRING, + "! The seed used, if it exists. + SEED type INTEGER, + "! The list of individual generated tokens. Extra token information is included + "! based on the other flags in the `return_options` of the request. + GENERATED_TOKENS type STANDARD TABLE OF T_TEXT_GEN_TOKEN_INFO WITH NON-UNIQUE DEFAULT KEY, + "! The list of input tokens. Extra token information is included based on the other + "! flags in the `return_options` of the request, but for decoder-only models. + INPUT_TOKENS type STANDARD TABLE OF T_TEXT_GEN_TOKEN_INFO WITH NON-UNIQUE DEFAULT KEY, + "! The result of any detected moderations. + MODERATIONS type T_MODERATION_RESULTS, + end of T_TEXT_GEN_RESULT. + types: + "!

+ "! Optional details coming from the service and related to the

+ "! API call or the associated resource. + begin of T_SYSTEM_TG_DETAILS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING_TG WITH NON-UNIQUE DEFAULT KEY, + end of T_SYSTEM_TG_DETAILS. + types: + "!

+ "! System details.

+ begin of T_TEXT_GEN_RESPONSE, + "! The `id` of the model for inference. + MODEL_ID type STRING, + "! The model version (using semantic versioning) if set. + MODEL_VERSION type STRING, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The generated tokens. + RESULTS type STANDARD TABLE OF T_TEXT_GEN_RESULT WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_TEXT_GEN_RESPONSE. + types: + "!

+ "! A task that is covered by some of the foundation models that

+ "! are supported in the service. + begin of T_FOUNDATION_MODEL_TASK, + "! The id of the task. + TASK_ID type STRING, + "! The label of the task. + LABEL type STRING, + "! The description of the task. + DESCRIPTION type STRING, + "! The rank of the task that is mainly for the UI. + RANK type INTEGER, + end of T_FOUNDATION_MODEL_TASK. + types: + "!

+ "! The supported foundation model tasks.

+ T_FOUNDATION_MODEL_TASKS_ARRAY type STANDARD TABLE OF T_FOUNDATION_MODEL_TASK WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The stats about deployments for a space.

+ begin of T_STATS, + "! An `id` associated with the space. + SPACE_ID type STRING, + "! The total number of deployments created in a space including `online` and + "! `batch`. + TOTAL_COUNT type NUMBER, + "! The number of online deployments created in a space. + ONLINE_COUNT type NUMBER, + "! The number of batch deployments created in a space. + BATCH_COUNT type NUMBER, + end of T_STATS. + types: + "!

+ "! Optional details provided by the service about statistics of

+ "! the number of deployments created. The deployments that are counted will depend + "! on the request parameters. + begin of T_DEPLOYMENT_SYSTEM_DETAILS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING WITH NON-UNIQUE DEFAULT KEY, + "! The stats about deployments. + STATS type STANDARD TABLE OF T_STATS WITH NON-UNIQUE DEFAULT KEY, + end of T_DEPLOYMENT_SYSTEM_DETAILS. + types: + "!

+ "! System details including warnings.

+ begin of T_DEPLOYMENT_SYSTEM, + "! Optional details provided by the service about statistics of the number of + "! deployments created. The deployments that are counted will depend on the + "! request parameters. + SYSTEM type T_DEPLOYMENT_SYSTEM_DETAILS, + end of T_DEPLOYMENT_SYSTEM. + types: + "!

+ "! The space that contains the resource. Either `space_id` or

+ "! `project_id` has to be given. + T_SPACE_ID type String. + types: + "!

+ "! The project that contains the resource. Either `space_id` or

+ "! `project_id` has to be given. + T_PROJECT_ID type String. + types: + "!

+ "! Common metadata for a resource.

+ begin of T_RESOURCE_META_BASE, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + end of T_RESOURCE_META_BASE. + types: + "!

+ "! Common metadata for a simple resource.

+ begin of T_RESOURCE_META_SIMPLE, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + end of T_RESOURCE_META_SIMPLE. + types: + "!

+ "! The AutoRAG metrics, this contains the list of calculated

+ "! metrics on test data (provided in the request) and (optionally) synthetic data + "! autogenerated. Metric value is mean value calculated over all records in the + "! dataset. + begin of T_AUTO_RAGMETRICS, + "! The metrics for the test data that was provided in the request. + TEST_DATA type MAP, + "! The metrics for the synthetic data, if autogenerated. + SYNTHETIC_DATA type MAP, + end of T_AUTO_RAGMETRICS. + types: + "!

+ "! The training details required when creating the job.

+ begin of T_TRAINING_RESOURCE_DETAILS, + "! The name of the training. + NAME type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! A description of the training. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_TRAINING_RESOURCE_DETAILS. + types: + "!

+ "! The properties specific to HAP.

+ begin of T_HAP_PROPERTIES, + "! The properties specific to masking. If this object exists,
+ "! even if it is empty, then masking will be applied. + MASK type T_MASK_PROPERTIES, + end of T_HAP_PROPERTIES. + types: + "!

+ "! The location of the different result files.

+ begin of T_AUTO_RAGRESULT_LOCATION, + "! The csv file with questions, answers, retrieved contexts, ground_truths and + "! metric scores. + EVALUATION_RESULTS type STRING, + "! The pickled python score function containing steps required to generate answers + "! to questions. + FUNCTION type STRING, + "! The location of the function source code. + FUNCTION_SOURCE_CODE type STRING, + "! The metadata of the function required to store the function in the repository. + FUNCTION_CREATION_REQUEST type STRING, + "! A Jupyter notebook with code required to build the index in the vector database. + "! + INDEXING_NOTEBOOK type STRING, + "! The Jupyter notebook with the python function code and steps required to store + "! and deploy the RAG pattern. + GENERATE_NOTEBOOK type STRING, + end of T_AUTO_RAGRESULT_LOCATION. + types: + "!

+ "! The return options for text similarity.

+ T_SIMILARITY_RETURN_OPTIONS type JSONOBJECT. + types: + "!

+ "! Parameters for text similarity.

+ begin of T_SIMILARITY_PARAMETERS, + "! Fail the call if the number of input tokens exceeds the allowed value. This + "! value can not be greater than the maximum sequence length that the model + "! supports. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! The return options for text similarity. + RETURN_OPTIONS type T_SIMILARITY_RETURN_OPTIONS, + end of T_SIMILARITY_PARAMETERS. + types: + "!

+ "! The source and target text that will be checked for

+ "! similarity. + begin of T_SIMILARITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! A source text. + SOURCE_TEXT type STRING, + "! The target texts. + TARGET_TEXTS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Parameters for text similarity. + PARAMETERS type T_SIMILARITY_PARAMETERS, + end of T_SIMILARITY_REQUEST. + types: + "!

+ "! Properties that control the moderation on the text.

+ begin of T_TEXT_MODERATION, + "! Should this moderation be enabled on the text.
+ "!
+ "!
+ "! The default value is `true` which means that if the parent object exists but the + "! `enabled` field does not exist then this is considered to be enabled. + ENABLED type BOOLEAN, + "! The threshold probability that this is a real match. + THRESHOLD type FLOAT, + end of T_TEXT_MODERATION. + types: + "!

+ "! The properties for the moderation. Each type of moderation

+ "! may have additional properties that are specific to that moderation. + begin of T_MODERATION_PROPERTIES, + "! Properties that control the moderation on the text. + INPUT type T_TEXT_MODERATION, + "! Properties that control the moderation on the text. + OUTPUT type T_TEXT_MODERATION, + end of T_MODERATION_PROPERTIES. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAINING_RESOURCE_PROTOTYPE, + "! The name of the training. + NAME type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! A description of the training. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Properties to control the prompt tuning. + PROMPT_TUNING type T_PROMPT_TUNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! If set to `true` then the result of the training, if successful, will be + "! uploaded to the repository as a model. + AUTO_UPDATE_MODEL type BOOLEAN, + "! The training results. Normally this is specified as `type=container` which + "! means
+ "! that it is stored in the space or project. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + end of T_TRAINING_RESOURCE_PROTOTYPE. + types: + "!

+ "! The parameters for text tokenization.

+ begin of T_TEXT_TOKENIZE_PARAMETERS, + "! If this is `true` then the actual tokens will also be returned in the response. + RETURN_TOKENS type BOOLEAN, + end of T_TEXT_TOKENIZE_PARAMETERS. + types: + "!

+ "! The input string to tokenize along with the associated model

+ "! id and any parameters. One of `space_id` or `project_id` must be provided. + begin of T_TEXT_TOKENIZE_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-mod + "! els.html?context=wx). + MODEL_ID type STRING, + "! The input string to tokenize. + INPUT type STRING, + "! The parameters for text tokenization. + PARAMETERS type T_TEXT_TOKENIZE_PARAMETERS, + end of T_TEXT_TOKENIZE_REQUEST. + types: + "!

+ "! A hardware specification.

+ begin of T_HARDWARE_SPEC, + "! The id of the hardware specification. One, and only one, of `id` or `name` must + "! be set. + ID type STRING, + "! The revision of the hardware specification if `id` is used. + REV type STRING, + "! The name of the hardware specification. One, and only one, of `id` or `name` + "! must be set. + NAME type STRING, + "! The number of nodes applied to a computation. + NUM_NODES type INTEGER, + end of T_HARDWARE_SPEC. + types: + "!

+ "! Status of the training job.

+ begin of T_TRAINING_STATUS_OUTPUT, + "! Status of the training job. + STATUS type T_TRAINING_STATUS, + end of T_TRAINING_STATUS_OUTPUT. + types: + "!

+ "! The `id` of the model to be used for this request.

+ T_GSPTL_TRNSFRMTN_MODEL_ID type String. + types: + "!

+ "! The metric for a given property.

+ begin of T_AUTO_RAGMETRIC, + "! The mean value calculated over all records in the dataset. + MEAN type NUMBER, + end of T_AUTO_RAGMETRIC. + types: + "!

+ "! The return options for text reranking.

+ begin of T_RERANK_RETURN_OPTIONS, + "! Just show the top `n` results if set. + TOP_N type INTEGER, + end of T_RERANK_RETURN_OPTIONS. + types: + "!

+ "! The tokens that are inferred from the prompt.


+ "!
+ "! Note that the events are different between a request with moderation and a + "! request without moderations. A request with moderation will have events that + "! are on a sentence level and a request without moderations will have events that + "! are on a token level. + begin of T_TEXT_GEN_RESPONSE_FIELDS, + "! The `id` of the model for inference. + MODEL_ID type STRING, + "! The model version (using semantic versioning) if set. + MODEL_VERSION type STRING, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The generated tokens. + RESULTS type STANDARD TABLE OF T_TEXT_GEN_RESULT WITH NON-UNIQUE DEFAULT KEY, + end of T_TEXT_GEN_RESPONSE_FIELDS. + types: + "!

+ "! The embeddings properties for an AutoRAG pattern.

+ begin of T_AUTO_RAGEMBEDDINGS, + "! No documentation available. + STRATEGY type STRING, + "! No documentation available. + SIZE type INTEGER, + "! No documentation available. + MODEL_NAME type STRING, + end of T_AUTO_RAGEMBEDDINGS. + types: + "!

+ "! The chunking details for an AutoRAG pattern,.

+ begin of T_AUTO_RAGCHUNKING, + "! No documentation available. + METHOD type STRING, + "! No documentation available. + CHUNK_SIZE type INTEGER, + "! No documentation available. + OVERLAP type INTEGER, + end of T_AUTO_RAGCHUNKING. + types: + "!

+ "! Properties that describe the AutoRAG vector store that

+ "! contains the results. + begin of T_AUTO_RAGVECTOR_STORE, + "! The database name. + DATABASE type STRING, + "! The database index name. + INDEX_NAME type STRING, + "! No documentation available. + DIMENSION type INTEGER, + "! No documentation available. + DISTANCE type STRING, + end of T_AUTO_RAGVECTOR_STORE. + types: + "!

+ "! Properties describing the AutoRAG generation.

+ begin of T_AUTO_RAGGENERATION, + "! No documentation available. + MODEL_NAME type STRING, + "! No documentation available. + MAX_NEW_TOKENS type INTEGER, + "! No documentation available. + PROMPT type STRING, + end of T_AUTO_RAGGENERATION. + types: + "!

+ "! Properties describing an AutoRAG method.

+ begin of T_AUTO_RAGMETHOD, + "! The method name. + METHOD type STRING, + end of T_AUTO_RAGMETHOD. + types: + "!

+ "! The RAG pattern configuration settings that were found

+ "! during the optimization process. + begin of T_AUTO_RAGSETTINGS, + "! Properties that describe the AutoRAG vector store that contains the results. + VECTOR_STORE type T_AUTO_RAGVECTOR_STORE, + "! The chunking details for an AutoRAG pattern,. + CHUNKING type T_AUTO_RAGCHUNKING, + "! The embeddings properties for an AutoRAG pattern. + EMBEDDINGS type T_AUTO_RAGEMBEDDINGS, + "! Properties describing an AutoRAG method. + RETRIEVAL type T_AUTO_RAGMETHOD, + "! Properties describing an AutoRAG method. + RERANKING type T_AUTO_RAGMETHOD, + "! Properties describing the AutoRAG generation. + GENERATION type T_AUTO_RAGGENERATION, + end of T_AUTO_RAGSETTINGS. + types: + "!

+ "! Describes the elements and settings of found, during the

+ "! optimization, of the RAG pattern. + begin of T_AUTO_RAGPATTERN, + "! No documentation available. + COMPOSITION_STEPS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The duration of the optimization step in seconds. + DURATION_SECONDS type INTEGER, + "! The location of the different result files. + LOCATION type T_AUTO_RAGRESULT_LOCATION, + "! The RAG Pattern name. + NAME type STRING, + "! The RAG pattern configuration settings that were found during the optimization + "! process. + SETTINGS type T_AUTO_RAGSETTINGS, + end of T_AUTO_RAGPATTERN. + types: + "!

+ "! The optimization parameters for an AutoRAG job.

+ begin of T_AUTO_RAGOPTIMIZATION_PARAM, + "! The metric score used for optimization. + OBJECTIVE_METRIC type STRING, + "! How many of evaluated foundation models should be selected and used in the + "! resutling RAG patterns. + MAX_NUM_FOUNDATION_MODELS type INTEGER, + "! The list of foundation models used to find the best RAG patterns. + INCLUDE_FOUNDATION_MODELS_ONLY type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The list of embedding models used in finding the optimal indexing. + INCLUDE_EMBEDDING_MODELS_ONLY type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_AUTO_RAGOPTIMIZATION_PARAM. + types: + "!

+ "! The parameters for an AutoRAG job.

+ begin of T_AUTO_RAGPARAMETERS, + "! The optimization parameters for an AutoRAG job. + OPTIMIZATION type T_AUTO_RAGOPTIMIZATION_PARAM, + "! Request that the output logs are also stored as part of the result. + OUTPUT_LOGS type BOOLEAN, + end of T_AUTO_RAGPARAMETERS. + types: + "! No documentation available. + begin of T_AUTO_RAGCONTEXT, + "! Describes the elements and settings of found, during the optimization, of the + "! RAG pattern. + RAG_PATTERN type T_AUTO_RAGPATTERN, + "! The nodes that make up the AutoRAG pattern. + CHAIN_NODES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The phase of the optimization run in which the particular pattern has been + "! built. + PHASE type STRING, + end of T_AUTO_RAGCONTEXT. + types: + "!

+ "! The AutoRAG results.

+ begin of T_AUTO_RAGRESULTS, + "! The AutoRAG metrics, this contains the list of calculated metrics on test data + "! (provided in the request) and (optionally) synthetic data autogenerated. Metric + "! value is mean value calculated over all records in the dataset. + METRICS type T_AUTO_RAGMETRICS, + "! No documentation available. + CONTEXT type T_AUTO_RAGCONTEXT, + end of T_AUTO_RAGRESULTS. + types: + "!

+ "! The AutoRAG results.

+ begin of T_AUTO_RAGRESPONSE_ENTITY, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! The parameters for an AutoRAG job. + PARAMETERS type T_AUTO_RAGPARAMETERS, + "! A reference to data. + INPUT_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + TEST_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + VECTOR_STORE_REFERENCES type T_OBJECT_LOCATION, + "! The list of results. + RESULTS type STANDARD TABLE OF T_AUTO_RAGRESULTS WITH NON-UNIQUE DEFAULT KEY, + "! The timestamp when the results were created. + TIMESTAMP type DATETIME, + end of T_AUTO_RAGRESPONSE_ENTITY. + types: + "!

+ "! A text to rank.

+ begin of T_RERANK_INPUT, + "! The text to rank. + TEXT type STRING, + end of T_RERANK_INPUT. + types: + "!

+ "! The AutoRAG metadata fields.

+ begin of T_AUTO_RAGMETADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The name of the AutoRAG job. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + end of T_AUTO_RAGMETADATA. + types: + "!

+ "! The response of an AutoRAG job.

+ begin of T_AUTO_RAGRESPONSE, + "! The AutoRAG metadata fields. + METADATA type T_AUTO_RAGMETADATA, + "! The AutoRAG results. + ENTITY type T_AUTO_RAGRESPONSE_ENTITY, + end of T_AUTO_RAGRESPONSE. + types: + "!

+ "! The AutoRAG results.

+ begin of T_AUTO_RAGRESPONSE_RESULTS, + "! The list of results. + RESULTS type STANDARD TABLE OF T_AUTO_RAGRESULTS WITH NON-UNIQUE DEFAULT KEY, + "! The timestamp when the results were created. + TIMESTAMP type DATETIME, + end of T_AUTO_RAGRESPONSE_RESULTS. + types: + "!

+ "! The request fields that are not part of the returned entity.

+ begin of T_AUTO_RAGREQUEST_FIELDS, + "! The name of the AutoRAG job. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + end of T_AUTO_RAGREQUEST_FIELDS. + types: + "!

+ "! Properties that control what is returned.

+ begin of T_RETURN_OPTION_PROPERTIES, + "! Include input text in the `generated_text` field. + INPUT_TEXT type BOOLEAN, + "! Include the list of individual generated tokens. Extra token information is + "! included based on the other flags below. + GENERATED_TOKENS type BOOLEAN, + "! Include the list of input tokens. Extra token information is included based on + "! the other flags here, but only for decoder-only models. + INPUT_TOKENS type BOOLEAN, + "! Include logprob (natural log of probability) for each returned token. Applicable + "! only if generated_tokens == true and/or input_tokens == true. + TOKEN_LOGPROBS type BOOLEAN, + "! Include rank of each returned token. Applicable only if generated_tokens == true + "! and/or input_tokens == true. + TOKEN_RANKS type BOOLEAN, + "! Include top n candidate tokens at the position of each returned token. The + "! maximum value permitted is 5, but more may be returned if there is a tie for + "! nth place. Applicable only if generated_tokens == true and/or input_tokens == + "! true. + TOP_N_TOKENS type INTEGER, + end of T_RETURN_OPTION_PROPERTIES. + types: + "!

+ "! The properties specific to HAP.

+ begin of T_MODERATION_HAP_PROPERTIES, + "! Properties that control the moderation on the text. + INPUT type T_TEXT_MODERATION, + "! Properties that control the moderation on the text. + OUTPUT type T_TEXT_MODERATION, + "! The properties specific to masking. If this object exists,
+ "! even if it is empty, then masking will be applied. + MASK type T_MASK_PROPERTIES, + end of T_MODERATION_HAP_PROPERTIES. + types: + "!

+ "! The properties specific to PII.

+ begin of T_MODERATION_PII_PROPERTIES, + "! Properties that control the moderation on the text. + INPUT type T_TEXT_MODERATION, + "! Properties that control the moderation on the text. + OUTPUT type T_TEXT_MODERATION, + "! The properties specific to masking. If this object exists,
+ "! even if it is empty, then masking will be applied. + MASK type T_MASK_PROPERTIES, + end of T_MODERATION_PII_PROPERTIES. + types: + "!

+ "! Properties that control the moderations, for usages such as

+ "! `Hate and profanity` (HAP) and `Personal identifiable information` (PII) + "! filtering. This list can be extended with new types of moderations. + begin of T_MODERATIONS, + "! The properties specific to HAP. + HAP type T_MODERATION_HAP_PROPERTIES, + "! The properties specific to PII. + PII type T_MODERATION_PII_PROPERTIES, + "! If set, then only these ranges will be applied to the moderations. This is + "! useful in the case that certain parts of the input text have already been + "! checked. + INPUT_RANGES type STANDARD TABLE OF T_MODERATION_TEXT_RANGE WITH NON-UNIQUE DEFAULT KEY, + end of T_MODERATIONS. + types: + "!

+ "! It can be used to exponentially increase the likelihood of

+ "! the text generation terminating once a specified number of tokens have been + "! generated. + begin of T_TEXT_GEN_LENGTH_PENALTY, + "! Represents the factor of exponential decay. Larger values correspond to more + "! aggressive decay. + DECAY_FACTOR type NUMBER, + "! A number of generated tokens after which this should take effect. + START_INDEX type INTEGER, + end of T_TEXT_GEN_LENGTH_PENALTY. + types: + "!

+ "! The template properties if this request refers to a prompt

+ "! template. + begin of T_DPLYMNT_TEXT_GEN_PROPERTIES, + "! Represents the strategy used for picking the tokens during generation of the + "! output text.
+ "!
+ "! During text generation when parameter value is set to greedy, each successive + "! token corresponds to the highest probability token given the text that has + "! already been generated. This strategy can lead to repetitive results especially + "! for longer output sequences. The alternative sample strategy generates text by + "! picking subsequent tokens based on the probability distribution of possible + "! next tokens defined by (i.e., conditioned on) the already-generated text and + "! the top_k and top_p parameters described below. See this + "! [url](https://huggingface.co/blog/how-to-generate) for an informative article + "! about text generation. + DECODING_METHOD type STRING, + "! It can be used to exponentially increase the likelihood of the text generation + "! terminating once a specified number of tokens have been generated. + LENGTH_PENALTY type T_TEXT_GEN_LENGTH_PENALTY, + "! The maximum number of new tokens to be generated. The maximum supported value + "! for this field depends on the model being used.
+ "!
+ "! How the "token" is defined depends on the tokenizer and vocabulary + "! size, which in turn depends on the model. Often the tokens are a mix of full + "! words and sub-words. To learn more about tokenization, [see + "! here](https://huggingface.co/course/chapter2/4).
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum number of new tokens. + MAX_NEW_TOKENS type INTEGER, + "! If stop sequences are given, they are ignored until minimum tokens are + "! generated. + MIN_NEW_TOKENS type INTEGER, + "! Random number generator seed to use in sampling mode for experimental + "! repeatability. + RANDOM_SEED type INTEGER, + "! Stop sequences are one or more strings which will cause the text generation to + "! stop if/when they are produced as part of the output. Stop sequences + "! encountered prior to the minimum number of tokens being generated will be + "! ignored. + STOP_SEQUENCES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A value used to modify the next-token probabilities in sampling mode. Values + "! less than 1.0 sharpen the probability distribution, resulting in "less + "! random" output. Values greater than 1.0 flatten the probability + "! distribution, resulting in "more random" output. A value of 1.0 has + "! no effect. + TEMPERATURE type NUMBER, + "! Time limit in milliseconds - if not completed within this time, generation will + "! stop. The text generated so far will be returned along with the TIME_LIMIT stop + "! reason.
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum time limit. + TIME_LIMIT type INTEGER, + "! The number of highest probability vocabulary tokens to keep for top-k-filtering. + "! Only applies for sampling mode. When decoding_strategy is set to sample, only + "! the top_k most likely tokens are considered as candidates for the next + "! generated token. + TOP_K type INTEGER, + "! Similar to top_k except the candidates to generate the next token are the most + "! likely tokens with probabilities that add up to at least top_p. Also known as + "! nucleus sampling. A value of 1.0 is equivalent to disabled. + TOP_P type NUMBER, + "! Represents the penalty for penalizing tokens that have already been generated or + "! belong to the context. The value 1.0 means that there is no penalty. + REPETITION_PENALTY type NUMBER, + "! Represents the number to which input tokens would be truncated. Can be used to + "! avoid requests failing due to input being longer than configured limits. Zero + "! means don't truncate. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! Properties that control what is returned. + RETURN_OPTIONS type T_RETURN_OPTION_PROPERTIES, + "! Pass `false` to omit matched stop sequences from the end of the output text. The + "! default is `true`, meaning that the output will end with the stop sequence text + "! when matched. + INCLUDE_STOP_SEQUENCE type BOOLEAN, + "! Local typicality measures how similar the conditional probability of predicting + "! a target token next is to the expected conditional probability of predicting a + "! random token next, given the partial text already generated. If less than 1, + "! the smallest set of the most locally typical tokens with probabilities that add + "! up to typical_p or higher are kept for generation. + TYPICAL_P type NUMBER, + "! The prompt variables. + PROMPT_VARIABLES type MAP, + end of T_DPLYMNT_TEXT_GEN_PROPERTIES. + types: + "! No documentation available. + begin of T_DEPLOYMENT_TEXT_GEN, + "! The template properties if this request refers to a prompt template. + PARAMETERS type T_DPLYMNT_TEXT_GEN_PROPERTIES, + "! Properties that control the moderations, for usages such as `Hate and profanity` + "! (HAP) and `Personal identifiable information` (PII) filtering. This list can be + "! extended with new types of moderations. + MODERATIONS type T_MODERATIONS, + end of T_DEPLOYMENT_TEXT_GEN. + types: + "!

+ "! The space that contains the resource.

+ T_SPACE_ID_ONLY type String. + types: + "!

+ "! The embedding values for a text string. The `input` field is

+ "! only set if the corresponding `return_option` is set. + begin of T_EMBEDDING, + "! The text input to the model. + INPUT type STRING, + "! The embedding values. + EMBEDDING type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_EMBEDDING. + types: + "!

+ "! The embeddings per input.

+ begin of T_EMBEDDINGS_RESPONSE_FIELDS, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The embedding values for a given text. + RESULTS type STANDARD TABLE OF T_EMBEDDING WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + end of T_EMBEDDINGS_RESPONSE_FIELDS. + types: + "!

+ "! A data location of the input or output data.

+ begin of T_GSPTL_TRANSFORMATION_DATA, + "! A signed url for the data in COS or elsewhere. This url will be used to download + "! if this is input, or upload if this is output. + URL type STRING, + end of T_GSPTL_TRANSFORMATION_DATA. + types: + "!

+ "! The transformation results.

+ begin of T_GSPTL_TRANSFORMATION_RESULTS, + "! The status of the transformation. + STATUS type STRING, + end of T_GSPTL_TRANSFORMATION_RESULTS. + types: + "!

+ "! The transformation results.

+ begin of T_GSPTL_TRNSFRMTN_RESP_ENTITY, + "! The `id` of the model to be used for this request. + MODEL_ID type STRING, + "! The input text. + INPUTS type STANDARD TABLE OF T_GSPTL_TRANSFORMATION_DATA WITH NON-UNIQUE DEFAULT KEY, + "! A data location of the input or output data. + OUTPUT type T_GSPTL_TRANSFORMATION_DATA, + "! The transformation results. + RESULTS type T_GSPTL_TRANSFORMATION_RESULTS, + end of T_GSPTL_TRNSFRMTN_RESP_ENTITY. + types: + "!

+ "! A reference to a resource.

+ begin of T_SIMPLE_REL, + "! The id of the referenced resource. + ID type STRING, + end of T_SIMPLE_REL. + types: + "!

+ "! The number of input tokens that were consumed.

+ T_INPUT_TOKEN_COUNT type Integer. + types: + "!

+ "! The return options for text embeddings.

+ begin of T_EMBEDDING_RETURN_OPTIONS, + "! Include the `input` text in each of the `results` documents. + INPUT_TEXT type BOOLEAN, + end of T_EMBEDDING_RETURN_OPTIONS. + types: + "!

+ "! Parameters for text embedding requests.

+ begin of T_EMBEDDING_PARAMETERS, + "! Fail the call if the number of input tokens exceeds the allowed value. This + "! value can not be greater than the maximum sequence length that the model + "! supports. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! The return options for text embeddings. + RETURN_OPTIONS type T_EMBEDDING_RETURN_OPTIONS, + end of T_EMBEDDING_PARAMETERS. + types: + "!

+ "! Metrics that can be returned by an operation.

+ T_TRAINING_METRICS type STANDARD TABLE OF T_TRAINING_METRIC WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The request entity for an AutoRAG job.

+ begin of T_AUTO_RAGREQUEST_ENTITY, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! The parameters for an AutoRAG job. + PARAMETERS type T_AUTO_RAGPARAMETERS, + "! A reference to data. + INPUT_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + TEST_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + VECTOR_STORE_REFERENCES type T_OBJECT_LOCATION, + end of T_AUTO_RAGREQUEST_ENTITY. + types: + "!

+ "! Contains a set of fields that describe the location of the

+ "! data with respect to the `connection`. + T_DATA_LOCATION type MAP. + types: + "!

+ "! The specific fields for the geospatial transformation

+ "! metadata fields. + begin of T_GSPTL_TRNSFRMTN_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The space that contains the resource. + SPACE_ID type STRING, + end of T_GSPTL_TRNSFRMTN_METADATA. + types: + "!

+ "! A reference to a resource.

+ begin of T_REL, + "! The id of the referenced resource. + ID type STRING, + "! The revision of the referenced resource. + REV type STRING, + end of T_REL. + types: + "!

+ "! A set of key-value pairs that are used to configure the

+ "! deployment. + begin of T_ONLINE_DEPLOYMENT_PARAMETERS, + "! The `serving_name` can be used in the inference URL in place of the + "! `deployment_id`. + SERVING_NAME type STRING, + end of T_ONLINE_DEPLOYMENT_PARAMETERS. + types: + "!

+ "! Indicates that this is an online deployment. An object has

+ "! to be specified but can be empty. The `serving_name` can be provided in the + "! `online.parameters`. + begin of T_ONLINE_DEPLOYMENT, + "! A set of key-value pairs that are used to configure the deployment. + PARAMETERS type T_ONLINE_DEPLOYMENT_PARAMETERS, + end of T_ONLINE_DEPLOYMENT. + types: + "!

+ "! The deployment request entity (this description is not

+ "! used). + begin of T_DPLYMNT_RESOURCE_PROTOTYPE, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A reference to a resource. + PROMPT_TEMPLATE type T_SIMPLE_REL, + "! Indicates that this is an online deployment. An object has to be specified but + "! can be empty.
+ "! The `serving_name` can be provided in the `online.parameters`. + ONLINE type T_ONLINE_DEPLOYMENT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! The base model that is required for this deployment if this is for a prompt + "! template or a prompt tune for an IBM foundation model. + BASE_MODEL_ID type STRING, + end of T_DPLYMNT_RESOURCE_PROTOTYPE. + types: + "!

+ "! System details.

+ begin of T_EMBEDDINGS_RESPONSE, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The embedding values for a given text. + RESULTS type STANDARD TABLE OF T_EMBEDDING WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_EMBEDDINGS_RESPONSE. + types: + "!

+ "! The inputs and outputs required to create a transformation

+ "! for the given model. + begin of T_GSPTL_TRANSFORMATION_ENTITY, + "! The `id` of the model to be used for this request. + MODEL_ID type STRING, + "! The input text. + INPUTS type STANDARD TABLE OF T_GSPTL_TRANSFORMATION_DATA WITH NON-UNIQUE DEFAULT KEY, + "! A data location of the input or output data. + OUTPUT type T_GSPTL_TRANSFORMATION_DATA, + end of T_GSPTL_TRANSFORMATION_ENTITY. + types: + "!

+ "! A set of server sent events, each event contains a response

+ "! for one or more tokens. + T_TEXT_GEN_STREAM_RESPONSE type STANDARD TABLE OF T_TEXT_GEN_RESPONSE WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The AutoRAG metadata fields.

+ begin of T_AUTO_RAGMETADATA_FIELDS, + "! The name of the AutoRAG job. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + end of T_AUTO_RAGMETADATA_FIELDS. + types: + "!

+ "! The template properties if this request refers to a prompt

+ "! template. + begin of T_PROMPT_TEMPLATE_VARIABLES, + "! The prompt variables. + PROMPT_VARIABLES type MAP, + end of T_PROMPT_TEMPLATE_VARIABLES. + types: + "!

+ "! Optional details coming from the service and related to the

+ "! API call or the associated resource. + begin of T_SYSTEM_DETAILS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING WITH NON-UNIQUE DEFAULT KEY, + end of T_SYSTEM_DETAILS. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_PAGINATION, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + end of T_PAGINATION. + types: + "!

+ "! A prompt to be used to infer the next tokens.

+ begin of T_DEPLOYMENT_TEXT_GEN_REQUEST, + "! The prompt to generate completions. Note: The method tokenizes the input + "! internally. It is recommended not to leave any trailing spaces. + INPUT type STRING, + "! The template properties if this request refers to a prompt template. + PARAMETERS type T_DPLYMNT_TEXT_GEN_PROPERTIES, + "! Properties that control the moderations, for usages such as `Hate and profanity` + "! (HAP) and `Personal identifiable information` (PII) filtering. This list can be + "! extended with new types of moderations. + MODERATIONS type T_MODERATIONS, + end of T_DEPLOYMENT_TEXT_GEN_REQUEST. + types: + "!

+ "! Properties that control the model and response that are only

+ "! supported in caikit. + begin of T_TEXT_GEN_PARAMETERS2, + "! Represents the strategy used for picking the tokens during generation of the + "! output text.
+ "!
+ "! During text generation when parameter value is set to greedy, each successive + "! token corresponds to the highest probability token given the text that has + "! already been generated. This strategy can lead to repetitive results especially + "! for longer output sequences. The alternative sample strategy generates text by + "! picking subsequent tokens based on the probability distribution of possible + "! next tokens defined by (i.e., conditioned on) the already-generated text and + "! the top_k and top_p parameters described below. See this + "! [url](https://huggingface.co/blog/how-to-generate) for an informative article + "! about text generation. + DECODING_METHOD type STRING, + "! It can be used to exponentially increase the likelihood of the text generation + "! terminating once a specified number of tokens have been generated. + LENGTH_PENALTY type T_TEXT_GEN_LENGTH_PENALTY, + "! The maximum number of new tokens to be generated. The maximum supported value + "! for this field depends on the model being used.
+ "!
+ "! How the "token" is defined depends on the tokenizer and vocabulary + "! size, which in turn depends on the model. Often the tokens are a mix of full + "! words and sub-words. To learn more about tokenization, [see + "! here](https://huggingface.co/course/chapter2/4).
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum number of new tokens. + MAX_NEW_TOKENS type INTEGER, + "! If stop sequences are given, they are ignored until minimum tokens are + "! generated. + MIN_NEW_TOKENS type INTEGER, + "! Random number generator seed to use in sampling mode for experimental + "! repeatability. + RANDOM_SEED type INTEGER, + "! Stop sequences are one or more strings which will cause the text generation to + "! stop if/when they are produced as part of the output. Stop sequences + "! encountered prior to the minimum number of tokens being generated will be + "! ignored. + STOP_SEQUENCES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A value used to modify the next-token probabilities in sampling mode. Values + "! less than 1.0 sharpen the probability distribution, resulting in "less + "! random" output. Values greater than 1.0 flatten the probability + "! distribution, resulting in "more random" output. A value of 1.0 has + "! no effect. + TEMPERATURE type NUMBER, + "! Time limit in milliseconds - if not completed within this time, generation will + "! stop. The text generated so far will be returned along with the TIME_LIMIT stop + "! reason.
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum time limit. + TIME_LIMIT type INTEGER, + "! The number of highest probability vocabulary tokens to keep for top-k-filtering. + "! Only applies for sampling mode. When decoding_strategy is set to sample, only + "! the top_k most likely tokens are considered as candidates for the next + "! generated token. + TOP_K type INTEGER, + "! Similar to top_k except the candidates to generate the next token are the most + "! likely tokens with probabilities that add up to at least top_p. Also known as + "! nucleus sampling. A value of 1.0 is equivalent to disabled. + TOP_P type NUMBER, + "! Represents the penalty for penalizing tokens that have already been generated or + "! belong to the context. The value 1.0 means that there is no penalty. + REPETITION_PENALTY type NUMBER, + "! Represents the number to which input tokens would be truncated. Can be used to + "! avoid requests failing due to input being longer than configured limits. Zero + "! means don't truncate. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! Properties that control what is returned. + RETURN_OPTIONS type T_RETURN_OPTION_PROPERTIES, + "! Pass `false` to omit matched stop sequences from the end of the output text. The + "! default is `true`, meaning that the output will end with the stop sequence text + "! when matched. + INCLUDE_STOP_SEQUENCE type BOOLEAN, + "! Local typicality measures how similar the conditional probability of predicting + "! a target token next is to the expected conditional probability of predicting a + "! random token next, given the partial text already generated. If less than 1, + "! the smallest set of the most locally typical tokens with probabilities that add + "! up to typical_p or higher are kept for generation. + TYPICAL_P type NUMBER, + end of T_TEXT_GEN_PARAMETERS2. + types: + "! No documentation available. + begin of T_RESULTS_REFERENCE_INPUT, + "! The training results. Normally this is specified as `type=container` which + "! means
+ "! that it is stored in the space or project. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + end of T_RESULTS_REFERENCE_INPUT. + types: + "!

+ "! The properties that are part of a request that supports

+ "! spaces and projects. Either `space_id` or `project_id` has to be provided and + "! is mandatory. + begin of T_ENTITY_REQ_SPC_PROJECT_BODY, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_ENTITY_REQ_SPC_PROJECT_BODY. + types: + "!

+ "! System details.

+ begin of T_SYSTEM_TG, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_SYSTEM_TG. + types: + "!

+ "! The properties used for reranking.

+ begin of T_RERANK_PARAMETERS, + "! Fail the call if the number of input tokens exceeds the allowed value. This + "! value can not be greater than the maximum sequence length that the model + "! supports. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! The return options for text reranking. + RETURN_OPTIONS type T_RERANK_RETURN_OPTIONS, + end of T_RERANK_PARAMETERS. + types: + "!

+ "! The details of an inference API.

+ begin of T_INFERENCE, + "! The inference URL. + URL type STRING, + "! This is `true` if the inference API supports SSE streaming. + SSE type BOOLEAN, + "! This is `true` if the inference API uses the `serving_name` that was defined in + "! this deployment. + USES_SERVING_NAME type BOOLEAN, + end of T_INFERENCE. + types: + "!

+ "! Specifies the current status, additional information about

+ "! the deployment and any failure messages in case of deployment failures. + begin of T_DEPLOYMENT_STATUS, + "! Specifies the current state of the deployment. + STATE type STRING, + "! Optional messages related to the deployment. + MESSAGE type T_MESSAGE, + "! The data returned when an error is encountered. + FAILURE type T_ERROR, + "! The URLs that can be used to submit inference API requests. These URLs will + "! contain the
+ "! `deployment_id` and the `serving_name`, if the `serving_name` was set. + INFERENCE type STANDARD TABLE OF T_INFERENCE WITH NON-UNIQUE DEFAULT KEY, + end of T_DEPLOYMENT_STATUS. + types: + "!

+ "! A prompt to be used to infer the next tokens. Each request

+ "! expects a `project_id` or a `space_id`, and the `project` or `space` must have + "! an associated WML instance that will be used for limits and billing (if a paid + "! plan). + begin of T_TEXT_GEN_COMMON, + "! The prompt to generate completions. Note: The method tokenizes the input + "! internally. It is recommended not to leave any trailing spaces. + INPUT type STRING, + end of T_TEXT_GEN_COMMON. + types: + "!

+ "! The specific fields for the geospatial transformation

+ "! metadata fields. + begin of T_GSPTL_TRNSFRMTN_MTDT_FIELDS, + "! The space that contains the resource. + SPACE_ID type STRING, + end of T_GSPTL_TRNSFRMTN_MTDT_FIELDS. + types: + "!

+ "! Properties that control the model and response.

+ begin of T_TEXT_GEN_PARAMETERS, + "! Represents the strategy used for picking the tokens during generation of the + "! output text.
+ "!
+ "! During text generation when parameter value is set to greedy, each successive + "! token corresponds to the highest probability token given the text that has + "! already been generated. This strategy can lead to repetitive results especially + "! for longer output sequences. The alternative sample strategy generates text by + "! picking subsequent tokens based on the probability distribution of possible + "! next tokens defined by (i.e., conditioned on) the already-generated text and + "! the top_k and top_p parameters described below. See this + "! [url](https://huggingface.co/blog/how-to-generate) for an informative article + "! about text generation. + DECODING_METHOD type STRING, + "! It can be used to exponentially increase the likelihood of the text generation + "! terminating once a specified number of tokens have been generated. + LENGTH_PENALTY type T_TEXT_GEN_LENGTH_PENALTY, + "! The maximum number of new tokens to be generated. The maximum supported value + "! for this field depends on the model being used.
+ "!
+ "! How the "token" is defined depends on the tokenizer and vocabulary + "! size, which in turn depends on the model. Often the tokens are a mix of full + "! words and sub-words. To learn more about tokenization, [see + "! here](https://huggingface.co/course/chapter2/4).
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum number of new tokens. + MAX_NEW_TOKENS type INTEGER, + "! If stop sequences are given, they are ignored until minimum tokens are + "! generated. + MIN_NEW_TOKENS type INTEGER, + "! Random number generator seed to use in sampling mode for experimental + "! repeatability. + RANDOM_SEED type INTEGER, + "! Stop sequences are one or more strings which will cause the text generation to + "! stop if/when they are produced as part of the output. Stop sequences + "! encountered prior to the minimum number of tokens being generated will be + "! ignored. + STOP_SEQUENCES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A value used to modify the next-token probabilities in sampling mode. Values + "! less than 1.0 sharpen the probability distribution, resulting in "less + "! random" output. Values greater than 1.0 flatten the probability + "! distribution, resulting in "more random" output. A value of 1.0 has + "! no effect. + TEMPERATURE type NUMBER, + "! Time limit in milliseconds - if not completed within this time, generation will + "! stop. The text generated so far will be returned along with the TIME_LIMIT stop + "! reason.
+ "!
+ "! Depending on the users plan, and on the model being used, there may be an + "! enforced maximum time limit. + TIME_LIMIT type INTEGER, + "! The number of highest probability vocabulary tokens to keep for top-k-filtering. + "! Only applies for sampling mode. When decoding_strategy is set to sample, only + "! the top_k most likely tokens are considered as candidates for the next + "! generated token. + TOP_K type INTEGER, + "! Similar to top_k except the candidates to generate the next token are the most + "! likely tokens with probabilities that add up to at least top_p. Also known as + "! nucleus sampling. A value of 1.0 is equivalent to disabled. + TOP_P type NUMBER, + "! Represents the penalty for penalizing tokens that have already been generated or + "! belong to the context. The value 1.0 means that there is no penalty. + REPETITION_PENALTY type NUMBER, + "! Represents the number to which input tokens would be truncated. Can be used to + "! avoid requests failing due to input being longer than configured limits. Zero + "! means don't truncate. + TRUNCATE_INPUT_TOKENS type INTEGER, + "! Properties that control what is returned. + RETURN_OPTIONS type T_RETURN_OPTION_PROPERTIES, + "! Pass `false` to omit matched stop sequences from the end of the output text. The + "! default is `true`, meaning that the output will end with the stop sequence text + "! when matched. + INCLUDE_STOP_SEQUENCE type BOOLEAN, + end of T_TEXT_GEN_PARAMETERS. + types: + "!

+ "! This model represents an individual patch operation to be

+ "! performed on a JSON document, as defined by RFC 6902. + begin of T_JSON_PATCH_OPERATION, + "! The operation to be performed. + OP type STRING, + "! The JSON Pointer that identifies the field that is the target of the operation. + PATH type STRING, + "! The JSON Pointer that identifies the field that is the source of the operation. + FROM type STRING, + "! The value to be used within the operation. + VALUE type JSONOBJECT, + end of T_JSON_PATCH_OPERATION. + types: + "! No documentation available. + begin of T_PAGINATION_BASE, + "! Computed explicitly only when 'total_count=true' query parameter is + "! present. This is in order to avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + end of T_PAGINATION_BASE. + types: + "!

+ "! User defined properties specified as key-value pairs.

+ T_CUSTOM type JSONOBJECT. + types: + "!

+ "! The `id` of the model to be used for this request. Please

+ "! refer to the [list of models](TBD). + T_EMBEDDING_MODEL_ID type String. + types: + "!

+ "! The similarity results.

+ begin of T_SIMILARITY_RESULT, + "! A similarity score between the source and target text. + SCORE type NUMBER, + end of T_SIMILARITY_RESULT. + types: + "!

+ "! The common fields between a request and the response.

+ begin of T_DEPLOYMENT_ENTITY_COMMON, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A reference to a resource. + PROMPT_TEMPLATE type T_SIMPLE_REL, + "! Indicates that this is an online deployment. An object has to be specified but + "! can be empty.
+ "! The `serving_name` can be provided in the `online.parameters`. + ONLINE type T_ONLINE_DEPLOYMENT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + end of T_DEPLOYMENT_ENTITY_COMMON. + types: + "!

+ "! The text input for a given model to be used to generate the

+ "! embeddings. + begin of T_EMBEDDINGS_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The input text. + INPUTS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Parameters for text embedding requests. + PARAMETERS type T_EMBEDDING_PARAMETERS, + end of T_EMBEDDINGS_REQUEST. + types: + "!

+ "! The ranking score for the input.

+ begin of T_RERANKED_RESULTS, + "! A text to rank. + INPUT type T_RERANK_INPUT, + "! The score of the input. + SCORE type NUMBER, + end of T_RERANKED_RESULTS. + types: + "!

+ "! System details.

+ begin of T_RERANK_RESPONSE, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The rank query. + QUERY type STRING, + "! The ranked results. + RESULTS type STANDARD TABLE OF T_RERANKED_RESULTS WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_RERANK_RESPONSE. + types: + "!

+ "! The request to rerank texts.

+ begin of T_RERANK_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The rank input strings. + INPUTS type STANDARD TABLE OF T_RERANK_INPUT WITH NON-UNIQUE DEFAULT KEY, + "! The rank query. + QUERY type STRING, + "! The properties used for reranking. + PARAMETERS type T_RERANK_PARAMETERS, + end of T_RERANK_REQUEST. + types: + "!

+ "! The result of tokenizing the input string.

+ begin of T_TEXT_TOKENIZE_RESULT, + "! The number of tokens in the input string. + TOKEN_COUNT type INTEGER, + "! The input string broken up into the tokens, if requested. + TOKENS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_TEXT_TOKENIZE_RESULT. + types: + "!

+ "! The tokenization result.

+ begin of T_TEXT_TOKENIZE_RESPONSE, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-mod + "! els.html?context=wx). + MODEL_ID type STRING, + "! The result of tokenizing the input string. + RESULT type T_TEXT_TOKENIZE_RESULT, + end of T_TEXT_TOKENIZE_RESPONSE. + types: + "!

+ "! The properties specific to `watsonx.ai` deployments.

+ begin of T_DEPLOYMENT_RESOURCE_ENTITY, + "! The base model that is required for this deployment if this is for a prompt + "! template or a prompt tune for an IBM foundation model. + BASE_MODEL_ID type STRING, + end of T_DEPLOYMENT_RESOURCE_ENTITY. + types: + "!

+ "! A prompt to be used to infer the next tokens. Each request

+ "! expects a `project_id` or a `space_id`, and the `project` or `space` must have + "! an associated WML instance that will be used for limits and billing (if a paid + "! plan). + begin of T_TEXT_GEN_REQUEST, + "! The prompt to generate completions. Note: The method tokenizes the input + "! internally. It is recommended not to leave any trailing spaces. + INPUT type STRING, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-mod + "! els.html?context=wx). + MODEL_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! Properties that control the model and response. + PARAMETERS type T_TEXT_GEN_PARAMETERS, + "! Properties that control the moderations, for usages such as `Hate and profanity` + "! (HAP) and `Personal identifiable information` (PII) filtering. This list can be + "! extended with new types of moderations. + MODERATIONS type T_MODERATIONS, + end of T_TEXT_GEN_REQUEST. + types: + "!

+ "! The transformation results.

+ begin of T_GSPTL_TRNSFRMTN_RESP_FIELDS, + "! The transformation results. + RESULTS type T_GSPTL_TRANSFORMATION_RESULTS, + end of T_GSPTL_TRNSFRMTN_RESP_FIELDS. + types: + "!

+ "! System details.

+ begin of T_FOUNDATION_MODELS, + "! The total number of resources. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! The supported foundation models. + RESOURCES type STANDARD TABLE OF T_FOUNDATION_MODEL WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_FOUNDATION_MODELS. + types: + "!

+ "! The rank query.

+ T_RERANK_QUERY type String. + types: + "!

+ "! The ranked results.

+ begin of T_RERANK_RESPONSE_FIELDS, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The rank query. + QUERY type STRING, + "! The ranked results. + RESULTS type STANDARD TABLE OF T_RERANKED_RESULTS WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + end of T_RERANK_RESPONSE_FIELDS. + types: + "!

+ "! The inputs and outputs required to create a transformation

+ "! for the given model. + begin of T_GSPTL_TRANSFORMATION_REQ, + "! The `id` of the model to be used for this request. + MODEL_ID type STRING, + "! The input text. + INPUTS type STANDARD TABLE OF T_GSPTL_TRANSFORMATION_DATA WITH NON-UNIQUE DEFAULT KEY, + "! A data location of the input or output data. + OUTPUT type T_GSPTL_TRANSFORMATION_DATA, + "! The space that contains the resource. + SPACE_ID type STRING, + end of T_GSPTL_TRANSFORMATION_REQ. + types: + "!

+ "! The request entity for an AutoRAG job.

+ begin of T_AUTO_RAGREQUEST, + "! The name of the AutoRAG job. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! The parameters for an AutoRAG job. + PARAMETERS type T_AUTO_RAGPARAMETERS, + "! A reference to data. + INPUT_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + TEST_DATA_REFERENCES type T_OBJECT_LOCATION, + "! A reference to data. + VECTOR_STORE_REFERENCES type T_OBJECT_LOCATION, + end of T_AUTO_RAGREQUEST. + types: + "!

+ "! The similarity scores per source string.

+ begin of T_SIMILARITY_RESPONSE_FIELDS, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The similarity scores. + RESULTS type STANDARD TABLE OF T_SIMILARITY_RESULT WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + end of T_SIMILARITY_RESPONSE_FIELDS. + types: + "!

+ "! The common fields that can be patched. This is a helper for

+ "! `cpdctl`. + begin of T_DEPLOYMENT_RESOURCE_PATCH, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + end of T_DEPLOYMENT_RESOURCE_PATCH. + types: + "!

+ "! Properties that control the model and response that are only

+ "! supported in caikit. + begin of T_CAI_KIT_TEXT_GEN_PROPERTIES, + "! Local typicality measures how similar the conditional probability of predicting + "! a target token next is to the expected conditional probability of predicting a + "! random token next, given the partial text already generated. If less than 1, + "! the smallest set of the most locally typical tokens with probabilities that add + "! up to typical_p or higher are kept for generation. + TYPICAL_P type NUMBER, + end of T_CAI_KIT_TEXT_GEN_PROPERTIES. + types: + "!

+ "! The definition of the deployment.

+ begin of T_DEPLOYMENT_ENTITY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A reference to a resource. + PROMPT_TEMPLATE type T_SIMPLE_REL, + "! Indicates that this is an online deployment. An object has to be specified but + "! can be empty.
+ "! The `serving_name` can be provided in the `online.parameters`. + ONLINE type T_ONLINE_DEPLOYMENT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! The base model that is required for this deployment if this is for a prompt + "! template or a prompt tune for an IBM foundation model. + BASE_MODEL_ID type STRING, + "! The type of the deployed model. The possible values are the following: 1. + "! `prompt_tune` - when a prompt tuned model is deployed. 2. `foundation_model` - + "! when a prompt template is used on a pre-deployed IBM provided model. + DEPLOYED_ASSET_TYPE type STRING, + "! The verbalizer that was used to train this model if the deployment has + "! `deployed_asset_type` of `prompt_tune`. + VERBALIZER type STRING, + "! Specifies the current status, additional information about the deployment
+ "! and any failure messages in case of deployment failures. + STATUS type T_DEPLOYMENT_STATUS, + end of T_DEPLOYMENT_ENTITY. + types: + "!

+ "! Array of patch operations as defined in RFC 6902.

+ T_JSON_PATCH type STANDARD TABLE OF T_JSON_PATCH_OPERATION WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The supported foundation models.

+ T_FOUNDATION_MODELS_ARRAY type STANDARD TABLE OF T_FOUNDATION_MODEL WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The response from a geospatial transformation request.

+ begin of T_GSPTL_TRANSFORMATION_RESP, + "! The specific fields for the geospatial transformation metadata fields. + METADATA type T_GSPTL_TRNSFRMTN_METADATA, + "! The transformation results. + ENTITY type T_GSPTL_TRNSFRMTN_RESP_ENTITY, + end of T_GSPTL_TRANSFORMATION_RESP. + types: + "!

+ "! A deployment resource.

+ begin of T_DEPLOYMENT_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! The definition of the deployment. + ENTITY type T_DEPLOYMENT_ENTITY, + end of T_DEPLOYMENT_RESOURCE. + types: + "!

+ "! The common fields that can be patched. This is a helper for

+ "! `cpdctl`. + begin of T_COMMON_PATCH_REQUEST_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_COMMON_PATCH_REQUEST_HELPER. + types: + "!

+ "! The deployment resources.

+ begin of T_DPLYMNT_RESOURCE_COLLECTION, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of deployment resources. + RESOURCES type STANDARD TABLE OF T_DEPLOYMENT_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! System details including warnings. + SYSTEM type T_DEPLOYMENT_SYSTEM, + end of T_DPLYMNT_RESOURCE_COLLECTION. + types: + "!

+ "! A list of tags for this resource.

+ T_TAGS type TT_String. + types: + "!

+ "! The text input to the model.

+ T_TEXT_INPUT type String. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_PAGINATION_TC, + "! The total number of resources. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + end of T_PAGINATION_TC. + types: + "! No documentation available. + begin of T_TRAIN_RESOURCE_ENTITY_COMMON, + "! Properties to control the prompt tuning. + PROMPT_TUNING type T_PROMPT_TUNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! If set to `true` then the result of the training, if successful, will be + "! uploaded to the repository as a model. + AUTO_UPDATE_MODEL type BOOLEAN, + end of T_TRAIN_RESOURCE_ENTITY_COMMON. + types: + "! No documentation available. + begin of T_GSPTL_TRNSFRMTN_REQ_FIELDS, + "! The space that contains the resource. + SPACE_ID type STRING, + end of T_GSPTL_TRNSFRMTN_REQ_FIELDS. + types: + "!

+ "! Fail the call if the number of input tokens exceeds the

+ "! allowed value. This value can not be greater than the maximum sequence length + "! that the model supports. + T_PARAM_TRUNCATE_INPUT_TOKENS type Integer. + types: + "!

+ "! The metrics.

+ T_TRAINING_MLMETRICS type MAP. + types: + "!

+ "! The name of the AutoRAG job.

+ T_AUTO_RAGNAME type String. + types: + "!

+ "! System details.

+ begin of T_SIMILARITY_RESPONSE, + "! The `id` of the model to be used for this request. Please refer to the [list of + "! models](TBD). + MODEL_ID type STRING, + "! The similarity scores. + RESULTS type STANDARD TABLE OF T_SIMILARITY_RESULT WITH NON-UNIQUE DEFAULT KEY, + "! The time when the response was created. + CREATED_AT type DATETIME, + "! The number of input tokens that were consumed. + INPUT_TOKEN_COUNT type INTEGER, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_SIMILARITY_RESPONSE. + types: + "!

+ "! The time when the response was created.

+ T_CREATED_AT type DATETIME. + types: + "! No documentation available. + begin of T_RESULTS_REFERENCE_OUTPUT, + "! The training results. Normally this is specified as `type=container` which + "! means
+ "! that it is stored in the space or project. Note that the training will add + "! some
+ "! fields that point to the training status, the model request and the assets.
+ "!
+ "! The `model_request_path` is the request body that should be used when creating + "! the
+ "! trained model in the API, if this model is to be deployed. If + "! `auto_update_model`
+ "! was set to `true` then this file is not needed. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + end of T_RESULTS_REFERENCE_OUTPUT. + types: + "!

+ "! System details.

+ begin of T_FOUNDATION_MODEL_TASKS, + "! The total number of resources. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! The supported foundation model tasks. + RESOURCES type STANDARD TABLE OF T_FOUNDATION_MODEL_TASK WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_TG_DETAILS, + end of T_FOUNDATION_MODEL_TASKS. + types: + "!

+ "! Array parameter type for method DEPLOYMENTS_UPDATE

+ TT_JSON_PATCH_OPERATION type STANDARD TABLE OF T_JSON_PATCH_OPERATION WITH NON-UNIQUE DEFAULT KEY. + +constants: + "!

List of required fields per type.

+ begin of C_REQUIRED_FIELDS, + T_ERROR_ITEM type string value '|CODE|MESSAGE|', + T_ERROR type string value '|TRACE|ERRORS|', + T_PRMPT_TUNING_METRICS_CONTEXT type string value '|', + T_METRICS_CONTEXT type string value '|', + T_MESSAGE type string value '|', + T_TRAINING_METRIC type string value '|', + T_TRAINING_STATUS type string value '|STATE|', + T_DATA_SCHEMA type string value '|ID|FIELDS|', + T_RESOURCE_COMMIT_INFO type string value '|COMMITTED_AT|', + T_WARNING type string value '|MESSAGE|', + T_TRAIN_RSRC_COLLECTION_SYS type string value '|', + T_OBJECT_LOCATION type string value '|TYPE|LOCATION|', + T_BASE_MODEL type string value '|', + T_RESOURCE_META type string value '|ID|CREATED_AT|', + T_DATA_CONNECTION_REFERENCE type string value '|TYPE|', + T_PROMPT_TUNING type string value '|TASK_ID|', + T_TRAINING_RESOURCE_ENTITY type string value '|RESULTS_REFERENCE|STATUS|', + T_TRAINING_RESOURCE type string value '|', + T_PAGINATION_FIRST type string value '|HREF|', + T_PAGINATION_NEXT type string value '|HREF|', + T_TRAINING_RESOURCE_COLLECTION type string value '|LIMIT|FIRST|', + T_TRAINING_NUM_EPOCHS type string value '|', + T_MASK_PROPERTIES type string value '|', + T_PII_PROPERTIES type string value '|', + T_LIFE_CYCLE_STATE type string value '|ID|', + T_CONSUMPTIONS_LIMIT type string value '|', + T_TRAINING_INIT_METHOD type string value '|', + T_TRAINING_MAX_OUTPUT_TOKENS type string value '|', + T_TRAINING_LEARNING_RATE type string value '|', + T_TRAINING_BATCH_SIZE type string value '|', + T_TRAINING_NUM_VIRTUAL_TOKENS type string value '|', + T_TRAINING_ACCUMULATED_STEPS type string value '|', + T_TRAINING_TORCH_DTYPE type string value '|', + T_TRAINING_VERBALIZER type string value '|', + T_TRAINING_MAX_INPUT_TOKENS type string value '|', + T_TRAINING_INIT_TEXT type string value '|', + T_TRAINING_PARAMETERS type string value '|', + T_TASK_RATING type string value '|', + T_TASK_DESCRIPTION type string value '|ID|', + T_FOUNDATION_MODEL_VERSION type string value '|', + T_MODEL_LIMITS type string value '|', + T_FOUNDATION_MODEL_LIMITS type string value '|', + T_FOUNDATION_MODEL type string value '|MODEL_ID|LABEL|PROVIDER|SHORT_DESCRIPTION|TASKS|TIER|SOURCE|MIN_SHOT_SIZE|NUMBER_PARAMS|', + T_MODERATION_TEXT_RANGE type string value '|START|END|', + T_MODERATION_RESULT type string value '|SCORE|INPUT|POSITION|ENTITY|', + T_MODERATION_RESULTS type string value '|', + T_WARNING_TG type string value '|MESSAGE|', + T_TEXT_GEN_TOP_TOKEN_INFO type string value '|', + T_TEXT_GEN_TOKEN_INFO type string value '|', + T_TEXT_GEN_RESULT type string value '|GENERATED_TEXT|STOP_REASON|', + T_SYSTEM_TG_DETAILS type string value '|', + T_TEXT_GEN_RESPONSE type string value '|MODEL_ID|CREATED_AT|RESULTS|', + T_FOUNDATION_MODEL_TASK type string value '|TASK_ID|LABEL|RANK|', + T_STATS type string value '|', + T_DEPLOYMENT_SYSTEM_DETAILS type string value '|', + T_DEPLOYMENT_SYSTEM type string value '|', + T_RESOURCE_META_BASE type string value '|', + T_RESOURCE_META_SIMPLE type string value '|ID|CREATED_AT|', + T_AUTO_RAGMETRICS type string value '|TEST_DATA|', + T_TRAINING_RESOURCE_DETAILS type string value '|NAME|', + T_HAP_PROPERTIES type string value '|', + T_AUTO_RAGRESULT_LOCATION type string value '|', + T_SIMILARITY_PARAMETERS type string value '|', + T_SIMILARITY_REQUEST type string value '|MODEL_ID|SOURCE_TEXT|TARGET_TEXTS|', + T_TEXT_MODERATION type string value '|', + T_MODERATION_PROPERTIES type string value '|', + T_TRAINING_RESOURCE_PROTOTYPE type string value '|NAME|RESULTS_REFERENCE|', + T_TEXT_TOKENIZE_PARAMETERS type string value '|', + T_TEXT_TOKENIZE_REQUEST type string value '|MODEL_ID|INPUT|', + T_HARDWARE_SPEC type string value '|', + T_TRAINING_STATUS_OUTPUT type string value '|STATUS|', + T_AUTO_RAGMETRIC type string value '|', + T_RERANK_RETURN_OPTIONS type string value '|', + T_TEXT_GEN_RESPONSE_FIELDS type string value '|MODEL_ID|CREATED_AT|RESULTS|', + T_AUTO_RAGEMBEDDINGS type string value '|', + T_AUTO_RAGCHUNKING type string value '|', + T_AUTO_RAGVECTOR_STORE type string value '|', + T_AUTO_RAGGENERATION type string value '|', + T_AUTO_RAGMETHOD type string value '|', + T_AUTO_RAGSETTINGS type string value '|', + T_AUTO_RAGPATTERN type string value '|', + T_AUTO_RAGOPTIMIZATION_PARAM type string value '|', + T_AUTO_RAGPARAMETERS type string value '|', + T_AUTO_RAGCONTEXT type string value '|', + T_AUTO_RAGRESULTS type string value '|', + T_AUTO_RAGRESPONSE_ENTITY type string value '|HARDWARE_SPEC|INPUT_DATA_REFERENCES|TEST_DATA_REFERENCES|VECTOR_STORE_REFERENCES|RESULTS|TIMESTAMP|', + T_RERANK_INPUT type string value '|TEXT|', + T_AUTO_RAGMETADATA type string value '|ID|CREATED_AT|', + T_AUTO_RAGRESPONSE type string value '|', + T_AUTO_RAGRESPONSE_RESULTS type string value '|RESULTS|TIMESTAMP|', + T_AUTO_RAGREQUEST_FIELDS type string value '|', + T_RETURN_OPTION_PROPERTIES type string value '|', + T_MODERATION_HAP_PROPERTIES type string value '|', + T_MODERATION_PII_PROPERTIES type string value '|', + T_MODERATIONS type string value '|', + T_TEXT_GEN_LENGTH_PENALTY type string value '|', + T_DPLYMNT_TEXT_GEN_PROPERTIES type string value '|', + T_DEPLOYMENT_TEXT_GEN type string value '|', + T_EMBEDDING type string value '|EMBEDDING|', + T_EMBEDDINGS_RESPONSE_FIELDS type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_GSPTL_TRANSFORMATION_DATA type string value '|', + T_GSPTL_TRANSFORMATION_RESULTS type string value '|', + T_GSPTL_TRNSFRMTN_RESP_ENTITY type string value '|MODEL_ID|INPUTS|OUTPUT|RESULTS|', + T_SIMPLE_REL type string value '|ID|', + T_EMBEDDING_RETURN_OPTIONS type string value '|', + T_EMBEDDING_PARAMETERS type string value '|', + T_AUTO_RAGREQUEST_ENTITY type string value '|HARDWARE_SPEC|INPUT_DATA_REFERENCES|TEST_DATA_REFERENCES|VECTOR_STORE_REFERENCES|', + T_GSPTL_TRNSFRMTN_METADATA type string value '|ID|CREATED_AT|SPACE_ID|', + T_REL type string value '|ID|', + T_ONLINE_DEPLOYMENT_PARAMETERS type string value '|', + T_ONLINE_DEPLOYMENT type string value '|', + T_DPLYMNT_RESOURCE_PROTOTYPE type string value '|NAME|ONLINE|', + T_EMBEDDINGS_RESPONSE type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_GSPTL_TRANSFORMATION_ENTITY type string value '|MODEL_ID|INPUTS|OUTPUT|', + T_AUTO_RAGMETADATA_FIELDS type string value '|', + T_PROMPT_TEMPLATE_VARIABLES type string value '|', + T_SYSTEM_DETAILS type string value '|', + T_PAGINATION type string value '|LIMIT|FIRST|', + T_DEPLOYMENT_TEXT_GEN_REQUEST type string value '|INPUT|', + T_TEXT_GEN_PARAMETERS2 type string value '|', + T_RESULTS_REFERENCE_INPUT type string value '|RESULTS_REFERENCE|', + T_ENTITY_REQ_SPC_PROJECT_BODY type string value '|NAME|', + T_SYSTEM_TG type string value '|', + T_RERANK_PARAMETERS type string value '|', + T_INFERENCE type string value '|URL|', + T_DEPLOYMENT_STATUS type string value '|', + T_TEXT_GEN_COMMON type string value '|INPUT|', + T_GSPTL_TRNSFRMTN_MTDT_FIELDS type string value '|SPACE_ID|', + T_TEXT_GEN_PARAMETERS type string value '|', + T_JSON_PATCH_OPERATION type string value '|OP|PATH|', + T_PAGINATION_BASE type string value '|LIMIT|FIRST|', + T_SIMILARITY_RESULT type string value '|SCORE|', + T_DEPLOYMENT_ENTITY_COMMON type string value '|ONLINE|', + T_EMBEDDINGS_REQUEST type string value '|MODEL_ID|INPUTS|', + T_RERANKED_RESULTS type string value '|SCORE|', + T_RERANK_RESPONSE type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_RERANK_REQUEST type string value '|MODEL_ID|INPUTS|QUERY|', + T_TEXT_TOKENIZE_RESULT type string value '|TOKEN_COUNT|', + T_TEXT_TOKENIZE_RESPONSE type string value '|MODEL_ID|RESULT|', + T_DEPLOYMENT_RESOURCE_ENTITY type string value '|', + T_TEXT_GEN_REQUEST type string value '|INPUT|MODEL_ID|', + T_GSPTL_TRNSFRMTN_RESP_FIELDS type string value '|RESULTS|', + T_FOUNDATION_MODELS type string value '|LIMIT|FIRST|', + T_RERANK_RESPONSE_FIELDS type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_GSPTL_TRANSFORMATION_REQ type string value '|MODEL_ID|INPUTS|OUTPUT|SPACE_ID|', + T_AUTO_RAGREQUEST type string value '|HARDWARE_SPEC|INPUT_DATA_REFERENCES|TEST_DATA_REFERENCES|VECTOR_STORE_REFERENCES|', + T_SIMILARITY_RESPONSE_FIELDS type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_DEPLOYMENT_RESOURCE_PATCH type string value '|', + T_CAI_KIT_TEXT_GEN_PROPERTIES type string value '|', + T_DEPLOYMENT_ENTITY type string value '|ONLINE|', + T_GSPTL_TRANSFORMATION_RESP type string value '|', + T_DEPLOYMENT_RESOURCE type string value '|', + T_COMMON_PATCH_REQUEST_HELPER type string value '|', + T_DPLYMNT_RESOURCE_COLLECTION type string value '|LIMIT|FIRST|', + T_PAGINATION_TC type string value '|LIMIT|FIRST|', + T_TRAIN_RESOURCE_ENTITY_COMMON type string value '|', + T_GSPTL_TRNSFRMTN_REQ_FIELDS type string value '|SPACE_ID|', + T_SIMILARITY_RESPONSE type string value '|MODEL_ID|RESULTS|CREATED_AT|INPUT_TOKEN_COUNT|', + T_RESULTS_REFERENCE_OUTPUT type string value '|RESULTS_REFERENCE|', + T_FOUNDATION_MODEL_TASKS type string value '|LIMIT|FIRST|', + __DUMMY type string value SPACE, + end of C_REQUIRED_FIELDS . + +constants: + "!

Map ABAP identifiers to service identifiers.

+ begin of C_ABAPNAME_DICTIONARY, + TAGS type string value 'tags', + NAME type string value 'name', + DESCRIPTION type string value 'description', + CUSTOM type string value 'custom', + INNER type string value 'inner', + ASSET type string value 'asset', + INPUT type string value 'input', + DECAY_FACTOR type string value 'decay_factor', + START_INDEX type string value 'start_index', + INPUT_TEXT type string value 'input_text', + GENERATED_TOKENS type string value 'generated_tokens', + INPUT_TOKENS type string value 'input_tokens', + TOKEN_LOGPROBS type string value 'token_logprobs', + TOKEN_RANKS type string value 'token_ranks', + TOP_N_TOKENS type string value 'top_n_tokens', + DECODING_METHOD type string value 'decoding_method', + LENGTH_PENALTY type string value 'length_penalty', + MAX_NEW_TOKENS type string value 'max_new_tokens', + MIN_NEW_TOKENS type string value 'min_new_tokens', + RANDOM_SEED type string value 'random_seed', + STOP_SEQUENCES type string value 'stop_sequences', + TEMPERATURE type string value 'temperature', + TIME_LIMIT type string value 'time_limit', + TOP_K type string value 'top_k', + TOP_P type string value 'top_p', + REPETITION_PENALTY type string value 'repetition_penalty', + TRUNCATE_INPUT_TOKENS type string value 'truncate_input_tokens', + RETURN_OPTIONS type string value 'return_options', + INCLUDE_STOP_SEQUENCE type string value 'include_stop_sequence', + ENABLED type string value 'enabled', + THRESHOLD type string value 'threshold', + OUTPUT type string value 'output', + REMOVE_ENTITY_VALUE type string value 'remove_entity_value', + MASK type string value 'mask', + START type string value 'start', + END type string value 'end', + HAP type string value 'hap', + PII type string value 'pii', + INPUT_RANGES type string value 'input_ranges', + MODEL_ID type string value 'model_id', + SPACE_ID type string value 'space_id', + PROJECT_ID type string value 'project_id', + PARAMETERS type string value 'parameters', + MODERATIONS type string value 'moderations', + TEXT type string value 'text', + LOGPROB type string value 'logprob', + RANK type string value 'rank', + TOP_TOKENS type string value 'top_tokens', + SCORE type string value 'score', + POSITION type string value 'position', + ENTITY type string value 'entity', + WORD type string value 'word', + GENERATED_TEXT type string value 'generated_text', + GENERATED_TOKEN_COUNT type string value 'generated_token_count', + INPUT_TOKEN_COUNT type string value 'input_token_count', + STOP_REASON type string value 'stop_reason', + SEED type string value 'seed', + MODEL_VERSION type string value 'model_version', + CREATED_AT type string value 'created_at', + RESULTS type string value 'results', + MESSAGE type string value 'message', + ID type string value 'id', + MORE_INFO type string value 'more_info', + WARNINGS type string value 'warnings', + SYSTEM type string value 'system', + CODE type string value 'code', + TRACE type string value 'trace', + ERRORS type string value 'errors', + RETURN_TOKENS type string value 'return_tokens', + TOKEN_COUNT type string value 'token_count', + TOKENS type string value 'tokens', + RESULT type string value 'result', + HREF type string value 'href', + TOTAL_COUNT type string value 'total_count', + LIMIT type string value 'limit', + FIRST type string value 'first', + NEXT type string value 'next', + CALL_TIME type string value 'call_time', + MAX_INPUT_TOKENS type string value 'max_input_tokens', + MAX_OUTPUT_TOKENS type string value 'max_output_tokens', + LITE type string value 'lite', + COST type string value 'cost', + QUALITY type string value 'quality', + RATINGS type string value 'ratings', + MAX_SEQUENCE_LENGTH type string value 'max_sequence_length', + TRAINING_DATA_MAX_RECORDS type string value 'training_data_max_records', + LABEL type string value 'label', + START_DATE type string value 'start_date', + ALTERNATIVE_MODEL_IDS type string value 'alternative_model_ids', + URL type string value 'url', + SUPPORTED type string value 'supported', + DEFAULT type string value 'default', + MIN type string value 'min', + MAX type string value 'max', + INIT_METHOD type string value 'init_method', + INIT_TEXT type string value 'init_text', + NUM_VIRTUAL_TOKENS type string value 'num_virtual_tokens', + NUM_EPOCHS type string value 'num_epochs', + VERBALIZER type string value 'verbalizer', + BATCH_SIZE type string value 'batch_size', + TORCH_DTYPE type string value 'torch_dtype', + ACCUMULATE_STEPS type string value 'accumulate_steps', + LEARNING_RATE type string value 'learning_rate', + VERSION type string value 'version', + AVAILABLE_DATE type string value 'available_date', + PROVIDER type string value 'provider', + TUNED_BY type string value 'tuned_by', + SHORT_DESCRIPTION type string value 'short_description', + LONG_DESCRIPTION type string value 'long_description', + LIMITS type string value 'limits', + TASK_IDS type string value 'task_ids', + TASKS type string value 'tasks', + TIER type string value 'tier', + SOURCE type string value 'source', + MIN_SHOT_SIZE type string value 'min_shot_size', + NUMBER_PARAMS type string value 'number_params', + MODEL_LIMITS type string value 'model_limits', + LIFECYCLE type string value 'lifecycle', + TRAINING_PARAMETERS type string value 'training_parameters', + VERSIONS type string value 'versions', + RESOURCES type string value 'resources', + TASK_ID type string value 'task_id', + COMMITTED_AT type string value 'committed_at', + COMMIT_MESSAGE type string value 'commit_message', + REV type string value 'rev', + OWNER type string value 'owner', + MODIFIED_AT type string value 'modified_at', + PARENT_ID type string value 'parent_id', + COMMIT_INFO type string value 'commit_info', + SERVING_NAME type string value 'serving_name', + NUM_NODES type string value 'num_nodes', + PROMPT_TEMPLATE type string value 'prompt_template', + ONLINE type string value 'online', + HARDWARE_SPEC type string value 'hardware_spec', + BASE_MODEL_ID type string value 'base_model_id', + LEVEL type string value 'level', + SSE type string value 'sse', + USES_SERVING_NAME type string value 'uses_serving_name', + STATE type string value 'state', + FAILURE type string value 'failure', + INFERENCE type string value 'inference', + DEPLOYED_ASSET_TYPE type string value 'deployed_asset_type', + STATUS type string value 'status', + METADATA type string value 'metadata', + ADDITIONAL_PROPERTIES type string value 'additional_properties', + ONLINE_COUNT type string value 'online_count', + BATCH_COUNT type string value 'batch_count', + STATS type string value 'stats', + OP type string value 'op', + PATH type string value 'path', + FROM type string value 'from', + VALUE type string value 'value', + TYPICAL_P type string value 'typical_p', + PROMPT_VARIABLES type string value 'prompt_variables', + BASE_MODEL type string value 'base_model', + TUNING_TYPE type string value 'tuning_type', + FIELDS type string value 'fields', + TYPE type string value 'type', + CONNECTION type string value 'connection', + LOCATION type string value 'location', + SCHEMA type string value 'schema', + PROMPT_TUNING type string value 'prompt_tuning', + TRAINING_DATA_REFERENCES type string value 'training_data_references', + AUTO_UPDATE_MODEL type string value 'auto_update_model', + RESULTS_REFERENCE type string value 'results_reference', + METRICS_LOCATION type string value 'metrics_location', + DEPLOYMENT_ID type string value 'deployment_id', + TIMESTAMP type string value 'timestamp', + ITERATION type string value 'iteration', + ML_METRICS type string value 'ml_metrics', + CONTEXT type string value 'context', + RUNNING_AT type string value 'running_at', + COMPLETED_AT type string value 'completed_at', + METRICS type string value 'metrics', + INPUTS type string value 'inputs', + EMBEDDING type string value 'embedding', + SOURCE_TEXT type string value 'source_text', + TARGET_TEXTS type string value 'target_texts', + TOP_N type string value 'top_n', + QUERY type string value 'query', + OBJECTIVE_METRIC type string value 'objective_metric', + MAX_NUM_FOUNDATION_MODELS type string value 'max_num_foundation_models', + INCLUDE_FOUNDATION_MODELS_ONLY type string value 'include_foundation_models_only', + INCLUDE_EMBEDDING_MODELS_ONLY type string value 'include_embedding_models_only', + OPTIMIZATION type string value 'optimization', + OUTPUT_LOGS type string value 'output_logs', + INPUT_DATA_REFERENCES type string value 'input_data_references', + TEST_DATA_REFERENCES type string value 'test_data_references', + VECTOR_STORE_REFERENCES type string value 'vector_store_references', + MEAN type string value 'mean', + TEST_DATA type string value 'test_data', + SYNTHETIC_DATA type string value 'synthetic_data', + EVALUATION_RESULTS type string value 'evaluation_results', + FUNCTION type string value 'function', + FUNCTION_SOURCE_CODE type string value 'function_source_code', + FUNCTION_CREATION_REQUEST type string value 'function_creation_request', + INDEXING_NOTEBOOK type string value 'indexing_notebook', + GENERATE_NOTEBOOK type string value 'generate_notebook', + DATABASE type string value 'database', + INDEX_NAME type string value 'index_name', + DIMENSION type string value 'dimension', + DISTANCE type string value 'distance', + METHOD type string value 'method', + CHUNK_SIZE type string value 'chunk_size', + OVERLAP type string value 'overlap', + STRATEGY type string value 'strategy', + SIZE type string value 'size', + MODEL_NAME type string value 'model_name', + PROMPT type string value 'prompt', + VECTOR_STORE type string value 'vector_store', + CHUNKING type string value 'chunking', + EMBEDDINGS type string value 'embeddings', + RETRIEVAL type string value 'retrieval', + RERANKING type string value 'reranking', + GENERATION type string value 'generation', + COMPOSITION_STEPS type string value 'composition_steps', + DURATION_SECONDS type string value 'duration_seconds', + SETTINGS type string value 'settings', + RAG_PATTERN type string value 'rag_pattern', + CHAIN_NODES type string value 'chain_nodes', + PHASE type string value 'phase', + end of C_ABAPNAME_DICTIONARY . + + + methods GET_APPNAME + redefinition . + methods GET_REQUEST_PROP + redefinition . + methods GET_SDK_VERSION_DATE + redefinition . + + + "!

Create a new watsonx.ai deployment

+ "! Create a new deployment, currently the only supported type is `online`.
+ "! If this is a deployment for a prompt tune then the `asset` object must exist and + "! the `id` must be the `id` of the `model` that was created after the prompt + "! training.
+ "! If this is a deployment for a prompt template then the `prompt_template` object + "! should exist and the `id` must be the `id` of the prompt template to be + "! deployed.
+ "! + "! + "! @parameter I_DEPLOYMENTRESOURCEPROTOTYPE | + "! The deployment request entity.
+ "!
+ "! The following important fields are described for each use case: 1. Prompt + "! template: (`deployed_asset_type` is `foundation_model`)
+ "! - `base_model_id`: **required**
+ "! - `promt_template.id`: **required**
+ "! - `online`: **required**
+ "! - `hardware_spec`: **forbidden** 1. Prompt tune: (`deployed_asset_type` is + "! `prompt_tune`)
+ "! - `asset.id`: **required**
+ "! - `online`: **required**
+ "! - `hardware_spec`: **forbidden**
+ "! - `base_model_id`: **forbidden**. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods CREATE_DEPLOYMENT + importing + !I_DEPLOYMENTRESOURCEPROTOTYPE type T_DPLYMNT_RESOURCE_PROTOTYPE + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployments

+ "! Retrieve the list of deployments for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_SERVING_NAME | + "! Retrieves the deployment, if any, that contains this `serving_name`. + "! @parameter I_TAG_VALUE | + "! Retrieves only the resources with the given tag value. + "! @parameter I_ASSET_ID | + "! Retrieves only the resources with the given asset_id, asset_id would be the + "! model id. + "! @parameter I_PROMPT_TEMPLATE_ID | + "! Retrieves only the resources with the given prompt_template_id. + "! @parameter I_NAME | + "! Retrieves only the resources with the given name. + "! @parameter I_TYPE | + "! Retrieves the resources filtered with the given type. There are the deployment + "! types as well as an additional
+ "! `prompt_template` if the deployment type includes a prompt template.
+ "!
+ "! The supported deployment types are (see the description for + "! `deployed_asset_type` in the deployment entity):
+ "!
+ "! 1. `prompt_tune` - when a prompt tuned model is deployed. 2. `foundation_model` + "! - when a prompt template is used on a pre-deployed IBM provided model.
+ "!
+ "! These can be combined with the flag `prompt_template` like this:
+ "!
+ "! 1. `type=prompt_tune` - return all prompt tuned model deployments. 2. + "! `type=prompt_tune and prompt_template` - return all prompt tuned model + "! deployments with a prompt template. 3. `type=foundation_model` - return all + "! prompt template deployments. 4. `type=foundation_model and prompt_template` - + "! return all prompt template deployments - this is the same as the previous query + "! because a `foundation_model` can only exist with a prompt template. 5. + "! `type=prompt_template` - return all deployments with a prompt template. + "! @parameter I_STATE | + "! Retrieves the resources filtered by state. Allowed values are `initializing`, + "! `updating`, `ready` and `failed`. + "! @parameter I_CONFLICT | + "! Returns whether `serving_name` is available for use or not. This query parameter + "! cannot be combined with any other parameter except for `serving_name`. + "! @parameter E_RESPONSE | + "! Service return value of type T_DPLYMNT_RESOURCE_COLLECTION + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods LIST_DEPLOYMENTS + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_SERVING_NAME type STRING optional + !I_TAG_VALUE type STRING optional + !I_ASSET_ID type STRING optional + !I_PROMPT_TEMPLATE_ID type STRING optional + !I_NAME type STRING optional + !I_TYPE type STRING optional + !I_STATE type STRING optional + !I_CONFLICT type BOOLEAN default c_boolean_false + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DPLYMNT_RESOURCE_COLLECTION + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment details

+ "! Retrieve the deployment details with the specified identifier.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_GET + importing + !I_DEPLOYMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the deployment metadata

+ "! Update the deployment metadata.
+ "! The following parameters of deployment metadata are supported for the patch + "! operation.
+ "!
+ "! - `/name`
+ "! - `/description`
+ "! - `/tags`
+ "! - `/custom`
+ "! - `/online/parameters`
+ "! - `/asset`
+ "! - `/prompt_template`
+ "! - `/hardware_spec`
+ "!
+ "! The PATCH operation with path specified as `/online/parameters` can be used to + "! update the `serving_name`.
+ "!
+ "! Patching `/asset` or `/prompt_template` should normally be used in the case when + "! these fields already exist.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_JSON_PATCH | + "! The json patch. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_UPDATE + importing + !I_DEPLOYMENT_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json-patch+json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the deployment

+ "! Delete the deployment with the specified identifier.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_DELETE + importing + !I_DEPLOYMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Infer text

+ "! Infer the next tokens for a given deployed model with a set of parameters.
+ "! If a `serving_name` is used then it must match the `serving_name` that is + "! returned in the `inference`
+ "! when the deployment was created.
+ "!
+ "! ### Return options
+ "!
+ "! Note that there is currently a limitation in this operation when using + "! `return_options`,
+ "! for input only `input_text` will be returned if requested,
+ "! for output the `input_tokens` and `generated_tokens` will not be returned.
+ "! + "! + "! @parameter I_ID_OR_NAME | + "! The `id_or_name` can be either the `deployment_id` that identifies the + "! deployment or a `serving_name` that allows a predefined URL to be used to post + "! a prediction.
+ "!
+ "! The `project` or `space` for the deployment must have a WML instance that will + "! be used for limits and billing (if a paid plan). + "! @parameter I_DEPLOYMENTTEXTGENREQUEST | + "! From a given prompt, infer the next tokens. + "! @parameter E_RESPONSE | + "! Service return value of type T_TEXT_GEN_RESPONSE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_TEXT_GENERATION + importing + !I_ID_OR_NAME type STRING + !I_DEPLOYMENTTEXTGENREQUEST type T_DEPLOYMENT_TEXT_GEN_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TEXT_GEN_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Infer text event stream

+ "! Infer the next tokens for a given deployed model with a set of parameters.
+ "! This operation will return the output tokens as a stream of events.
+ "! If a `serving_name` is used then it must match the `serving_name` that is + "! returned in the `inference`
+ "! when the deployment was created.
+ "!
+ "! ### Return options
+ "!
+ "! Note that there is currently a limitation in this operation when using + "! `return_options`,
+ "! for input only `input_text` will be returned if requested,
+ "! for output the `input_tokens` and `generated_tokens` will not be returned, also + "! the
+ "! `rank` and `top_tokens` will not be returned.
+ "! + "! + "! @parameter I_ID_OR_NAME | + "! The `id_or_name` can be either the `deployment_id` that identifies the + "! deployment or a `serving_name` that allows a predefined URL to be used to post + "! a prediction.
+ "!
+ "! The `project` or `space` for the deployment must have a WML instance that will + "! be used for limits and billing (if a paid plan). + "! @parameter I_DEPLOYMENTTEXTGENREQUEST | + "! From a given prompt, infer the next tokens in a server-sent events (SSE) stream. + "! + "! @parameter I_ACCEPT | + "! The type of the response: application/json or text/event-stream. A character + "! encoding can be specified by including a `charset` parameter. For example, + "! 'text/event-stream;charset=utf-8'. + "! @parameter E_RESPONSE | + "! Service return value of type T_Array + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_TEXT_GEN_STREAM + importing + !I_ID_OR_NAME type STRING + !I_DEPLOYMENTTEXTGENREQUEST type T_DEPLOYMENT_TEXT_GEN_REQUEST + !I_ACCEPT type STRING optional + !I_contenttype type string default 'application/json' + exporting + !E_RESPONSE type T_Array + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

List the available foundation models

+ "! Retrieve the list of deployed foundation models.
+ "! + "! + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_FOUNDATION_MODELS + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods LIST_FOUNDATION_MODEL_SPECS + importing + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FOUNDATION_MODELS + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

List the supported tasks

+ "! Retrieve the list of tasks that are supported by the foundation models.
+ "! + "! + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_FOUNDATION_MODEL_TASKS + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods LIST_FOUNDATION_MODEL_TASKS + importing + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FOUNDATION_MODEL_TASKS + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Infer text

+ "! Infer the next tokens for a given deployed model with a set of parameters.
+ "! + "! + "! @parameter I_TEXTGENREQUEST | + "! From a given prompt, infer the next tokens. + "! @parameter E_RESPONSE | + "! Service return value of type T_TEXT_GEN_RESPONSE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TEXT_GENERATION + importing + !I_TEXTGENREQUEST type T_TEXT_GEN_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TEXT_GEN_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Infer text event stream

+ "! Infer the next tokens for a given deployed model with a set of parameters.
+ "! This operation will return the output tokens as a stream of events.
+ "! + "! + "! @parameter I_TEXTGENREQUEST | + "! From a given prompt, infer the next tokens in a server-sent events (SSE) stream. + "! + "! @parameter I_ACCEPT | + "! The type of the response: application/json or text/event-stream. A character + "! encoding can be specified by including a `charset` parameter. For example, + "! 'text/event-stream;charset=utf-8'. + "! @parameter E_RESPONSE | + "! Service return value of type T_Array + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TEXT_GENERATION_STREAM + importing + !I_TEXTGENREQUEST type T_TEXT_GEN_REQUEST + !I_ACCEPT type STRING optional + !I_contenttype type string default 'application/json' + exporting + !E_RESPONSE type T_Array + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Text tokenization

+ "! The text tokenize operation allows you to check the conversion of provided input + "! to tokens for a given model.
+ "! It splits text into words or sub-words, which then are converted to ids through + "! a look-up table (vocabulary).
+ "! Tokenization allows the model to have a reasonable vocabulary size.
+ "! + "! + "! @parameter I_TEXTTOKENIZEREQUEST | + "! The input string to tokenize. + "! @parameter E_RESPONSE | + "! Service return value of type T_TEXT_TOKENIZE_RESPONSE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TEXT_TOKENIZATION + importing + !I_TEXTTOKENIZEREQUEST type T_TEXT_TOKENIZE_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TEXT_TOKENIZE_RESPONSE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new watsonx.ai training

+ "! Create a new watsonx.ai training in a project or a space.
+ "!
+ "! The details of the base model and parameters for the training
+ "! must be provided in the `prompt_tuning` object.
+ "!
+ "!
+ "! In order to deploy the tuned model you need to follow the following steps:
+ "!
+ "! 1. Create a WML model asset, in a space or a project,
+ "! by providing the `request.json` as shown below:
+ "! ```
+ "! curl -X POST + "! "https://{cpd_cluster}/ml/v4/models?version=2024-01-29" + "! \
+ "! -H "Authorization: Bearer <replace with your token>" + "! \
+ "! -H "content-type: application/json" \
+ "! --data '{
+ "! "name": "replace_with_a_meaningful_name",
+ "! "space_id": "replace_with_your_space_id",
+ "! "type": "prompt_tune_1.0",
+ "! "software_spec": {
+ "! "name": "watsonx-textgen-fm-1.0"
+ "! },
+ "! "metrics": [ from the training job ],
+ "! "training": {
+ "! "base_model": {
+ "! "model_id": "google/flan-t5-xl"
+ "! },
+ "! "task_id": "generation",
+ "! "verbalizer": "Input: {{input}} + "! Output:"
+ "! },
+ "! "training_data_references": [
+ "! {
+ "! "connection": {
+ "! "id": + "! "20933468-7e8a-4706-bc90-f0a09332b263"
+ "! },
+ "! "id": "file_to_tune1.json",
+ "! "location": {
+ "! "bucket": + "! "wxproject-donotdelete-pr-xeyivy0rx3vrbl",
+ "! "path": "file_to_tune1.json"
+ "! },
+ "! "type": "connection_asset"
+ "! }
+ "! ],
+ "! "training_id": + "! "05859469-b25b-420e-aefe-4a5cb6b595eb"
+ "! }'
+ "! ```
+ "!
+ "!
+ "! **Notes:**
+ "!
+ "! 1. If you used the training request field `auto_update_model: true`
+ "! then you can skip this step as the model will have been saved at
+ "! the end of the training job.
+ "! 1. Rather than creating the payload for the model you can use the
+ "! generated `request.json` that was stored in the + "! `results_reference`
+ "! field, look for the path in the field
+ "! `entity.results_reference.location.model_request_path`.
+ "! 1. The model `type` must be `prompt_tune_1.0`.
+ "! 1. The software spec name must be `watsonx-textgen-fm-1.0`.
+ "!
+ "! 1. Create a tuned model deployment as described in the
+ "! [create deployment documentation](#create-deployment).
+ "! + "! + "! @parameter I_TRAININGRESOURCEPROTOTYPE | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_CREATE + importing + !I_TRAININGRESOURCEPROTOTYPE type T_TRAINING_RESOURCE_PROTOTYPE + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the list of trainings

+ "! Retrieve the list of trainings for the specified space or project.
+ "! + "! + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TOTAL_COUNT | + "! Compute the total count. May have performance impact. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag value. + "! @parameter I_STATE | + "! Filter based on on the training job state. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCE_COLLECTION + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_LIST + importing + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TOTAL_COUNT type BOOLEAN optional + !I_TAG_VALUE type STRING optional + !I_STATE type STRING optional + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCE_COLLECTION + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the training

+ "! Retrieve the training with the specified identifier.
+ "! + "! + "! @parameter I_TRAINING_ID | + "! The training identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_GET + importing + !I_TRAINING_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Cancel the training

+ "! Cancel the specified training and remove it.
+ "! + "! + "! @parameter I_TRAINING_ID | + "! The training identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_HARD_DELETE | + "! Set to true in order to also delete the job metadata information. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_DELETE + importing + !I_TRAINING_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_HARD_DELETE type BOOLEAN optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + +protected section. + +private section. + +ENDCLASS. + +class ZCL_IBMX_WATSONX_AI_ML_V1 IMPLEMENTATION. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->GET_APPNAME +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_APPNAME TYPE STRING +* +-------------------------------------------------------------------------------------- + method GET_APPNAME. + + e_appname = 'watsonx.ai'. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Protected Method ZCL_IBMX_WATSONX_AI_ML_V1->GET_REQUEST_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT) +* | [<-()] E_REQUEST_PROP TYPE TS_REQUEST_PROP +* +-------------------------------------------------------------------------------------- +method GET_REQUEST_PROP. + + data: + lv_auth_method type string ##NEEDED. + + e_request_prop = super->get_request_prop( i_auth_method = i_auth_method ). + + lv_auth_method = i_auth_method. + if lv_auth_method eq c_default. + lv_auth_method = 'BearerToken'. + endif. + if lv_auth_method is initial. + e_request_prop-auth_basic = c_boolean_false. + e_request_prop-auth_oauth = c_boolean_false. + e_request_prop-auth_apikey = c_boolean_false. + elseif lv_auth_method eq 'BearerToken'. + e_request_prop-auth_name = 'BearerToken'. + e_request_prop-auth_type = 'http'. + e_request_prop-auth_oauth = c_boolean_true. + else. + endif. + + e_request_prop-url-protocol = 'https'. + e_request_prop-url-host = 'us-south.ml.cloud.ibm.com'. + e_request_prop-url-path_base = ''. + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->GET_SDK_VERSION_DATE +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_SDK_VERSION_DATE TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_sdk_version_date. + + e_sdk_version_date = '20240325'. + + endmethod. + + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->CREATE_DEPLOYMENT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENTRESOURCEPROTOTYPE TYPE T_DPLYMNT_RESOURCE_PROTOTYPE +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method CREATE_DEPLOYMENT. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_DEPLOYMENTRESOURCEPROTOTYPE ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_DEPLOYMENTRESOURCEPROTOTYPE to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_DEPLOYMENTRESOURCEPROTOTYPE i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'DeploymentResourcePrototype' i_value = i_DEPLOYMENTRESOURCEPROTOTYPE ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_DEPLOYMENTRESOURCEPROTOTYPE to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->LIST_DEPLOYMENTS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_SERVING_NAME TYPE STRING (optional) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_ASSET_ID TYPE STRING (optional) +* | [--->] I_PROMPT_TEMPLATE_ID TYPE STRING (optional) +* | [--->] I_NAME TYPE STRING (optional) +* | [--->] I_TYPE TYPE STRING (optional) +* | [--->] I_STATE TYPE STRING (optional) +* | [--->] I_CONFLICT TYPE BOOLEAN (default =c_boolean_false) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DPLYMNT_RESOURCE_COLLECTION +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method LIST_DEPLOYMENTS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SERVING_NAME is supplied. + lv_queryparam = escape( val = i_SERVING_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `serving_name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_ASSET_ID is supplied. + lv_queryparam = escape( val = i_ASSET_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `asset_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROMPT_TEMPLATE_ID is supplied. + lv_queryparam = escape( val = i_PROMPT_TEMPLATE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `prompt_template_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_NAME is supplied. + lv_queryparam = escape( val = i_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TYPE is supplied. + lv_queryparam = escape( val = i_TYPE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `type` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATE is supplied. + lv_queryparam = escape( val = i_STATE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `state` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONFLICT is supplied. + lv_queryparam = i_CONFLICT. + add_query_parameter( + exporting + i_parameter = `conflict` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->DEPLOYMENTS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->DEPLOYMENTS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json-patch+json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->DEPLOYMENTS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->DEPLOYMENTS_TEXT_GENERATION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_ID_OR_NAME TYPE STRING +* | [--->] I_DEPLOYMENTTEXTGENREQUEST TYPE T_DEPLOYMENT_TEXT_GEN_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TEXT_GEN_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_TEXT_GENERATION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/deployments/{id_or_name}/text/generation'. + replace all occurrences of `{id_or_name}` in ls_request_prop-url-path with i_ID_OR_NAME ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_DEPLOYMENTTEXTGENREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_DEPLOYMENTTEXTGENREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_DEPLOYMENTTEXTGENREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'DeploymentTextGenRequest' i_value = i_DEPLOYMENTTEXTGENREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_DEPLOYMENTTEXTGENREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->DEPLOYMENTS_TEXT_GEN_STREAM +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_ID_OR_NAME TYPE STRING +* | [--->] I_DEPLOYMENTTEXTGENREQUEST TYPE T_DEPLOYMENT_TEXT_GEN_REQUEST +* | [--->] I_ACCEPT TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_Array +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_TEXT_GEN_STREAM. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/deployments/{id_or_name}/text/generation_stream'. + replace all occurrences of `{id_or_name}` in ls_request_prop-url-path with i_ID_OR_NAME ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + " process header parameters + data: + lv_headerparam type string ##NEEDED. + + if i_ACCEPT is supplied. + lv_headerparam = I_ACCEPT. + add_header_parameter( + exporting + i_parameter = 'Accept' + i_value = lv_headerparam + changing + c_headers = ls_request_prop-headers ) ##NO_TEXT. + endif. + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_DEPLOYMENTTEXTGENREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_DEPLOYMENTTEXTGENREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_DEPLOYMENTTEXTGENREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'DeploymentTextGenRequest' i_value = i_DEPLOYMENTTEXTGENREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_DEPLOYMENTTEXTGENREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->LIST_FOUNDATION_MODEL_SPECS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FOUNDATION_MODELS +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method LIST_FOUNDATION_MODEL_SPECS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/foundation_model_specs'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->LIST_FOUNDATION_MODEL_TASKS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FOUNDATION_MODEL_TASKS +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method LIST_FOUNDATION_MODEL_TASKS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/foundation_model_tasks'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TEXT_GENERATION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TEXTGENREQUEST TYPE T_TEXT_GEN_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TEXT_GEN_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TEXT_GENERATION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/text/generation'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TEXTGENREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TEXTGENREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TEXTGENREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TextGenRequest' i_value = i_TEXTGENREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TEXTGENREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TEXT_GENERATION_STREAM +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TEXTGENREQUEST TYPE T_TEXT_GEN_REQUEST +* | [--->] I_ACCEPT TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_Array +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TEXT_GENERATION_STREAM. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/text/generation_stream'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + " process header parameters + data: + lv_headerparam type string ##NEEDED. + + if i_ACCEPT is supplied. + lv_headerparam = I_ACCEPT. + add_header_parameter( + exporting + i_parameter = 'Accept' + i_value = lv_headerparam + changing + c_headers = ls_request_prop-headers ) ##NO_TEXT. + endif. + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TEXTGENREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TEXTGENREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TEXTGENREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TextGenRequest' i_value = i_TEXTGENREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TEXTGENREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TEXT_TOKENIZATION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TEXTTOKENIZEREQUEST TYPE T_TEXT_TOKENIZE_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TEXT_TOKENIZE_RESPONSE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TEXT_TOKENIZATION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v1/text/tokenization'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TEXTTOKENIZEREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TEXTTOKENIZEREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TEXTTOKENIZEREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TextTokenizeRequest' i_value = i_TEXTTOKENIZEREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TEXTTOKENIZEREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TRAININGS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAININGRESOURCEPROTOTYPE TYPE T_TRAINING_RESOURCE_PROTOTYPE +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TRAININGRESOURCEPROTOTYPE ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TRAININGRESOURCEPROTOTYPE to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TRAININGRESOURCEPROTOTYPE i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TrainingResourcePrototype' i_value = i_TRAININGRESOURCEPROTOTYPE ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TRAININGRESOURCEPROTOTYPE to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TRAININGS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TOTAL_COUNT TYPE BOOLEAN (optional) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_STATE TYPE STRING (optional) +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCE_COLLECTION +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TOTAL_COUNT is supplied. + lv_queryparam = i_TOTAL_COUNT. + add_query_parameter( + exporting + i_parameter = `total_count` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATE is supplied. + lv_queryparam = escape( val = i_STATE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `state` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TRAININGS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings/{training_id}'. + replace all occurrences of `{training_id}` in ls_request_prop-url-path with i_TRAINING_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WATSONX_AI_ML_V1->TRAININGS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_HARD_DELETE TYPE BOOLEAN (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings/{training_id}'. + replace all occurrences of `{training_id}` in ls_request_prop-url-path with i_TRAINING_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_HARD_DELETE is supplied. + lv_queryparam = i_HARD_DELETE. + add_query_parameter( + exporting + i_parameter = `hard_delete` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + + +ENDCLASS. diff --git a/src/zcl_ibmx_watsonx_ai_ml_v1.clas.xml b/src/zcl_ibmx_watsonx_ai_ml_v1.clas.xml new file mode 100644 index 0000000..507f297 --- /dev/null +++ b/src/zcl_ibmx_watsonx_ai_ml_v1.clas.xml @@ -0,0 +1,114 @@ + + + + + + ZCL_IBMX_WATSONX_AI_ML_V1 + E + watsonx.ai + 1 + X + X + X + + + + ZCL_IBMX_WATSONX_AI_ML_V1 + CREATE_DEPLOYMENT + E + Create a new watsonx.ai deployment + + + ZCL_IBMX_WATSONX_AI_ML_V1 + DEPLOYMENTS_DELETE + E + Delete the deployment + + + ZCL_IBMX_WATSONX_AI_ML_V1 + DEPLOYMENTS_GET + E + Retrieve the deployment details + + + ZCL_IBMX_WATSONX_AI_ML_V1 + DEPLOYMENTS_TEXT_GENERATION + E + Infer text + + + ZCL_IBMX_WATSONX_AI_ML_V1 + DEPLOYMENTS_TEXT_GEN_STREAM + E + Infer text event stream + + + ZCL_IBMX_WATSONX_AI_ML_V1 + DEPLOYMENTS_UPDATE + E + Update the deployment metadata + + + ZCL_IBMX_WATSONX_AI_ML_V1 + LIST_DEPLOYMENTS + E + Retrieve the deployments + + + ZCL_IBMX_WATSONX_AI_ML_V1 + LIST_FOUNDATION_MODEL_SPECS + E + List the available foundation models + + + ZCL_IBMX_WATSONX_AI_ML_V1 + LIST_FOUNDATION_MODEL_TASKS + E + List the supported tasks + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TEXT_GENERATION + E + Infer text + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TEXT_GENERATION_STREAM + E + Infer text event stream + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TEXT_TOKENIZATION + E + Text tokenization + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TRAININGS_CREATE + E + Create a new watsonx.ai training + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TRAININGS_DELETE + E + Cancel the training + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TRAININGS_GET + E + Retrieve the training + + + ZCL_IBMX_WATSONX_AI_ML_V1 + TRAININGS_LIST + E + Retrieve the list of trainings + + + + + diff --git a/src/zcl_ibmx_wml_v4.clas.abap b/src/zcl_ibmx_wml_v4.clas.abap new file mode 100644 index 0000000..d3759ca --- /dev/null +++ b/src/zcl_ibmx_wml_v4.clas.abap @@ -0,0 +1,15717 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +"!

Watson Machine Learning

+"! No documentation available.
+class ZCL_IBMX_WML_V4 DEFINITION + public + inheriting from ZCL_IBMX_SERVICE_EXT + create public . + +public section. + types: + "!

+ "! The schema of the expected data, see


+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + begin of T_DATA_SCHEMA, + "! An id to identify a schema. + ID type STRING, + "! A name for the schema. + NAME type STRING, + "! The fields that describe the data schema. + FIELDS type STANDARD TABLE OF JSONOBJECT WITH NON-UNIQUE DEFAULT KEY, + "! The type of the schema, can be ignored or set to `struct` or `DataFrame`. + TYPE type STRING, + end of T_DATA_SCHEMA. + types: + "!

+ "! If the prediction schemas are provided here then they take

+ "! precedent over any schemas provided in the data references. Note that data + "! references contain the schema for the associated data and this object contains + "! the schema(s) for the associated prediction, if any. In the case that the + "! prediction input data matches exactly the schema of the training data + "! references then the prediction schema can be omitted. However it is highly + "! recommended to always specify the prediction schemas using this field. + begin of T_MODEL_ENTITY_SCHEMAS, + "! The schema of the expected prediction input data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + INPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + "! The schema of the expected prediction output data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + OUTPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + end of T_MODEL_ENTITY_SCHEMAS. + types: + "!

+ "! Hyperparameter optimization.

+ begin of T_TRAINING_STATUS_HPO, + "! No documentation available. + NODE_ID type STRING, + "! No documentation available. + HYPER_PARAMETERS type JSONOBJECT, + end of T_TRAINING_STATUS_HPO. + types: + "! No documentation available. + begin of T_ERROR_ITEM, + "! A simple code that should convey the general sense of the error. + CODE type STRING, + "! The message that describes the error. + MESSAGE type STRING, + "! A reference to a more detailed explanation when available. + MORE_INFO type STRING, + end of T_ERROR_ITEM. + types: + "!

+ "! The data returned when an error is encountered.

+ begin of T_ERROR, + "! An identifier that can be used to trace the request. + TRACE type STRING, + "! The list of errors. + ERRORS type STANDARD TABLE OF T_ERROR_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_ERROR. + types: + "!

+ "! The location of the intermediate model.

+ begin of T_MODEL_LOCATION, + "! The generated pipeline at this stage. + PIPELINE type STRING, + "! The generated pipeline model. + PIPELINE_MODEL type STRING, + "! The generated model at this stage. + MODEL type STRING, + end of T_MODEL_LOCATION. + types: + "!

+ "! The details of the intermediate model.

+ begin of T_INTERMEDIATE_MODEL, + "! The name of the pipeline. + NAME type STRING, + "! The process that generated this pipeline. + PROCESS type STRING, + "! The location of the intermediate model. + LOCATION type T_MODEL_LOCATION, + "! No documentation available. + NOTEBOOK_LOCATION type STRING, + "! No documentation available. + SDK_NOTEBOOK_LOCATION type STRING, + "! The nodes of this pipeline. + PIPELINE_NODES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The steps that lead to the creation of this pipeline. + COMPOSITION_STEPS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! No documentation available. + DURATION type INTEGER, + "! No documentation available. + MODEL_ASSET type STRING, + end of T_INTERMEDIATE_MODEL. + types: + "! No documentation available. + begin of T_FEATURE_IMPORTANCE, + "! By default the `computation_type` will not be set except for incremental + "! learning, in this case the value will be one of `all`, `LR`, `Ridge`, `Lasso`,` + "! Stability`, `RFE`, `RF`, `Corr`, `MIC`. + COMPUTATION_TYPE type STRING, + "! The feature names where the calculated score describes the importance of each + "! feature in the decision-making process. + FEATURES type MAP, + "! Indicates if the importance coefficients, in the `features` field, should have + "! min-max rescaling (0-1) applied. When set to `false`, min-max rescaling (0-1) + "! will not be applied to the coefficients, when set to `true` the coefficients in + "! the `features` field will sum up to 1. + MIN_MAX_NORMALIZATION type BOOLEAN, + end of T_FEATURE_IMPORTANCE. + types: + "!

+ "! The confusion matrix for the selected class.

+ begin of T_CONFUSION_MATRIX, + "! No documentation available. + TRUE_CLASS type STRING, + "! No documentation available. + TP type INTEGER, + "! No documentation available. + TN type INTEGER, + "! No documentation available. + FP type INTEGER, + "! No documentation available. + FN type INTEGER, + end of T_CONFUSION_MATRIX. + types: + "!

+ "! The roc (receiver operating characteristic) curve for the

+ "! selected class. + begin of T_ROC_CURVE, + "! No documentation available. + TRUE_CLASS type STRING, + "! The true positive rates. + TPR type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + "! The false positive rates. + FPR type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + "! The thresholds. + THRESHOLDS type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_ROC_CURVE. + types: + "! No documentation available. + begin of T_MULTI_CLASS_CLASSIFICATION, + "! The class name. + CLASS type STRING, + "! The location of the confusion_matrix details in associated storage. + CONFUSION_MATRIX_LOCATION type STRING, + "! The confusion matrix for the selected class. + CONFUSION_MATRIX type T_CONFUSION_MATRIX, + "! The location of the roc (receiver operating characteristic) curve details in the + "! associated storage. + ROC_CURVE_LOCATION type STRING, + "! The roc (receiver operating characteristic) curve for the selected class. + ROC_CURVE type T_ROC_CURVE, + end of T_MULTI_CLASS_CLASSIFICATION. + types: + "!

+ "! Details about the step.

+ begin of T_STEP_INFO, + "! No documentation available. + ID type STRING, + "! No documentation available. + NAME type STRING, + "! No documentation available. + STARTED_AT type DATETIME, + "! No documentation available. + COMPLETED_AT type DATETIME, + "! No documentation available. + HYPER_PARAMETERS type JSONOBJECT, + "! No documentation available. + DATA_ALLOCATION type INTEGER, + "! No documentation available. + ESTIMATOR type STRING, + "! No documentation available. + TRANSFORMER type STRING, + "! No documentation available. + SCORE type NUMBER, + end of T_STEP_INFO. + types: + "!

+ "! The process of training the model in batches.

+ begin of T_INCREMENTAL_TRAINING, + "! The current iteration (batch of data). + ITERATION type INTEGER, + "! Total number of iterations (data batches). + TOTAL_ITERATIONS type INTEGER, + "! Location of csv file with incremental learning metrics. + MEASURES_LOCATION type STRING, + "! The cumulative size of data used in incremental training. + TRAIN_BATCH_SAMPLES_COUNT type INTEGER, + "! The size of the holdout data set used to evaluate training progress. + HOLDOUT_SAMPLES_COUNT type INTEGER, + "! Indicates if the training has been stopped earlier. + EARLY_STOP_TRIGGERED type BOOLEAN, + end of T_INCREMENTAL_TRAINING. + types: + "! No documentation available. + begin of T_MULTI_CLASS_CLASSIFICATIONS, + "! The classifications details for each class. + ONE_VS_ALL type STANDARD TABLE OF T_MULTI_CLASS_CLASSIFICATION WITH NON-UNIQUE DEFAULT KEY, + "! The location of the classifications details in associated storage. + ONE_VS_ALL_LOCATION type STRING, + end of T_MULTI_CLASS_CLASSIFICATIONS. + types: + "! No documentation available. + begin of T_BINARY_CLASSIFICATION, + "! No documentation available. + CONFUSION_MATRICES type STANDARD TABLE OF T_CONFUSION_MATRIX WITH NON-UNIQUE DEFAULT KEY, + "! No documentation available. + ROC_CURVES type STANDARD TABLE OF T_ROC_CURVE WITH NON-UNIQUE DEFAULT KEY, + end of T_BINARY_CLASSIFICATION. + types: + "!

+ "! Provides extra information for this training stage in the

+ "! context of auto-ml. + begin of T_METRICS_CONTEXT, + "! The deployment that created the metrics. + DEPLOYMENT_ID type STRING, + "! The details of the intermediate model. + INTERMEDIATE_MODEL type T_INTERMEDIATE_MODEL, + "! No documentation available. + PHASE type STRING, + "! Details about the step. + STEP type T_STEP_INFO, + "! The prediction target labels. Can be either an array of `number` such as `[0,1]` + "! or array of `string` such + "! as`['positive','negative','neutral']`. + CLASSES type STANDARD TABLE OF JSONOBJECT WITH NON-UNIQUE DEFAULT KEY, + "! No documentation available. + BINARY_CLASSIFICATION type T_BINARY_CLASSIFICATION, + "! No documentation available. + MULTI_CLASS_CLASSIFICATION type T_MULTI_CLASS_CLASSIFICATIONS, + "! No documentation available. + FEATURES_IMPORTANCE type STANDARD TABLE OF T_FEATURE_IMPORTANCE WITH NON-UNIQUE DEFAULT KEY, + "! No documentation available. + SCHEMA type STRING, + "! No documentation available. + ESTIMATORS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The process of training the model in batches. + INCREMENTAL_TRAINING type T_INCREMENTAL_TRAINING, + "! The type of machine learning problem:
+ "! * `binary` - Binary Classification
+ "! * `multiclass` - Multiclass Classification
+ "! * `regression` - Regression
+ "! * `forecasting` - Forecasting
+ "! * `timeseries_anomaly_prediction` - Time Series Anomaly Prediction. + PREDICTION_TYPE type STRING, + end of T_METRICS_CONTEXT. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_INF_AGGRGTR_CNN1, + "! No documentation available. + HOST type STRING, + "! No documentation available. + PORT type NUMBER, + "! No documentation available. + ENDPOINT type STRING, + "! No documentation available. + PROTOCOL type STRING, + "! The headers object contains key-value pairs of headers to be supplied when + "! connecting to the aggregator. + HEADERS type JSONOBJECT, + end of T_FDRTD_LRNNG_INF_AGGRGTR_CNN1. + types: + "!

+ "! The metrics from the time series. For more information,

+ "! please see the [Time Series + "! Implementation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-dat + "! a/autoai-timeseries-details.html?audience=wdp#ts-metrics) documentation. + T_METRIC_TS_METRICS type JSONOBJECT. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_INF_RMT_TRAIN_S3, + "! No documentation available. + TIMESTAMP type DATETIME, + "! No documentation available. + EVENT type STRING, + end of T_FDRTD_LRNNG_INF_RMT_TRAIN_S3. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_INF_RMT_TRAIN_S2, + "! No documentation available. + ID type STRING, + "! No documentation available. + NAME type STRING, + "! No documentation available. + STATE type STRING, + "! No documentation available. + REGISTRATION_LOG type STANDARD TABLE OF T_FDRTD_LRNNG_INF_RMT_TRAIN_S3 WITH NON-UNIQUE DEFAULT KEY, + end of T_FDRTD_LRNNG_INF_RMT_TRAIN_S2. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_INF_RMT_TRAIN_S1, + "! No documentation available. + STATES type T_FDRTD_LRNNG_INF_RMT_TRAIN_S2, + end of T_FDRTD_LRNNG_INF_RMT_TRAIN_S1. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_INFO_AGGREGATOR, + "! No documentation available. + CONNECTION type T_FDRTD_LRNNG_INF_AGGRGTR_CNN1, + end of T_FDRTD_LRNNG_INFO_AGGREGATOR. + types: + "!

+ "! Federated learning info.

+ begin of T_FEDERATED_LEARNING_INFO, + "! No documentation available. + AGGREGATOR type T_FDRTD_LRNNG_INFO_AGGREGATOR, + "! Remote training systems. + REMOTE_TRAINING_SYSTEMS type STANDARD TABLE OF T_FDRTD_LRNNG_INF_RMT_TRAIN_S1 WITH NON-UNIQUE DEFAULT KEY, + end of T_FEDERATED_LEARNING_INFO. + types: + "! No documentation available. + begin of T_GPU_METRICS_MEMORY, + "! No documentation available. + MEASURE type STRING, + "! No documentation available. + VALUE type DOUBLE, + end of T_GPU_METRICS_MEMORY. + types: + "!

+ "! GPU metrics.

+ begin of T_GPU_METRICS, + "! No documentation available. + TYPE type STRING, + "! No documentation available. + MEMORY type T_GPU_METRICS_MEMORY, + end of T_GPU_METRICS. + types: + "!

+ "! Compute usage metrics.

+ begin of T_COMPUTE_USAGE_METRICS, + "! No documentation available. + TIMESTAMP type DATETIME, + "! No documentation available. + GPU_COUNT type NUMBER, + "! No documentation available. + GPUS type STANDARD TABLE OF T_GPU_METRICS WITH NON-UNIQUE DEFAULT KEY, + end of T_COMPUTE_USAGE_METRICS. + types: + "!

+ "! The metrics from the time series anomaly detection. For more

+ "! information, please see the [Creating a Time Series Anomaly + "! Prediction](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/au + "! toai-ts-ad.html?audience=wdp) documentation. + T_METRIC_TSAD_METRICS type JSONOBJECT. + types: + "!

+ "! A metric.

+ begin of T_METRIC, + "! A timestamp for the metrics. + TIMESTAMP type DATETIME, + "! The iteration number. + ITERATION type INTEGER, + "! The metrics. + ML_METRICS type MAP, + "! The metrics from the time series. For more information, please see the [Time + "! Series + "! Implementation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-dat + "! a/autoai-timeseries-details.html?audience=wdp#ts-metrics) documentation. + TS_METRICS type T_METRIC_TS_METRICS, + "! The metrics from the time series anomaly detection. For more information, please + "! see the [Creating a Time Series Anomaly + "! Prediction](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/au + "! toai-ts-ad.html?audience=wdp) documentation. + TSAD_METRICS type T_METRIC_TSAD_METRICS, + "! The metrics from federated training. + ML_FEDERATED_METRICS type MAP, + "! Provides extra information for this training stage in the context of auto-ml. + CONTEXT type T_METRICS_CONTEXT, + end of T_METRIC. + types: + "!

+ "! Message.

+ begin of T_TRAINING_STATUS_MESSAGE, + "! No documentation available. + LEVEL type STRING, + "! No documentation available. + TEXT type STRING, + end of T_TRAINING_STATUS_MESSAGE. + types: + "!

+ "! Status of the model.

+ begin of T_TRAINING_STATUS, + "! Date and Time in which current training state has started. + RUNNING_AT type DATETIME, + "! Date and Time in which training had completed. + COMPLETED_AT type DATETIME, + "! Current training iteration. + ITERATION type NUMBER, + "! Total number of iterations training must complete. + TOTAL_ITERATIONS type NUMBER, + "! Current state of training. + STATE type STRING, + "! Compute usage metrics. + COMPUTE_USAGE_METRICS type T_COMPUTE_USAGE_METRICS, + "! Hyperparameter optimization. + HPO type T_TRAINING_STATUS_HPO, + "! Federated learning info. + FEDERATED_LEARNING_INFO type T_FEDERATED_LEARNING_INFO, + "! Message. + MESSAGE type T_TRAINING_STATUS_MESSAGE, + "! Metrics that can be returned by an operation. + METRICS type STANDARD TABLE OF T_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! The data returned when an error is encountered. + FAILURE type T_ERROR, + end of T_TRAINING_STATUS. + types: + "! No documentation available. + begin of T_CONSUMPTION_GPU_COUNT, + "! The current number of reserved GPUs. + CURRENT type INTEGER, + "! The maximal number of reserved GPUs. + LIMIT type INTEGER, + end of T_CONSUMPTION_GPU_COUNT. + types: + "! No documentation available. + T_SYNC_SCRNG_DATA_ITEM_VALUES type TT_JSONOBJECT. + types: + "!

+ "! The space that contains the resource. Either `space_id` or

+ "! `project_id` has to be given. + T_SPACE_ID type String. + types: + "!

+ "! The project that contains the resource. Either `space_id` or

+ "! `project_id` has to be given. + T_PROJECT_ID type String. + types: + "!

+ "! The token count for the account.

+ begin of T_TOKEN_COUNT, + "! The number of tokens used for text generation. It is the sum of the input tokens + "! and generated tokens. + CURRENT type INTEGER, + "! The maximal number of tokens that can be used, when applicable. + LIMIT type INTEGER, + end of T_TOKEN_COUNT. + types: + "!

+ "! Information related to the revision.

+ begin of T_RESOURCE_COMMIT_INFO, + "! The time when the revision was committed. + COMMITTED_AT type DATETIME, + "! The message that was provided when the revision was created. + COMMIT_MESSAGE type STRING, + end of T_RESOURCE_COMMIT_INFO. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_MODEL_DEF_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_MODEL_DEF_RESOURCE_METADATA. + types: + "!

+ "! Common metadata for a simple resource.

+ begin of T_RESOURCE_META_SIMPLE, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + end of T_RESOURCE_META_SIMPLE. + types: + "!

+ "! Variance anomaly refers to a segment of time series in which

+ "! the variance of a time series is changed. + begin of T_VARIANCE, + "! The mean value. + MEAN type NUMBER, + "! The range of values. + RANGE type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_VARIANCE. + types: + "!

+ "! Measures the accuracy of a prediction based on percent of

+ "! positive predictions that are correct. + begin of T_TSAD_HOLDOUT_AGG_PRECISION, + "! No documentation available. + LEVEL_SHIFT type JSONOBJECT, + "! No documentation available. + LOCALIZED_EXTREME type JSONOBJECT, + "! No documentation available. + TREND type JSONOBJECT, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type T_VARIANCE, + end of T_TSAD_HOLDOUT_AGG_PRECISION. + types: + "!

+ "! Level shift anomaly refers to a segment in which the mean

+ "! value of a time series is changed. Includes scores for all pipelines. + begin of T_TSD_HLDT_SPPRTNG_RNK_AVG_PR2, + "! The score of the Level Shift anomaly with average_precision for Pipeline 1. + P1 type NUMBER, + "! The score of the Level Shift anomaly with average_precision for Pipeline 2. + P2 type NUMBER, + "! The score of the Level Shift anomaly with average_precision for Pipeline 3. + P3 type NUMBER, + "! The score of the Level Shift anomaly with average_precision for Pipeline 4. + P4 type NUMBER, + "! The score of the Level Shift anomaly with average_precision for Pipeline 5. + P5 type NUMBER, + "! The score of the Level Shift anomaly with average_precision for Pipeline 6. + P6 type NUMBER, + end of T_TSD_HLDT_SPPRTNG_RNK_AVG_PR2. + types: + "!

+ "! (Recommended): Average of the accuracy of predictions based

+ "! on percent of positive predictions that are correct. + begin of T_TSD_HLDT_SPPRTNG_RNK_AVG_PR1, + "! Level shift anomaly refers to a segment in which the mean value of a time series + "! is changed. Includes scores for all pipelines. + LEVEL_SHIFT type T_TSD_HLDT_SPPRTNG_RNK_AVG_PR2, + "! Localized extreme anomaly refers to an unusual data point in a time series, + "! which deviates significantly from the data points around it. Includes scores + "! for all pipelines. + LOCALIZED_EXTREME type JSONOBJECT, + "! trend anomaly refers to a segment of time series, which has a trend change + "! compared to the time series before the segment. Includes scores for all + "! pipelines. + TREND type JSONOBJECT, + "! variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. Includes scores for all pipelines. + VARIANCE type JSONOBJECT, + end of T_TSD_HLDT_SPPRTNG_RNK_AVG_PR1. + types: + "!

+ "! (Recommended): Average of the accuracy of predictions based

+ "! on percent of positive predictions that are correct. + begin of T_TSD_HLDT_ITRTNS_ITM_AVG_PRC1, + "! Localized extreme anomaly refers to an unusual data point in a time series, + "! which deviates significantly from the data points around it. + LOCALIZED_EXTREME type NUMBER, + "! Level shift anomaly refers to a segment in which the mean value of a time series + "! is changed. + LEVEL_SHIFT type NUMBER, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type NUMBER, + "! Trend anomaly refers to a segment of time series, which has a trend change + "! compared to the time series before the segment. + TREND type NUMBER, + end of T_TSD_HLDT_ITRTNS_ITM_AVG_PRC1. + types: + "! No documentation available. + begin of T_TSAD_HOLDOUT_ITERATIONS_ITEM, + "! (Recommended): Average of the accuracy of predictions based on percent of + "! positive predictions that are correct. + AVERAGE_PRECISION type T_TSD_HLDT_ITRTNS_ITM_AVG_PRC1, + "! Measure of how well a parameter can distinguish between two groups. + ROC_AUC type JSONOBJECT, + "! Harmonic average of the precision and recall, with best value of 1 (perfect + "! precision and recall) and worst at 0. + F1 type JSONOBJECT, + "! Measures the accuracy of a prediction based on percent of positive predictions + "! that are correct. + PRECISION type JSONOBJECT, + "! Measures the percentage of identified positive predictions against possible + "! positives in data set. + RECALL type JSONOBJECT, + end of T_TSAD_HOLDOUT_ITERATIONS_ITEM. + types: + "!

+ "! Level shift anomaly refers to a segment in which the mean

+ "! value of a time series is changed. + begin of T_TSD_HLDT_AGG_AVG_PRCSN_LVL_1, + "! The mean value. + MEAN type NUMBER, + "! The range of values. + RANGE type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_TSD_HLDT_AGG_AVG_PRCSN_LVL_1. + types: + "!

+ "! Pipeline ranking based on the specified metric.

+ begin of T_TSAD_HOLDOUT_SUPPORTING_RANK, + "! (Recommended): Average of the accuracy of predictions based on percent of + "! positive predictions that are correct. + AVERAGE_PRECISION type T_TSD_HLDT_SPPRTNG_RNK_AVG_PR1, + "! Harmonic average of the precision and recall, with best value of 1 (perfect + "! precision and recall) and worst at 0. + F1 type JSONOBJECT, + "! Measure of how well a parameter can distinguish between two groups. + ROC_AUC type JSONOBJECT, + "! Measures the accuracy of a prediction based on percent of positive predictions + "! that are correct. + PRECISION type JSONOBJECT, + "! Measures the percentage of identified positive predictions against possible + "! positives in data set. + RECALL type JSONOBJECT, + end of T_TSAD_HOLDOUT_SUPPORTING_RANK. + types: + "!

+ "! Measure of how well a parameter can distinguish between two

+ "! groups. + begin of T_TSAD_HOLDOUT_AGG_ROC_AUC, + "! No documentation available. + LEVEL_SHIFT type JSONOBJECT, + "! No documentation available. + LOCALIZED_EXTREME type JSONOBJECT, + "! No documentation available. + TREND type JSONOBJECT, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type T_VARIANCE, + end of T_TSAD_HOLDOUT_AGG_ROC_AUC. + types: + "! No documentation available. + begin of T_TSD_HLDT_AGGRGTD_SCORE_ITEM, + "! Metric score for the Pipeline 1. + P1 type NUMBER, + "! Metric score for the Pipeline 2. + P2 type NUMBER, + "! Metric score for the Pipeline 3. + P3 type NUMBER, + "! Metric score for the Pipeline 4. + P4 type NUMBER, + "! Metric score for the Pipeline 5. + P5 type NUMBER, + "! Metric score for the Pipeline 6. + P6 type NUMBER, + end of T_TSD_HLDT_AGGRGTD_SCORE_ITEM. + types: + "!

+ "! trend anomaly refers to a segment of time series, which has

+ "! a trend change compared to the time series before the segment. + begin of T_TSD_HLDT_AGG_AVG_PRCSN_TREND, + "! The mean value. + MEAN type NUMBER, + "! The range of values. + RANGE type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_TSD_HLDT_AGG_AVG_PRCSN_TREND. + types: + "!

+ "! Harmonic average of the precision and recall, with best

+ "! value of 1 (perfect precision and recall) and worst at 0. + begin of T_TSAD_HOLDOUT_AGG_F1, + "! Level shift anomaly refers to a segment in which the mean value of a time series + "! is changed. + LEVEL_SHIFT type JSONOBJECT, + "! No documentation available. + LOCALIZED_EXTREME type JSONOBJECT, + "! No documentation available. + TREND type JSONOBJECT, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type T_VARIANCE, + end of T_TSAD_HOLDOUT_AGG_F1. + types: + "!

+ "! Localized extreme anomaly refers to an unusual data point in

+ "! a time series, which deviates significantly from the data points around it. + begin of T_TSD_HLDT_AGG_AVG_PRCSN_LCLZ1, + "! The mean value. + MEAN type NUMBER, + "! The range of values. + RANGE type STANDARD TABLE OF NUMBER WITH NON-UNIQUE DEFAULT KEY, + end of T_TSD_HLDT_AGG_AVG_PRCSN_LCLZ1. + types: + "!

+ "! Measures the percentage of identified positive predictions

+ "! against possible positives in data set. + begin of T_TSAD_HOLDOUT_AGG_RECALL, + "! No documentation available. + LEVEL_SHIFT type JSONOBJECT, + "! No documentation available. + LOCALIZED_EXTREME type JSONOBJECT, + "! No documentation available. + TREND type JSONOBJECT, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type T_VARIANCE, + end of T_TSAD_HOLDOUT_AGG_RECALL. + types: + "!

+ "! Average of the accuracy of predictions based on percent of

+ "! positive predictions that are correct. + begin of T_TSD_HLDT_AGG_AVG_PRECISION, + "! Level shift anomaly refers to a segment in which the mean value of a time series + "! is changed. + LEVEL_SHIFT type T_TSD_HLDT_AGG_AVG_PRCSN_LVL_1, + "! Localized extreme anomaly refers to an unusual data point in a time series, + "! which deviates significantly from the data points around it. + LOCALIZED_EXTREME type T_TSD_HLDT_AGG_AVG_PRCSN_LCLZ1, + "! trend anomaly refers to a segment of time series, which has a trend change + "! compared to the time series before the segment. + TREND type T_TSD_HLDT_AGG_AVG_PRCSN_TREND, + "! Variance anomaly refers to a segment of time series in which the variance of a + "! time series is changed. + VARIANCE type T_VARIANCE, + end of T_TSD_HLDT_AGG_AVG_PRECISION. + types: + "!

+ "! Aggregated scores of anomaly types per metric.

+ begin of T_TSAD_HOLDOUT_AGG, + "! Average of the accuracy of predictions based on percent of positive predictions + "! that are correct. + AVERAGE_PRECISION type T_TSD_HLDT_AGG_AVG_PRECISION, + "! Harmonic average of the precision and recall, with best value of 1 (perfect + "! precision and recall) and worst at 0. + F1 type T_TSAD_HOLDOUT_AGG_F1, + "! Measures the accuracy of a prediction based on percent of positive predictions + "! that are correct. + PRECISION type T_TSAD_HOLDOUT_AGG_PRECISION, + "! Measures the percentage of identified positive predictions against possible + "! positives in data set. + RECALL type T_TSAD_HOLDOUT_AGG_RECALL, + "! Measure of how well a parameter can distinguish between two groups. + ROC_AUC type T_TSAD_HOLDOUT_AGG_ROC_AUC, + end of T_TSAD_HOLDOUT_AGG. + types: + "!

+ "! Metrics generated in model evaluation phase.

+ begin of T_MTRC_TSD_MTRCS_TSAD_HOLDOUT, + "! Simulated anomaly values are injected into the holdout data in each iteration + "! for pipeline evaluation. + ITERATIONS type STANDARD TABLE OF T_TSAD_HOLDOUT_ITERATIONS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Aggregated scores of anomaly types per metric. + AGG type T_TSAD_HOLDOUT_AGG, + "! Pipeline ranking based on the specified metric. + SUPPORTING_RANK type T_TSAD_HOLDOUT_SUPPORTING_RANK, + "! This score is calculated based on an aggregation of the optimized metric (for + "! example, Average precision) values for the 4 anomaly types. The scores for each + "! pipeline are ranked, using the Borda count method, and then weighted for their + "! contribution to the aggregate score. Unlike a standard metric score, this value + "! is not between 0 and 1. A higher value indicates a stronger score. + AGGREGATED_SCORE type STANDARD TABLE OF T_TSD_HLDT_AGGRGTD_SCORE_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_MTRC_TSD_MTRCS_TSAD_HOLDOUT. + types: + "!

+ "! A reference to a resource.

+ begin of T_SIMPLE_REL, + "! The id of the referenced resource. + ID type STRING, + end of T_SIMPLE_REL. + types: + "!

+ "! Contains a set of fields specific to each connection. See

+ "! here for [details about specifying connections](#datareferences). + T_DATA_CONNECTION type JSONOBJECT. + types: + "!

+ "! A reference to data with an optional data schema. If

+ "! necessary, it is possible to provide a data connection that contains just the + "! data schema. + begin of T_DATA_CONNECTION_REFERENCE, + "! Optional item identification inside a collection. + ID type STRING, + "! The data source type like `connection_asset` or `data_asset`. If the data + "! connection contains just a schema then this field is not required. + TYPE type STRING, + "! Contains a set of fields specific to each connection.
+ "! See here for [details about specifying connections](#datareferences). + CONNECTION type T_DATA_CONNECTION, + "! Contains a set of fields that describe the location of the data with respect to + "! the `connection`. + LOCATION type MAP, + "! The schema of the expected data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json)
+ "! for the schema definition. + SCHEMA type T_DATA_SCHEMA, + end of T_DATA_CONNECTION_REFERENCE. + types: + "!

+ "! The payload for scoring.

+ begin of T_SCORING_PAYLOAD_OPTIM, + "! Discriminates the data for multi input data situation. For example in cases + "! where multiple tensors are expected. + ID type STRING, + "! The names of the fields. The order of fields values must be consistent with the + "! order of fields names. Mutually exclusive with `content` field. + FIELDS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Input data as a vector for a single record or a matrix representing a mini batch + "! of records. Mutually exclusive with `content` field. + VALUES type STANDARD TABLE OF T_Array WITH NON-UNIQUE DEFAULT KEY, + "! Input data as a base64 encoded string. Mutually exclusive with `fields` or + "! `values` field. + CONTENT type STRING, + end of T_SCORING_PAYLOAD_OPTIM. + types: + "!

+ "! An optional message related to the job status.

+ begin of T_JOB_STATUS_MESSAGE, + "! The level of the message, normally one of `debug`, `info` or `warning`. + LEVEL type STRING, + "! The message. + TEXT type STRING, + end of T_JOB_STATUS_MESSAGE. + types: + "!

+ "! The status of the job.

+ begin of T_JOB_STATUS, + "! The state of the job. + STATE type STRING, + "! The date when the job started to run. + RUNNING_AT type DATETIME, + "! The date that the job finished. + COMPLETED_AT type DATETIME, + "! An optional message related to the job status. + MESSAGE type T_JOB_STATUS_MESSAGE, + "! The data returned when an error is encountered. + FAILURE type T_ERROR, + end of T_JOB_STATUS. + types: + "!

+ "! A reference to data.

+ begin of T_OBJECT_LOCATION_OPTIM, + "! Item identification inside a collection. + ID type STRING, + "! The data source type like `connection_asset` or `data_asset`. + TYPE type STRING, + "! Contains a set of fields specific to each connection. See here for [details + "! about specifying connections](#datareferences). + CONNECTION type JSONOBJECT, + "! Contains a set of fields that describe the location of the data with respect to + "! the `connection`. + LOCATION type MAP, + end of T_OBJECT_LOCATION_OPTIM. + types: + "!

+ "! The solve state for a Decision Optimization job.

+ begin of T_SOLVE_STATE, + "! Details related to the job. + DETAILS type JSONOBJECT, + "! The solve status. + SOLVE_STATUS type STRING, + "! The interrupted status. + INTERRUPTION_STATUS type STRING, + "! The latest engine activity. + LATEST_ENGINE_ACTIVITY type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_SOLVE_STATE. + types: + "!

+ "! The solve state for a Decision Optimization job.

+ begin of T_JB_DCSN_OPTIMIZATION_RESULT, + "! To control solve behavior, you can specify solve parameters in your request as + "! key-value pairs. + SOLVE_PARAMETERS type JSONOBJECT, + "! A list of payloads. + INPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of input data references. + INPUT_DATA_REFERENCES type STANDARD TABLE OF T_OBJECT_LOCATION_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of output payloads. + OUTPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of output data references. + OUTPUT_DATA_REFERENCES type STANDARD TABLE OF T_OBJECT_LOCATION_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! The status of the job. + STATUS type T_JOB_STATUS, + "! The solve state for a Decision Optimization job. + SOLVE_STATE type T_SOLVE_STATE, + end of T_JB_DCSN_OPTIMIZATION_RESULT. + types: + "!

+ "! The payload for scoring.

+ begin of T_SCORING_PAYLOAD, + "! Discriminates the data for multi input data situation. For example in cases + "! where multiple tensors are expected. + ID type STRING, + "! If specified, the `values` represents the ground truth data (the label + "! information) for the input data provided. This information will be used for + "! computing machine learning metrics. + TYPE type STRING, + "! The names of the fields. The order of fields values must be consistent with the + "! order of fields names. + FIELDS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Input data as a vector for a single record or a matrix representing a mini batch + "! of records. + VALUES type STANDARD TABLE OF T_Array WITH NON-UNIQUE DEFAULT KEY, + "! Used when performing evaluation. This contains the ground truths for the input + "! data. + TARGETS type STANDARD TABLE OF T_Array WITH NON-UNIQUE DEFAULT KEY, + end of T_SCORING_PAYLOAD. + types: + "!

+ "! An evaluation specification used to support evaluations for

+ "! TensorFlow. + begin of T_EVALUATIONS_SPEC_ITEM, + "! An identifier of this metrics set. For a DL problem this can be the output + "! tensor id/name in order to identify on which output these metrics will be + "! computed. + ID type STRING, + "! The id of the `input_data.id` with the `type=target`. This points to the ground + "! truth information that will be used together with prediction information to + "! generate metrics. + INPUT_TARGET type STRING, + "! A list of the metric names. + METRICS_NAMES type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_EVALUATIONS_SPEC_ITEM. + types: + "!

+ "! The status of the job.

+ begin of T_JOB_SCORING_RESULT, + "! A list of payloads. + INPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD WITH NON-UNIQUE DEFAULT KEY, + "! A list of input data references. + INPUT_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! A reference to data with an optional data schema.
+ "! If necessary, it is possible to provide a data connection that contains
+ "! just the data schema. + OUTPUT_DATA_REFERENCE type T_DATA_CONNECTION_REFERENCE, + "! A list of evaluation specifications. + EVALUATIONS type STANDARD TABLE OF T_EVALUATIONS_SPEC_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! This property is used to specify environment variables and their values required + "! to be consumed by the batch deployment job. The environment variables and + "! values must be specified as key-value pairs.
+ "!
+ "! This property is currently supported only for Python Scripts in batch deployment + "! jobs. + ENVIRONMENT_VARIABLES type MAP, + "! The predictions. + PREDICTIONS type STANDARD TABLE OF T_SCORING_PAYLOAD WITH NON-UNIQUE DEFAULT KEY, + "! The status of the job. + STATUS type T_JOB_STATUS, + end of T_JOB_SCORING_RESULT. + types: + "!

+ "! A hardware specification.

+ begin of T_HARDWARE_SPEC, + "! The id of the hardware specification. One, and only one, of `id` or `name` must + "! be set. + ID type STRING, + "! The revision of the hardware specification if `id` is used. + REV type STRING, + "! The name of the hardware specification. One, and only one, of `id` or `name` + "! must be set. + NAME type STRING, + "! The number of nodes applied to a computation. + NUM_NODES type INTEGER, + end of T_HARDWARE_SPEC. + types: + "! No documentation available. + begin of T_HYBRD_PPLN_HRDWR_SPECS_ITEM, + "! The id of node runtime. + NODE_RUNTIME_ID type STRING, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + end of T_HYBRD_PPLN_HRDWR_SPECS_ITEM. + types: + "!

+ "! Information about the platform job assets related to this

+ "! execution. Depending on the `version` date passed, the `platform_jobs` section + "! in the response may or may not be populated. Use the GET call to retrieve the + "! deployment job, this GET call will eventually populate the `platform_jobs` + "! section. Refer to the `version date` description for more details. + begin of T_PLATFORM_JOB, + "! The id of the platform job. + JOB_ID type STRING, + "! The run id of the platform job. + RUN_ID type STRING, + end of T_PLATFORM_JOB. + types: + "!

+ "! Information about the platform job assets related to this

+ "! execution. + begin of T_JOB_STATUS_ENTITY, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + "! User defined properties. + CUSTOM type JSONOBJECT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! The status of the job. + SCORING type T_JOB_SCORING_RESULT, + "! The solve state for a Decision Optimization job. + DECISION_OPTIMIZATION type T_JB_DCSN_OPTIMIZATION_RESULT, + "! Information about the platform job assets related to this execution.
+ "! Depending on the `version` date passed, the `platform_jobs` section in the + "! response may or may not be populated.
+ "! Use the GET call to retrieve the deployment job, this GET call will eventually + "! populate the `platform_jobs` section.
+ "! Refer to the `version date` description for more details. + PLATFORM_JOB type T_PLATFORM_JOB, + end of T_JOB_STATUS_ENTITY. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_RESOURCE_META, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_RESOURCE_META. + types: + "!

+ "! The reference to the first item in the current page.

+ begin of T_PAGINATION_FIRST, + "! The uri of the first resource returned. + HREF type STRING, + end of T_PAGINATION_FIRST. + types: + "!

+ "! A reference to the first item of the next page, if any.

+ begin of T_PAGINATION_NEXT, + "! The uri of the next set of resources. + HREF type STRING, + end of T_PAGINATION_NEXT. + types: + "!

+ "! The information related to the job.

+ begin of T_JOBS_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! Information about the platform job assets related to this execution. + ENTITY type T_JOB_STATUS_ENTITY, + end of T_JOBS_RESOURCE. + types: + "!

+ "! The information related to the jobs.

+ begin of T_JOBS_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of jobs. + RESOURCES type STANDARD TABLE OF T_JOBS_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + end of T_JOBS_RESOURCES. + types: + "!

+ "! The details for the revision.

+ begin of T_RMT_TRAIN_SYS_REV_ENTITY_REQ, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_RMT_TRAIN_SYS_REV_ENTITY_REQ. + types: + "!

+ "! A software specification.

+ begin of T_SOFTWARE_SPEC_REL, + "! The id of the software specification. One, and only one, of `id` or `name` must + "! be set. + ID type STRING, + "! The revision of the software specification. + REV type STRING, + "! The name of the software specification. One, and only one, of `id` or `name` + "! must be set. + NAME type STRING, + end of T_SOFTWARE_SPEC_REL. + types: + "! No documentation available. + begin of T_MDL_DEF_ENTITY_REQ_PLATFORM, + "! The name of the platform. + NAME type STRING, + "! The supported versions. + VERSIONS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_MDL_DEF_ENTITY_REQ_PLATFORM. + types: + "!

+ "! The definition of a model. The `software_spec` is used only

+ "! for training. Either space_id or project_id has to be provided and is + "! mandatory. + begin of T_MODEL_DEF_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The package version. + VERSION type STRING, + "! No documentation available. + PLATFORM type T_MDL_DEF_ENTITY_REQ_PLATFORM, + "! The command used to run the model. + COMMAND type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_MODEL_DEF_ENTITY_REQUEST. + types: + "!

+ "! The optimizer for federated learning.

+ begin of T_FEDERATED_LEARNING_OPTIMIZER, + "! No documentation available. + NAME type STRING, + "! Optimizer specification. + SPEC type JSONOBJECT, + end of T_FEDERATED_LEARNING_OPTIMIZER. + types: + "!

+ "! Details about the batch deployment job.


+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually exclusive. + begin of T_JOB_ENTITY_RESULT, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + "! User defined properties. + CUSTOM type JSONOBJECT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! The status of the job. + SCORING type T_JOB_SCORING_RESULT, + "! The solve state for a Decision Optimization job. + DECISION_OPTIMIZATION type T_JB_DCSN_OPTIMIZATION_RESULT, + end of T_JOB_ENTITY_RESULT. + types: + "!

+ "! A warning message.

+ begin of T_WARNING, + "! The message. + MESSAGE type STRING, + "! An `id` associated with the message. + ID type STRING, + "! Additional key-value pairs that depend on the specific warning. + ADDITIONAL_PROPERTIES type JSONOBJECT, + end of T_WARNING. + types: + "!

+ "! Optional details coming from the service and related to the

+ "! API call or the associated resource. + begin of T_SYSTEM_DETAILS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING WITH NON-UNIQUE DEFAULT KEY, + end of T_SYSTEM_DETAILS. + types: + "! No documentation available. + begin of T_MODEL_DEF_ENTITY_PLATFORM, + "! The name of the platform. + NAME type STRING, + "! The supported versions. + VERSIONS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_MODEL_DEF_ENTITY_PLATFORM. + types: + "!

+ "! The definition of a model. The `software_spec` is used only

+ "! for training. Either space_id or project_id has to be provided and is + "! mandatory. + begin of T_MODEL_DEF_RESOURCE_ENTITY, + "! The package version. + VERSION type STRING, + "! No documentation available. + PLATFORM type T_MODEL_DEF_ENTITY_PLATFORM, + "! The command used to run the model. + COMMAND type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_MODEL_DEF_RESOURCE_ENTITY. + types: + "!

+ "! The information for a model definition.

+ begin of T_MODEL_DEFINITION_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_MODEL_DEF_RESOURCE_METADATA, + "! The definition of a model.
+ "! The `software_spec` is used only for training.
+ "! Either space_id or project_id has to be provided and is mandatory. + ENTITY type T_MODEL_DEF_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_MODEL_DEFINITION_RESOURCE. + types: + "!

+ "! A paginated list of model definitions.

+ begin of T_MODEL_DEFINITION_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of model definitions. + RESOURCES type STANDARD TABLE OF T_MODEL_DEFINITION_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_MODEL_DEFINITION_RESOURCES. + types: + "!

+ "! Details about the input/output data and other properties to

+ "! be used for a batch deployment job of a model, Python Function or a Python + "! Scripts.
+ "!
+ "! Use `input_data` property to specify the input data for batch processing as part + "! of the job's payload. The `input_data` property is mutually exclusive with + "! `input_data_references` property, only use one of these. When `input_data` is + "! specified, the processed output of batch deployment job will be available in + "! `scoring.predictions` parameter in the deployment job response. `input_data` + "! property is not supported for batch deployment of Python Scripts.
+ "!
+ "! Use `input_data_references` property to specify the details pertaining to the + "! remote source where the input data for batch deployment job is available. The + "! `input_data_references` must be used with `output_data_references`. The + "! `input_data_references` property is mutually exclusive with `input_data` + "! property, only use one of these. The `input_data_references` property is not + "! supported for batch deployment job of Spark models and Python Functions.
+ "!
+ "! Use `output_data_references` property to specify the details pertaining to the + "! remote source where the input data for batch deployment job is available. + "! `output_data_references` must be used with `input_data_references`. The + "! `output_data_references` property is not supported for batch deployment job of + "! Spark models and Python Functions. + begin of T_JOB_SCORING_REQUEST, + "! A list of payloads. + INPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD WITH NON-UNIQUE DEFAULT KEY, + "! A list of input data references. + INPUT_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! A reference to data with an optional data schema.
+ "! If necessary, it is possible to provide a data connection that contains
+ "! just the data schema. + OUTPUT_DATA_REFERENCE type T_DATA_CONNECTION_REFERENCE, + "! A list of evaluation specifications. + EVALUATIONS type STANDARD TABLE OF T_EVALUATIONS_SPEC_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! This property is used to specify environment variables and their values required + "! to be consumed by the batch deployment job. The environment variables and + "! values must be specified as key-value pairs.
+ "!
+ "! This property is currently supported only for Python Scripts in batch deployment + "! jobs. + ENVIRONMENT_VARIABLES type MAP, + end of T_JOB_SCORING_REQUEST. + types: + "!

+ "! A remote organization.

+ begin of T_ORGANIZATION, + "! The name of the organization. + NAME type STRING, + "! The region for the organization. + REGION type STRING, + end of T_ORGANIZATION. + types: + "!

+ "! The allowed identity.

+ begin of T_ALLOWED_IDENTITY, + "! The id of the identity. + ID type STRING, + "! The type of the identity. + TYPE type STRING, + "! A list of IP(s) and or CIDR(s) that are permitted to connect to the Remote + "! Training System, both IPv4 and IPv6 are supported. + ALLOWED_IPS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_ALLOWED_IDENTITY. + types: + "!

+ "! The details of the remote administrator for the organization

+ "! and identities. + begin of T_REMOTE_ADMIN, + "! The name of the remote administrator. + NAME type STRING, + "! The email of the remote administrator. + EMAIL type STRING, + end of T_REMOTE_ADMIN. + types: + "!

+ "! The definition of a remote system used by Federated

+ "! Learning. + begin of T_RMT_TRAIN_SYS_RSRC_ENTITY, + "! The list of allowed identities that are allowed to access the remote system. + ALLOWED_IDENTITIES type STANDARD TABLE OF T_ALLOWED_IDENTITY WITH NON-UNIQUE DEFAULT KEY, + "! A remote organization. + ORGANIZATION type T_ORGANIZATION, + "! The details of the remote administrator for the organization and identities. + REMOTE_ADMIN type T_REMOTE_ADMIN, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_RMT_TRAIN_SYS_RSRC_ENTITY. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_RMT_TRAIN_SYS_RSRC_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_RMT_TRAIN_SYS_RSRC_METADATA. + types: + "!

+ "! The information for a remote training system.

+ begin of T_REMOTE_TRAIN_SYSTEM_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RMT_TRAIN_SYS_RSRC_METADATA, + "! The definition of a remote system used by Federated Learning. + ENTITY type T_RMT_TRAIN_SYS_RSRC_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_REMOTE_TRAIN_SYSTEM_RESOURCE. + types: + "!

+ "! The model definition.

+ begin of T_MODEL_DEFINITION_ID, + "! The id of the model definition. + ID type STRING, + end of T_MODEL_DEFINITION_ID. + types: + "!

+ "! Optional messages related to the deployment.

+ begin of T_MESSAGE, + "! The level of the message, normally one of `debug`, `info` or `warning`. + LEVEL type STRING, + "! The message. + TEXT type STRING, + end of T_MESSAGE. + types: + "!

+ "! The input data.

+ begin of T_SYNC_SCORING_DATA_ITEM, + "! Discriminates the data for multi input data situation. For example in cases + "! where multiple tensors are expected. + ID type STRING, + "! The names of the fields. The order of fields values must be consistent with the + "! order of fields names. + FIELDS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Input data as a a vector for a single record or a matrix representing a mini + "! batch of records. + VALUES type STANDARD TABLE OF T_Array WITH NON-UNIQUE DEFAULT KEY, + end of T_SYNC_SCORING_DATA_ITEM. + types: + "!

+ "! Scoring data.

+ begin of T_SYNC_SCORING_DATA, + "! The input data. + INPUT_DATA type STANDARD TABLE OF T_SYNC_SCORING_DATA_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_SYNC_SCORING_DATA. + types: + "!

+ "! A reference to a model that is used by this function. Note

+ "! that the reference can be to a model that is in a different space or project + "! from this function. For this reason either a `space_id` or a `project_id` must + "! be provided or the `space_id` or a `project_id` of the function will be + "! assumed. + begin of T_MODEL_REFERENCE, + "! The space that contains the resource. + SPACE_ID type STRING, + "! The project that contains the resource. + PROJECT_ID type STRING, + "! The model id. + ID type STRING, + "! The optional revision of the model. + REV type STRING, + end of T_MODEL_REFERENCE. + types: + "!

+ "! The schemas of the expected data.

+ begin of T_FUNCTION_ENTITY_SCHEMAS, + "! The schema of the expected input data. + INPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + "! The schema of the expected output data. + OUTPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + end of T_FUNCTION_ENTITY_SCHEMAS. + types: + "!

+ "! The details of the function to be created.

+ begin of T_FUNCTION_ENTITY, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! Type of the function to be created. Only `python` type is supported as of now. + "! If not specified, `python` is the default. Functions expect a gzip file that + "! contains a python file that make up the function. Python functions specify what + "! needs to be run when the function is deployed and what needs to be run when the + "! scoring function is called. In other words, you are able to customize what + "! preparation WML does in the environment when you deploy the function, as well + "! as what steps WML takes to generate the output when you call the API later on. + "! The function consists of the outer function (any place that is not within the + "! score function) and the inner score function. The code that sits in the outer + "! function runs when the function is deployed, and the environment is then frozen + "! and ready to be used whenever the online scoring or batch inline job processing + "! API is called. The code that sits in the inner score function runs when the + "! online scoring or batch inline job processing API is called, in the environment + "! customized by the outer function. See [Deploying Python + "! function](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-d + "! eploy-py-function.html?context=cpdaas&audience=wdp) for more details.
+ "!
+ "! This is illustrated in the example below:
+ "!
+ "! ><python code used to set up the environment> \
+ "! >\
+ "! >def score(payload): \
+ "! >    df_payload = + "! pd.DataFrame(payload["values"]) \
+ "! >    df_payload.columns = payload["fields"] + "! \
+ "! >    ... \
+ "! >    output = {"result" : res} \
+ "! >    return output \
+ "! >\
+ "! >return score. + TYPE type STRING, + "! Scoring data. + SAMPLE_SCORING_INPUT type T_SYNC_SCORING_DATA, + "! The schemas of the expected data. + SCHEMAS type T_FUNCTION_ENTITY_SCHEMAS, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! This is a list of references of the models that are used by this function, if + "! any. These references are provided by the owner of the function and are used + "! for usage tracking only. + MODEL_REFERENCES type STANDARD TABLE OF T_MODEL_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + end of T_FUNCTION_ENTITY. + types: + "!

+ "! A reference to data.

+ begin of T_OBJECT_LOCATION, + "! Item identification inside a collection. + ID type STRING, + "! The data source type like `connection_asset` or `data_asset`. + TYPE type STRING, + "! Contains a set of fields specific to each connection.
+ "! See here for [details about specifying connections](#datareferences). + CONNECTION type T_DATA_CONNECTION, + "! Contains a set of fields that describe the location of the data with respect to + "! the `connection`. + LOCATION type MAP, + end of T_OBJECT_LOCATION. + types: + "!

+ "! A reference to a resource.

+ begin of T_REL, + "! The id of the referenced resource. + ID type STRING, + "! The revision of the referenced resource. + REV type STRING, + end of T_REL. + types: + "! No documentation available. + begin of T_FDRTD_LEARNING_MODEL_SPEC, + "! A reference to a resource. + HREF type T_REL, + end of T_FDRTD_LEARNING_MODEL_SPEC. + types: + "! No documentation available. + begin of T_FDRTD_LRNNG_RMT_TRAIN_RMT_T1, + "! The remote training id of the referenced resource. + ID type STRING, + "! The required of the referenced resource. + REQUIRED type BOOLEAN, + end of T_FDRTD_LRNNG_RMT_TRAIN_RMT_T1. + types: + "!

+ "! The remote training for federated learning.

+ begin of T_FDRTD_LEARNING_REMOTE_TRAIN, + "! The quorum for federated learning. + QUORUM type DOUBLE, + "! The maximum timeout for federated learning. + MAX_TIMEOUT type INTEGER, + "! No documentation available. + REMOTE_TRAINING_SYSTEMS type STANDARD TABLE OF T_FDRTD_LRNNG_RMT_TRAIN_RMT_T1 WITH NON-UNIQUE DEFAULT KEY, + end of T_FDRTD_LEARNING_REMOTE_TRAIN. + types: + "!

+ "! Settings for cryptographic fusion for federated learning.

+ begin of T_FEDERATED_LEARNING_CRYPTO, + "! The level of encryption used to encrypt training data. + CIPHER_SPEC type STRING, + end of T_FEDERATED_LEARNING_CRYPTO. + types: + "!

+ "! The model type for federated_learning.

+ begin of T_FEDERATED_LEARNING_MODEL, + "! No documentation available. + TYPE type STRING, + "! No documentation available. + SPEC type T_FDRTD_LEARNING_MODEL_SPEC, + "! No documentation available. + MODEL_FILE type STRING, + end of T_FEDERATED_LEARNING_MODEL. + types: + "!

+ "! Federated Learning.

+ begin of T_FEDERATED_LEARNING, + "! The model type for federated_learning. + MODEL type T_FEDERATED_LEARNING_MODEL, + "! The fusion type for federated learning. For an in-depth description of each + "! fusion type, please refer to + "! [here](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fl-fram + "! es.html).
+ "! * `iter_avg` - Simple Avg, simplest aggregation that is used as a baseline + "! where all parties' model updates are equally weighted.
+ "! * `avg` - Weighted Avg, weights the average of updates based on the number of + "! each party sample. Use with training data sets of widely differing sizes.
+ "! * `pfnm` - Probabilistic Federated Neural Matching (PFNM), + "! communication-efficient method for fully connected neural networks when parties + "! have heterogeneous data sets.
+ "! * `spahm` - K-Means/SPAHM, used to train KMeans (unsupervised learning) models + "! when parties have heterogeneous data sets.
+ "! * `xgb_classifier` - XGBoost Classification, used to build classification + "! models that use XGBoost.
+ "! * `xgb_regressor` - XGBoost Regression, used to build regression models that + "! use XGBoost.
+ "! * `crypto_iter_avg` - Iterative averaging based fusion implemented with a + "! crypto system. + FUSION_TYPE type STRING, + "! The remote training for federated learning. + REMOTE_TRAINING type T_FDRTD_LEARNING_REMOTE_TRAIN, + "! The number of training iterations to complete between the aggregator and the + "! remote systems unless termination accuracy is achieved first. + ROUNDS type INTEGER, + "! A boolean expression that describes the conditions, in terms of model metrics, + "! under which training should complete. + TERMINATION_PREDICATE type STRING, + "! The total number of passes over the local training dataset to train a model. + EPOCHS type INTEGER, + "! The optimizer for federated learning. + OPTIMIZER type T_FEDERATED_LEARNING_OPTIMIZER, + "! The loss function to use in the boosting process. + LOSS type STRING, + "! The metrics for federated learning. + METRICS type STRING, + "! The maximum depth of each tree. + MAX_DEPTH type INTEGER, + "! Controls how rapidly to change the model in response to the estimated error each + "! time the model weights are updated. + LEARNING_RATE type DOUBLE, + "! The coefficient for the L2 regularizer. + L2_REGULARIZATION type DOUBLE, + "! The maximum number of bins to use for non-missing values across all features. + MAX_BINS type INTEGER, + "! The maximum number of leaves for each tree. + MAX_LEAF_NODES type INTEGER, + "! The minimum number of samples per leaf. + MIN_SAMPLES_LEAF type INTEGER, + "! Seed used to set the pseudo-random number generator. + RANDOM_STATE type INTEGER, + "! A general programming term to produce logging output. + VERBOSE type BOOLEAN, + "! Number of target classes for the classification model. + NUM_CLASSES type INTEGER, + "! Specifies the failure tolerance, for example the maximum number of parties that + "! would possibly be failing during training. + BYZANTINE_THRESHOLD type INTEGER, + "! Specifies how far the local model neurons are allowed from the global model. + SIGMA type DOUBLE, + "! Specifies the standard deviation of the global network neurons. + SIGMA0 type DOUBLE, + "! Specifies the expected number of features present in each observation. + GAMMA type DOUBLE, + "! Specifies the number of iterations of randomly initialized matching-unmatching + "! procedure is to be performed. + ITERS type INTEGER, + "! If true, save the model generated at the end of each round of training. + SAVE_INTERMEDIATE_MODELS type BOOLEAN, + "! Settings for cryptographic fusion for federated learning. + CRYPTO type T_FEDERATED_LEARNING_CRYPTO, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! The version for federated learning. + VERSION type STRING, + "! The log level (`critical`, `error`, `warning`, `info`, `debug`) for federated + "! learning. + LOG_LEVEL type STRING, + "! Used with XGBoost training to control the relative accuracy of sketched data + "! sent to the aggregator. Higher values will result in higher quality models but + "! with a reduction in data privacy and increase in resource consumption. + SKETCH_ACCURACY_VS_PRIVACY type NUMBER, + end of T_FEDERATED_LEARNING. + types: + "!

+ "! The stats about deployments for a space.

+ begin of T_STATS, + "! An `id` associated with the space. + SPACE_ID type STRING, + "! The total number of deployments created in a space including `online` and + "! `batch`. + TOTAL_COUNT type NUMBER, + "! The number of online deployments created in a space. + ONLINE_COUNT type NUMBER, + "! The number of batch deployments created in a space. + BATCH_COUNT type NUMBER, + end of T_STATS. + types: + "!

+ "! Optional details provided by the service about statistics of

+ "! the number of deployments created. The deployments that are counted will depend + "! on the request parameters. + begin of T_DEPLOYMENT_SYSTEM_DETAILS, + "! Any warnings coming from the system. + WARNINGS type STANDARD TABLE OF T_WARNING WITH NON-UNIQUE DEFAULT KEY, + "! The stats about deployments. + STATS type STANDARD TABLE OF T_STATS WITH NON-UNIQUE DEFAULT KEY, + end of T_DEPLOYMENT_SYSTEM_DETAILS. + types: + "!

+ "! System details including warnings and stats. This will get

+ "! populated only if 'stats' query parameter is passed with + "! 'true'. + begin of T_DEPLOYMENT_RESOURCES_SYSTEM, + "! Optional details provided by the service about statistics of the number of + "! deployments created. The deployments that are counted will depend on the + "! request parameters. + SYSTEM type T_DEPLOYMENT_SYSTEM_DETAILS, + end of T_DEPLOYMENT_RESOURCES_SYSTEM. + types: + "!

+ "! A set of key-value pairs where `key` is the parameter name.

+ begin of T_ONLINE_PARAMETERS, + "! The `serving_name` can be used in the prediction URL in place of the + "! `deployment_id`. The `serving_name`` can only have the characters [a-z,0-9,_] + "! and the length should not be more than 36 characters. + SERVING_NAME type STRING, + end of T_ONLINE_PARAMETERS. + types: + "!

+ "! Indicates that this is an online deployment. An empty object

+ "! has to be specified. If the online scoring schema has a `type` of `DataFrame` + "! then the scoring payload will be converted to a `Pandas` data frame. + begin of T_ONLINE_REQUEST, + "! A set of key-value pairs where `key` is the parameter name. + PARAMETERS type T_ONLINE_PARAMETERS, + end of T_ONLINE_REQUEST. + types: + "! No documentation available. + begin of T_PPLN_REL_DATA_BINDINGS_ITEM, + "! The input_data_reference name that is the input for the node identified by + "! node_id. + DATA_REFERENCE_NAME type STRING, + "! The id of the pipeline node that will receive the associated + "! input_data_reference input. + NODE_ID type STRING, + end of T_PPLN_REL_DATA_BINDINGS_ITEM. + types: + "! No documentation available. + begin of T_PPLN_REL_NODES_PARAM_ITEM, + "! The id of the pipeline node that will receive the associated + "! input_data_reference input. + NODE_ID type STRING, + "! The parameters. + PARAMETERS type JSONOBJECT, + end of T_PPLN_REL_NODES_PARAM_ITEM. + types: + "!

+ "! A pipeline. The `hardware_spec` is a reference to the

+ "! hardware specification. The `hybrid_pipeline_hardware_specs` are used only when + "! training a hybrid pipeline in order to specify compute requirement for each + "! pipeline node. + begin of T_PIPELINE_REL, + "! The id of the referenced resource. + ID type STRING, + "! The revision of the referenced resource. + REV type STRING, + "! The underlying model type produced by the pipeline or by the model_definition. + MODEL_TYPE type STRING, + "! The data bindings. + DATA_BINDINGS type STANDARD TABLE OF T_PPLN_REL_DATA_BINDINGS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! The node parameters. + NODES_PARAMETERS type STANDARD TABLE OF T_PPLN_REL_NODES_PARAM_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_PIPELINE_REL. + types: + "!

+ "! A model. The `software_spec` is a reference to a software

+ "! specification. The `hardware_spec` is a reference to a hardware specification. + begin of T_MODEL_DEFINITION_REL, + "! The id of the referenced resource. + ID type STRING, + "! The revision of the referenced resource. + REV type STRING, + "! The underlying model type produced by the pipeline or by the model_definition. + MODEL_TYPE type STRING, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! If present, it overrides the command specified to the library resource itself. + COMMAND type STRING, + "! Optional key-value pairs parameters. + PARAMETERS type JSONOBJECT, + end of T_MODEL_DEFINITION_REL. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAIN_DEF_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_TRAIN_DEF_ENTITY_REQUEST. + types: + "!

+ "! To control solve behavior, you can specify solve parameters

+ "! in your request as key-value pairs. + T_SOLVE_PARAMETERS type JSONOBJECT. + types: + "!

+ "! The definition of a remote system used by Federated

+ "! Learning. + begin of T_REMOTE_TRAIN_SYS_ENTITY_REQ, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The list of allowed identities that are allowed to access the remote system. + ALLOWED_IDENTITIES type STANDARD TABLE OF T_ALLOWED_IDENTITY WITH NON-UNIQUE DEFAULT KEY, + "! A remote organization. + ORGANIZATION type T_ORGANIZATION, + "! The details of the remote administrator for the organization and identities. + REMOTE_ADMIN type T_REMOTE_ADMIN, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_REMOTE_TRAIN_SYS_ENTITY_REQ. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_TRAIN_DEF_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_TRAIN_DEF_RESOURCE_METADATA. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAIN_DEF_RESOURCE_ENTITY, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_TRAIN_DEF_RESOURCE_ENTITY. + types: + "!

+ "! The information for a training definition.

+ begin of T_TRAINING_DEFINITION_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_TRAIN_DEF_RESOURCE_METADATA, + "! The `training_data_references` contain the training datasets and the
+ "! `results_reference` the connection where results will be stored. + ENTITY type T_TRAIN_DEF_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_TRAINING_DEFINITION_RESOURCE. + types: + "!

+ "! A paginated list of training definitions.

+ begin of T_TRAIN_DEFINITION_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of training definitions. + RESOURCES type STANDARD TABLE OF T_TRAINING_DEFINITION_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_TRAIN_DEFINITION_RESOURCES. + types: + "!

+ "! Contains a set of fields that describe the location of the

+ "! data with respect to the `connection`. + T_DATA_LOCATION type MAP. + types: + "!

+ "! The solve state for a Decision Optimization job.

+ begin of T_FIELD_SOLVE_STATE, + "! The solve state for a Decision Optimization job. + SOLVE_STATE type T_SOLVE_STATE, + end of T_FIELD_SOLVE_STATE. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_MODEL_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_MODEL_RESOURCE_METADATA. + types: + "! No documentation available. + begin of T_CNSMPTN_CAPACITY_UNIT_HOURS, + "! The expiration date of the instance limit. + EXPIRATION_DATE type DATE, + "! The current total computation time (in capacity unit hours). It is a sum of + "! both, reserved and already send to BSS, units. + CURRENT type NUMBER, + "! The maximal computation time (in capacity unit hours). + LIMIT type DOUBLE, + end of T_CNSMPTN_CAPACITY_UNIT_HOURS. + types: + "!

+ "! Limit for deployment jobs.

+ begin of T_CNSMPTN_DEPLOYMENT_JOB_COUNT, + "! The maximal number of deployment jobs. + LIMIT type INTEGER, + end of T_CNSMPTN_DEPLOYMENT_JOB_COUNT. + types: + "! No documentation available. + begin of T_CONSUMPTION_DO_JOB_COUNT, + "! The maximal number of parallel DO jobs. + LIMIT type INTEGER, + end of T_CONSUMPTION_DO_JOB_COUNT. + types: + "!

+ "! Compute usage details in a given context and framework.

+ begin of T_CONSUMPTION_DETAILS, + "! Context in which compute resources are consumed. + CONTEXT type STRING, + "! Machine learning framework or tool. + FRAMEWORK type STRING, + "! The current total computation time (in capacity unit hours) in a given context + "! and framework. It is a sum of both, reserved and already send to BSS, units. + CAPACITY_UNIT_HOURS type NUMBER, + "! The current total number of tokens in a given context and framework. It is a sum + "! of both, reserved and already send to BSS, units. + TOKEN_COUNT type INTEGER, + "! Space ID on which the consumption is requested. At most, only one of `space_id` + "! or `project_id` will be provided. + SPACE_ID type STRING, + "! Project ID on which the consumption is requested. At most, only one of + "! `space_id` or `project_id` will be provided. + PROJECT_ID type STRING, + end of T_CONSUMPTION_DETAILS. + types: + "!

+ "! The consumption part is available only when `plan.version`

+ "! is `2`. All the values are calculated at the account level the instance belongs + "! to, not the instance itself. + begin of T_CONSUMPTION, + "! No documentation available. + CAPACITY_UNIT_HOURS type T_CNSMPTN_CAPACITY_UNIT_HOURS, + "! No documentation available. + GPU_COUNT type T_CONSUMPTION_GPU_COUNT, + "! No documentation available. + DO_JOB_COUNT type T_CONSUMPTION_DO_JOB_COUNT, + "! Limit for deployment jobs. + DEPLOYMENT_JOB_COUNT type T_CNSMPTN_DEPLOYMENT_JOB_COUNT, + "! Grouped compute usage details presented at the account level the instance + "! belongs to. + DETAILS type STANDARD TABLE OF T_CONSUMPTION_DETAILS WITH NON-UNIQUE DEFAULT KEY, + "! The token count for the account. + TOKEN_COUNT type T_TOKEN_COUNT, + end of T_CONSUMPTION. + types: + "!

+ "! The list of allowed identities that are allowed to access

+ "! the remote system. + T_ALLOWED_IDENTITIES type STANDARD TABLE OF T_ALLOWED_IDENTITY WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The feature names where the calculated score describes the

+ "! importance of each feature in the decision-making process. + T_FEATURE_COEFFICIENTS type MAP. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_PAGINATION, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + end of T_PAGINATION. + types: + "!

+ "! Details about the input/output data and other properties to

+ "! be used for a batch deployment job of a Decision Optimization problem. You can + "! find more information in [Deploying Decision + "! Optimization](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment + "! /ModelIODataDefn.html) documentation. Use the `solve_parameters` as named value + "! pairs to control the Decision Optimization solve behavior. Use the `input_data` + "! and `output_data` properties to specify respectively input and output data for + "! batch processing as part of the job's payload. Use the + "! `input_data_references` and `output_data_references` properties to specify + "! respectively input and output data for batch processing as remote data sources. + begin of T_JB_DECISION_OPTIMIZATION_REQ, + "! To control solve behavior, you can specify solve parameters in your request as + "! key-value pairs. + SOLVE_PARAMETERS type JSONOBJECT, + "! A list of payloads. + INPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of input data references. + INPUT_DATA_REFERENCES type STANDARD TABLE OF T_OBJECT_LOCATION_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of output payloads. + OUTPUT_DATA type STANDARD TABLE OF T_SCORING_PAYLOAD_OPTIM WITH NON-UNIQUE DEFAULT KEY, + "! A list of output data references. + OUTPUT_DATA_REFERENCES type STANDARD TABLE OF T_OBJECT_LOCATION_OPTIM WITH NON-UNIQUE DEFAULT KEY, + end of T_JB_DECISION_OPTIMIZATION_REQ. + types: + "!

+ "! Details about the batch deployment job.


+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually exclusive. + "! Specify only one of these when submitting a batch deployment job.
+ "!
+ "! Use `hybrid_pipeline_hardware_specs` only in a batch deployment job of a hybrid + "! pipeline in order to specify compute configuration for each pipeline node. For + "! all other cases use `hardware_spec` to specify compute configuration.
+ "!
+ "! In case of output data references where the data asset is a remote database, + "! users can specify if the batch deployment output must be appended to the table + "! or if the table is to be truncated and output data updated.
+ "! `output_data_references.location.write_mode` parameter can be used to for this + "! purpose. The values `truncate` or `append` can be specified for + "! `output_data_references.location.write_mode` parameter.
+ "! * Specifying `truncate` as value will truncate the table and the batch output + "! data will be inserted.
+ "! * Specifying `append` as value will insert the batch output data to the remote + "! database table.
+ "! * The `write_mode` parameter is applicable only for `output_data_references` + "! parameter.
+ "! * The `write_mode` parameter will be applicable only for remote database related + "! data assets. This parameter will not be applicable for local data asset or COS + "! based data asset. + begin of T_JOB_RESOURCE_ENTITY, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + "! User defined properties. + CUSTOM type JSONOBJECT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a model,
+ "! Python Function or a Python Scripts.
+ "!
+ "! Use `input_data` property to specify the input data for batch processing as part + "! of the job's payload.
+ "! The `input_data` property is mutually exclusive with `input_data_references` + "! property, only use one of these.
+ "! When `input_data` is specified, the processed output of batch deployment job + "! will be available in `scoring.predictions`
+ "! parameter in the deployment job response. `input_data` property is not supported + "! for batch deployment of Python Scripts.
+ "!
+ "! Use `input_data_references` property to specify the details pertaining to the + "! remote source where the input data for
+ "! batch deployment job is available. The `input_data_references` must be used with + "! `output_data_references`.
+ "! The `input_data_references` property
+ "! is mutually exclusive with `input_data` property, only use one of these. The + "! `input_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions.
+ "!
+ "! Use `output_data_references` property to specify the details pertaining to the + "! remote source where the input
+ "! data for batch deployment job is available. `output_data_references` must be + "! used with `input_data_references`.
+ "! The `output_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions. + SCORING type T_JOB_SCORING_REQUEST, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a Decision Optimization problem. You can find more + "! information in [Deploying Decision + "! Optimization](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment + "! /ModelIODataDefn.html) documentation.
+ "! Use the `solve_parameters` as named value pairs to control the Decision + "! Optimization solve behavior.
+ "! Use the `input_data` and `output_data` properties to specify respectively input + "! and output data for batch processing as part of the job's payload.
+ "! Use the `input_data_references` and `output_data_references` properties to + "! specify respectively input and output data for batch processing as remote data + "! sources. + DECISION_OPTIMIZATION type T_JB_DECISION_OPTIMIZATION_REQ, + end of T_JOB_RESOURCE_ENTITY. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_PIPELINE_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_PIPELINE_RESOURCE_METADATA. + types: + "!

+ "! The details of the pipeline to be created.

+ begin of T_PIPELINE_RESOURCE_ENTITY, + "! The pipeline document, see
+ "! [pipeline-flow-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipeline-sc + "! hemas/master/common-pipeline/pipeline-flow/pipeline-flow-v2-schema.json) for the + "! schema definition. + DOCUMENT type JSONOBJECT, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_PIPELINE_RESOURCE_ENTITY. + types: + "!

+ "! The information for a pipeline.

+ begin of T_PIPELINE_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_PIPELINE_RESOURCE_METADATA, + "! The details of the pipeline to be created. + ENTITY type T_PIPELINE_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_PIPELINE_RESOURCE. + types: + "!

+ "! A paginated list of pipelines.

+ begin of T_PIPELINE_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of pipelines. + RESOURCES type STANDARD TABLE OF T_PIPELINE_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_PIPELINE_RESOURCES. + types: + "!

+ "! The details for the revision.

+ begin of T_REV_ENTITY_SPACE_REQUEST, + "! The space that contains the resource. + SPACE_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_REV_ENTITY_SPACE_REQUEST. + types: + "!

+ "! The definition of a remote system used by Federated

+ "! Learning. + begin of T_REMOTE_TRAIN_SYSTEM_ENTITY, + "! The list of allowed identities that are allowed to access the remote system. + ALLOWED_IDENTITIES type STANDARD TABLE OF T_ALLOWED_IDENTITY WITH NON-UNIQUE DEFAULT KEY, + "! A remote organization. + ORGANIZATION type T_ORGANIZATION, + "! The details of the remote administrator for the organization and identities. + REMOTE_ADMIN type T_REMOTE_ADMIN, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_REMOTE_TRAIN_SYSTEM_ENTITY. + types: + "! No documentation available. + begin of T_INSTNC_RESOURCE_ENTITY_PLAN, + "! The payment plan ID. + ID type STRING, + "! The payment plan name. + NAME type STRING, + "! 1 - for v1 plans, 2 - for the v2 plans where v2 plan means an instance is space + "! / project aware. + VERSION type INTEGER, + end of T_INSTNC_RESOURCE_ENTITY_PLAN. + types: + "!

+ "! Common metadata for a resource.

+ begin of T_RESOURCE_META_BASE, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + end of T_RESOURCE_META_BASE. + types: + "! No documentation available. + begin of T_BLUEMIX_ACCOUNT, + "! The account ID. + ID type STRING, + end of T_BLUEMIX_ACCOUNT. + types: + "! No documentation available. + begin of T_INSTANCE_RESOURCE_ENTITY, + "! Status of the service instance (active|inactive). + STATUS type STRING, + "! No documentation available. + PLAN type T_INSTNC_RESOURCE_ENTITY_PLAN, + "! No documentation available. + CRN type STRING, + "! No documentation available. + ACCOUNT type T_BLUEMIX_ACCOUNT, + "! The consumption part is available only when `plan.version` is `2`.
+ "! All the values are calculated at the account
+ "! level the instance belongs to, not the instance itself. + CONSUMPTION type T_CONSUMPTION, + "! Cloud Service Endpoints (CSE) the instance is enabled for. Possible values are + "! `public`, `private` and `public-and-private`. + SERVICE_ENDPOINTS type STRING, + end of T_INSTANCE_RESOURCE_ENTITY. + types: + "! No documentation available. + begin of T_INSTANCE_RESOURCE, + "! Common metadata for a resource. + METADATA type T_RESOURCE_META_BASE, + "! No documentation available. + ENTITY type T_INSTANCE_RESOURCE_ENTITY, + end of T_INSTANCE_RESOURCE. + types: + "!

+ "! Optimization algorithm.

+ begin of T_TRAIN_RFRNC_HYPR_PRM_OPTMZT1, + "! No documentation available. + NAME type STRING, + "! Optimizer configuration parameters. + PARAMETERS type JSONOBJECT, + end of T_TRAIN_RFRNC_HYPR_PRM_OPTMZT1. + types: + "!

+ "! A set of hyper parameters.

+ begin of T_HYPER_PARAMETER, + "! The name of the hyper parameters. + NAME type STRING, + "! An object containing floating point properties 'min_value', + "! 'max_value', 'step', and 'power', or a list of + "! either strings or floating point values. + ITEMS type JSONOBJECT, + end of T_HYPER_PARAMETER. + types: + "!

+ "! The hyper parameters used in the experiment.

+ begin of T_TRAIN_RFRNC_HYPR_PRM_OPTMZTN, + "! Optimization algorithm. + METHOD type T_TRAIN_RFRNC_HYPR_PRM_OPTMZT1, + "! Hyper parameters that can be a range or an array of number or strings. + HYPER_PARAMETERS type STANDARD TABLE OF T_HYPER_PARAMETER WITH NON-UNIQUE DEFAULT KEY, + end of T_TRAIN_RFRNC_HYPR_PRM_OPTMZTN. + types: + "!

+ "! An evaluation metric.

+ begin of T_EVALUATION_METRIC, + "! No documentation available. + NAME type STRING, + "! No documentation available. + MAXIMIZE type BOOLEAN, + end of T_EVALUATION_METRIC. + types: + "!

+ "! The optional evaluation definition.

+ begin of T_EVALUATION_DEFINITION, + "! The evaluation method. + METHOD type STRING, + "! The evaluation metrics. + METRICS type STANDARD TABLE OF T_EVALUATION_METRIC WITH NON-UNIQUE DEFAULT KEY, + end of T_EVALUATION_DEFINITION. + types: + "!

+ "! The `pipeline` is a reference to the pipeline. The

+ "! `model_definition` is the library reference that contains the training library. + begin of T_TRAINING_REFERENCE, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! The model definition. + MODEL_DEFINITION type T_MODEL_DEFINITION_ID, + "! The hyper parameters used in the experiment. + HYPER_PARAMETERS_OPTIMIZATION type T_TRAIN_RFRNC_HYPR_PRM_OPTMZTN, + end of T_TRAINING_REFERENCE. + types: + "!

+ "! The details of the experiment to be created.

+ begin of T_EXPERIMENT_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The label column. + LABEL_COLUMN type STRING, + "! The optional evaluation definition. + EVALUATION_DEFINITION type T_EVALUATION_DEFINITION, + "! The optional training references used by the experiment. + TRAINING_REFERENCES type STANDARD TABLE OF T_TRAINING_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_EXPERIMENT_ENTITY_REQUEST. + types: + "!

+ "! Data shape after the transformation.

+ begin of T_DATA_OUTPUT, + "! The number of rows. + ROWS type INTEGER, + "! The number of columns. + COLUMNS type INTEGER, + end of T_DATA_OUTPUT. + types: + "!

+ "! Data shape (rows, columns) passed as input to the

+ "! transformer/transformation. + begin of T_DATA_INPUT, + "! The number of rows. + ROWS type INTEGER, + "! The number of columns. + COLUMNS type INTEGER, + end of T_DATA_INPUT. + types: + "!

+ "! Informational information about the preprocessing

+ "! transformation that was executed during the training run. + begin of T_DT_PRPRCSSNG_TRANSFORMATION, + "! The preprocessing stage. + STAGE type STRING, + "! Data shape (rows, columns) passed as input to the transformer/transformation. + INPUT type T_DATA_INPUT, + "! Data shape after the transformation. + OUTPUT type T_DATA_OUTPUT, + "! Properties of preprocessing transformation. + PROPS type JSONOBJECT, + end of T_DT_PRPRCSSNG_TRANSFORMATION. + types: + "!

+ "! The details of an inference API.

+ begin of T_INFERENCE, + "! The inference URL. + URL type STRING, + "! This is `true` if the inference API supports SSE streaming. + SSE type BOOLEAN, + "! This is `true` if the inference API uses the `serving_name` that was defined in + "! this deployment. + USES_SERVING_NAME type BOOLEAN, + end of T_INFERENCE. + types: + "!

+ "! Status information related to the state of the scaling, if

+ "! scaling is in progress or has completed. + begin of T_DEPLOYMENT_SCALING, + "! The state of the scaling request. + STATE type STRING, + "! The time when the scaling was attempted. + ATTEMPTED_AT type DATETIME, + "! The number of requested replicas. + REQUESTED_REPLICAS type INTEGER, + "! The number of replicas currently deployed. + DEPLOYED_REPLICAS type INTEGER, + "! Optional messages related to the deployment. + MESSAGE type T_MESSAGE, + end of T_DEPLOYMENT_SCALING. + types: + "!

+ "! Specifies the current status, additional information about

+ "! the deployment and any failure messages in case of deployment failures. + begin of T_DEPLOYMENT_STATUS, + "! Specifies the current state of the deployment. + STATE type STRING, + "! Optional messages related to the deployment. + MESSAGE type T_MESSAGE, + "! The data returned when an error is encountered. + FAILURE type T_ERROR, + "! The URLs that can be used to submit online prediction API requests. These URLs + "! will contain the
+ "! `deployment_id` and the `serving_name`, if the `serving_name` was set. + INFERENCE type STANDARD TABLE OF T_INFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! **Deprecated: use `inference` instead.**. + SERVING_URLS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Status information related to the state of the scaling, if scaling is in + "! progress or has completed. + SCALING type T_DEPLOYMENT_SCALING, + end of T_DEPLOYMENT_STATUS. + types: + "!

+ "! Optional metadata that can be used to provide information

+ "! about this model that can be tracked with IBM AI Factsheets. See [Using AI + "! Factsheets](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fa + "! ctsheets-model-inventory.html) for more details. + begin of T_MDL_RSRC_ENTITY_MODEL_VER, + "! This is the user-provided version which should follow semantic versioning. + NUMBER type STRING, + "! This is the user-provided tag for the model. + TAG type STRING, + "! This is the user provided description that provides context for the change in + "! the model version. + DESCRIPTION type STRING, + end of T_MDL_RSRC_ENTITY_MODEL_VER. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAIN_RESOURCE_ENTITY_REQ, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the training. + NAME type STRING, + "! A description of the training. + DESCRIPTION type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_TRAIN_RESOURCE_ENTITY_REQ. + types: + "! No documentation available. + begin of T_MTRC_TSD_MTRCS_TSD_TRAIN_AG1, + "! Metric score for the Pipeline 1. + P1 type NUMBER, + end of T_MTRC_TSD_MTRCS_TSD_TRAIN_AG1. + types: + "!

+ "! The details of the function to be created.

+ begin of T_FUNCTION_RESOURCE_ENTITY, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! Type of the function to be created. Only `python` type is supported as of now. + "! If not specified, `python` is the default. Functions expect a gzip file that + "! contains a python file that make up the function. Python functions specify what + "! needs to be run when the function is deployed and what needs to be run when the + "! scoring function is called. In other words, you are able to customize what + "! preparation WML does in the environment when you deploy the function, as well + "! as what steps WML takes to generate the output when you call the API later on. + "! The function consists of the outer function (any place that is not within the + "! score function) and the inner score function. The code that sits in the outer + "! function runs when the function is deployed, and the environment is then frozen + "! and ready to be used whenever the online scoring or batch inline job processing + "! API is called. The code that sits in the inner score function runs when the + "! online scoring or batch inline job processing API is called, in the environment + "! customized by the outer function. See [Deploying Python + "! function](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-d + "! eploy-py-function.html?context=cpdaas&audience=wdp) for more details.
+ "!
+ "! This is illustrated in the example below:
+ "!
+ "! ><python code used to set up the environment> \
+ "! >\
+ "! >def score(payload): \
+ "! >    df_payload = + "! pd.DataFrame(payload["values"]) \
+ "! >    df_payload.columns = payload["fields"] + "! \
+ "! >    ... \
+ "! >    output = {"result" : res} \
+ "! >    return output \
+ "! >\
+ "! >return score. + TYPE type STRING, + "! Scoring data. + SAMPLE_SCORING_INPUT type T_SYNC_SCORING_DATA, + "! The schemas of the expected data. + SCHEMAS type T_FUNCTION_ENTITY_SCHEMAS, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! This is a list of references of the models that are used by this function, if + "! any. These references are provided by the owner of the function and are used + "! for usage tracking only. + MODEL_REFERENCES type STANDARD TABLE OF T_MODEL_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + end of T_FUNCTION_RESOURCE_ENTITY. + types: + "!

+ "! The content information to be uploaded.

+ begin of T_CONTENT_INFO, + "! The content format of the attachment. This can be one of `native`, `coreML`, + "! `pipeline-node`. + CONTENT_FORMAT type STRING, + "! The location of the content to be uploaded. + LOCATION type STRING, + "! The file name that will be used when downloading the content from the UI. + FILE_NAME type STRING, + "! The `pipeline_node_id` that corresponds to this content. This is required only + "! if the `content_format` is `pipeline-node` otherwise it is rejected or ignored. + "! + PIPELINE_NODE_ID type STRING, + "! The `deployment_id` that corresponds to this content. This is required only if + "! the `content_format` is `coreml` otherwise it is rejected or ignored. + DEPLOYMENT_ID type STRING, + end of T_CONTENT_INFO. + types: + "!

+ "! Details about the attachments that should be uploaded with

+ "! this model. + begin of T_CONTENT_LOCATION, + "! The content information to be uploaded. + CONTENTS type STANDARD TABLE OF T_CONTENT_INFO WITH NON-UNIQUE DEFAULT KEY, + "! The data source type like `connection_asset` or `data_asset`. + TYPE type STRING, + "! Connection properties. + CONNECTION type MAP, + "! Location properties. + LOCATION type MAP, + end of T_CONTENT_LOCATION. + types: + "!

+ "! A paginated list of remote training systems.

+ begin of T_REMOTE_TRAIN_SYS_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of remote training systems. + RESOURCES type STANDARD TABLE OF T_REMOTE_TRAIN_SYSTEM_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_REMOTE_TRAIN_SYS_RESOURCES. + types: + "!

+ "! The metadata related to the attachment.

+ begin of T_CONTENT_METADATA, + "! The content id for the attachment. + ATTACHMENT_ID type STRING, + "! The type of the content. + CONTENT_FORMAT type STRING, + "! The name of the attachment. + NAME type STRING, + "! The `pipeline_node_id` that corresponds to this content. + PIPELINE_NODE_ID type STRING, + "! The `deployment_id` that corresponds to this content. + DEPLOYMENT_ID type STRING, + "! This will be set to `true` if the content has been persisted. If this content + "! was part of the import process and the upload of the content failed then the + "! message can be found in the
+ "! `warnings` field of the `system_details` that are returned with the model + "! details. + PERSISTED type BOOLEAN, + end of T_CONTENT_METADATA. + types: + "!

+ "! The metadata related to the attachments.

+ begin of T_ALL_CONTENT_METADATA, + "! The number of attachments associated with the resource. + TOTAL_COUNT type INTEGER, + "! No documentation available. + ATTACHMENTS type STANDARD TABLE OF T_CONTENT_METADATA WITH NON-UNIQUE DEFAULT KEY, + end of T_ALL_CONTENT_METADATA. + types: + "!

+ "! Details about the batch deployment job.


+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually exclusive. + "! Specify only one of these when submitting a batch deployment job.
+ "!
+ "! Use `hybrid_pipeline_hardware_specs` only in a batch deployment job of a hybrid + "! pipeline in order to specify compute configuration for each pipeline node. For + "! all other cases use `hardware_spec` to specify compute configuration.
+ "!
+ "! In case of output data references where the data asset is a remote database, + "! users can specify if the batch deployment output must be appended to the table + "! or if the table is to be truncated and output data updated.
+ "! `output_data_references.location.write_mode` parameter can be used to for this + "! purpose. The values `truncate` or `append` can be specified for + "! `output_data_references.location.write_mode` parameter.
+ "! * Specifying `truncate` as value will truncate the table and the batch output + "! data will be inserted.
+ "! * Specifying `append` as value will insert the batch output data to the remote + "! database table.
+ "! * The `write_mode` parameter is applicable only for `output_data_references` + "! parameter.
+ "! * The `write_mode` parameter will be applicable only for remote database related + "! data assets. This parameter will not be applicable for local data asset or COS + "! based data asset. + begin of T_JOB_ENTITY, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + "! User defined properties. + CUSTOM type JSONOBJECT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a model,
+ "! Python Function or a Python Scripts.
+ "!
+ "! Use `input_data` property to specify the input data for batch processing as part + "! of the job's payload.
+ "! The `input_data` property is mutually exclusive with `input_data_references` + "! property, only use one of these.
+ "! When `input_data` is specified, the processed output of batch deployment job + "! will be available in `scoring.predictions`
+ "! parameter in the deployment job response. `input_data` property is not supported + "! for batch deployment of Python Scripts.
+ "!
+ "! Use `input_data_references` property to specify the details pertaining to the + "! remote source where the input data for
+ "! batch deployment job is available. The `input_data_references` must be used with + "! `output_data_references`.
+ "! The `input_data_references` property
+ "! is mutually exclusive with `input_data` property, only use one of these. The + "! `input_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions.
+ "!
+ "! Use `output_data_references` property to specify the details pertaining to the + "! remote source where the input
+ "! data for batch deployment job is available. `output_data_references` must be + "! used with `input_data_references`.
+ "! The `output_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions. + SCORING type T_JOB_SCORING_REQUEST, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a Decision Optimization problem. You can find more + "! information in [Deploying Decision + "! Optimization](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment + "! /ModelIODataDefn.html) documentation.
+ "! Use the `solve_parameters` as named value pairs to control the Decision + "! Optimization solve behavior.
+ "! Use the `input_data` and `output_data` properties to specify respectively input + "! and output data for batch processing as part of the job's payload.
+ "! Use the `input_data_references` and `output_data_references` properties to + "! specify respectively input and output data for batch processing as remote data + "! sources. + DECISION_OPTIMIZATION type T_JB_DECISION_OPTIMIZATION_REQ, + end of T_JOB_ENTITY. + types: + "! No documentation available. + begin of T_PAGINATION_BASE, + "! Computed explicitly only when 'total_count=true' query parameter is + "! present. This is in order to avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + end of T_PAGINATION_BASE. + types: + "!

+ "! User defined properties specified as key-value pairs.

+ T_CUSTOM type JSONOBJECT. + types: + "! No documentation available. + begin of T_TRAINING_WEBSOCKET, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! Status of the model. + ENTITY type T_TRAINING_STATUS, + end of T_TRAINING_WEBSOCKET. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_JOB_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_JOB_RESOURCE_METADATA. + types: + "!

+ "! The information for a deployment job definition.

+ begin of T_JOB_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_JOB_RESOURCE_METADATA, + "! Details about the batch deployment job.
+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually + "! exclusive.
+ "! Specify only one of these when submitting a batch deployment job.
+ "!
+ "! Use `hybrid_pipeline_hardware_specs` only in a batch deployment job of a hybrid + "! pipeline
+ "! in order to specify compute configuration for each pipeline node. For all other + "! cases use `hardware_spec`
+ "! to specify compute configuration.
+ "!
+ "! In case of output data references where the data asset is a remote database, + "! users can specify if the batch
+ "! deployment output must be appended to the table or if the table is to be + "! truncated and output data updated.
+ "! `output_data_references.location.write_mode` parameter can be used to for this + "! purpose.
+ "! The values `truncate` or `append` can be specified for + "! `output_data_references.location.write_mode`
+ "! parameter.
+ "! * Specifying `truncate` as value will truncate the table and the batch output + "! data will be inserted.
+ "! * Specifying `append` as value will insert the batch output data to the remote + "! database table.
+ "! * The `write_mode` parameter is applicable only for `output_data_references` + "! parameter.
+ "! * The `write_mode` parameter will be applicable only for remote database related + "! data assets.
+ "! This parameter will not be applicable for local data asset or COS based data + "! asset. + ENTITY type T_JOB_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_JOB_RESOURCE. + types: + "!

+ "! The details for the revision.

+ begin of T_EXPERIMENT_REV_ENTITY_REQ, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_EXPERIMENT_REV_ENTITY_REQ. + types: + "!

+ "! Arbitrary `gzip` file.

+ T_CONTENT_GZIP type FILE. + types: + "!

+ "! The details of the pipeline to be created.

+ begin of T_PIPELINE_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The pipeline document, see
+ "! [pipeline-flow-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipeline-sc + "! hemas/master/common-pipeline/pipeline-flow/pipeline-flow-v2-schema.json) for the + "! schema definition. + DOCUMENT type JSONOBJECT, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_PIPELINE_ENTITY_REQUEST. + types: + "!

+ "! Metrics generated during training.

+ begin of T_TS_TRAINING_TRAINING, + "! At each fitted point, the absolute difference between actual value and predicted + "! value is divided by half the sum of absolute actual value and predicted value, + "! and then average all such values across all the fitted points. + NG_SYMMTRC_MN_ABSLT_PRCNTG_ERR type NUMBER, + end of T_TS_TRAINING_TRAINING. + types: + "! No documentation available. + begin of T_METRIC_TS_METRICS_TS_TRAIN, + "! Metrics generated during training. + TRAINING type T_TS_TRAINING_TRAINING, + end of T_METRIC_TS_METRICS_TS_TRAIN. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_FUNCTION_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_FUNCTION_RESOURCE_METADATA. + types: + "!

+ "! The information for a function.

+ begin of T_FUNCTION_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_FUNCTION_RESOURCE_METADATA, + "! The details of the function to be created. + ENTITY type T_FUNCTION_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_FUNCTION_RESOURCE. + types: + "!

+ "! A paginated list of functions.

+ begin of T_FUNCTION_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of functions. + RESOURCES type STANDARD TABLE OF T_FUNCTION_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_FUNCTION_RESOURCES. + types: + "!

+ "! The details of the experiment to be created.

+ begin of T_EXPERIMENT_RESOURCE_ENTITY, + "! The label column. + LABEL_COLUMN type STRING, + "! The optional evaluation definition. + EVALUATION_DEFINITION type T_EVALUATION_DEFINITION, + "! The optional training references used by the experiment. + TRAINING_REFERENCES type STANDARD TABLE OF T_TRAINING_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_EXPERIMENT_RESOURCE_ENTITY. + types: + "! No documentation available. + T_SCORING_TARGETS type TT_JSONOBJECT. + types: + "!

+ "! This will be used by scoring to record the size of the

+ "! model. + begin of T_MODEL_RESOURCE_ENTITY_SIZE, + "! The memory size of the model. + IN_MEMORY type NUMBER, + "! The size of the model on disk. + CONTENT type NUMBER, + end of T_MODEL_RESOURCE_ENTITY_SIZE. + types: + "!

+ "! The model id of the base model for this prompt tuning.

+ begin of T_BASE_MODEL, + "! The model id of the base model. + MODEL_ID type STRING, + end of T_BASE_MODEL. + types: + "!

+ "! Information about the training job that created this model.

+ begin of T_TRAINING_DETAILS, + "! The `id` of the training job that produced this model. + ID type STRING, + "! The model id of the base model for this prompt tuning. + BASE_MODEL type T_BASE_MODEL, + "! The task that is targeted for this model. + TASK_ID type STRING, + "! The optional verbalizer that was used during the training, if appropriate. + VERBALIZER type STRING, + end of T_TRAINING_DETAILS. + types: + "!

+ "! If the prediction schemas are provided here then they take

+ "! precedent over any schemas provided in the data references. Note that data + "! references contain the schema for the associated data and this object contains + "! the schema(s) for the associated prediction, if any. In the case that the + "! prediction input data matches exactly the schema of the training data + "! references then the prediction schema can be omitted. However it is highly + "! recommended to always specify the prediction schemas using this field. + begin of T_MDL_RESOURCE_ENTITY_SCHEMAS, + "! The schema of the expected prediction input data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + INPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + "! The schema of the expected prediction output data, see
+ "! [datarecord-metadata-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipel + "! ine-schemas/master/common-pipeline/datarecord-metadata/datarecord-metadata-v2-sc + "! hema.json) for the schema definition. + OUTPUT type STANDARD TABLE OF T_DATA_SCHEMA WITH NON-UNIQUE DEFAULT KEY, + end of T_MDL_RESOURCE_ENTITY_SCHEMAS. + types: + "!

+ "! Information related to the upload of the model content.

+ begin of T_MODEL_RESOURCE_ENTITY, + "! The model type. The supported model types can be found in the documentation
+ "! [here](https://dataplatform.cloud.ibm.com/docs/content/wsj/wmls/wmls-deploy-pyth + "! on-types.html?context=analytics). + TYPE type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! A reference to a resource. + PIPELINE type T_REL, + "! The model definition. + MODEL_DEFINITION type T_MODEL_DEFINITION_ID, + "! Hyper parameters used for training this model. + HYPER_PARAMETERS type JSONOBJECT, + "! User provided domain name for this model. For example: sentiment, entity, + "! visual-recognition, finance, retail, real estate etc. + DOMAIN type STRING, + "! The training data that was used to create this model. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! If the prediction schemas are provided here then they take precedent over any + "! schemas
+ "! provided in the data references. Note that data references contain the schema + "! for the
+ "! associated data and this object contains the schema(s) for the associated + "! prediction, if any.
+ "! In the case that the prediction input data matches exactly the schema of the + "! training data
+ "! references then the prediction schema can be omitted. However it is highly + "! recommended to
+ "! always specify the prediction schemas using this field. + SCHEMAS type T_MDL_RESOURCE_ENTITY_SCHEMAS, + "! The name of the label column. + LABEL_COLUMN type STRING, + "! The name of the label column seen by the estimator, which may have been + "! transformed by the previous transformers in the pipeline. This is not + "! necessarily the same column as the `label_column` in the initial data set. + TRANSFORMED_LABEL_COLUMN type STRING, + "! This will be used by scoring to record the size of the model. + SIZE type T_MODEL_RESOURCE_ENTITY_SIZE, + "! Metrics that can be returned by an operation. + METRICS type STANDARD TABLE OF T_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! User defined objects referenced by the model. For any user defined class or + "! function used in the model, its name, as referenced in the model, must be + "! specified as the `key` and its fully qualified class or function name must be + "! specified as the `value`. This is applicable for `Tensorflow 2.X` models + "! serialized in `H5` format using the `tf.keras` API. + USER_DEFINED_OBJECTS type MAP, + "! This is the array which contains information about the software specifications + "! that are used in the hybrid pipeline (if this model includes a hybrid + "! pipeline). + HYBRID_PIPELINE_SOFTWARE_SPECS type STANDARD TABLE OF T_SOFTWARE_SPEC_REL WITH NON-UNIQUE DEFAULT KEY, + "! Optional metadata that can be used to provide information
+ "! about this model that can be tracked with IBM AI Factsheets.
+ "! See [Using AI + "! Factsheets](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fa + "! ctsheets-model-inventory.html) for more details. + MODEL_VERSION type T_MDL_RSRC_ENTITY_MODEL_VER, + "! Deprecated: this is replaced by `training.id`. This field can be used to store + "! the `id` of the training job that was used to produce this model. + TRAINING_ID type STRING, + "! An optional array which contains the data preprocessing transformations that + "! were executed by the training job that created this model. + DATA_PREPROCESSING type STANDARD TABLE OF T_DT_PRPRCSSNG_TRANSFORMATION WITH NON-UNIQUE DEFAULT KEY, + "! Information about the training job that created this model. + TRAINING type T_TRAINING_DETAILS, + "! The upload state. + CONTENT_IMPORT_STATE type STRING, + end of T_MODEL_RESOURCE_ENTITY. + types: + "!

+ "! The information for a model.

+ begin of T_MODEL_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_MODEL_RESOURCE_METADATA, + "! Information related to the upload of the model content. + ENTITY type T_MODEL_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_MODEL_RESOURCE. + types: + "!

+ "! A paginated list of models.

+ begin of T_MODEL_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of models. + RESOURCES type STANDARD TABLE OF T_MODEL_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_MODEL_RESOURCES. + types: + "!

+ "! A list of evaluation specifications.

+ T_EVALUATIONS_SPEC type STANDARD TABLE OF T_EVALUATIONS_SPEC_ITEM WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The details for the revision.

+ begin of T_REV_ENTITY_SPC_PROJECT_REQ, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_REV_ENTITY_SPC_PROJECT_REQ. + types: + "!

+ "! The details for the revision.

+ begin of T_JOB_REVISION_ENTITY_REQUEST, + "! The space that contains the resource. + SPACE_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_JOB_REVISION_ENTITY_REQUEST. + types: + "!

+ "! This will be used by scoring to record the size of the

+ "! model. + begin of T_MODEL_ENTITY_SIZE, + "! The memory size of the model. + IN_MEMORY type NUMBER, + "! The size of the model on disk. + CONTENT type NUMBER, + end of T_MODEL_ENTITY_SIZE. + types: + "!

+ "! The status of the job.

+ begin of T_FIELD_JOB_STATUS, + "! The status of the job. + STATUS type T_JOB_STATUS, + end of T_FIELD_JOB_STATUS. + types: + "!

+ "! Indicates that this is a batch deployment. An empty object

+ "! has to be specified. + begin of T_BATCH_REQUEST, + "! A set of key-value pairs where `key` is the parameter name. + PARAMETERS type JSONOBJECT, + end of T_BATCH_REQUEST. + types: + "!

+ "! The definition of the deployment.

+ begin of T_DEPLOYMENT_ENTITY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Indicates that this is an online deployment. An empty object has to be + "! specified.
+ "! If the online scoring schema has a `type` of `DataFrame` then the scoring + "! payload will be converted to a `Pandas` data frame. + ONLINE type T_ONLINE_REQUEST, + "! Indicates that this is a batch deployment. An empty object has to be specified. + BATCH type T_BATCH_REQUEST, + "! Specifies the type of the asset on which deployment is created. + DEPLOYED_ASSET_TYPE type STRING, + "! Specifies the current status, additional information about the deployment
+ "! and any failure messages in case of deployment failures. + STATUS type T_DEPLOYMENT_STATUS, + end of T_DEPLOYMENT_ENTITY. + types: + "!

+ "! The details for the revision.

+ begin of T_TRAIN_DEF_REV_ENTITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_TRAIN_DEF_REV_ENTITY_REQUEST. + types: + "!

+ "! The common fields that can be patched. This is a helper for

+ "! `cpdctl`. + begin of T_COMMON_PATCH_REQUEST_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_COMMON_PATCH_REQUEST_HELPER. + types: + "!

+ "! The remote training system metric.

+ begin of T_REMOTE_TRAIN_SYSTEM_METRIC, + "! No documentation available. + ID type STRING, + "! No documentation available. + LOCAL type NUMBER, + "! No documentation available. + FUSED type NUMBER, + end of T_REMOTE_TRAIN_SYSTEM_METRIC. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_INSTANCE_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! No documentation available. + RESOURCES type STANDARD TABLE OF T_INSTANCE_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + end of T_INSTANCE_RESOURCES. + types: + "!

+ "! Common metadata for a resource where `project_id` or

+ "! `space_id` must be present. + begin of T_EXPERIMENT_RESOURCE_METADATA, + "! The id of the resource. + ID type STRING, + "! The time when the resource was created. + CREATED_AT type DATETIME, + "! The revision of the resource. + REV type STRING, + "! The user id which created this resource. + OWNER type STRING, + "! The time when the resource was last modified. + MODIFIED_AT type DATETIME, + "! The id of the parent resource where applicable. + PARENT_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! Information related to the revision. + COMMIT_INFO type T_RESOURCE_COMMIT_INFO, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + end of T_EXPERIMENT_RESOURCE_METADATA. + types: + "!

+ "! Details about the batch deployment job.


+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually exclusive. + "! Specify only one of these when submitting a batch deployment job.
+ "!
+ "! Use `hybrid_pipeline_hardware_specs` only in a batch deployment job of a hybrid + "! pipeline in order to specify compute configuration for each pipeline node. For + "! all other cases use `hardware_spec` to specify compute configuration.
+ "!
+ "! In case of output data references where the data asset is a remote database, + "! users can specify if the batch deployment output must be appended to the table + "! or if the table is to be truncated and output data updated.
+ "! `output_data_references.location.write_mode` parameter can be used to for this + "! purpose. The values `truncate` or `append` can be specified for + "! `output_data_references.location.write_mode` parameter.
+ "! * Specifying `truncate` as value will truncate the table and the batch output + "! data will be inserted.
+ "! * Specifying `append` as value will insert the batch output data to the remote + "! database table.
+ "! * The `write_mode` parameter is applicable only for `output_data_references` + "! parameter.
+ "! * The `write_mode` parameter will be applicable only for remote database related + "! data assets. This parameter will not be applicable for local data asset or COS + "! based data asset. + begin of T_JOB_ENTITY_REQUEST, + "! The space that contains the resource. + SPACE_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + "! User defined properties. + CUSTOM type JSONOBJECT, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a model,
+ "! Python Function or a Python Scripts.
+ "!
+ "! Use `input_data` property to specify the input data for batch processing as part + "! of the job's payload.
+ "! The `input_data` property is mutually exclusive with `input_data_references` + "! property, only use one of these.
+ "! When `input_data` is specified, the processed output of batch deployment job + "! will be available in `scoring.predictions`
+ "! parameter in the deployment job response. `input_data` property is not supported + "! for batch deployment of Python Scripts.
+ "!
+ "! Use `input_data_references` property to specify the details pertaining to the + "! remote source where the input data for
+ "! batch deployment job is available. The `input_data_references` must be used with + "! `output_data_references`.
+ "! The `input_data_references` property
+ "! is mutually exclusive with `input_data` property, only use one of these. The + "! `input_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions.
+ "!
+ "! Use `output_data_references` property to specify the details pertaining to the + "! remote source where the input
+ "! data for batch deployment job is available. `output_data_references` must be + "! used with `input_data_references`.
+ "! The `output_data_references`
+ "! property is not supported for batch deployment job of Spark models and Python + "! Functions. + SCORING type T_JOB_SCORING_REQUEST, + "! Details about the input/output data and other properties to be used for a batch + "! deployment job of a Decision Optimization problem. You can find more + "! information in [Deploying Decision + "! Optimization](https://dataplatform.cloud.ibm.com/docs/content/DO/WML_Deployment + "! /ModelIODataDefn.html) documentation.
+ "! Use the `solve_parameters` as named value pairs to control the Decision + "! Optimization solve behavior.
+ "! Use the `input_data` and `output_data` properties to specify respectively input + "! and output data for batch processing as part of the job's payload.
+ "! Use the `input_data_references` and `output_data_references` properties to + "! specify respectively input and output data for batch processing as remote data + "! sources. + DECISION_OPTIMIZATION type T_JB_DECISION_OPTIMIZATION_REQ, + end of T_JOB_ENTITY_REQUEST. + types: + "!

+ "! Arbitrary `text` file.

+ T_CONTENT_TEXT type String. + types: + "!

+ "! A set of metrics.

+ begin of T_TS_METRIC_LEVELS, + "! At each fitted point, the absolute difference between actual value and predicted + "! value is divided by half the sum of absolute actual value and predicted value, + "! and then average all such values across all the fitted points. A single `float` + "! in the univariate case, an array of `float` in the multivariate case. + NG_SYMMTRC_MN_ABSLT_PRCNTG_ERR type JSONOBJECT, + "! The average of the Negative Symmetric Mean Absolute Percentage Error (SMAPE). + NG_AVG_SYMMTRC_MN_ABSLT_PRCNT1 type NUMBER, + "! Measure of how the model performance compares to the baseline model, or mean + "! model. The R2 should be equal or less than 1. Negative R2 value means that the + "! model under consideration is worse than the mean model. Zero R2 value means + "! that the model under consideration is as good or bad as the mean model. + "! Positive R2 value means that the model under consideration is better than the + "! mean model. A single `float` in the univariate case, an array of `float` in the + "! multivariate case. + R2 type JSONOBJECT, + "! The average of the r2. + AVG_R2 type NUMBER, + "! Square root of the mean of the squared differences between the actual values and + "! predicted values. A single `float` in the univariate case, an array of `float` + "! in the multivariate case. + NEG_ROOT_MEAN_SQUARED_ERROR type JSONOBJECT, + "! Average of the Negative Root Mean Squared Error (RMSE). Only appears in the + "! univariate case. + NEG_AVG_ROOT_MEAN_SQUARED_ERR type NUMBER, + "! Average of absolute differences between the actual values and predicted values. + "! A single `float` in the univariate case, an array of `float` in the + "! multivariate case. + NEG_MEAN_ABSOLUTE_ERROR type JSONOBJECT, + "! Average of the Mean Absolute Error (MAE). Only appears in the univariate case. + NEG_AVG_MEAN_ABSOLUTE_ERROR type NUMBER, + end of T_TS_METRIC_LEVELS. + types: + "!

+ "! Metrics generated during evaluation of the pipeline on

+ "! holdout data. + begin of T_METRIC_TS_METRICS_TS_HOLDOUT, + "! A set of metrics. + HOLDOUT type T_TS_METRIC_LEVELS, + end of T_METRIC_TS_METRICS_TS_HOLDOUT. + types: + "!

+ "! The information for an experiment.

+ begin of T_EXPERIMENT_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_EXPERIMENT_RESOURCE_METADATA, + "! The details of the experiment to be created. + ENTITY type T_EXPERIMENT_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_EXPERIMENT_RESOURCE. + types: + "!

+ "! A paginated list of experiments.

+ begin of T_EXPERIMENT_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of experiments. + RESOURCES type STANDARD TABLE OF T_EXPERIMENT_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_EXPERIMENT_RESOURCES. + types: + "!

+ "! The properties that are part of a request that supports

+ "! spaces. + begin of T_ENTITY_REQUEST_SPACE_BODY, + "! The space that contains the resource. + SPACE_ID type STRING, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_ENTITY_REQUEST_SPACE_BODY. + types: + "!

+ "! The project that contains the resource.

+ T_PROJECT_ID_ONLY type String. + types: + "!

+ "! The record.

+ T_SCORING_PAYLOAD_OPTIM_VALUE type JSONOBJECT. + types: + "!

+ "! Metrics generated in model evaluation phase.

+ begin of T_TSAD_HOLDOUT, + "! Simulated anomaly values are injected into the holdout data in each iteration + "! for pipeline evaluation. + ITERATIONS type STANDARD TABLE OF T_TSAD_HOLDOUT_ITERATIONS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Aggregated scores of anomaly types per metric. + AGG type T_TSAD_HOLDOUT_AGG, + "! Pipeline ranking based on the specified metric. + SUPPORTING_RANK type T_TSAD_HOLDOUT_SUPPORTING_RANK, + "! This score is calculated based on an aggregation of the optimized metric (for + "! example, Average precision) values for the 4 anomaly types. The scores for each + "! pipeline are ranked, using the Borda count method, and then weighted for their + "! contribution to the aggregate score. Unlike a standard metric score, this value + "! is not between 0 and 1. A higher value indicates a stronger score. + AGGREGATED_SCORE type STANDARD TABLE OF T_TSD_HLDT_AGGRGTD_SCORE_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_TSAD_HOLDOUT. + types: + "!

+ "! Can patch the deployment id.

+ begin of T_DPLYMNT_JOB_DEF_PATCH_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + DEPLOYMENT type T_SIMPLE_REL, + end of T_DPLYMNT_JOB_DEF_PATCH_HELPER. + types: + "!

+ "! Information related to the upload of the model content.

+ begin of T_EXTRA_MODEL_ENTITY, + "! The upload state. + CONTENT_IMPORT_STATE type STRING, + "! This is the array which contains information about the software specifications + "! that are used in the hybrid pipeline (if this model includes a hybrid + "! pipeline). + HYBRID_PIPELINE_SOFTWARE_SPECS type STANDARD TABLE OF T_SOFTWARE_SPEC_REL WITH NON-UNIQUE DEFAULT KEY, + end of T_EXTRA_MODEL_ENTITY. + types: + "! No documentation available. + begin of T_TS_MTRC_BCKTST_ITRTNS_ITEM, + "! Average of absolute differences between the actual values and predicted values. + "! A single `float` in the univariate case, an array of `float` in the + "! multivariate case. + NEG_MEAN_ABSOLUTE_ERROR type JSONOBJECT, + "! Square root of the mean of the squared differences between the actual values and + "! predicted values. A single `float` in the univariate case, an array of `float` + "! in the multivariate case. + NEG_ROOT_MEAN_SQUARED_ERROR type JSONOBJECT, + "! Measure of how the model performance compares to the baseline model, or mean + "! model. The R2 should be equal or less than 1. Negative R2 value means that the + "! model under consideration is worse than the mean model. Zero R2 value means + "! that the model under consideration is as good or bad as the mean model. + "! Positive R2 value means that the model under consideration is better than the + "! mean model. A single `float` in the univariate case, an array of `float` in the + "! multivariate case. + R2 type JSONOBJECT, + "! At each fitted point, the absolute difference between actual value and predicted + "! value is divided by half the sum of absolute actual value and predicted value, + "! and then average all such values across all the fitted points. A single `float` + "! in the univariate case, an array of `float` in the multivariate case. + NG_SYMMTRC_MN_ABSLT_PRCNTG_ERR type JSONOBJECT, + end of T_TS_MTRC_BCKTST_ITRTNS_ITEM. + types: + "!

+ "! Scoring results.

+ begin of T_SYNC_SCORING_DATA_RESULTS, + "! The predictions. + PREDICTIONS type STANDARD TABLE OF T_SCORING_PAYLOAD WITH NON-UNIQUE DEFAULT KEY, + end of T_SYNC_SCORING_DATA_RESULTS. + types: + "!

+ "! The details of the pipeline to be created.

+ begin of T_PIPELINE_ENTITY, + "! The pipeline document, see
+ "! [pipeline-flow-v2-schema](https://raw.githubusercontent.com/elyra-ai/pipeline-sc + "! hemas/master/common-pipeline/pipeline-flow/pipeline-flow-v2-schema.json) for the + "! schema definition. + DOCUMENT type JSONOBJECT, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_PIPELINE_ENTITY. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAINING_DEFINITION_ENTITY, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_TRAINING_DEFINITION_ENTITY. + types: + "!

+ "! A paginated list of deployment job definitions.

+ begin of T_JOB_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of deployment job definitions. + RESOURCES type STANDARD TABLE OF T_JOB_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_JOB_RESOURCES. + types: + "!

+ "! This property is used to specify environment variables and

+ "! their values required to be consumed by the batch deployment job. The + "! environment variables and values must be specified as key-value pairs.
+ "!
+ "! This property is currently supported only for Python Scripts in batch deployment + "! jobs. + T_ENVIRONMENT_VARIABLES type MAP. + types: + "!

+ "! Arbitrary `JSON` file.

+ T_CONTENT_JSON type JSONOBJECT. + types: + "!

+ "! System details.

+ begin of T_SYSTEM, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_SYSTEM. + types: + "!

+ "! Metrics generated in model selection phase.

+ begin of T_MTRC_TSAD_METRICS_TSAD_TRAIN, + "! This score is calculated based on an aggregation of the optimized metric (for + "! example, Average precision) values for the 4 anomaly types. The scores for each + "! pipeline are ranked, using the Borda count method, and then weighted for their + "! contribution to the aggregate score. Unlike a standard metric score, this value + "! is not between 0 and 1. A higher value indicates a stronger score. + AGGREGATED_SCORE type STANDARD TABLE OF T_MTRC_TSD_MTRCS_TSD_TRAIN_AG1 WITH NON-UNIQUE DEFAULT KEY, + end of T_MTRC_TSAD_METRICS_TSAD_TRAIN. + types: + "!

+ "! The common fields that can be patched. This is a helper for

+ "! `cpdctl`. + begin of T_DEPLOYMENT_PATCH_REQ_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_DEPLOYMENT_PATCH_REQ_HELPER. + types: + "!

+ "! See the description in `POST /ml/v4/deployments`.

+ begin of T_DEPLOYMENT_ENTITY_REQUEST, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Indicates that this is an online deployment. An empty object has to be + "! specified.
+ "! If the online scoring schema has a `type` of `DataFrame` then the scoring + "! payload will be converted to a `Pandas` data frame. + ONLINE type T_ONLINE_REQUEST, + "! Indicates that this is a batch deployment. An empty object has to be specified. + BATCH type T_BATCH_REQUEST, + "! Tags that can be used when searching for resources. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The space that contains the resource. + SPACE_ID type STRING, + "! The name of the deployment. + NAME type STRING, + "! A description of the deployment. + DESCRIPTION type STRING, + end of T_DEPLOYMENT_ENTITY_REQUEST. + types: + "!

+ "! The space that contains the resource.

+ T_SPACE_ID_ONLY type String. + types: + "!

+ "! Optional metadata that can be used to provide information

+ "! about this model that can be tracked with IBM AI Factsheets. See [Using AI + "! Factsheets](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fa + "! ctsheets-model-inventory.html) for more details. + begin of T_MODEL_ENTITY_MODEL_VERSION, + "! This is the user-provided version which should follow semantic versioning. + NUMBER type STRING, + "! This is the user-provided tag for the model. + TAG type STRING, + "! This is the user provided description that provides context for the change in + "! the model version. + DESCRIPTION type STRING, + end of T_MODEL_ENTITY_MODEL_VERSION. + types: + "!

+ "! The details of the model to be created.

+ begin of T_MODEL_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The model type. The supported model types can be found in the documentation
+ "! [here](https://dataplatform.cloud.ibm.com/docs/content/wsj/wmls/wmls-deploy-pyth + "! on-types.html?context=analytics). + TYPE type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! A reference to a resource. + PIPELINE type T_REL, + "! The model definition. + MODEL_DEFINITION type T_MODEL_DEFINITION_ID, + "! Hyper parameters used for training this model. + HYPER_PARAMETERS type JSONOBJECT, + "! User provided domain name for this model. For example: sentiment, entity, + "! visual-recognition, finance, retail, real estate etc. + DOMAIN type STRING, + "! The training data that was used to create this model. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! If the prediction schemas are provided here then they take precedent over any + "! schemas
+ "! provided in the data references. Note that data references contain the schema + "! for the
+ "! associated data and this object contains the schema(s) for the associated + "! prediction, if any.
+ "! In the case that the prediction input data matches exactly the schema of the + "! training data
+ "! references then the prediction schema can be omitted. However it is highly + "! recommended to
+ "! always specify the prediction schemas using this field. + SCHEMAS type T_MODEL_ENTITY_SCHEMAS, + "! The name of the label column. + LABEL_COLUMN type STRING, + "! The name of the label column seen by the estimator, which may have been + "! transformed by the previous transformers in the pipeline. This is not + "! necessarily the same column as the `label_column` in the initial data set. + TRANSFORMED_LABEL_COLUMN type STRING, + "! This will be used by scoring to record the size of the model. + SIZE type T_MODEL_ENTITY_SIZE, + "! Metrics that can be returned by an operation. + METRICS type STANDARD TABLE OF T_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! User defined objects referenced by the model. For any user defined class or + "! function used in the model, its name, as referenced in the model, must be + "! specified as the `key` and its fully qualified class or function name must be + "! specified as the `value`. This is applicable for `Tensorflow 2.X` models + "! serialized in `H5` format using the `tf.keras` API. + USER_DEFINED_OBJECTS type MAP, + "! The list of the software specifications that are used by the pipeline that + "! generated this model, if the model was generated by a pipeline. + HYBRID_PIPELINE_SOFTWARE_SPECS type STANDARD TABLE OF T_SOFTWARE_SPEC_REL WITH NON-UNIQUE DEFAULT KEY, + "! Optional metadata that can be used to provide information
+ "! about this model that can be tracked with IBM AI Factsheets.
+ "! See [Using AI + "! Factsheets](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fa + "! ctsheets-model-inventory.html) for more details. + MODEL_VERSION type T_MODEL_ENTITY_MODEL_VERSION, + "! Deprecated: this is replaced by `training.id`. This field can be used to store + "! the `id` of the training job that was used to produce this model. + TRAINING_ID type STRING, + "! An optional array which contains the data preprocessing transformations that + "! were executed by the training job that created this model. + DATA_PREPROCESSING type STANDARD TABLE OF T_DT_PRPRCSSNG_TRANSFORMATION WITH NON-UNIQUE DEFAULT KEY, + "! Information about the training job that created this model. + TRAINING type T_TRAINING_DETAILS, + "! Details about the attachments that should be uploaded with this model. + CONTENT_LOCATION type T_CONTENT_LOCATION, + end of T_MODEL_ENTITY_REQUEST. + types: + "!

+ "! Arbitrary `zip` file.

+ T_CONTENT_ZIP type FILE. + types: + "!

+ "! Hybrid pipeline hardware specification.

+ T_HYBRD_PPLN_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! Metrics from the backtest data.

+ begin of T_TS_METRIC_BACKTEST, + "! A set of metrics. + AVG type T_TS_METRIC_LEVELS, + "! Time Series metrics evaluated per iteration on the backtest data. + ITERATIONS type STANDARD TABLE OF T_TS_MTRC_BCKTST_ITRTNS_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_TS_METRIC_BACKTEST. + types: + "!

+ "! Metrics generated during evaluation of the pipeline on

+ "! backtest data. + begin of T_TS_BACKTEST, + "! Metrics from the backtest data. + BACKTEST type T_TS_METRIC_BACKTEST, + end of T_TS_BACKTEST. + types: + "!

+ "! Metrics that can be returned by an operation.

+ T_METRICS type STANDARD TABLE OF T_METRIC WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! The records.

+ T_SCORING_PAYLOAD_OPTIM_VALUES type STANDARD TABLE OF T_SCORING_PAYLOAD_OPTIM_VALUE WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! A deployment resource.

+ begin of T_DEPLOYMENT_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! The definition of the deployment. + ENTITY type T_DEPLOYMENT_ENTITY, + end of T_DEPLOYMENT_RESOURCE. + types: + "!

+ "! The deployment resources.

+ begin of T_DEPLOYMENT_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! A list of deployment resources. This will be empty if 'stats' query + "! parameter is passed with 'true'. + RESOURCES type STANDARD TABLE OF T_DEPLOYMENT_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! System details including warnings and stats. This will get populated only if + "! 'stats' query parameter is passed with 'true'. + SYSTEM type T_DEPLOYMENT_RESOURCES_SYSTEM, + end of T_DEPLOYMENT_RESOURCES. + types: + "!

+ "! The details for the revision.

+ begin of T_MODEL_REV_ENTITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_MODEL_REV_ENTITY_REQUEST. + types: + "! No documentation available. + begin of T_TSD_TRAIN_AGGRGTD_SCORE_ITEM, + "! Metric score for the Pipeline 1. + P1 type NUMBER, + end of T_TSD_TRAIN_AGGRGTD_SCORE_ITEM. + types: + "!

+ "! The properties that are part of a request that supports

+ "! spaces and projects. Either `space_id` or `project_id` has to be provided and + "! is mandatory. + begin of T_ENTITY_REQ_SPC_PROJECT_BODY, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + end of T_ENTITY_REQ_SPC_PROJECT_BODY. + types: + "!

+ "! Metrics generated in model selection phase.

+ begin of T_TSAD_TRAINING, + "! This score is calculated based on an aggregation of the optimized metric (for + "! example, Average precision) values for the 4 anomaly types. The scores for each + "! pipeline are ranked, using the Borda count method, and then weighted for their + "! contribution to the aggregate score. Unlike a standard metric score, this value + "! is not between 0 and 1. A higher value indicates a stronger score. + AGGREGATED_SCORE type STANDARD TABLE OF T_TSD_TRAIN_AGGRGTD_SCORE_ITEM WITH NON-UNIQUE DEFAULT KEY, + end of T_TSAD_TRAINING. + types: + "!

+ "! Metrics generated during evaluation of the pipeline on

+ "! holdout data. + begin of T_TS_HOLDOUT, + "! A set of metrics. + HOLDOUT type T_TS_METRIC_LEVELS, + end of T_TS_HOLDOUT. + types: + "!

+ "! This model represents an individual patch operation to be

+ "! performed on an object, as defined by
+ "! [RFC 6902](https://tools.ietf.org/html/rfc6902). + begin of T_JSON_PATCH_OPERATION, + "! The operation to be performed. + OP type STRING, + "! The pointer that identifies the field that is the target of the operation. + PATH type STRING, + "! The value to be used within the operation. + VALUE type STRING, + end of T_JSON_PATCH_OPERATION. + types: + "!

+ "! Arbitrary `XML` file.

+ T_CONTENT_XML type JSONOBJECT. + types: + "!

+ "! See the description in `POST /ml/v4/deployments`.

+ begin of T_DEPLOYMENT_ENTITY_COMMON, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A reference to a resource. + ASSET type T_REL, + "! A hardware specification. + HARDWARE_SPEC type T_HARDWARE_SPEC, + "! Hybrid pipeline hardware specification. + HYBRID_PIPELINE_HARDWARE_SPECS type STANDARD TABLE OF T_HYBRD_PPLN_HRDWR_SPECS_ITEM WITH NON-UNIQUE DEFAULT KEY, + "! Indicates that this is an online deployment. An empty object has to be + "! specified.
+ "! If the online scoring schema has a `type` of `DataFrame` then the scoring + "! payload will be converted to a `Pandas` data frame. + ONLINE type T_ONLINE_REQUEST, + "! Indicates that this is a batch deployment. An empty object has to be specified. + BATCH type T_BATCH_REQUEST, + end of T_DEPLOYMENT_ENTITY_COMMON. + types: + "! No documentation available. + begin of T_TS_TRAINING, + "! Metrics generated during training. + TRAINING type T_TS_TRAINING_TRAINING, + end of T_TS_TRAINING. + types: + "!

+ "! The definition of a model. The `software_spec` is used only

+ "! for training. Either space_id or project_id has to be provided and is + "! mandatory. + begin of T_MODEL_DEFINITION_ENTITY, + "! The package version. + VERSION type STRING, + "! No documentation available. + PLATFORM type T_MODEL_DEF_ENTITY_PLATFORM, + "! The command used to run the model. + COMMAND type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_MODEL_DEFINITION_ENTITY. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAINING_RESOURCE_ENTITY, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! Status of the model. + STATUS type T_TRAINING_STATUS, + end of T_TRAINING_RESOURCE_ENTITY. + types: + "!

+ "! Training resource.

+ begin of T_TRAINING_RESOURCE, + "! Common metadata for a resource where `project_id` or `space_id` must be present. + "! + METADATA type T_RESOURCE_META, + "! The `training_data_references` contain the training datasets and the
+ "! `results_reference` the connection where results will be stored. + ENTITY type T_TRAINING_RESOURCE_ENTITY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_TRAINING_RESOURCE. + types: + "!

+ "! Information for paging when querying resources.

+ begin of T_TRAINING_RESOURCES, + "! The total number of resources. Computed explicitly only when + "! 'total_count=true' query parameter is present. This is in order to + "! avoid performance penalties. + TOTAL_COUNT type INTEGER, + "! The number of items to return in each page. + LIMIT type INTEGER, + "! The reference to the first item in the current page. + FIRST type T_PAGINATION_FIRST, + "! A reference to the first item of the next page, if any. + NEXT type T_PAGINATION_NEXT, + "! No documentation available. + RESOURCES type STANDARD TABLE OF T_TRAINING_RESOURCE WITH NON-UNIQUE DEFAULT KEY, + "! Optional details coming from the service and related to the API call or the + "! associated resource. + SYSTEM type T_SYSTEM_DETAILS, + end of T_TRAINING_RESOURCES. + types: + "!

+ "! The details for the revision.

+ begin of T_PIPELINE_REV_ENTITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_PIPELINE_REV_ENTITY_REQUEST. + types: + "!

+ "! The details of the experiment to be created.

+ begin of T_EXPERIMENT_ENTITY, + "! The label column. + LABEL_COLUMN type STRING, + "! The optional evaluation definition. + EVALUATION_DEFINITION type T_EVALUATION_DEFINITION, + "! The optional training references used by the experiment. + TRAINING_REFERENCES type STANDARD TABLE OF T_TRAINING_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_EXPERIMENT_ENTITY. + types: + "!

+ "! The details for the revision.

+ begin of T_MODEL_DEF_REV_ENTITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_MODEL_DEF_REV_ENTITY_REQUEST. + types: + "! No documentation available. + begin of T_CONTENT_LOCATION_FIELD, + "! Details about the attachments that should be uploaded with this model. + CONTENT_LOCATION type T_CONTENT_LOCATION, + end of T_CONTENT_LOCATION_FIELD. + types: + "!

+ "! See [JSON PATCH RFC

+ "! 6902](https://tools.ietf.org/html/rfc6902). + T_JSON_PATCH type STANDARD TABLE OF T_JSON_PATCH_OPERATION WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! Fields that can be patched.

+ begin of T_TRAIN_DEF_PATCH_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + end of T_TRAIN_DEF_PATCH_HELPER. + types: + "!

+ "! The expiration date of the instance limit.

+ T_LIMIT_EXPIRATION_DATE type Date. + types: + "!

+ "! A list of tags for this resource.

+ T_TAGS type TT_String. + types: + "!

+ "! The details for the revision.

+ begin of T_FUNC_REVISION_ENTITY_REQUEST, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! An optional commit message for the revision. + COMMIT_MESSAGE type STRING, + end of T_FUNC_REVISION_ENTITY_REQUEST. + types: + "!

+ "! The details of the model to be created.

+ begin of T_MODEL_ENTITY, + "! The model type. The supported model types can be found in the documentation
+ "! [here](https://dataplatform.cloud.ibm.com/docs/content/wsj/wmls/wmls-deploy-pyth + "! on-types.html?context=analytics). + TYPE type STRING, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! A reference to a resource. + PIPELINE type T_REL, + "! The model definition. + MODEL_DEFINITION type T_MODEL_DEFINITION_ID, + "! Hyper parameters used for training this model. + HYPER_PARAMETERS type JSONOBJECT, + "! User provided domain name for this model. For example: sentiment, entity, + "! visual-recognition, finance, retail, real estate etc. + DOMAIN type STRING, + "! The training data that was used to create this model. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! If the prediction schemas are provided here then they take precedent over any + "! schemas
+ "! provided in the data references. Note that data references contain the schema + "! for the
+ "! associated data and this object contains the schema(s) for the associated + "! prediction, if any.
+ "! In the case that the prediction input data matches exactly the schema of the + "! training data
+ "! references then the prediction schema can be omitted. However it is highly + "! recommended to
+ "! always specify the prediction schemas using this field. + SCHEMAS type T_MODEL_ENTITY_SCHEMAS, + "! The name of the label column. + LABEL_COLUMN type STRING, + "! The name of the label column seen by the estimator, which may have been + "! transformed by the previous transformers in the pipeline. This is not + "! necessarily the same column as the `label_column` in the initial data set. + TRANSFORMED_LABEL_COLUMN type STRING, + "! This will be used by scoring to record the size of the model. + SIZE type T_MODEL_ENTITY_SIZE, + "! Metrics that can be returned by an operation. + METRICS type STANDARD TABLE OF T_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! User defined objects referenced by the model. For any user defined class or + "! function used in the model, its name, as referenced in the model, must be + "! specified as the `key` and its fully qualified class or function name must be + "! specified as the `value`. This is applicable for `Tensorflow 2.X` models + "! serialized in `H5` format using the `tf.keras` API. + USER_DEFINED_OBJECTS type MAP, + "! The list of the software specifications that are used by the pipeline that + "! generated this model, if the model was generated by a pipeline. + HYBRID_PIPELINE_SOFTWARE_SPECS type STANDARD TABLE OF T_SOFTWARE_SPEC_REL WITH NON-UNIQUE DEFAULT KEY, + "! Optional metadata that can be used to provide information
+ "! about this model that can be tracked with IBM AI Factsheets.
+ "! See [Using AI + "! Factsheets](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fa + "! ctsheets-model-inventory.html) for more details. + MODEL_VERSION type T_MODEL_ENTITY_MODEL_VERSION, + "! Deprecated: this is replaced by `training.id`. This field can be used to store + "! the `id` of the training job that was used to produce this model. + TRAINING_ID type STRING, + "! An optional array which contains the data preprocessing transformations that + "! were executed by the training job that created this model. + DATA_PREPROCESSING type STANDARD TABLE OF T_DT_PRPRCSSNG_TRANSFORMATION WITH NON-UNIQUE DEFAULT KEY, + "! Information about the training job that created this model. + TRAINING type T_TRAINING_DETAILS, + end of T_MODEL_ENTITY. + types: + "!

+ "! The `training_data_references` contain the training datasets

+ "! and the
+ "! `results_reference` the connection where results will be stored. + begin of T_TRAIN_RESOURCE_ENTITY_COMMON, + "! A reference to a resource. + EXPERIMENT type T_REL, + "! A pipeline.
+ "! The `hardware_spec` is a reference to the hardware specification.
+ "! The `hybrid_pipeline_hardware_specs` are used only when training a hybrid + "! pipeline in order to
+ "! specify compute requirement for each pipeline node. + PIPELINE type T_PIPELINE_REL, + "! A model.
+ "! The `software_spec` is a reference to a software specification.
+ "! The `hardware_spec` is a reference to a hardware specification. + MODEL_DEFINITION type T_MODEL_DEFINITION_REL, + "! Federated Learning. + FEDERATED_LEARNING type T_FEDERATED_LEARNING, + "! Training datasets. + TRAINING_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! The training results. + RESULTS_REFERENCE type T_OBJECT_LOCATION, + "! The holdout/test datasets. + TEST_DATA_REFERENCES type STANDARD TABLE OF T_DATA_CONNECTION_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + end of T_TRAIN_RESOURCE_ENTITY_COMMON. + types: + "! No documentation available. + T_FEATURES_IMPORTANCE type STANDARD TABLE OF T_FEATURE_IMPORTANCE WITH NON-UNIQUE DEFAULT KEY. + types: + "!

+ "! Metrics generated during evaluation of the pipeline on

+ "! backtest data. + begin of T_MTRC_TS_METRICS_TS_BACKTEST, + "! Metrics from the backtest data. + BACKTEST type T_TS_METRIC_BACKTEST, + end of T_MTRC_TS_METRICS_TS_BACKTEST. + types: + "!

+ "! Fields that can be patched.

+ begin of T_RMT_TRAIN_SYS_PATCH_HELPER, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! The name of the resource. + NAME type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! A remote organization. + ORGANIZATION type T_ORGANIZATION, + "! The list of allowed identities that are allowed to access the remote system. + ALLOWED_IDENTITIES type STANDARD TABLE OF T_ALLOWED_IDENTITY WITH NON-UNIQUE DEFAULT KEY, + "! The details of the remote administrator for the organization and identities. + REMOTE_ADMIN type T_REMOTE_ADMIN, + end of T_RMT_TRAIN_SYS_PATCH_HELPER. + types: + "!

+ "! The metrics from federated training.

+ begin of T_ML_FEDERATED_METRIC, + "! Remote training systems. + REMOTE_TRAINING_SYSTEMS type STANDARD TABLE OF T_REMOTE_TRAIN_SYSTEM_METRIC WITH NON-UNIQUE DEFAULT KEY, + "! No documentation available. + GLOBAL type NUMBER, + end of T_ML_FEDERATED_METRIC. + types: + "!

+ "! The details of the function to be created.

+ begin of T_FUNCTION_ENTITY_REQUEST, + "! The name of the resource. + NAME type STRING, + "! The project that contains the resource. Either `space_id` or `project_id` has to + "! be given. + PROJECT_ID type STRING, + "! The space that contains the resource. Either `space_id` or `project_id` has to + "! be given. + SPACE_ID type STRING, + "! A description of the resource. + DESCRIPTION type STRING, + "! A list of tags for this resource. + TAGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, + "! A software specification. + SOFTWARE_SPEC type T_SOFTWARE_SPEC_REL, + "! Type of the function to be created. Only `python` type is supported as of now. + "! If not specified, `python` is the default. Functions expect a gzip file that + "! contains a python file that make up the function. Python functions specify what + "! needs to be run when the function is deployed and what needs to be run when the + "! scoring function is called. In other words, you are able to customize what + "! preparation WML does in the environment when you deploy the function, as well + "! as what steps WML takes to generate the output when you call the API later on. + "! The function consists of the outer function (any place that is not within the + "! score function) and the inner score function. The code that sits in the outer + "! function runs when the function is deployed, and the environment is then frozen + "! and ready to be used whenever the online scoring or batch inline job processing + "! API is called. The code that sits in the inner score function runs when the + "! online scoring or batch inline job processing API is called, in the environment + "! customized by the outer function. See [Deploying Python + "! function](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-d + "! eploy-py-function.html?context=cpdaas&audience=wdp) for more details.
+ "!
+ "! This is illustrated in the example below:
+ "!
+ "! ><python code used to set up the environment> \
+ "! >\
+ "! >def score(payload): \
+ "! >    df_payload = + "! pd.DataFrame(payload["values"]) \
+ "! >    df_payload.columns = payload["fields"] + "! \
+ "! >    ... \
+ "! >    output = {"result" : res} \
+ "! >    return output \
+ "! >\
+ "! >return score. + TYPE type STRING, + "! Scoring data. + SAMPLE_SCORING_INPUT type T_SYNC_SCORING_DATA, + "! The schemas of the expected data. + SCHEMAS type T_FUNCTION_ENTITY_SCHEMAS, + "! User defined properties specified as key-value pairs. + CUSTOM type JSONOBJECT, + "! This is a list of references of the models that are used by this function, if + "! any. These references are provided by the owner of the function and are used + "! for usage tracking only. + MODEL_REFERENCES type STANDARD TABLE OF T_MODEL_REFERENCE WITH NON-UNIQUE DEFAULT KEY, + end of T_FUNCTION_ENTITY_REQUEST. + types: + "!

+ "! Array parameter type for method DEPLOYMENT_JOB_DEF_UPDATE

+ TT_JSON_PATCH_OPERATION type STANDARD TABLE OF T_JSON_PATCH_OPERATION WITH NON-UNIQUE DEFAULT KEY. + +constants: + "!

List of required fields per type.

+ begin of C_REQUIRED_FIELDS, + T_DATA_SCHEMA type string value '|ID|FIELDS|', + T_MODEL_ENTITY_SCHEMAS type string value '|', + T_TRAINING_STATUS_HPO type string value '|HYPER_PARAMETERS|', + T_ERROR_ITEM type string value '|CODE|MESSAGE|', + T_ERROR type string value '|TRACE|ERRORS|', + T_MODEL_LOCATION type string value '|', + T_INTERMEDIATE_MODEL type string value '|NAME|PROCESS|', + T_FEATURE_IMPORTANCE type string value '|FEATURES|', + T_CONFUSION_MATRIX type string value '|TRUE_CLASS|TP|TN|FP|FN|', + T_ROC_CURVE type string value '|TRUE_CLASS|TPR|FPR|', + T_MULTI_CLASS_CLASSIFICATION type string value '|CLASS|CONFUSION_MATRIX|ROC_CURVE|', + T_STEP_INFO type string value '|NAME|', + T_INCREMENTAL_TRAINING type string value '|', + T_MULTI_CLASS_CLASSIFICATIONS type string value '|', + T_BINARY_CLASSIFICATION type string value '|', + T_METRICS_CONTEXT type string value '|', + T_FDRTD_LRNNG_INF_AGGRGTR_CNN1 type string value '|', + T_FDRTD_LRNNG_INF_RMT_TRAIN_S3 type string value '|', + T_FDRTD_LRNNG_INF_RMT_TRAIN_S2 type string value '|', + T_FDRTD_LRNNG_INF_RMT_TRAIN_S1 type string value '|', + T_FDRTD_LRNNG_INFO_AGGREGATOR type string value '|', + T_FEDERATED_LEARNING_INFO type string value '|', + T_GPU_METRICS_MEMORY type string value '|MEASURE|VALUE|', + T_GPU_METRICS type string value '|TYPE|', + T_COMPUTE_USAGE_METRICS type string value '|TIMESTAMP|', + T_METRIC type string value '|TIMESTAMP|', + T_TRAINING_STATUS_MESSAGE type string value '|', + T_TRAINING_STATUS type string value '|STATE|', + T_CONSUMPTION_GPU_COUNT type string value '|', + T_TOKEN_COUNT type string value '|CURRENT|', + T_RESOURCE_COMMIT_INFO type string value '|COMMITTED_AT|', + T_MODEL_DEF_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_RESOURCE_META_SIMPLE type string value '|ID|CREATED_AT|', + T_VARIANCE type string value '|', + T_TSAD_HOLDOUT_AGG_PRECISION type string value '|', + T_TSD_HLDT_SPPRTNG_RNK_AVG_PR2 type string value '|', + T_TSD_HLDT_SPPRTNG_RNK_AVG_PR1 type string value '|', + T_TSD_HLDT_ITRTNS_ITM_AVG_PRC1 type string value '|', + T_TSAD_HOLDOUT_ITERATIONS_ITEM type string value '|', + T_TSD_HLDT_AGG_AVG_PRCSN_LVL_1 type string value '|', + T_TSAD_HOLDOUT_SUPPORTING_RANK type string value '|', + T_TSAD_HOLDOUT_AGG_ROC_AUC type string value '|', + T_TSD_HLDT_AGGRGTD_SCORE_ITEM type string value '|', + T_TSD_HLDT_AGG_AVG_PRCSN_TREND type string value '|', + T_TSAD_HOLDOUT_AGG_F1 type string value '|', + T_TSD_HLDT_AGG_AVG_PRCSN_LCLZ1 type string value '|', + T_TSAD_HOLDOUT_AGG_RECALL type string value '|', + T_TSD_HLDT_AGG_AVG_PRECISION type string value '|', + T_TSAD_HOLDOUT_AGG type string value '|', + T_MTRC_TSD_MTRCS_TSAD_HOLDOUT type string value '|', + T_SIMPLE_REL type string value '|ID|', + T_DATA_CONNECTION_REFERENCE type string value '|TYPE|', + T_SCORING_PAYLOAD_OPTIM type string value '|ID|', + T_JOB_STATUS_MESSAGE type string value '|', + T_JOB_STATUS type string value '|', + T_OBJECT_LOCATION_OPTIM type string value '|ID|TYPE|LOCATION|', + T_SOLVE_STATE type string value '|', + T_JB_DCSN_OPTIMIZATION_RESULT type string value '|', + T_SCORING_PAYLOAD type string value '|', + T_EVALUATIONS_SPEC_ITEM type string value '|', + T_JOB_SCORING_RESULT type string value '|', + T_HARDWARE_SPEC type string value '|', + T_HYBRD_PPLN_HRDWR_SPECS_ITEM type string value '|NODE_RUNTIME_ID|HARDWARE_SPEC|', + T_PLATFORM_JOB type string value '|JOB_ID|RUN_ID|', + T_JOB_STATUS_ENTITY type string value '|DEPLOYMENT|', + T_RESOURCE_META type string value '|ID|CREATED_AT|', + T_PAGINATION_FIRST type string value '|HREF|', + T_PAGINATION_NEXT type string value '|HREF|', + T_JOBS_RESOURCE type string value '|', + T_JOBS_RESOURCES type string value '|LIMIT|FIRST|', + T_RMT_TRAIN_SYS_REV_ENTITY_REQ type string value '|', + T_SOFTWARE_SPEC_REL type string value '|', + T_MDL_DEF_ENTITY_REQ_PLATFORM type string value '|NAME|VERSIONS|', + T_MODEL_DEF_ENTITY_REQUEST type string value '|NAME|VERSION|PLATFORM|', + T_FEDERATED_LEARNING_OPTIMIZER type string value '|', + T_JOB_ENTITY_RESULT type string value '|DEPLOYMENT|', + T_WARNING type string value '|MESSAGE|', + T_SYSTEM_DETAILS type string value '|', + T_MODEL_DEF_ENTITY_PLATFORM type string value '|NAME|VERSIONS|', + T_MODEL_DEF_RESOURCE_ENTITY type string value '|VERSION|PLATFORM|', + T_MODEL_DEFINITION_RESOURCE type string value '|METADATA|ENTITY|', + T_MODEL_DEFINITION_RESOURCES type string value '|LIMIT|FIRST|', + T_JOB_SCORING_REQUEST type string value '|', + T_ORGANIZATION type string value '|NAME|', + T_ALLOWED_IDENTITY type string value '|ID|TYPE|', + T_REMOTE_ADMIN type string value '|NAME|', + T_RMT_TRAIN_SYS_RSRC_ENTITY type string value '|ALLOWED_IDENTITIES|', + T_RMT_TRAIN_SYS_RSRC_METADATA type string value '|ID|CREATED_AT|', + T_REMOTE_TRAIN_SYSTEM_RESOURCE type string value '|METADATA|ENTITY|', + T_MODEL_DEFINITION_ID type string value '|', + T_MESSAGE type string value '|', + T_SYNC_SCORING_DATA_ITEM type string value '|', + T_SYNC_SCORING_DATA type string value '|INPUT_DATA|', + T_MODEL_REFERENCE type string value '|ID|', + T_FUNCTION_ENTITY_SCHEMAS type string value '|', + T_FUNCTION_ENTITY type string value '|SOFTWARE_SPEC|', + T_OBJECT_LOCATION type string value '|TYPE|LOCATION|', + T_REL type string value '|ID|', + T_FDRTD_LEARNING_MODEL_SPEC type string value '|', + T_FDRTD_LRNNG_RMT_TRAIN_RMT_T1 type string value '|ID|', + T_FDRTD_LEARNING_REMOTE_TRAIN type string value '|REMOTE_TRAINING_SYSTEMS|', + T_FEDERATED_LEARNING_CRYPTO type string value '|', + T_FEDERATED_LEARNING_MODEL type string value '|TYPE|', + T_FEDERATED_LEARNING type string value '|FUSION_TYPE|REMOTE_TRAINING|', + T_STATS type string value '|', + T_DEPLOYMENT_SYSTEM_DETAILS type string value '|', + T_DEPLOYMENT_RESOURCES_SYSTEM type string value '|', + T_ONLINE_PARAMETERS type string value '|', + T_ONLINE_REQUEST type string value '|', + T_PPLN_REL_DATA_BINDINGS_ITEM type string value '|DATA_REFERENCE_NAME|NODE_ID|', + T_PPLN_REL_NODES_PARAM_ITEM type string value '|NODE_ID|PARAMETERS|', + T_PIPELINE_REL type string value '|ID|', + T_MODEL_DEFINITION_REL type string value '|ID|', + T_TRAIN_DEF_ENTITY_REQUEST type string value '|NAME|RESULTS_REFERENCE|', + T_REMOTE_TRAIN_SYS_ENTITY_REQ type string value '|NAME|ALLOWED_IDENTITIES|', + T_TRAIN_DEF_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_TRAIN_DEF_RESOURCE_ENTITY type string value '|RESULTS_REFERENCE|', + T_TRAINING_DEFINITION_RESOURCE type string value '|METADATA|ENTITY|', + T_TRAIN_DEFINITION_RESOURCES type string value '|LIMIT|FIRST|', + T_FIELD_SOLVE_STATE type string value '|', + T_MODEL_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_CNSMPTN_CAPACITY_UNIT_HOURS type string value '|CURRENT|', + T_CNSMPTN_DEPLOYMENT_JOB_COUNT type string value '|', + T_CONSUMPTION_DO_JOB_COUNT type string value '|', + T_CONSUMPTION_DETAILS type string value '|CONTEXT|', + T_CONSUMPTION type string value '|', + T_PAGINATION type string value '|LIMIT|FIRST|', + T_JB_DECISION_OPTIMIZATION_REQ type string value '|', + T_JOB_RESOURCE_ENTITY type string value '|DEPLOYMENT|', + T_PIPELINE_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_PIPELINE_RESOURCE_ENTITY type string value '|DOCUMENT|', + T_PIPELINE_RESOURCE type string value '|METADATA|ENTITY|', + T_PIPELINE_RESOURCES type string value '|LIMIT|FIRST|', + T_REV_ENTITY_SPACE_REQUEST type string value '|SPACE_ID|', + T_REMOTE_TRAIN_SYSTEM_ENTITY type string value '|ALLOWED_IDENTITIES|', + T_INSTNC_RESOURCE_ENTITY_PLAN type string value '|ID|NAME|VERSION|', + T_RESOURCE_META_BASE type string value '|', + T_BLUEMIX_ACCOUNT type string value '|ID|', + T_INSTANCE_RESOURCE_ENTITY type string value '|STATUS|PLAN|SERVICE_ENDPOINTS|', + T_INSTANCE_RESOURCE type string value '|', + T_TRAIN_RFRNC_HYPR_PRM_OPTMZT1 type string value '|', + T_HYPER_PARAMETER type string value '|NAME|ITEMS|', + T_TRAIN_RFRNC_HYPR_PRM_OPTMZTN type string value '|', + T_EVALUATION_METRIC type string value '|NAME|', + T_EVALUATION_DEFINITION type string value '|METRICS|', + T_TRAINING_REFERENCE type string value '|', + T_EXPERIMENT_ENTITY_REQUEST type string value '|NAME|', + T_DATA_OUTPUT type string value '|', + T_DATA_INPUT type string value '|', + T_DT_PRPRCSSNG_TRANSFORMATION type string value '|', + T_INFERENCE type string value '|URL|', + T_DEPLOYMENT_SCALING type string value '|STATE|', + T_DEPLOYMENT_STATUS type string value '|', + T_MDL_RSRC_ENTITY_MODEL_VER type string value '|', + T_TRAIN_RESOURCE_ENTITY_REQ type string value '|RESULTS_REFERENCE|', + T_MTRC_TSD_MTRCS_TSD_TRAIN_AG1 type string value '|', + T_FUNCTION_RESOURCE_ENTITY type string value '|SOFTWARE_SPEC|', + T_CONTENT_INFO type string value '|CONTENT_FORMAT|LOCATION|FILE_NAME|', + T_CONTENT_LOCATION type string value '|CONTENTS|TYPE|', + T_REMOTE_TRAIN_SYS_RESOURCES type string value '|LIMIT|FIRST|', + T_CONTENT_METADATA type string value '|ATTACHMENT_ID|CONTENT_FORMAT|', + T_ALL_CONTENT_METADATA type string value '|TOTAL_COUNT|ATTACHMENTS|', + T_JOB_ENTITY type string value '|DEPLOYMENT|', + T_PAGINATION_BASE type string value '|LIMIT|FIRST|', + T_TRAINING_WEBSOCKET type string value '|', + T_JOB_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_JOB_RESOURCE type string value '|METADATA|ENTITY|', + T_EXPERIMENT_REV_ENTITY_REQ type string value '|', + T_PIPELINE_ENTITY_REQUEST type string value '|NAME|DOCUMENT|', + T_TS_TRAINING_TRAINING type string value '|', + T_METRIC_TS_METRICS_TS_TRAIN type string value '|', + T_FUNCTION_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_FUNCTION_RESOURCE type string value '|METADATA|ENTITY|', + T_FUNCTION_RESOURCES type string value '|LIMIT|FIRST|', + T_EXPERIMENT_RESOURCE_ENTITY type string value '|', + T_MODEL_RESOURCE_ENTITY_SIZE type string value '|', + T_BASE_MODEL type string value '|', + T_TRAINING_DETAILS type string value '|', + T_MDL_RESOURCE_ENTITY_SCHEMAS type string value '|', + T_MODEL_RESOURCE_ENTITY type string value '|TYPE|SOFTWARE_SPEC|', + T_MODEL_RESOURCE type string value '|METADATA|', + T_MODEL_RESOURCES type string value '|LIMIT|FIRST|', + T_REV_ENTITY_SPC_PROJECT_REQ type string value '|', + T_JOB_REVISION_ENTITY_REQUEST type string value '|SPACE_ID|', + T_MODEL_ENTITY_SIZE type string value '|', + T_FIELD_JOB_STATUS type string value '|', + T_BATCH_REQUEST type string value '|', + T_DEPLOYMENT_ENTITY type string value '|', + T_TRAIN_DEF_REV_ENTITY_REQUEST type string value '|', + T_COMMON_PATCH_REQUEST_HELPER type string value '|', + T_REMOTE_TRAIN_SYSTEM_METRIC type string value '|ID|', + T_INSTANCE_RESOURCES type string value '|LIMIT|FIRST|', + T_EXPERIMENT_RESOURCE_METADATA type string value '|ID|CREATED_AT|', + T_JOB_ENTITY_REQUEST type string value '|SPACE_ID|NAME|DEPLOYMENT|', + T_TS_METRIC_LEVELS type string value '|', + T_METRIC_TS_METRICS_TS_HOLDOUT type string value '|', + T_EXPERIMENT_RESOURCE type string value '|METADATA|ENTITY|', + T_EXPERIMENT_RESOURCES type string value '|LIMIT|FIRST|', + T_ENTITY_REQUEST_SPACE_BODY type string value '|SPACE_ID|NAME|', + T_TSAD_HOLDOUT type string value '|', + T_DPLYMNT_JOB_DEF_PATCH_HELPER type string value '|', + T_EXTRA_MODEL_ENTITY type string value '|', + T_TS_MTRC_BCKTST_ITRTNS_ITEM type string value '|', + T_SYNC_SCORING_DATA_RESULTS type string value '|', + T_PIPELINE_ENTITY type string value '|DOCUMENT|', + T_TRAINING_DEFINITION_ENTITY type string value '|RESULTS_REFERENCE|', + T_JOB_RESOURCES type string value '|LIMIT|FIRST|', + T_SYSTEM type string value '|', + T_MTRC_TSAD_METRICS_TSAD_TRAIN type string value '|', + T_DEPLOYMENT_PATCH_REQ_HELPER type string value '|', + T_DEPLOYMENT_ENTITY_REQUEST type string value '|SPACE_ID|', + T_MODEL_ENTITY_MODEL_VERSION type string value '|', + T_MODEL_ENTITY_REQUEST type string value '|NAME|TYPE|SOFTWARE_SPEC|', + T_TS_METRIC_BACKTEST type string value '|', + T_TS_BACKTEST type string value '|', + T_DEPLOYMENT_RESOURCE type string value '|', + T_DEPLOYMENT_RESOURCES type string value '|LIMIT|FIRST|', + T_MODEL_REV_ENTITY_REQUEST type string value '|', + T_TSD_TRAIN_AGGRGTD_SCORE_ITEM type string value '|', + T_ENTITY_REQ_SPC_PROJECT_BODY type string value '|NAME|', + T_TSAD_TRAINING type string value '|', + T_TS_HOLDOUT type string value '|', + T_JSON_PATCH_OPERATION type string value '|OP|PATH|', + T_DEPLOYMENT_ENTITY_COMMON type string value '|', + T_TS_TRAINING type string value '|', + T_MODEL_DEFINITION_ENTITY type string value '|VERSION|PLATFORM|', + T_TRAINING_RESOURCE_ENTITY type string value '|RESULTS_REFERENCE|', + T_TRAINING_RESOURCE type string value '|', + T_TRAINING_RESOURCES type string value '|LIMIT|FIRST|', + T_PIPELINE_REV_ENTITY_REQUEST type string value '|', + T_EXPERIMENT_ENTITY type string value '|', + T_MODEL_DEF_REV_ENTITY_REQUEST type string value '|', + T_CONTENT_LOCATION_FIELD type string value '|', + T_TRAIN_DEF_PATCH_HELPER type string value '|', + T_FUNC_REVISION_ENTITY_REQUEST type string value '|', + T_MODEL_ENTITY type string value '|TYPE|SOFTWARE_SPEC|', + T_TRAIN_RESOURCE_ENTITY_COMMON type string value '|RESULTS_REFERENCE|', + T_MTRC_TS_METRICS_TS_BACKTEST type string value '|', + T_RMT_TRAIN_SYS_PATCH_HELPER type string value '|', + T_ML_FEDERATED_METRIC type string value '|', + T_FUNCTION_ENTITY_REQUEST type string value '|NAME|SOFTWARE_SPEC|', + __DUMMY type string value SPACE, + end of C_REQUIRED_FIELDS . + +constants: + "!

Map ABAP identifiers to service identifiers.

+ begin of C_ABAPNAME_DICTIONARY, + TAGS type string value 'tags', + NAME type string value 'name', + DESCRIPTION type string value 'description', + CUSTOM type string value 'custom', + INNER type string value 'inner', + DEPLOYMENT type string value 'deployment', + ASSET type string value 'asset', + HARDWARE_SPEC type string value 'hardware_spec', + HYBRID_PIPELINE_HARDWARE_SPECS type string value 'hybrid_pipeline_hardware_specs', + ORGANIZATION type string value 'organization', + ALLOWED_IDENTITIES type string value 'allowed_identities', + REMOTE_ADMIN type string value 'remote_admin', + FEDERATED_LEARNING type string value 'federated_learning', + HREF type string value 'href', + TOTAL_COUNT type string value 'total_count', + LIMIT type string value 'limit', + FIRST type string value 'first', + NEXT type string value 'next', + ID type string value 'id', + CREATED_AT type string value 'created_at', + COMMITTED_AT type string value 'committed_at', + COMMIT_MESSAGE type string value 'commit_message', + REV type string value 'rev', + OWNER type string value 'owner', + MODIFIED_AT type string value 'modified_at', + PARENT_ID type string value 'parent_id', + COMMIT_INFO type string value 'commit_info', + SPACE_ID type string value 'space_id', + PROJECT_ID type string value 'project_id', + NUM_NODES type string value 'num_nodes', + MODEL_TYPE type string value 'model_type', + DATA_BINDINGS type string value 'data_bindings', + NODES_PARAMETERS type string value 'nodes_parameters', + SOFTWARE_SPEC type string value 'software_spec', + COMMAND type string value 'command', + PARAMETERS type string value 'parameters', + MODEL type string value 'model', + FUSION_TYPE type string value 'fusion_type', + REMOTE_TRAINING type string value 'remote_training', + ROUNDS type string value 'rounds', + TERMINATION_PREDICATE type string value 'termination_predicate', + EPOCHS type string value 'epochs', + OPTIMIZER type string value 'optimizer', + LOSS type string value 'loss', + METRICS type string value 'metrics', + MAX_DEPTH type string value 'max_depth', + LEARNING_RATE type string value 'learning_rate', + L2_REGULARIZATION type string value 'l2_regularization', + MAX_BINS type string value 'max_bins', + MAX_LEAF_NODES type string value 'max_leaf_nodes', + MIN_SAMPLES_LEAF type string value 'min_samples_leaf', + RANDOM_STATE type string value 'random_state', + VERBOSE type string value 'verbose', + NUM_CLASSES type string value 'num_classes', + BYZANTINE_THRESHOLD type string value 'byzantine_threshold', + SIGMA type string value 'sigma', + SIGMA0 type string value 'sigma0', + GAMMA type string value 'gamma', + ITERS type string value 'iters', + SAVE_INTERMEDIATE_MODELS type string value 'save_intermediate_models', + CRYPTO type string value 'crypto', + VERSION type string value 'version', + LOG_LEVEL type string value 'log_level', + SKETCH_ACCURACY_VS_PRIVACY type string value 'sketch_accuracy_vs_privacy', + FIELDS type string value 'fields', + TYPE type string value 'type', + CONNECTION type string value 'connection', + LOCATION type string value 'location', + SCHEMA type string value 'schema', + EXPERIMENT type string value 'experiment', + PIPELINE type string value 'pipeline', + MODEL_DEFINITION type string value 'model_definition', + TRAINING_DATA_REFERENCES type string value 'training_data_references', + RESULTS_REFERENCE type string value 'results_reference', + TEST_DATA_REFERENCES type string value 'test_data_references', + MEMORY type string value 'memory', + TIMESTAMP type string value 'timestamp', + GPU_COUNT type string value 'gpu_count', + GPUS type string value 'gpus', + AGGREGATOR type string value 'aggregator', + REMOTE_TRAINING_SYSTEMS type string value 'remote_training_systems', + TRAINING type string value 'training', + NG_SYMMTRC_MN_ABSLT_PRCNTG_ERR type string value 'neg_symmetric_mean_absolute_percentage_error', + NG_AVG_SYMMTRC_MN_ABSLT_PRCNT1 type string value 'neg_avg_symmetric_mean_absolute_percentage_error', + R2 type string value 'r2', + AVG_R2 type string value 'avg_r2', + NEG_ROOT_MEAN_SQUARED_ERROR type string value 'neg_root_mean_squared_error', + NEG_AVG_ROOT_MEAN_SQUARED_ERR type string value 'neg_avg_root_mean_squared_error', + NEG_MEAN_ABSOLUTE_ERROR type string value 'neg_mean_absolute_error', + NEG_AVG_MEAN_ABSOLUTE_ERROR type string value 'neg_avg_mean_absolute_error', + HOLDOUT type string value 'holdout', + AVG type string value 'avg', + ITERATIONS type string value 'iterations', + BACKTEST type string value 'backtest', + MEAN type string value 'mean', + RANGE type string value 'range', + AGG type string value 'agg', + SUPPORTING_RANK type string value 'supporting_rank', + AGGREGATED_SCORE type string value 'aggregated_score', + LOCAL type string value 'local', + FUSED type string value 'fused', + GLOBAL type string value 'global', + PIPELINE_MODEL type string value 'pipeline_model', + PROCESS type string value 'process', + NOTEBOOK_LOCATION type string value 'notebook_location', + SDK_NOTEBOOK_LOCATION type string value 'sdk_notebook_location', + PIPELINE_NODES type string value 'pipeline_nodes', + COMPOSITION_STEPS type string value 'composition_steps', + DURATION type string value 'duration', + MODEL_ASSET type string value 'model_asset', + STARTED_AT type string value 'started_at', + COMPLETED_AT type string value 'completed_at', + HYPER_PARAMETERS type string value 'hyper_parameters', + DATA_ALLOCATION type string value 'data_allocation', + ESTIMATOR type string value 'estimator', + TRANSFORMER type string value 'transformer', + SCORE type string value 'score', + TRUE_CLASS type string value 'true_class', + TP type string value 'tp', + TN type string value 'tn', + FP type string value 'fp', + FN type string value 'fn', + TPR type string value 'tpr', + FPR type string value 'fpr', + THRESHOLDS type string value 'thresholds', + CONFUSION_MATRICES type string value 'confusion_matrices', + ROC_CURVES type string value 'roc_curves', + CLASS type string value 'class', + CONFUSION_MATRIX_LOCATION type string value 'confusion_matrix_location', + CONFUSION_MATRIX type string value 'confusion_matrix', + ROC_CURVE_LOCATION type string value 'roc_curve_location', + ROC_CURVE type string value 'roc_curve', + ONE_VS_ALL type string value 'one_vs_all', + ONE_VS_ALL_LOCATION type string value 'one_vs_all_location', + COMPUTATION_TYPE type string value 'computation_type', + FEATURES type string value 'features', + MIN_MAX_NORMALIZATION type string value 'min_max_normalization', + ITERATION type string value 'iteration', + TOTAL_ITERATIONS type string value 'total_iterations', + MEASURES_LOCATION type string value 'measures_location', + TRAIN_BATCH_SAMPLES_COUNT type string value 'train_batch_samples_count', + HOLDOUT_SAMPLES_COUNT type string value 'holdout_samples_count', + EARLY_STOP_TRIGGERED type string value 'early_stop_triggered', + DEPLOYMENT_ID type string value 'deployment_id', + INTERMEDIATE_MODEL type string value 'intermediate_model', + PHASE type string value 'phase', + STEP type string value 'step', + CLASSES type string value 'classes', + BINARY_CLASSIFICATION type string value 'binary_classification', + MULTI_CLASS_CLASSIFICATION type string value 'multi_class_classification', + FEATURES_IMPORTANCE type string value 'features_importance', + ESTIMATORS type string value 'estimators', + INCREMENTAL_TRAINING type string value 'incremental_training', + PREDICTION_TYPE type string value 'prediction_type', + ML_METRICS type string value 'ml_metrics', + TS_METRICS type string value 'ts_metrics', + TSAD_METRICS type string value 'tsad_metrics', + ML_FEDERATED_METRICS type string value 'ml_federated_metrics', + CONTEXT type string value 'context', + CODE type string value 'code', + MESSAGE type string value 'message', + MORE_INFO type string value 'more_info', + TRACE type string value 'trace', + ERRORS type string value 'errors', + RUNNING_AT type string value 'running_at', + STATE type string value 'state', + COMPUTE_USAGE_METRICS type string value 'compute_usage_metrics', + HPO type string value 'hpo', + FEDERATED_LEARNING_INFO type string value 'federated_learning_info', + FAILURE type string value 'failure', + STATUS type string value 'status', + ADDITIONAL_PROPERTIES type string value 'additional_properties', + WARNINGS type string value 'warnings', + METADATA type string value 'metadata', + ENTITY type string value 'entity', + SYSTEM type string value 'system', + RESOURCES type string value 'resources', + SERVING_NAME type string value 'serving_name', + ONLINE type string value 'online', + BATCH type string value 'batch', + LEVEL type string value 'level', + TEXT type string value 'text', + URL type string value 'url', + SSE type string value 'sse', + USES_SERVING_NAME type string value 'uses_serving_name', + ATTEMPTED_AT type string value 'attempted_at', + REQUESTED_REPLICAS type string value 'requested_replicas', + DEPLOYED_REPLICAS type string value 'deployed_replicas', + INFERENCE type string value 'inference', + SERVING_URLS type string value 'serving_urls', + SCALING type string value 'scaling', + DEPLOYED_ASSET_TYPE type string value 'deployed_asset_type', + ONLINE_COUNT type string value 'online_count', + BATCH_COUNT type string value 'batch_count', + STATS type string value 'stats', + OP type string value 'op', + PATH type string value 'path', + VALUE type string value 'value', + VALUES type string value 'values', + INPUT_DATA type string value 'input_data', + TARGETS type string value 'targets', + PREDICTIONS type string value 'predictions', + INPUT_DATA_REFERENCES type string value 'input_data_references', + OUTPUT_DATA_REFERENCE type string value 'output_data_reference', + EVALUATIONS type string value 'evaluations', + ENVIRONMENT_VARIABLES type string value 'environment_variables', + CONTENT type string value 'content', + SOLVE_PARAMETERS type string value 'solve_parameters', + OUTPUT_DATA type string value 'output_data', + OUTPUT_DATA_REFERENCES type string value 'output_data_references', + DETAILS type string value 'details', + SOLVE_STATUS type string value 'solve_status', + INTERRUPTION_STATUS type string value 'interruption_status', + LATEST_ENGINE_ACTIVITY type string value 'latest_engine_activity', + SOLVE_STATE type string value 'solve_state', + SCORING type string value 'scoring', + DECISION_OPTIMIZATION type string value 'decision_optimization', + JOB_ID type string value 'job_id', + RUN_ID type string value 'run_id', + PLATFORM_JOB type string value 'platform_job', + FRAMEWORK type string value 'framework', + CAPACITY_UNIT_HOURS type string value 'capacity_unit_hours', + TOKEN_COUNT type string value 'token_count', + CURRENT type string value 'current', + DO_JOB_COUNT type string value 'do_job_count', + DEPLOYMENT_JOB_COUNT type string value 'deployment_job_count', + PLAN type string value 'plan', + CRN type string value 'crn', + ACCOUNT type string value 'account', + CONSUMPTION type string value 'consumption', + SERVICE_ENDPOINTS type string value 'service_endpoints', + MAXIMIZE type string value 'maximize', + METHOD type string value 'method', + ITEMS type string value 'items', + HYPER_PARAMETERS_OPTIMIZATION type string value 'hyper_parameters_optimization', + LABEL_COLUMN type string value 'label_column', + EVALUATION_DEFINITION type string value 'evaluation_definition', + TRAINING_REFERENCES type string value 'training_references', + SAMPLE_SCORING_INPUT type string value 'sample_scoring_input', + SCHEMAS type string value 'schemas', + MODEL_REFERENCES type string value 'model_references', + ATTACHMENT_ID type string value 'attachment_id', + CONTENT_FORMAT type string value 'content_format', + PIPELINE_NODE_ID type string value 'pipeline_node_id', + PERSISTED type string value 'persisted', + DOCUMENT type string value 'document', + ROWS type string value 'rows', + COLUMNS type string value 'columns', + STAGE type string value 'stage', + INPUT type string value 'input', + OUTPUT type string value 'output', + PROPS type string value 'props', + MODEL_ID type string value 'model_id', + BASE_MODEL type string value 'base_model', + TASK_ID type string value 'task_id', + VERBALIZER type string value 'verbalizer', + DOMAIN type string value 'domain', + TRANSFORMED_LABEL_COLUMN type string value 'transformed_label_column', + SIZE type string value 'size', + USER_DEFINED_OBJECTS type string value 'user_defined_objects', + HYBRID_PIPELINE_SOFTWARE_SPECS type string value 'hybrid_pipeline_software_specs', + MODEL_VERSION type string value 'model_version', + TRAINING_ID type string value 'training_id', + DATA_PREPROCESSING type string value 'data_preprocessing', + CONTENT_IMPORT_STATE type string value 'content_import_state', + FILE_NAME type string value 'file_name', + CONTENTS type string value 'contents', + CONTENT_LOCATION type string value 'content_location', + ATTACHMENTS type string value 'attachments', + PLATFORM type string value 'platform', + ALLOWED_IPS type string value 'allowed_ips', + REGION type string value 'region', + EMAIL type string value 'email', + VERSIONS type string value 'versions', + SPEC type string value 'spec', + MODEL_FILE type string value 'model_file', + QUORUM type string value 'quorum', + MAX_TIMEOUT type string value 'max_timeout', + CIPHER_SPEC type string value 'cipher_spec', + IN_MEMORY type string value 'in_memory', + NUMBER type string value 'number', + TAG type string value 'tag', + NODE_RUNTIME_ID type string value 'node_runtime_id', + AVERAGE_PRECISION type string value 'average_precision', + ROC_AUC type string value 'roc_auc', + F1 type string value 'f1', + PRECISION type string value 'precision', + RECALL type string value 'recall', + P1 type string value 'p1', + P2 type string value 'p2', + P3 type string value 'p3', + P4 type string value 'p4', + P5 type string value 'p5', + P6 type string value 'p6', + MEASURE type string value 'measure', + EXPIRATION_DATE type string value 'expiration_date', + DATA_REFERENCE_NAME type string value 'data_reference_name', + NODE_ID type string value 'node_id', + INPUT_TARGET type string value 'input_target', + METRICS_NAMES type string value 'metrics_names', + STATES type string value 'states', + LEVEL_SHIFT type string value 'level_shift', + LOCALIZED_EXTREME type string value 'localized_extreme', + TREND type string value 'trend', + VARIANCE type string value 'variance', + HOST type string value 'host', + PORT type string value 'port', + ENDPOINT type string value 'endpoint', + PROTOCOL type string value 'protocol', + HEADERS type string value 'headers', + REQUIRED type string value 'required', + REGISTRATION_LOG type string value 'registration_log', + EVENT type string value 'event', + end of C_ABAPNAME_DICTIONARY . + + + methods GET_APPNAME + redefinition . + methods GET_REQUEST_PROP + redefinition . + methods GET_SDK_VERSION_DATE + redefinition . + + + "!

Create a new WML deployment

+ "! Create a new deployment, the parameters specifying the deployment type are + "! `online` and `batch`.
+ "! These parameters are mutually exclusive, specify only one of these when creating + "! a deployment.
+ "! Use `hybrid_pipeline_hardware_specs` only when creating a `batch` deployment job + "! of a hybrid pipeline in order to specify compute configuration for each + "! pipeline node. For all other `batch` deployment cases use `hardware_spec` to + "! specify compute configuration. The `hybrid_pipeline_hardware_specs` and + "! `hardware_spec` are mutually exclusive, specify only one of these when creating + "! a deployment.
+ "! For `batch` deployments, `hardware_spec.num_nodes` parameter is not currently + "! supported.
+ "! For `online` deployments, `hardware_spec` cannot be specified at the time of + "! creation, `hardware_spec.num_nodes` parameter is not supported as part of `POST + "! /ml/v4/deployments` API request, but it can be updated using `PATCH + "! /ml/v4/deployments/<deployment id>`.
+ "! For `online` deployments, `serving_name` can be provided in + "! `online.parameters`.
+ "! The serving name can have the characters `[a-z,0-9,_]` and must not be more than + "! 36 characters.
+ "! The `serving_name` can be used in the prediction URL in place of the + "! `deployment_id`.
+ "! See the documentation [supported + "! frameworks](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm + "! _service_supported_frameworks.html?context=cpdaas&audience=wdp) for details + "! about which frameworks can be used in a deployment.
+ "! + "! + "! @parameter I_DEPLOYMENTENTITYREQUEST | + "! The deployment entity. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_CREATE + importing + !I_DEPLOYMENTENTITYREQUEST type T_DEPLOYMENT_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployments

+ "! Retrieve the list of deployments for the specified space.
+ "! + "! + "! @parameter I_SPACE_ID | + "! Retrieves the deployments that belong to this space. + "! @parameter I_SERVING_NAME | + "! Retrieves the deployment, if any, that contains this `serving_name`. + "! @parameter I_TAG_VALUE | + "! Retrieves only the resources with the given tag value. + "! @parameter I_ASSET_ID | + "! Retrieves only the resources with the given asset_id, asset_id would be either + "! model_id or function_id. + "! @parameter I_NAME | + "! Retrieves only the resources with the given name. + "! @parameter I_TYPE | + "! Retrieves the resources filtered with the given type. Allowed values are + "! `model`, `function`, `py_script` and `do`. + "! @parameter I_STATE | + "! Retrieves the resources filtered by state. Allowed values are `initializing`, + "! `updating`, `ready` and `failed`. + "! @parameter I_STATS | + "! Returns stats about deployments within a space or across spaces if it is set to + "! true. This query parameter cannot be combined with any other except for + "! 'space_id'. + "! @parameter I_CONFLICT | + "! Returns whether serving_name is available for use or not. This query parameter + "! cannot be combined with any other except for 'serving_name'. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_LIST + importing + !I_SPACE_ID type STRING optional + !I_SERVING_NAME type STRING optional + !I_TAG_VALUE type STRING optional + !I_ASSET_ID type STRING optional + !I_NAME type STRING optional + !I_TYPE type STRING optional + !I_STATE type STRING optional + !I_STATS type BOOLEAN optional + !I_CONFLICT type BOOLEAN default c_boolean_false + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment details

+ "! Retrieve the deployment details with the specified identifier.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_SPACE_ID | + "! Retrieves the deployments of assets that belong to this space. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_GET + importing + !I_DEPLOYMENT_ID type STRING + !I_SPACE_ID type STRING + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the deployment

+ "! Delete the deployment with the specified identifier.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_SPACE_ID | + "! Retrieves the deployments of assets that belong to this space. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_DELETE + importing + !I_DEPLOYMENT_ID type STRING + !I_SPACE_ID type STRING + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the deployment metadata

+ "! Update the deployment metadata.
+ "! The following parameters of deployment metadata are supported for the patch + "! operation.
+ "! - `/tags` - `/name` - `/description` - `/custom` - `/hardware_spec` - + "! `/hybrid_pipeline_hardware_specs` - `/asset` - `/online/parameters`
+ "! In case of online deployments, using PATCH operation of `/ml/v4/deployments`, + "! users can update the number of copies of an online deployment.
+ "! Users can specify the desired value of number of copies in + "! `hardware_spec.num_nodes` parameter.
+ "! As `hardware_spec.name` or `hardware_spec.id` is mandatory for `hardware_spec` + "! schema, a valid value such as `XS`, `S` must be specified for + "! `hardware_spec.name` parameter as part of PATCH request. Alternatively, users + "! can also specify a valid ID of a hardware specification in `hardware_spec.id` + "! parameter. However, changes related to `hardware_spec.name` or + "! `hardware_spec.id` specified in PATCH operation will not be applied for online + "! deployments.
+ "! <br />
+ "! In case of batch deployments, using PATCH operation of `/ml/v4/deployments`, + "! users can update the hardware specification so that subsequent batch deployment + "! jobs can make use of the updated compute configurations. To update the compute + "! configuration, users must specify a valid value for either `hardware_spec.name` + "! or `hardware_spec.id` of the hardware specification that suits their + "! requirement. In the batch deployment context, `hardware_spec.num_nodes` + "! parameter is not currently supported.
+ "! <br />
+ "! When 'asset' is patched with id/rev:
+ "! - Deployment with the patched id/rev is started. - If the deployment is + "! asynchronous, 202 response code will be returned and
+ "! one can poll the deployment status thereafter.
+ "! - If the deployment is synchronous, 200 response code will be returned with
+ "! patched deployment response.
+ "! - If any failures, deployment will be reverted back to the previous id/rev
+ "! and the failure message will be captured in 'failures' field in + "! the
+ "! response.
+ "!
+ "! In the case of an online deployment, the PATCH operation with path specified as + "! `/online/parameters` can be used to update the `serving_name`.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The deployment id. + "! @parameter I_SPACE_ID | + "! Retrieves the deployments of assets that belong to this space. + "! @parameter I_JSON_PATCH | + "! The json patch. + "! @parameter E_RESPONSE | + "! Service return value of type T_DEPLOYMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_UPDATE + importing + !I_DEPLOYMENT_ID type STRING + !I_SPACE_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_DEPLOYMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Execute a synchronous deployment prediction

+ "! Execute a synchronous prediction for the deployment with the specified + "! identifier.
+ "! If a `serving_name` is used then it must match the `serving_name` that is + "! returned in the `inference` field.
+ "! + "! + "! @parameter I_DEPLOYMENT_ID | + "! The `deployment_id` can be either the `deployment_id` that identifies the + "! deployment or a `serving_name` that allows a predefined URL to be used to post + "! a prediction. + "! @parameter I_SYNCSCORINGDATA | + "! The scoring data. + "! @parameter E_RESPONSE | + "! Service return value of type T_SYNC_SCORING_DATA_RESULTS + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENTS_COMPUTE_PREDICT + importing + !I_DEPLOYMENT_ID type STRING + !I_SYNCSCORINGDATA type T_SYNC_SCORING_DATA + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_SYNC_SCORING_DATA_RESULTS + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Retrieve the deployment jobs

+ "! Retrieve the status of the current jobs. The system will apply a max limit of + "! jobs retained by the system
+ "! as we cannot accumulate an infinite number of jobs. Only most recent 300 jobs + "! (system configurable)
+ "! will be preserved. Older jobs will be purged by the system.
+ "! + "! + "! @parameter I_SPACE_ID | + "! Retrieves the deployment jobs that belong to this space. + "! @parameter I_TAG_VALUE | + "! Retrieves only the jobs with these tags (comma separated). + "! @parameter I_STATE | + "! Filter based on on the deployment job state: queued, running, completed, failed + "! etc. + "! @parameter I_DEPLOYMENT_ID | + "! Filter based on the deployment_id. + "! @parameter I_INCLUDE | + "! Retrieves only fields from `decision_optimization` and `scoring` section + "! mentioned as comma separated values as output response fields. Retrieves all + "! the fields if not mentioned. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOBS_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOBS_LIST + importing + !I_SPACE_ID type STRING + !I_TAG_VALUE type STRING optional + !I_STATE type STRING optional + !I_DEPLOYMENT_ID type STRING optional + !I_INCLUDE type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOBS_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Start an asynchronous deployment job

+ "! Start a deployment job asynchronously. This can perform batch scoring, + "! streaming, or other types of batch
+ "! operations, such as solving a Decision Optimization problem.
+ "! Depending on the `version` date passed, the `platform_jobs` section in the + "! response may or may not be populated.
+ "! Use the GET call to retrieve the deployment job, this GET call will eventually + "! populate the `platform_jobs` section.
+ "! Refer to the `version date` description for more details.
+ "! + "! + "! @parameter I_JOBENTITYREQUEST | + "! The request body contains information about the batch deployment job that is + "! described in more detail below.
+ "!
+ "! The `deployment` is a reference to the deployment associated with the deployment + "! job or deployment job definition.
+ "!
+ "! The `scoring` and `decision_optimization` properties are mutually exclusive. + "! Specify only one of these when submitting a batch deployment job, one of these + "! fields must be defined.
+ "!
+ "! Use `hybrid_pipeline_hardware_specs` only in a batch deployment job of a hybrid + "! pipeline in order to specify compute configuration for each pipeline node. For + "! all other cases use `hardware_spec` to specify compute configuration.
+ "!
+ "! In case of output data references where the data asset is a remote database, + "! users can specify if the batch deployment output must be appended to the table + "! or if the table is to be truncated and output data updated. The + "! `output_data_references.location.write_mode` parameter can be used to for this + "! purpose. The values `truncate` or `append` can be specified for + "! `output_data_references.location.write_mode` parameter.
+ "! * Specifying `truncate` as value will truncate the table and the batch output + "! data will be inserted.
+ "! * Specifying `append` as value will insert the batch output data to the remote + "! database table.
+ "! * The `write_mode` parameter is applicable only for `output_data_references` + "! parameter.
+ "! * The `write_mode` parameter will be applicable only for remote database related + "! data assets. This parameter will not be applicable for local data assets or a + "! COS based data asset. + "! @parameter I_RETENTION | + "! Defines number of days to retain the job meta. Job meta will be auto deleted + "! after that. Value '-1' sets the meta to be never auto deleted. + "! accepted values are positive integer and '-1'. The default value if + "! the parameter is not passed is '30' days. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOBS_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOBS_CREATE + importing + !I_JOBENTITYREQUEST type T_JOB_ENTITY_REQUEST + !I_RETENTION type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOBS_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Cancel the deployment job

+ "! Cancel the specified deployment job.
+ "! + "! + "! @parameter I_JOB_ID | + "! The id of the job. + "! @parameter I_SPACE_ID | + "! Cancel the deployment job that belong to this space. + "! @parameter I_HARD_DELETE | + "! Set to true in order to also delete the job metadata information. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOBS_DELETE + importing + !I_JOB_ID type STRING + !I_SPACE_ID type STRING + !I_HARD_DELETE type BOOLEAN optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment job

+ "! Retrieve the deployment job. The predicted data bound to this job_id is going + "! to
+ "! be kept around for a limited time based on the service configuration.
+ "! + "! + "! @parameter I_JOB_ID | + "! The id of the job. + "! @parameter I_SPACE_ID | + "! Retrieve the deployment job that belong to this space. + "! @parameter I_INCLUDE | + "! Retrieves only fields from `decision_optimization` and `scoring` section + "! mentioned as comma separated values as output response fields. Retrieves all + "! the fields if not mentioned. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOBS_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOBS_GET + importing + !I_JOB_ID type STRING + !I_SPACE_ID type STRING + !I_INCLUDE type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOBS_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new deployment job definition

+ "! Create a new deployment job definition with the given payload. A deployment job + "! definition represents the deployment metadata information in order to create a + "! batch job in WML. This contains the same metadata used by the + "! /ml/v4/deployment_jobs endpoint. This means that when submitting batch + "! deployment jobs the user can either provide the job definition inline or + "! reference a job definition in a query parameter.
+ "! + "! + "! @parameter I_JOBENTITYREQUEST | + "! Payload for creating the deployment job definition. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_CREATE + importing + !I_JOBENTITYREQUEST type T_JOB_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment job definitions

+ "! Retrieve the deployment job definitions for the specified space.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_LIST + importing + !I_SPACE_ID type STRING + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment job definition

+ "! Retrieve the deployment job definition with the specified identifier. If `rev` + "! query parameter is provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record.
+ "! + "! + "! @parameter I_JOB_DEFINITION_ID | + "! Deployment job definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEFINITIONS_GET + importing + !I_JOB_DEFINITION_ID type STRING + !I_SPACE_ID type STRING + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the deployment job definition

+ "! Update the deployment job definition with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! - `/deployment`
+ "! + "! + "! @parameter I_JOB_DEFINITION_ID | + "! Deployment job definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_UPDATE + importing + !I_JOB_DEFINITION_ID type STRING + !I_SPACE_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the deployment job definition

+ "! Delete the deployment job definition with the specified identifier. This will + "! delete all revisions of
+ "! this deployment job definition as well. For each revision all attachments will + "! also be deleted.
+ "! + "! + "! @parameter I_JOB_DEFINITION_ID | + "! Deployment job definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_DELETE + importing + !I_JOB_DEFINITION_ID type STRING + !I_SPACE_ID type STRING + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new deployment job definition revision

+ "! Create a new deployment job definition revision.
+ "! The current metadata and content for
+ "! job_definition_id will be taken and a new revision created.
+ "! + "! + "! @parameter I_JOB_DEFINITION_ID | + "! Deployment job definition identifier. + "! @parameter I_JOBREVISIONENTITYREQUEST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_CRE_REV + importing + !I_JOB_DEFINITION_ID type STRING + !I_JOBREVISIONENTITYREQUEST type T_JOB_REVISION_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the deployment job definition revisions

+ "! Retrieve the deployment job definition revisions.
+ "! + "! + "! @parameter I_JOB_DEFINITION_ID | + "! Deployment job definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_JOB_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods DEPLOYMENT_JOB_DEF_LST_REV + importing + !I_JOB_DEFINITION_ID type STRING + !I_SPACE_ID type STRING + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_JOB_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new experiment

+ "! Create a new experiment with the given payload. An experiment represents an + "! asset that captures a set of `pipeline` or `model definition` assets that will + "! be trained at the same time on the same data set.
+ "! + "! + "! @parameter I_EXPERIMENTENTITYREQUEST | + "! Payload for creating the experiment. Either `space_id` or `project_id` has to be + "! provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_CREATE + importing + !I_EXPERIMENTENTITYREQUEST type T_EXPERIMENT_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the experiments

+ "! Retrieve the experiments for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the experiment

+ "! Retrieve the experiment with the specified identifier. If `rev` query parameter + "! is provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_EXPERIMENT_ID | + "! Experiment identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_GET + importing + !I_EXPERIMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the experiment

+ "! Update the experiment with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! + "! + "! @parameter I_EXPERIMENT_ID | + "! Experiment identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_UPDATE + importing + !I_EXPERIMENT_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the experiment

+ "! Delete the experiment with the specified identifier. This will delete all + "! revisions of
+ "! this experiment as well. For each revision all attachments will also be + "! deleted.
+ "! + "! + "! @parameter I_EXPERIMENT_ID | + "! Experiment identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_DELETE + importing + !I_EXPERIMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new experiment revision

+ "! Create a new experiment revision.
+ "! The current metadata and content for
+ "! experiment_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_EXPERIMENT_ID | + "! Experiment identifier. + "! @parameter I_EXPRMNTRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_CREATE_REVISION + importing + !I_EXPERIMENT_ID type STRING + !I_EXPRMNTRVSNNTTYRQST type T_EXPERIMENT_REV_ENTITY_REQ + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the experiment revisions

+ "! Retrieve the experiment revisions.
+ "! + "! + "! @parameter I_EXPERIMENT_ID | + "! Experiment identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_EXPERIMENT_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods EXPERIMENTS_LIST_REVISIONS + importing + !I_EXPERIMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_EXPERIMENT_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new function

+ "! Create a new function with the given payload. A function is some code that can + "! be deployed as an online, or batch deployment.
+ "! + "! + "! @parameter I_FUNCTIONENTITYREQUEST | + "! Payload for creating the function. Either `space_id` or `project_id` has to be + "! provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_CREATE + importing + !I_FUNCTIONENTITYREQUEST type T_FUNCTION_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the functions

+ "! Retrieve the functions for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the function

+ "! Retrieve the function with the specified identifier. If `rev` query parameter is + "! provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_GET + importing + !I_FUNCTION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the function

+ "! Update the function with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_UPDATE + importing + !I_FUNCTION_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the function

+ "! Delete the function with the specified identifier. This will delete all + "! revisions of
+ "! this function as well. For each revision all attachments will also be + "! deleted.
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_DELETE + importing + !I_FUNCTION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new function revision

+ "! Create a new function revision.
+ "! The current metadata and content for
+ "! function_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_FNCTNRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_CREATE_REVISION + importing + !I_FUNCTION_ID type STRING + !I_FNCTNRVSNNTTYRQST type T_FUNC_REVISION_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the function revisions

+ "! Retrieve the function revisions.
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_FUNCTION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_LIST_REVISIONS + importing + !I_FUNCTION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_FUNCTION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Upload the function code

+ "! Upload the function code. Functions expect a zip file that contains a python + "! file that make up the function. Python functions specify what needs to be + "! run when the function is deployed and what needs to be run when the scoring + "! function is called. In other words, you are able to customize what + "! preparation WML does in the environment when you deploy the function, as + "! well as what steps WML takes to generate the output when you call the API + "! later on. The function consists of the outer function (any place that is + "! not within the score function) and the inner score function. The code that + "! sits in the outer function runs when the function is deployed, and the + "! environment is then frozen and ready to be used whenever the online scoring + "! or batch inline job processing API is called. The code that sits in the + "! inner score function runs when the online scoring or batch inline job + "! processing API is called, in the environment customized by the outer function. + "! See [Deploying Python + "! function](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-d + "! eploy-py-function.html?context=cpdaas${content_description}audience=wd + "! p) for more details. This is illustrated in the example below: + "! <pre> <br /> ...python code used to set up the environment... + "! <br /> <br /> def score(payload): <br /> + "! df_payload = pd.DataFrame(payload[values]) <br /> + "! df_payload.columns = payload[fields] <br /> ... <br /> + "! output = {result : res} <br /> return output <br + "! /> <br /> return score <br /> </pre>
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_UPLOAD_CODE | + "! A gzip file containing code files. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_CONTENT_METADATA + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_UPLOAD_CODE + importing + !I_FUNCTION_ID type STRING + !I_UPLOAD_CODE type FILE + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/gzip' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_CONTENT_METADATA + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Download the function code

+ "! Download the function code.
+ "! It is possible to get the `code` for a given
+ "! revision of the `function`.
+ "! Functions expect a zip file that contains a python file that make up the + "! function. Python functions specify what needs to be run when the function + "! is deployed and what needs to be run when the scoring function is called. + "! In other words, you are able to customize what preparation WML does in the + "! environment when you deploy the function, as well as what steps WML takes to + "! generate the output when you call the API later on. The function consists of + "! the outer function (any place that is not within the score function) and + "! the inner score function. The code that sits in the outer function runs + "! when the function is deployed, and the environment is then frozen and ready + "! to be used whenever the online scoring or batch inline job processing API + "! is called. The code that sits in the inner score function runs when the + "! online scoring or batch inline job processing API is called, in the + "! environment customized by the outer function. See [Deploying Python + "! function](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-d + "! eploy-py-function.html?context=cpdaas${content_description}audience=wd + "! p) for more details. This is illustrated in the example below: + "! <pre> <br /> ...python code used to set up the environment... + "! <br /> <br /> def score(payload): <br /> + "! df_payload = pd.DataFrame(payload[values]) <br /> + "! df_payload.columns = payload[fields] <br /> ... <br /> + "! output = {result : res} <br /> return output <br + "! /> <br /> return score <br /> </pre>
+ "! + "! + "! @parameter I_FUNCTION_ID | + "! Function identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type FILE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods FUNCTIONS_DOWNLOAD_CODE + importing + !I_FUNCTION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/zip' + exporting + !E_RESPONSE type FILE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Retrieve the service instances

+ "! Retrieve the service instances. Either `space_id` or `project_id` query + "! parameter is mandatory but both can be provided. + "! + "! @parameter I_SPACE_ID | + "! Return resources pertaining to any space_id listed. Either `space_id` or + "! `project_id` query parameter is mandatory but both can be provided. + "! @parameter I_PROJECT_ID | + "! Return resources pertaining to any project_id listed. Either `space_id` or + "! `project_id` query parameter is mandatory but both can be provided. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_CONSUMPTION_DETAILS | + "! Only if `consumption_details` is set to `true` each instance + "! `entity.consumption.details` part is available in response. + "! @parameter E_RESPONSE | + "! Service return value of type T_INSTANCE_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods INSTANCES_LIST + importing + !I_SPACE_ID type TT_STRING optional + !I_PROJECT_ID type TT_STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_CONSUMPTION_DETAILS type BOOLEAN default c_boolean_false + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_INSTANCE_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the service instance

+ "! Retrieve the service instance details.
+ "! + "! + "! @parameter I_INSTANCE_ID | + "! The instance identifier. + "! @parameter I_SPACE_ID | + "! Defines authorization context that allows a space member to perform this + "! operation. + "! @parameter I_PROJECT_ID | + "! Defines authorization context that allows a project member to perform this + "! operation. + "! @parameter I_CONSUMPTION_DETAILS | + "! Only if `consumption_details` is set to `true` the instance + "! `entity.consumption.details` part is available in response. + "! @parameter E_RESPONSE | + "! Service return value of type T_INSTANCE_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods INSTANCES_GET + importing + !I_INSTANCE_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_CONSUMPTION_DETAILS type BOOLEAN default c_boolean_false + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_INSTANCE_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new model

+ "! Create a new model with the given payload. A model represents a machine learning + "! model asset.
+ "! If a `202` status is returned then the model will be ready when the
+ "! `content_import_state` in the model
+ "! status (/ml/v4/models/{model_id}) is `completed`.
+ "! If `content_import_state` is not used then a `201` status is returned.
+ "! + "! + "! @parameter I_MODELENTITYREQUEST | + "! Payload for creating the model. Either `space_id` or `project_id` has to be + "! provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_CREATE + importing + !I_MODELENTITYREQUEST type T_MODEL_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the models

+ "! Retrieve the models for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model

+ "! Retrieve the model with the specified identifier. If `rev` query parameter is + "! provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_GET + importing + !I_MODEL_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the model

+ "! Update the model with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! - `/software_spec` (operation `replace` only)
+ "! - `/model_version` (operation `add` and `replace` only)
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_UPDATE + importing + !I_MODEL_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the model

+ "! Delete the model with the specified identifier. This will delete all revisions + "! of
+ "! this model as well. For each revision all attachments will also be deleted.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_DELETE + importing + !I_MODEL_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new model revision

+ "! Create a new model revision.
+ "! The current metadata and content for
+ "! model_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_MODELREVISIONENTITYREQUEST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_CREATE_REVISION + importing + !I_MODEL_ID type STRING + !I_MODELREVISIONENTITYREQUEST type T_MODEL_REV_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model revisions

+ "! Retrieve the model revisions.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_LIST_REVISIONS + importing + !I_MODEL_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model content metadata list

+ "! Retrieve the content metadata list for the specified model attachments.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter I_NAME | + "! List only attachments with the given name. + "! @parameter I_CONTENT_FORMAT | + "! This is the format of the content. Any value can be used for the format and is + "! there to be able to easily find content by format. + "! @parameter E_RESPONSE | + "! Service return value of type T_ALL_CONTENT_METADATA + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_LIST_ATTACHMENTS + importing + !I_MODEL_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_NAME type STRING optional + !I_CONTENT_FORMAT type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_ALL_CONTENT_METADATA + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Upload the model content

+ "! Upload the content for the specified model.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_CONTENT_FORMAT | + "! This is the format of the content. Any value can be used for the format and is + "! there to be able to easily find content by format. + "! @parameter I_UPLOAD_CONTENT | + "! models file. + "! @parameter I_CONTENT_TYPE | + "! The type of the input. A character encoding can be specified by including a + "! `charset` parameter. For example, 'text/plain;charset=utf-8'. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PIPELINE_NODE_ID | + "! Returns only resources that match this `pipeline_node_id`, this is only relevant + "! if `content_format` is `pipeline-node`. + "! @parameter I_DEPLOYMENT_ID | + "! Returns only resources that match this `deployment_id`, this is only relevant if + "! `content_format` is `coreml`. + "! @parameter I_NAME | + "! Provide the name of the attachment. + "! @parameter E_RESPONSE | + "! Service return value of type T_CONTENT_METADATA + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_UPLOAD_CONTENT + importing + !I_MODEL_ID type STRING + !I_CONTENT_FORMAT type STRING + !I_UPLOAD_CONTENT type JSONOBJECT + !I_CONTENT_TYPE type STRING default 'application/json' + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_PIPELINE_NODE_ID type STRING optional + !I_DEPLOYMENT_ID type STRING optional + !I_NAME type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_CONTENT_METADATA + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Download the model content

+ "! Download the model content.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_ATTACHMENT_ID | + "! Identifier for the attachment for resources that support separate content. + "! @parameter I_ACCEPT | + "! The type of the response: application/zip, application/gzip, application/json, + "! text/plain, or application/xml. A character encoding can be specified by + "! including a `charset` parameter. For example, + "! 'text/plain;charset=utf-8'. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type FILE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_DOWNLOAD_CONTENT + importing + !I_MODEL_ID type STRING + !I_ATTACHMENT_ID type STRING + !I_ACCEPT type STRING optional + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + exporting + !E_RESPONSE type FILE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the model content

+ "! Delete the content for the specified model.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_ATTACHMENT_ID | + "! Identifier for the attachment for resources that support separate content. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_DELETE_CONTENT + importing + !I_MODEL_ID type STRING + !I_ATTACHMENT_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Download the model content that matches a certain criteria

+ "! Download the model content identified by the provided criteria.
+ "! If more than one attachment is found for the given filter then a
+ "! `400` error is returned. If there are no attachments that match the
+ "! filter then a `404` error is returned. If there are no filters then,
+ "! if there is a single attachment, the attachment content will
+ "! be returned otherwise a `400` or `404` error will be returned as
+ "! described above.
+ "! This method is just a shortcut for getting the attachment metadata
+ "! and then downloading by attachment id.
+ "! + "! + "! @parameter I_MODEL_ID | + "! Model identifier. + "! @parameter I_ACCEPT | + "! The type of the response: application/zip, application/gzip, application/json, + "! text/plain, or application/xml. A character encoding can be specified by + "! including a `charset` parameter. For example, + "! 'text/plain;charset=utf-8'. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter I_PIPELINE_NODE_ID | + "! Returns only resources that match this `pipeline_node_id`, this is only relevant + "! if `content_format` is `pipeline-node`. + "! @parameter I_DEPLOYMENT_ID | + "! Returns only resources that match this `deployment_id`, this is only relevant if + "! `content_format` is `coreml`. + "! @parameter I_NAME | + "! Match an attachment with this name. + "! @parameter I_CONTENT_FORMAT | + "! This is the format of the content. Any value can be used for the format and is + "! there to be able to easily find content by format. + "! @parameter E_RESPONSE | + "! Service return value of type FILE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODELS_FILTERED_DOWNLOAD + importing + !I_MODEL_ID type STRING + !I_ACCEPT type STRING optional + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_PIPELINE_NODE_ID type STRING optional + !I_DEPLOYMENT_ID type STRING optional + !I_NAME type STRING optional + !I_CONTENT_FORMAT type STRING optional + exporting + !E_RESPONSE type FILE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new model definition

+ "! Create a new model definition with the given payload. A model definition + "! represents the code that is used to train one or more models.
+ "! + "! + "! @parameter I_MODELDEFINITIONENTITYREQUEST | + "! Payload for creating the model definition. Either `space_id` or `project_id` has + "! to be provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_CREATE + importing + !I_MODELDEFINITIONENTITYREQUEST type T_MODEL_DEF_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model definitions

+ "! Retrieve the model definitions for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model definition

+ "! Retrieve the model definition with the specified identifier. If `rev` query + "! parameter is provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_GET + importing + !I_MODEL_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the model definition

+ "! Update the model definition with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_UPDATE + importing + !I_MODEL_DEFINITION_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the model definition

+ "! Delete the model definition with the specified identifier. This will delete all + "! revisions of
+ "! this model definition as well. For each revision all attachments will also be + "! deleted.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_DELETE + importing + !I_MODEL_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new model definition revision

+ "! Create a new model definition revision.
+ "! The current metadata and content for
+ "! model_definition_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_MDLDFNTNRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEF_CREATE_REVISION + importing + !I_MODEL_DEFINITION_ID type STRING + !I_MDLDFNTNRVSNNTTYRQST type T_MODEL_DEF_REV_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the model definition revisions

+ "! Retrieve the model definition revisions.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_MODEL_DEFINITION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEF_LIST_REVISIONS + importing + !I_MODEL_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_MODEL_DEFINITION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Upload the model definition model

+ "! Upload the model definition model. Model definitions for Deep Learning accept a + "! zip file that contains one or more python files organized in any directory + "! structure.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_UPLOAD_MODEL | + "! A gzip file containing code files. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_CONTENT_METADATA + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEFINITIONS_UPLOAD_MODEL + importing + !I_MODEL_DEFINITION_ID type STRING + !I_UPLOAD_MODEL type FILE + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/gzip' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_CONTENT_METADATA + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Download the model definition model

+ "! Download the model definition model.
+ "! It is possible to get the `model` for a given
+ "! revision of the `model definition`.
+ "! Model definitions for Deep Learning accept a zip file that contains one or more + "! python files organized in any directory structure.
+ "! + "! + "! @parameter I_MODEL_DEFINITION_ID | + "! Model definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type FILE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods MODEL_DEF_DOWNLOAD_MODEL + importing + !I_MODEL_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/zip' + exporting + !E_RESPONSE type FILE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new pipeline

+ "! Create a new pipeline with the given payload. A pipeline represents a + "! hybrid-pipeline, as a JSON document, that is used to train one or more + "! models.
+ "! + "! + "! @parameter I_PIPELINEENTITYREQUEST | + "! Payload for creating the pipeline. Either `space_id` or `project_id` has to be + "! provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_CREATE + importing + !I_PIPELINEENTITYREQUEST type T_PIPELINE_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the pipelines

+ "! Retrieve the pipelines for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the pipeline

+ "! Retrieve the pipeline with the specified identifier. If `rev` query parameter is + "! provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_PIPELINE_ID | + "! Pipeline identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_GET + importing + !I_PIPELINE_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the pipeline

+ "! Update the pipeline with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! + "! + "! @parameter I_PIPELINE_ID | + "! Pipeline identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_UPDATE + importing + !I_PIPELINE_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the pipeline

+ "! Delete the pipeline with the specified identifier. This will delete all + "! revisions of
+ "! this pipeline as well. For each revision all attachments will also be + "! deleted.
+ "! + "! + "! @parameter I_PIPELINE_ID | + "! Pipeline identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_DELETE + importing + !I_PIPELINE_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new pipeline revision

+ "! Create a new pipeline revision.
+ "! The current metadata and content for
+ "! pipeline_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_PIPELINE_ID | + "! Pipeline identifier. + "! @parameter I_PPLNRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_CREATE_REVISION + importing + !I_PIPELINE_ID type STRING + !I_PPLNRVSNNTTYRQST type T_PIPELINE_REV_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the pipeline revisions

+ "! Retrieve the pipeline revisions.
+ "! + "! + "! @parameter I_PIPELINE_ID | + "! Pipeline identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_PIPELINE_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods PIPELINES_LIST_REVISIONS + importing + !I_PIPELINE_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_PIPELINE_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new remote training system

+ "! Create a new remote training system with the given payload. A remote training + "! system represents a remote system used by Federated Learning. This definition + "! is necessary to control who can register to a federated learning job.
+ "! + "! + "! @parameter I_RMTTRNNGSYSTMNTTYRQST | + "! Payload for creating the remote training system. Either `space_id` or + "! `project_id` has to be provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYSTEM_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAINING_SYSTEMS_CREATE + importing + !I_RMTTRNNGSYSTMNTTYRQST type T_REMOTE_TRAIN_SYS_ENTITY_REQ + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYSTEM_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the remote training systems

+ "! Retrieve the remote training systems for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYS_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAINING_SYSTEMS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYS_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the remote training system

+ "! Retrieve the remote training system with the specified identifier. If `rev` + "! query parameter is provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_REMOTE_TRAINING_SYSTEM_ID | + "! Remote training system identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYSTEM_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAINING_SYSTEMS_GET + importing + !I_REMOTE_TRAINING_SYSTEM_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYSTEM_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the remote training system

+ "! Update the remote training system with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! - `/organization`
+ "! - `/allowed_identities`
+ "! - `/remote_admin`
+ "! + "! + "! @parameter I_REMOTE_TRAINING_SYSTEM_ID | + "! Remote training system identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYSTEM_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAINING_SYSTEMS_UPDATE + importing + !I_REMOTE_TRAINING_SYSTEM_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYSTEM_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the remote training system

+ "! Delete the remote training system with the specified identifier. This will + "! delete all revisions of
+ "! this remote training system as well. For each revision all attachments will also + "! be deleted.
+ "! + "! + "! @parameter I_REMOTE_TRAINING_SYSTEM_ID | + "! Remote training system identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAINING_SYSTEMS_DELETE + importing + !I_REMOTE_TRAINING_SYSTEM_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new remote training system revision

+ "! Create a new remote training system revision.
+ "! The current metadata and content for
+ "! remote_training_system_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_REMOTE_TRAINING_SYSTEM_ID | + "! Remote training system identifier. + "! @parameter I_RMTTRNNGSYSTMRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYSTEM_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAIN_SYS_CRE_REVISION + importing + !I_REMOTE_TRAINING_SYSTEM_ID type STRING + !I_RMTTRNNGSYSTMRVSNNTTYRQST type T_RMT_TRAIN_SYS_REV_ENTITY_REQ + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYSTEM_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the remote training system revisions

+ "! Retrieve the remote training system revisions.
+ "! + "! + "! @parameter I_REMOTE_TRAINING_SYSTEM_ID | + "! Remote training system identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_REMOTE_TRAIN_SYS_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods REMOTE_TRAIN_SYS_LST_REVISIONS + importing + !I_REMOTE_TRAINING_SYSTEM_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_REMOTE_TRAIN_SYS_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new WML training

+ "! Create a new WML training.
+ "! + "! + "! @parameter I_TRNNGRSRCNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_CREATE + importing + !I_TRNNGRSRCNTTYRQST type T_TRAIN_RESOURCE_ENTITY_REQ + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the list of trainings

+ "! Retrieve the list of trainings for the specified space or project.
+ "! + "! + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. Default value is 100. Max value is 200. + "! @parameter I_TOTAL_COUNT | + "! Compute the total count. May have performance impact. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag value. + "! @parameter I_TYPE | + "! Filter based on 'pipeline' or 'experiment' trainings. + "! Example: `type=pipeline`. If not provided, returns all the trainings. + "! @parameter I_STATE | + "! Filter based on on the training job state: queued, running, completed, failed + "! etc. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PARENT_ID | + "! Return the training jobs that are sub-jobs of this parent_id job. The parent_id + "! can be the experiment job ID. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_LIST + importing + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TOTAL_COUNT type BOOLEAN optional + !I_TAG_VALUE type STRING optional + !I_TYPE type STRING optional + !I_STATE type STRING optional + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_PARENT_ID type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the training

+ "! Retrieve the training with the specified identifier. This call supports + "! Web-Socket upgrade.
+ "! However in order to preserve bandwidth, web-socket messages are not context + "! complete.
+ "! Meaning that a single web-socket message only reflects a message or metric + "! happening in the
+ "! context of a training job or sub-job (in case of experiment trainings or + "! HPO/AutoML trainings). Hence the metadata property of a
+ "! web-socket message contains a parent with the href information of the parent job + "! that triggered this particular job.
+ "! Also the metrics will be provided as they arrive from the backend runtime, and + "! not as a cumulative list.
+ "! In order to get the full view of the running training job the caller should do a + "! regular GET call.
+ "! + "! + "! @parameter I_TRAINING_ID | + "! The training identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_GET + importing + !I_TRAINING_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Cancel the training

+ "! Cancel the specified training and remove it.
+ "! + "! + "! @parameter I_TRAINING_ID | + "! The training identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_HARD_DELETE | + "! Set to true in order to also delete the job metadata information. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAININGS_DELETE + importing + !I_TRAINING_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_HARD_DELETE type BOOLEAN optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + "!

Create a new training definition

+ "! Create a new training definition with the given payload. A training definition + "! represents the training meta-data necessary to start a training job.
+ "! + "! + "! @parameter I_TRNNGDFNTNNTTYRQST | + "! Payload for creating the training definition. Either `space_id` or `project_id` + "! has to be provided and is mandatory. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAINING_DEFINITIONS_CREATE + importing + !I_TRNNGDFNTNNTTYRQST type T_TRAIN_DEF_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the training definitions

+ "! Retrieve the training definitions for the specified space or project.
+ "! + "! + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter I_TAG_VALUE | + "! Return only the resources with the given tag values, separated by `or` or `and` + "! to support multiple tags. + "! @parameter I_SEARCH | + "! Returns only resources that match this search string. The path to the field must + "! be the complete path to the field, and this field must be one of the indexed + "! fields for this resource type. Note that the search string must be URL encoded. + "! + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAIN_DEFINITION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAINING_DEFINITIONS_LIST + importing + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_TAG_VALUE type STRING optional + !I_SEARCH type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAIN_DEFINITION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the training definition

+ "! Retrieve the training definition with the specified identifier. If `rev` query + "! parameter is provided,
+ "! `rev=latest` will fetch the latest revision. A call with + "! `rev={revision_number}` will fetch the given
+ "! revision_number record. Either `space_id` or `project_id` has to be provided and + "! is mandatory.
+ "! + "! + "! @parameter I_TRAINING_DEFINITION_ID | + "! Training definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_REV | + "! The revision number of the resource. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAINING_DEFINITIONS_GET + importing + !I_TRAINING_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_REV type STRING optional + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Update the training definition

+ "! Update the training definition with the provided patch data.
+ "! The following fields can be patched:
+ "! - `/tags`
+ "! - `/name`
+ "! - `/description`
+ "! - `/custom`
+ "! - `/federated_learning`
+ "! + "! + "! @parameter I_TRAINING_DEFINITION_ID | + "! Training definition identifier. + "! @parameter I_JSON_PATCH | + "! Input For Patch. This is the patch body which corresponds to the JavaScript + "! Object Notation (JSON) Patch standard (RFC 6902). + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAINING_DEFINITIONS_UPDATE + importing + !I_TRAINING_DEFINITION_ID type STRING + !I_JSON_PATCH type TT_JSON_PATCH_OPERATION + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Delete the training definition

+ "! Delete the training definition with the specified identifier. This will delete + "! all revisions of
+ "! this training definition as well. For each revision all attachments will also be + "! deleted.
+ "! + "! + "! @parameter I_TRAINING_DEFINITION_ID | + "! Training definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAINING_DEFINITIONS_DELETE + importing + !I_TRAINING_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Create a new training definition revision

+ "! Create a new training definition revision.
+ "! The current metadata and content for
+ "! training_definition_id will be taken and a new revision created.
+ "! Either `space_id` or `project_id` has to be provided and is mandatory.
+ "! + "! + "! @parameter I_TRAINING_DEFINITION_ID | + "! Training definition identifier. + "! @parameter I_TRNNGDFNTNRVSNNTTYRQST | + "! No documentation available. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAINING_DEFINITION_RESOURCE + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAIN_DEF_CREATE_REVISION + importing + !I_TRAINING_DEFINITION_ID type STRING + !I_TRNNGDFNTNRVSNNTTYRQST type T_TRAIN_DEF_REV_ENTITY_REQUEST + !I_contenttype type string default 'application/json' + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAINING_DEFINITION_RESOURCE + raising + ZCX_IBMX_SERVICE_EXCEPTION . + "!

Retrieve the training definition revisions

+ "! Retrieve the training definition revisions.
+ "! + "! + "! @parameter I_TRAINING_DEFINITION_ID | + "! Training definition identifier. + "! @parameter I_SPACE_ID | + "! The space that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_PROJECT_ID | + "! The project that contains the resource. Either `space_id` or `project_id` query + "! parameter has to be given. + "! @parameter I_START | + "! Token required for token-based pagination. This token cannot be determined by + "! end user. It is generated by the service and it is set in the href available in + "! the `next` field. + "! @parameter I_LIMIT | + "! How many resources should be returned. By default limit is 100. Max limit + "! allowed is 200. + "! @parameter E_RESPONSE | + "! Service return value of type T_TRAIN_DEFINITION_RESOURCES + "! @raising ZCX_IBMX_SERVICE_EXCEPTION | Exception being raised in case of an error. + "! + methods TRAIN_DEF_LIST_REVISIONS + importing + !I_TRAINING_DEFINITION_ID type STRING + !I_SPACE_ID type STRING optional + !I_PROJECT_ID type STRING optional + !I_START type STRING optional + !I_LIMIT type INTEGER default 100 + !I_accept type string default 'application/json' + exporting + !E_RESPONSE type T_TRAIN_DEFINITION_RESOURCES + raising + ZCX_IBMX_SERVICE_EXCEPTION . + + +protected section. + +private section. + +ENDCLASS. + +class ZCL_IBMX_WML_V4 IMPLEMENTATION. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->GET_APPNAME +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_APPNAME TYPE STRING +* +-------------------------------------------------------------------------------------- + method GET_APPNAME. + + e_appname = 'Watson Machine Learning'. + + endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Protected Method ZCL_IBMX_WML_V4->GET_REQUEST_PROP +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT) +* | [<-()] E_REQUEST_PROP TYPE TS_REQUEST_PROP +* +-------------------------------------------------------------------------------------- +method GET_REQUEST_PROP. + + data: + lv_auth_method type string ##NEEDED. + + e_request_prop = super->get_request_prop( i_auth_method = i_auth_method ). + + lv_auth_method = i_auth_method. + if lv_auth_method eq c_default. + lv_auth_method = 'BearerToken'. + endif. + if lv_auth_method is initial. + e_request_prop-auth_basic = c_boolean_false. + e_request_prop-auth_oauth = c_boolean_false. + e_request_prop-auth_apikey = c_boolean_false. + elseif lv_auth_method eq 'BearerToken'. + e_request_prop-auth_name = 'BearerToken'. + e_request_prop-auth_type = 'http'. + e_request_prop-auth_oauth = c_boolean_true. + else. + endif. + + e_request_prop-url-protocol = 'https'. + e_request_prop-url-host = 'us-south.ml.cloud.ibm.com'. + e_request_prop-url-path_base = ''. + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->GET_SDK_VERSION_DATE +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] E_SDK_VERSION_DATE TYPE STRING +* +-------------------------------------------------------------------------------------- + method get_sdk_version_date. + + e_sdk_version_date = '20240325'. + + endmethod. + + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENTENTITYREQUEST TYPE T_DEPLOYMENT_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_DEPLOYMENTENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_DEPLOYMENTENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_DEPLOYMENTENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'DeploymentEntityRequest' i_value = i_DEPLOYMENTENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_DEPLOYMENTENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_SERVING_NAME TYPE STRING (optional) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_ASSET_ID TYPE STRING (optional) +* | [--->] I_NAME TYPE STRING (optional) +* | [--->] I_TYPE TYPE STRING (optional) +* | [--->] I_STATE TYPE STRING (optional) +* | [--->] I_STATS TYPE BOOLEAN (optional) +* | [--->] I_CONFLICT TYPE BOOLEAN (default =c_boolean_false) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SERVING_NAME is supplied. + lv_queryparam = escape( val = i_SERVING_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `serving_name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_ASSET_ID is supplied. + lv_queryparam = escape( val = i_ASSET_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `asset_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_NAME is supplied. + lv_queryparam = escape( val = i_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TYPE is supplied. + lv_queryparam = escape( val = i_TYPE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `type` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATE is supplied. + lv_queryparam = escape( val = i_STATE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `state` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATS is supplied. + lv_queryparam = i_STATS. + add_query_parameter( + exporting + i_parameter = `stats` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONFLICT is supplied. + lv_queryparam = i_CONFLICT. + add_query_parameter( + exporting + i_parameter = `conflict` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_DEPLOYMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENTS_COMPUTE_PREDICT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_DEPLOYMENT_ID TYPE STRING +* | [--->] I_SYNCSCORINGDATA TYPE T_SYNC_SCORING_DATA +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_SYNC_SCORING_DATA_RESULTS +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENTS_COMPUTE_PREDICT. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployments/{deployment_id}/predictions'. + replace all occurrences of `{deployment_id}` in ls_request_prop-url-path with i_DEPLOYMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_SYNCSCORINGDATA ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_SYNCSCORINGDATA to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_SYNCSCORINGDATA i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'SyncScoringData' i_value = i_SYNCSCORINGDATA ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_SYNCSCORINGDATA to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOBS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_STATE TYPE STRING (optional) +* | [--->] I_DEPLOYMENT_ID TYPE STRING (optional) +* | [--->] I_INCLUDE TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOBS_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOBS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_jobs'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATE is supplied. + lv_queryparam = escape( val = i_STATE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `state` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_DEPLOYMENT_ID is supplied. + lv_queryparam = escape( val = i_DEPLOYMENT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `deployment_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_INCLUDE is supplied. + lv_queryparam = escape( val = i_INCLUDE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `include` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOBS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOBENTITYREQUEST TYPE T_JOB_ENTITY_REQUEST +* | [--->] I_RETENTION TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOBS_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOBS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_jobs'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_RETENTION is supplied. + lv_queryparam = escape( val = i_RETENTION format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `retention` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JOBENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JOBENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JOBENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'JobEntityRequest' i_value = i_JOBENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JOBENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOBS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_HARD_DELETE TYPE BOOLEAN (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOBS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_jobs/{job_id}'. + replace all occurrences of `{job_id}` in ls_request_prop-url-path with i_JOB_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_HARD_DELETE is supplied. + lv_queryparam = i_HARD_DELETE. + add_query_parameter( + exporting + i_parameter = `hard_delete` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOBS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_INCLUDE TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOBS_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOBS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_jobs/{job_id}'. + replace all occurrences of `{job_id}` in ls_request_prop-url-path with i_JOB_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_INCLUDE is supplied. + lv_queryparam = escape( val = i_INCLUDE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `include` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOBENTITYREQUEST TYPE T_JOB_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JOBENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JOBENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JOBENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'JobEntityRequest' i_value = i_JOBENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JOBENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEFINITIONS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEFINITIONS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions/{job_definition_id}'. + replace all occurrences of `{job_definition_id}` in ls_request_prop-url-path with i_JOB_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions/{job_definition_id}'. + replace all occurrences of `{job_definition_id}` in ls_request_prop-url-path with i_JOB_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions/{job_definition_id}'. + replace all occurrences of `{job_definition_id}` in ls_request_prop-url-path with i_JOB_DEFINITION_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_CRE_REV +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_DEFINITION_ID TYPE STRING +* | [--->] I_JOBREVISIONENTITYREQUEST TYPE T_JOB_REVISION_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_CRE_REV. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions/{job_definition_id}/revisions'. + replace all occurrences of `{job_definition_id}` in ls_request_prop-url-path with i_JOB_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JOBREVISIONENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JOBREVISIONENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JOBREVISIONENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'JobRevisionEntityRequest' i_value = i_JOBREVISIONENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JOBREVISIONENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->DEPLOYMENT_JOB_DEF_LST_REV +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_JOB_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_JOB_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method DEPLOYMENT_JOB_DEF_LST_REV. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/deployment_job_definitions/{job_definition_id}/revisions'. + replace all occurrences of `{job_definition_id}` in ls_request_prop-url-path with i_JOB_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENTENTITYREQUEST TYPE T_EXPERIMENT_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_EXPERIMENTENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_EXPERIMENTENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_EXPERIMENTENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ExperimentEntityRequest' i_value = i_EXPERIMENTENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_EXPERIMENTENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments/{experiment_id}'. + replace all occurrences of `{experiment_id}` in ls_request_prop-url-path with i_EXPERIMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENT_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments/{experiment_id}'. + replace all occurrences of `{experiment_id}` in ls_request_prop-url-path with i_EXPERIMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments/{experiment_id}'. + replace all occurrences of `{experiment_id}` in ls_request_prop-url-path with i_EXPERIMENT_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENT_ID TYPE STRING +* | [--->] I_EXPRMNTRVSNNTTYRQST TYPE T_EXPERIMENT_REV_ENTITY_REQ +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments/{experiment_id}/revisions'. + replace all occurrences of `{experiment_id}` in ls_request_prop-url-path with i_EXPERIMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_EXPRMNTRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_EXPRMNTRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_EXPRMNTRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ExperimentRevisionEntityRequest' i_value = i_EXPRMNTRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_EXPRMNTRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->EXPERIMENTS_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_EXPERIMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_EXPERIMENT_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method EXPERIMENTS_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/experiments/{experiment_id}/revisions'. + replace all occurrences of `{experiment_id}` in ls_request_prop-url-path with i_EXPERIMENT_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTIONENTITYREQUEST TYPE T_FUNCTION_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_FUNCTIONENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_FUNCTIONENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_FUNCTIONENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'FunctionEntityRequest' i_value = i_FUNCTIONENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_FUNCTIONENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_FNCTNRVSNNTTYRQST TYPE T_FUNC_REVISION_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}/revisions'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_FNCTNRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_FNCTNRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_FNCTNRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'FunctionRevisionEntityRequest' i_value = i_FNCTNRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_FNCTNRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_FUNCTION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}/revisions'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_UPLOAD_CODE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_UPLOAD_CODE TYPE FILE +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/gzip') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_CONTENT_METADATA +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_UPLOAD_CODE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}/code'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + ls_request_prop-body_bin = i_UPLOAD_CODE. + + " execute HTTP PUT request + lo_response = HTTP_PUT( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->FUNCTIONS_DOWNLOAD_CODE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_FUNCTION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/zip') +* | [<---] E_RESPONSE TYPE FILE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method FUNCTIONS_DOWNLOAD_CODE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/functions/{function_id}/code'. + replace all occurrences of `{function_id}` in ls_request_prop-url-path with i_FUNCTION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve file data + e_response = get_response_binary( lo_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->INSTANCES_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE TT_STRING (optional) +* | [--->] I_PROJECT_ID TYPE TT_STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_CONSUMPTION_DETAILS TYPE BOOLEAN (default =c_boolean_false) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_INSTANCE_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method INSTANCES_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/instances'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + data: + lv_item_SPACE_ID type STRING. + clear: lv_queryparam, lv_sep. + loop at i_SPACE_ID into lv_item_SPACE_ID. + lv_queryparam = lv_queryparam && lv_sep && lv_item_SPACE_ID. + lv_sep = ','. + endloop. + lv_queryparam = escape( val = lv_queryparam format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + data: + lv_item_PROJECT_ID type STRING. + clear: lv_queryparam, lv_sep. + loop at i_PROJECT_ID into lv_item_PROJECT_ID. + lv_queryparam = lv_queryparam && lv_sep && lv_item_PROJECT_ID. + lv_sep = ','. + endloop. + lv_queryparam = escape( val = lv_queryparam format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONSUMPTION_DETAILS is supplied. + lv_queryparam = i_CONSUMPTION_DETAILS. + add_query_parameter( + exporting + i_parameter = `consumption_details` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->INSTANCES_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_INSTANCE_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_CONSUMPTION_DETAILS TYPE BOOLEAN (default =c_boolean_false) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_INSTANCE_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method INSTANCES_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/instances/{instance_id}'. + replace all occurrences of `{instance_id}` in ls_request_prop-url-path with i_INSTANCE_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONSUMPTION_DETAILS is supplied. + lv_queryparam = i_CONSUMPTION_DETAILS. + add_query_parameter( + exporting + i_parameter = `consumption_details` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODELENTITYREQUEST TYPE T_MODEL_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_MODELENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_MODELENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_MODELENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ModelEntityRequest' i_value = i_MODELENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_MODELENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_MODELREVISIONENTITYREQUEST TYPE T_MODEL_REV_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/revisions'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_MODELREVISIONENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_MODELREVISIONENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_MODELREVISIONENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ModelRevisionEntityRequest' i_value = i_MODELREVISIONENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_MODELREVISIONENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/revisions'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_LIST_ATTACHMENTS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_NAME TYPE STRING (optional) +* | [--->] I_CONTENT_FORMAT TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_ALL_CONTENT_METADATA +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_LIST_ATTACHMENTS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/content'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_NAME is supplied. + lv_queryparam = escape( val = i_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONTENT_FORMAT is supplied. + lv_queryparam = escape( val = i_CONTENT_FORMAT format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `content_format` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_UPLOAD_CONTENT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_CONTENT_FORMAT TYPE STRING +* | [--->] I_UPLOAD_CONTENT TYPE JSONOBJECT +* | [--->] I_CONTENT_TYPE TYPE STRING (default ='application/json') +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_PIPELINE_NODE_ID TYPE STRING (optional) +* | [--->] I_DEPLOYMENT_ID TYPE STRING (optional) +* | [--->] I_NAME TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_CONTENT_METADATA +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_UPLOAD_CONTENT. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/content'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + lv_queryparam = escape( val = i_CONTENT_FORMAT format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `content_format` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PIPELINE_NODE_ID is supplied. + lv_queryparam = escape( val = i_PIPELINE_NODE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `pipeline_node_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_DEPLOYMENT_ID is supplied. + lv_queryparam = escape( val = i_DEPLOYMENT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `deployment_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_NAME is supplied. + lv_queryparam = escape( val = i_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + " process header parameters + data: + lv_headerparam type string ##NEEDED. + + if i_CONTENT_TYPE is supplied. + ls_request_prop-header_content_type = I_CONTENT_TYPE. + endif. + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_UPLOAD_CONTENT ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_UPLOAD_CONTENT to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_UPLOAD_CONTENT i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'upload-content' i_value = i_UPLOAD_CONTENT ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_UPLOAD_CONTENT to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PUT request + lo_response = HTTP_PUT( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_DOWNLOAD_CONTENT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_ATTACHMENT_ID TYPE STRING +* | [--->] I_ACCEPT TYPE STRING (optional) +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [<---] E_RESPONSE TYPE FILE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_DOWNLOAD_CONTENT. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/content/{attachment_id}'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + replace all occurrences of `{attachment_id}` in ls_request_prop-url-path with i_ATTACHMENT_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + " process header parameters + data: + lv_headerparam type string ##NEEDED. + + if i_ACCEPT is supplied. + lv_headerparam = I_ACCEPT. + add_header_parameter( + exporting + i_parameter = 'Accept' + i_value = lv_headerparam + changing + c_headers = ls_request_prop-headers ) ##NO_TEXT. + endif. + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve file data + e_response = get_response_binary( lo_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_DELETE_CONTENT +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_ATTACHMENT_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_DELETE_CONTENT. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/content/{attachment_id}'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + replace all occurrences of `{attachment_id}` in ls_request_prop-url-path with i_ATTACHMENT_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODELS_FILTERED_DOWNLOAD +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_ID TYPE STRING +* | [--->] I_ACCEPT TYPE STRING (optional) +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_PIPELINE_NODE_ID TYPE STRING (optional) +* | [--->] I_DEPLOYMENT_ID TYPE STRING (optional) +* | [--->] I_NAME TYPE STRING (optional) +* | [--->] I_CONTENT_FORMAT TYPE STRING (optional) +* | [<---] E_RESPONSE TYPE FILE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODELS_FILTERED_DOWNLOAD. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/models/{model_id}/download'. + replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_MODEL_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PIPELINE_NODE_ID is supplied. + lv_queryparam = escape( val = i_PIPELINE_NODE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `pipeline_node_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_DEPLOYMENT_ID is supplied. + lv_queryparam = escape( val = i_DEPLOYMENT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `deployment_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_NAME is supplied. + lv_queryparam = escape( val = i_NAME format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `name` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_CONTENT_FORMAT is supplied. + lv_queryparam = escape( val = i_CONTENT_FORMAT format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `content_format` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + " process header parameters + data: + lv_headerparam type string ##NEEDED. + + if i_ACCEPT is supplied. + lv_headerparam = I_ACCEPT. + add_header_parameter( + exporting + i_parameter = 'Accept' + i_value = lv_headerparam + changing + c_headers = ls_request_prop-headers ) ##NO_TEXT. + endif. + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve file data + e_response = get_response_binary( lo_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODELDEFINITIONENTITYREQUEST TYPE T_MODEL_DEF_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_MODELDEFINITIONENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_MODELDEFINITIONENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_MODELDEFINITIONENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ModelDefinitionEntityRequest' i_value = i_MODELDEFINITIONENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_MODELDEFINITIONENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEF_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_MDLDFNTNRVSNNTTYRQST TYPE T_MODEL_DEF_REV_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEF_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}/revisions'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_MDLDFNTNRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_MDLDFNTNRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_MDLDFNTNRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'ModelDefinitionRevisionEntityRequest' i_value = i_MDLDFNTNRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_MDLDFNTNRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEF_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_MODEL_DEFINITION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEF_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}/revisions'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEFINITIONS_UPLOAD_MODEL +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_UPLOAD_MODEL TYPE FILE +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/gzip') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_CONTENT_METADATA +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEFINITIONS_UPLOAD_MODEL. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}/model'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + ls_request_prop-body_bin = i_UPLOAD_MODEL. + + " execute HTTP PUT request + lo_response = HTTP_PUT( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->MODEL_DEF_DOWNLOAD_MODEL +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_MODEL_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/zip') +* | [<---] E_RESPONSE TYPE FILE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method MODEL_DEF_DOWNLOAD_MODEL. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/model_definitions/{model_definition_id}/model'. + replace all occurrences of `{model_definition_id}` in ls_request_prop-url-path with i_MODEL_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve file data + e_response = get_response_binary( lo_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINEENTITYREQUEST TYPE T_PIPELINE_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_PIPELINEENTITYREQUEST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_PIPELINEENTITYREQUEST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_PIPELINEENTITYREQUEST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'PipelineEntityRequest' i_value = i_PIPELINEENTITYREQUEST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_PIPELINEENTITYREQUEST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINE_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines/{pipeline_id}'. + replace all occurrences of `{pipeline_id}` in ls_request_prop-url-path with i_PIPELINE_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINE_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines/{pipeline_id}'. + replace all occurrences of `{pipeline_id}` in ls_request_prop-url-path with i_PIPELINE_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINE_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines/{pipeline_id}'. + replace all occurrences of `{pipeline_id}` in ls_request_prop-url-path with i_PIPELINE_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINE_ID TYPE STRING +* | [--->] I_PPLNRVSNNTTYRQST TYPE T_PIPELINE_REV_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines/{pipeline_id}/revisions'. + replace all occurrences of `{pipeline_id}` in ls_request_prop-url-path with i_PIPELINE_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_PPLNRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_PPLNRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_PPLNRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'PipelineRevisionEntityRequest' i_value = i_PPLNRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_PPLNRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->PIPELINES_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_PIPELINE_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_PIPELINE_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method PIPELINES_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/pipelines/{pipeline_id}/revisions'. + replace all occurrences of `{pipeline_id}` in ls_request_prop-url-path with i_PIPELINE_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAINING_SYSTEMS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_RMTTRNNGSYSTMNTTYRQST TYPE T_REMOTE_TRAIN_SYS_ENTITY_REQ +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYSTEM_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAINING_SYSTEMS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_RMTTRNNGSYSTMNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_RMTTRNNGSYSTMNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_RMTTRNNGSYSTMNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'RemoteTrainingSystemEntityRequest' i_value = i_RMTTRNNGSYSTMNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_RMTTRNNGSYSTMNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAINING_SYSTEMS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYS_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAINING_SYSTEMS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAINING_SYSTEMS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REMOTE_TRAINING_SYSTEM_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYSTEM_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAINING_SYSTEMS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems/{remote_training_system_id}'. + replace all occurrences of `{remote_training_system_id}` in ls_request_prop-url-path with i_REMOTE_TRAINING_SYSTEM_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAINING_SYSTEMS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REMOTE_TRAINING_SYSTEM_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYSTEM_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAINING_SYSTEMS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems/{remote_training_system_id}'. + replace all occurrences of `{remote_training_system_id}` in ls_request_prop-url-path with i_REMOTE_TRAINING_SYSTEM_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAINING_SYSTEMS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REMOTE_TRAINING_SYSTEM_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAINING_SYSTEMS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems/{remote_training_system_id}'. + replace all occurrences of `{remote_training_system_id}` in ls_request_prop-url-path with i_REMOTE_TRAINING_SYSTEM_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAIN_SYS_CRE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REMOTE_TRAINING_SYSTEM_ID TYPE STRING +* | [--->] I_RMTTRNNGSYSTMRVSNNTTYRQST TYPE T_RMT_TRAIN_SYS_REV_ENTITY_REQ +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYSTEM_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAIN_SYS_CRE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems/{remote_training_system_id}/revisions'. + replace all occurrences of `{remote_training_system_id}` in ls_request_prop-url-path with i_REMOTE_TRAINING_SYSTEM_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_RMTTRNNGSYSTMRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_RMTTRNNGSYSTMRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_RMTTRNNGSYSTMRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'RemoteTrainingSystemRevisionEntityRequest' i_value = i_RMTTRNNGSYSTMRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_RMTTRNNGSYSTMRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->REMOTE_TRAIN_SYS_LST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_REMOTE_TRAINING_SYSTEM_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_REMOTE_TRAIN_SYS_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method REMOTE_TRAIN_SYS_LST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/remote_training_systems/{remote_training_system_id}/revisions'. + replace all occurrences of `{remote_training_system_id}` in ls_request_prop-url-path with i_REMOTE_TRAINING_SYSTEM_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAININGS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRNNGRSRCNTTYRQST TYPE T_TRAIN_RESOURCE_ENTITY_REQ +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TRNNGRSRCNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TRNNGRSRCNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TRNNGRSRCNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TrainingResourceEntityRequest' i_value = i_TRNNGRSRCNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TRNNGRSRCNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAININGS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TOTAL_COUNT TYPE BOOLEAN (optional) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_TYPE TYPE STRING (optional) +* | [--->] I_STATE TYPE STRING (optional) +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_PARENT_ID TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TOTAL_COUNT is supplied. + lv_queryparam = i_TOTAL_COUNT. + add_query_parameter( + exporting + i_parameter = `total_count` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TYPE is supplied. + lv_queryparam = escape( val = i_TYPE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `type` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_STATE is supplied. + lv_queryparam = escape( val = i_STATE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `state` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PARENT_ID is supplied. + lv_queryparam = escape( val = i_PARENT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `parent_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAININGS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings/{training_id}'. + replace all occurrences of `{training_id}` in ls_request_prop-url-path with i_TRAINING_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAININGS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_HARD_DELETE TYPE BOOLEAN (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAININGS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/trainings/{training_id}'. + replace all occurrences of `{training_id}` in ls_request_prop-url-path with i_TRAINING_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_HARD_DELETE is supplied. + lv_queryparam = i_HARD_DELETE. + add_query_parameter( + exporting + i_parameter = `hard_delete` + i_value = lv_queryparam + i_is_boolean = c_boolean_true + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAINING_DEFINITIONS_CREATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRNNGDFNTNNTTYRQST TYPE T_TRAIN_DEF_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAINING_DEFINITIONS_CREATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions'. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TRNNGDFNTNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TRNNGDFNTNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TRNNGDFNTNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TrainingDefinitionEntityRequest' i_value = i_TRNNGDFNTNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TRNNGDFNTNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAINING_DEFINITIONS_LIST +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_TAG_VALUE TYPE STRING (optional) +* | [--->] I_SEARCH TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAIN_DEFINITION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAINING_DEFINITIONS_LIST. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions'. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_TAG_VALUE is supplied. + lv_queryparam = escape( val = i_TAG_VALUE format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `tag.value` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_SEARCH is supplied. + lv_queryparam = escape( val = i_SEARCH format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `search` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAINING_DEFINITIONS_GET +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_REV TYPE STRING (optional) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAINING_DEFINITIONS_GET. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions/{training_definition_id}'. + replace all occurrences of `{training_definition_id}` in ls_request_prop-url-path with i_TRAINING_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_REV is supplied. + lv_queryparam = escape( val = i_REV format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `rev` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAINING_DEFINITIONS_UPDATE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_DEFINITION_ID TYPE STRING +* | [--->] I_JSON_PATCH TYPE TT_JSON_PATCH_OPERATION +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAINING_DEFINITIONS_UPDATE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions/{training_definition_id}'. + replace all occurrences of `{training_definition_id}` in ls_request_prop-url-path with i_TRAINING_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_JSON_PATCH ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_JSON_PATCH to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_JSON_PATCH i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'json-patch' i_value = i_JSON_PATCH ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_JSON_PATCH to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP PATCH request + lo_response = HTTP_PATCH( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAINING_DEFINITIONS_DELETE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAINING_DEFINITIONS_DELETE. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions/{training_definition_id}'. + replace all occurrences of `{training_definition_id}` in ls_request_prop-url-path with i_TRAINING_DEFINITION_ID ignoring case. + + " standard headers + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP DELETE request + lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ). + + + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAIN_DEF_CREATE_REVISION +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_DEFINITION_ID TYPE STRING +* | [--->] I_TRNNGDFNTNRVSNNTTYRQST TYPE T_TRAIN_DEF_REV_ENTITY_REQUEST +* | [--->] I_contenttype TYPE string (default ='application/json') +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAINING_DEFINITION_RESOURCE +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAIN_DEF_CREATE_REVISION. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions/{training_definition_id}/revisions'. + replace all occurrences of `{training_definition_id}` in ls_request_prop-url-path with i_TRAINING_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_content_type = I_contenttype. + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + + + + + + " process body parameters + data: + lv_body type string, + lv_bodyparam type string, + lv_datatype type char. + field-symbols: + type any. + lv_separator = ''. + lv_datatype = get_datatype( i_TRNNGDFNTNRVSNNTTYRQST ). + + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-dataref or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-x. + assign i_TRNNGDFNTNRVSNNTTYRQST to . + if ls_request_prop-header_content_type cp '*json' or ls_request_prop-header_content_type cp 'text*'. + ls_request_prop-body = CAST string( )->*. + else. + ls_request_prop-body_bin = CAST xstring( )->*. + endif. + else. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab or + ls_request_prop-header_content_type cp '*json*'. + if lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-struct_deep or + lv_datatype eq ZIF_IBMX_SERVICE_ARCH~c_datatype-itab. + lv_bodyparam = abap_to_json( i_value = i_TRNNGDFNTNRVSNNTTYRQST i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). + else. + lv_bodyparam = abap_to_json( i_name = 'TrainingDefinitionRevisionEntityRequest' i_value = i_TRNNGDFNTNRVSNNTTYRQST ). + endif. + lv_body = lv_body && lv_separator && lv_bodyparam. + else. + assign i_TRNNGDFNTNRVSNNTTYRQST to . + lv_bodyparam = . + concatenate lv_body lv_bodyparam into lv_body. + endif. + if ls_request_prop-header_content_type cp '*json*'. + if lv_body is initial. + lv_body = '{}'. + elseif lv_body(1) ne '{' and lv_body(1) ne '['. + lv_body = `{` && lv_body && `}`. + endif. + endif. + + if ls_request_prop-header_content_type cp '*charset=utf-8*'. + ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ). + "replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case. + find_regex( + exporting + i_regex = ';\s*charset=utf-8' + i_with = '' + i_ignoring_case = 'X' + changing + c_in = ls_request_prop-header_content_type ). + else. + ls_request_prop-body = lv_body. + endif. + endif. + + + " execute HTTP POST request + lo_response = HTTP_POST( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method ZCL_IBMX_WML_V4->TRAIN_DEF_LIST_REVISIONS +* +-------------------------------------------------------------------------------------------------+ +* | [--->] I_TRAINING_DEFINITION_ID TYPE STRING +* | [--->] I_SPACE_ID TYPE STRING (optional) +* | [--->] I_PROJECT_ID TYPE STRING (optional) +* | [--->] I_START TYPE STRING (optional) +* | [--->] I_LIMIT TYPE INTEGER (default =100) +* | [--->] I_accept TYPE string (default ='application/json') +* | [<---] E_RESPONSE TYPE T_TRAIN_DEFINITION_RESOURCES +* | [!CX!] ZCX_IBMX_SERVICE_EXCEPTION +* +-------------------------------------------------------------------------------------- +method TRAIN_DEF_LIST_REVISIONS. + + data: + ls_request_prop type ts_request_prop, + lv_separator(1) type c ##NEEDED, + lv_sep(1) type c ##NEEDED, + lo_response type to_rest_response, + lv_json type string ##NEEDED. + + ls_request_prop-url-path = '/ml/v4/training_definitions/{training_definition_id}/revisions'. + replace all occurrences of `{training_definition_id}` in ls_request_prop-url-path with i_TRAINING_DEFINITION_ID ignoring case. + + " standard headers + ls_request_prop-header_accept = I_accept. + set_default_query_parameters( + changing + c_url = ls_request_prop-url ). + + " process query parameters + data: + lv_queryparam type string. + + if i_SPACE_ID is supplied. + lv_queryparam = escape( val = i_SPACE_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `space_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_PROJECT_ID is supplied. + lv_queryparam = escape( val = i_PROJECT_ID format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `project_id` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_START is supplied. + lv_queryparam = escape( val = i_START format = cl_abap_format=>e_uri_full ). + add_query_parameter( + exporting + i_parameter = `start` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + if i_LIMIT is supplied. + lv_queryparam = i_LIMIT. + add_query_parameter( + exporting + i_parameter = `limit` + i_value = lv_queryparam + changing + c_url = ls_request_prop-url ) ##NO_TEXT. + endif. + + + + + + + " execute HTTP GET request + lo_response = HTTP_GET( i_request_prop = ls_request_prop ). + + + " retrieve JSON data + lv_json = get_response_string( lo_response ). + parse_json( + exporting + i_json = lv_json + i_dictionary = c_abapname_dictionary + changing + c_abap = e_response ). + +endmethod. + + +ENDCLASS. diff --git a/src/zcl_ibmx_wml_v4.clas.xml b/src/zcl_ibmx_wml_v4.clas.xml new file mode 100644 index 0000000..baf5b0a --- /dev/null +++ b/src/zcl_ibmx_wml_v4.clas.xml @@ -0,0 +1,504 @@ + + + + + + ZCL_IBMX_WML_V4 + E + Watson Machine Learning + 1 + X + X + X + + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_COMPUTE_PREDICT + E + Execute a synchronous deployment prediction + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_CREATE + E + Create a new WML deployment + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_DELETE + E + Delete the deployment + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_GET + E + Retrieve the deployment details + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_LIST + E + Retrieve the deployments + + + ZCL_IBMX_WML_V4 + DEPLOYMENTS_UPDATE + E + Update the deployment metadata + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOBS_CREATE + E + Start an asynchronous deployment job + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOBS_DELETE + E + Cancel the deployment job + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOBS_GET + E + Retrieve the deployment job + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOBS_LIST + E + Retrieve the deployment jobs + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEFINITIONS_GET + E + Retrieve the deployment job definition + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_CREATE + E + Create a new deployment job definition + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_CRE_REV + E + Create a new deployment job definition revision + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_DELETE + E + Delete the deployment job definition + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_LIST + E + Retrieve the deployment job definitions + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_LST_REV + E + Retrieve the deployment job definition revisions + + + ZCL_IBMX_WML_V4 + DEPLOYMENT_JOB_DEF_UPDATE + E + Update the deployment job definition + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_CREATE + E + Create a new experiment + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_CREATE_REVISION + E + Create a new experiment revision + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_DELETE + E + Delete the experiment + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_GET + E + Retrieve the experiment + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_LIST + E + Retrieve the experiments + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_LIST_REVISIONS + E + Retrieve the experiment revisions + + + ZCL_IBMX_WML_V4 + EXPERIMENTS_UPDATE + E + Update the experiment + + + ZCL_IBMX_WML_V4 + FUNCTIONS_CREATE + E + Create a new function + + + ZCL_IBMX_WML_V4 + FUNCTIONS_CREATE_REVISION + E + Create a new function revision + + + ZCL_IBMX_WML_V4 + FUNCTIONS_DELETE + E + Delete the function + + + ZCL_IBMX_WML_V4 + FUNCTIONS_DOWNLOAD_CODE + E + Download the function code + + + ZCL_IBMX_WML_V4 + FUNCTIONS_GET + E + Retrieve the function + + + ZCL_IBMX_WML_V4 + FUNCTIONS_LIST + E + Retrieve the functions + + + ZCL_IBMX_WML_V4 + FUNCTIONS_LIST_REVISIONS + E + Retrieve the function revisions + + + ZCL_IBMX_WML_V4 + FUNCTIONS_UPDATE + E + Update the function + + + ZCL_IBMX_WML_V4 + FUNCTIONS_UPLOAD_CODE + E + Upload the function code + + + ZCL_IBMX_WML_V4 + INSTANCES_GET + E + Retrieve the service instance + + + ZCL_IBMX_WML_V4 + INSTANCES_LIST + E + Retrieve the service instances + + + ZCL_IBMX_WML_V4 + MODELS_CREATE + E + Create a new model + + + ZCL_IBMX_WML_V4 + MODELS_CREATE_REVISION + E + Create a new model revision + + + ZCL_IBMX_WML_V4 + MODELS_DELETE + E + Delete the model + + + ZCL_IBMX_WML_V4 + MODELS_DELETE_CONTENT + E + Delete the model content + + + ZCL_IBMX_WML_V4 + MODELS_DOWNLOAD_CONTENT + E + Download the model content + + + ZCL_IBMX_WML_V4 + MODELS_FILTERED_DOWNLOAD + E + Download the model content that matches a certain criteria + + + ZCL_IBMX_WML_V4 + MODELS_GET + E + Retrieve the model + + + ZCL_IBMX_WML_V4 + MODELS_LIST + E + Retrieve the models + + + ZCL_IBMX_WML_V4 + MODELS_LIST_ATTACHMENTS + E + Retrieve the model content metadata list + + + ZCL_IBMX_WML_V4 + MODELS_LIST_REVISIONS + E + Retrieve the model revisions + + + ZCL_IBMX_WML_V4 + MODELS_UPDATE + E + Update the model + + + ZCL_IBMX_WML_V4 + MODELS_UPLOAD_CONTENT + E + Upload the model content + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_CREATE + E + Create a new model definition + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_DELETE + E + Delete the model definition + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_GET + E + Retrieve the model definition + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_LIST + E + Retrieve the model definitions + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_UPDATE + E + Update the model definition + + + ZCL_IBMX_WML_V4 + MODEL_DEFINITIONS_UPLOAD_MODEL + E + Upload the model definition model + + + ZCL_IBMX_WML_V4 + MODEL_DEF_CREATE_REVISION + E + Create a new model definition revision + + + ZCL_IBMX_WML_V4 + MODEL_DEF_DOWNLOAD_MODEL + E + Download the model definition model + + + ZCL_IBMX_WML_V4 + MODEL_DEF_LIST_REVISIONS + E + Retrieve the model definition revisions + + + ZCL_IBMX_WML_V4 + PIPELINES_CREATE + E + Create a new pipeline + + + ZCL_IBMX_WML_V4 + PIPELINES_CREATE_REVISION + E + Create a new pipeline revision + + + ZCL_IBMX_WML_V4 + PIPELINES_DELETE + E + Delete the pipeline + + + ZCL_IBMX_WML_V4 + PIPELINES_GET + E + Retrieve the pipeline + + + ZCL_IBMX_WML_V4 + PIPELINES_LIST + E + Retrieve the pipelines + + + ZCL_IBMX_WML_V4 + PIPELINES_LIST_REVISIONS + E + Retrieve the pipeline revisions + + + ZCL_IBMX_WML_V4 + PIPELINES_UPDATE + E + Update the pipeline + + + ZCL_IBMX_WML_V4 + REMOTE_TRAINING_SYSTEMS_CREATE + E + Create a new remote training system + + + ZCL_IBMX_WML_V4 + REMOTE_TRAINING_SYSTEMS_DELETE + E + Delete the remote training system + + + ZCL_IBMX_WML_V4 + REMOTE_TRAINING_SYSTEMS_GET + E + Retrieve the remote training system + + + ZCL_IBMX_WML_V4 + REMOTE_TRAINING_SYSTEMS_LIST + E + Retrieve the remote training systems + + + ZCL_IBMX_WML_V4 + REMOTE_TRAINING_SYSTEMS_UPDATE + E + Update the remote training system + + + ZCL_IBMX_WML_V4 + REMOTE_TRAIN_SYS_CRE_REVISION + E + Create a new remote training system revision + + + ZCL_IBMX_WML_V4 + REMOTE_TRAIN_SYS_LST_REVISIONS + E + Retrieve the remote training system revisions + + + ZCL_IBMX_WML_V4 + TRAININGS_CREATE + E + Create a new WML training + + + ZCL_IBMX_WML_V4 + TRAININGS_DELETE + E + Cancel the training + + + ZCL_IBMX_WML_V4 + TRAININGS_GET + E + Retrieve the training + + + ZCL_IBMX_WML_V4 + TRAININGS_LIST + E + Retrieve the list of trainings + + + ZCL_IBMX_WML_V4 + TRAINING_DEFINITIONS_CREATE + E + Create a new training definition + + + ZCL_IBMX_WML_V4 + TRAINING_DEFINITIONS_DELETE + E + Delete the training definition + + + ZCL_IBMX_WML_V4 + TRAINING_DEFINITIONS_GET + E + Retrieve the training definition + + + ZCL_IBMX_WML_V4 + TRAINING_DEFINITIONS_LIST + E + Retrieve the training definitions + + + ZCL_IBMX_WML_V4 + TRAINING_DEFINITIONS_UPDATE + E + Update the training definition + + + ZCL_IBMX_WML_V4 + TRAIN_DEF_CREATE_REVISION + E + Create a new training definition revision + + + ZCL_IBMX_WML_V4 + TRAIN_DEF_LIST_REVISIONS + E + Retrieve the training definition revisions + + + + + diff --git a/src/zcx_ibmx_service_exception.clas.abap b/src/zcx_ibmx_service_exception.clas.abap new file mode 100644 index 0000000..bc942ac --- /dev/null +++ b/src/zcx_ibmx_service_exception.clas.abap @@ -0,0 +1,80 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +class ZCX_IBMX_SERVICE_EXCEPTION definition + public + inheriting from CX_STATIC_CHECK + final + create public . + +public section. + + interfaces IF_T100_DYN_MSG . + interfaces IF_T100_MESSAGE . + + data P_MSG_JSON type STRING . + data P_HTTP_STATUS type STRING . + data P_HTTP_REASON type STRING . + + methods CONSTRUCTOR + importing + !TEXTID like IF_T100_MESSAGE=>T100KEY optional + !PREVIOUS like PREVIOUS optional + !P_MSG_JSON type STRING optional + !P_HTTP_STATUS type STRING optional + !P_HTTP_REASON type STRING optional . + + methods IF_MESSAGE~GET_LONGTEXT + redefinition . + methods IF_MESSAGE~GET_TEXT + redefinition . +protected section. +private section. +ENDCLASS. + + + +CLASS ZCX_IBMX_SERVICE_EXCEPTION IMPLEMENTATION. + + + method CONSTRUCTOR. + CALL METHOD SUPER->CONSTRUCTOR + EXPORTING + PREVIOUS = PREVIOUS. + me->P_MSG_JSON = P_MSG_JSON . + me->P_HTTP_STATUS = P_HTTP_STATUS . + me->P_HTTP_REASON = P_HTTP_REASON . + clear me->textid. + if textid is initial. + IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID. + else. + IF_T100_MESSAGE~T100KEY = TEXTID. + endif. + endmethod. + + + method if_message~get_longtext. + call method super->if_message~get_longtext + exporting + preserve_newlines = preserve_newlines + receiving + result = result. + endmethod. + + + method if_message~get_text. + call method super->if_message~get_text + receiving + result = result. + endmethod. +ENDCLASS. diff --git a/src/zcx_ibmx_service_exception.clas.xml b/src/zcx_ibmx_service_exception.clas.xml new file mode 100644 index 0000000..b5dc40e --- /dev/null +++ b/src/zcx_ibmx_service_exception.clas.xml @@ -0,0 +1,25 @@ + + + + + + ZCX_IBMX_SERVICE_EXCEPTION + E + IBM Cloud Service Exception + 40 + 1 + X + X + X + + + + ZCX_IBMX_SERVICE_EXCEPTION + CONSTRUCTOR + E + CONSTRUCTOR + + + + + \ No newline at end of file diff --git a/src/zibmx.msag.xml b/src/zibmx.msag.xml new file mode 100644 index 0000000..d369ce3 --- /dev/null +++ b/src/zibmx.msag.xml @@ -0,0 +1,416 @@ + + + + + + ZIBMX + E + + + + E + ZIBMX + 000 + &1 + + + E + ZIBMX + 001 + &1: return code &2 + + + E + ZIBMX + 002 + An exception has occurred, reason code &1. + + + E + ZIBMX + 003 + HTTP Status: &1 (&2) + + + E + ZIBMX + 004 + Malformated url: &1 + + + E + ZIBMX + 005 + HTTP &1 request failed: &2 + + + E + ZIBMX + 006 + HTTP client cannot be created, return code &1. + + + E + ZIBMX + 007 + Parameter &1 not set + + + E + ZIBMX + 008 + Either parameter &1 or parameter &2 must be specified. + + + E + ZIBMX + 020 + Cannot parse JSON string, see short dump. + + + E + ZIBMX + 030 + Decoding of base64 string failed. + + + E + ZIBMX + 040 + &1 + + + E + ZIBMX + 050 + Missing field &1 in input structure. + + + E + ZIBMX + 051 + Input image is missing or ambiguous. + + + E + ZIBMX + 052 + base64 decoding of image &1 failed with return code &2. + + + E + ZIBMX + 053 + Classifier &1 has status &2. Operation terminated. + + + E + ZIBMX + 054 + Field &1 is missing or has incompatible type. + + + E + ZIBMX + 055 + Input structure meta data is not available. + + + E + ZIBMX + 056 + Cannot add image to ZIP file without filename. + + + + + + NA + ZIBMX003 + E + E + 0018 + X + 00005 + + + DOKU + ZIBMX003 + NA + E + S_DOCU_SHOW + S_DOCUS1 + 00018 + 072 + + + + AS + The HTTP Request received status "&V1&": "&V2&" + + + U1 + &SYSTEM_RESPONSE& + + + AS + Access point: &V3& + + + AS + Detailed Information reported by the service: + + + AS + &V4& + + + U1 + &WHAT_TO_DO& + + + AS + ,,Correct the error and restart the process. + + + + + + NA + ZIBMX004 + E + E + 0002 + X + 00004 + + + DOKU + ZIBMX004 + NA + E + S_DOCU_SHOW + S_DOCUS1 + 00002 + 072 + + + + U1 + &CAUSE& + + + AS + The format of URL "&V1&" is not correct. + + + U1 + &SYSTEM_RESPONSE& + + + AS + The request has been terminated. + + + U1 + &WHAT_TO_DO& + + + AS + Correct the URL. Format of the URL must comply with schema http(s):// + + + = + <host>/<api path> + + + U1 + &SYS_ADMIN& + + + AS + + + + + + NA + ZIBMX040 + E + E + 0004 + X + 00004 + + + DOKU + ZIBMX040 + NA + E + S_DOCU_SHOW + S_DOCUS1 + 00004 + 072 + + + + U1 + &CAUSE& + + + AS + Error + + + U1 + &SYSTEM_RESPONSE& + + + AS + JSON comes here. + + + AS + <(>&<)>1 + + + AS + &V1& + + + U1 + &WHAT_TO_DO& + + + AS + + + U1 + &SYS_ADMIN& + + + AS + + + + + + NA + ZIBMX050 + E + E + 0003 + X + 00004 + + + DOKU + ZIBMX050 + NA + E + S_DOCU_SHOW + S_DOCUS1 + 00003 + 072 + + + + U1 + &CAUSE& + + + AS + The Watson Machine Learning scoring endpoint requires input field &V1& + + + which is not present in the input structure. + + + U1 + &SYSTEM_RESPONSE& + + + AS + Watson Machine Learning refuses the scoring request. + + + U1 + &WHAT_TO_DO& + + + AS + Add field &V1& to the input structure. + + + U1 + &SYS_ADMIN& + + + AS + + + + + + NA + ZIBMX051 + E + E + 0001 + X + 00005 + + + DOKU + ZIBMX051 + NA + E + S_DOCU_SHOW + S_DOCUS1 + 00001 + 072 + + + + U1 + &CAUSE& + + + AS + The image to be classified is not specified or its specification is + + + ambiguous. + + + U1 + &SYSTEM_RESPONSE& + + + AS + The image is not being classified. + + + U1 + &WHAT_TO_DO& + + + AS + Specify the image either as binary data (type XSTRING) or as base64 + + + encoded character data (type STRING), but not both. + + + U1 + &SYS_ADMIN& + + + AS + + + + + + + \ No newline at end of file diff --git a/src/zibmx_config.tabl.xml b/src/zibmx_config.tabl.xml new file mode 100644 index 0000000..a7b1727 --- /dev/null +++ b/src/zibmx_config.tabl.xml @@ -0,0 +1,87 @@ + + + + + + ZIBMX_CONFIG + E + TRANSP + X + IBM Cloud Service Integration - Configuration + X + C + 1 + + + ZIBMX_CONFIG + A + 2 + APPL2 + X + X + + + + ZIBMX_CONFIG + CLIENT + E + 0001 + X + 0 + C + 000006 + X + CLNT + 000003 + CLNT + + + ZIBMX_CONFIG + SERVICE + E + 0002 + X + 0 + C + 000060 + X + CHAR + 000030 + CHAR + + + ZIBMX_CONFIG + INSTANCE_UID + 0003 + X + ZIBMX_TY_INSTANCE_UID + 0 + X + E + + + ZIBMX_CONFIG + PARAM + E + 0004 + X + 0 + C + 000064 + X + CHAR + 000032 + CHAR + + + ZIBMX_CONFIG + VALUE + 0005 + ZIBMX_TY_STRINGVALUE + 0 + E + + + + + \ No newline at end of file diff --git a/src/zibmx_dom_stringvalue.doma.xml b/src/zibmx_dom_stringvalue.doma.xml new file mode 100644 index 0000000..e66e6dd --- /dev/null +++ b/src/zibmx_dom_stringvalue.doma.xml @@ -0,0 +1,14 @@ + + + + + + ZIBMX_DOM_STRINGVALUE + E + STRG + X + Case-sensitive string value + + + + \ No newline at end of file diff --git a/src/zibmx_token.tabl.xml b/src/zibmx_token.tabl.xml new file mode 100644 index 0000000..cf66262 --- /dev/null +++ b/src/zibmx_token.tabl.xml @@ -0,0 +1,141 @@ + + + + + + ZIBMX_TOKEN + E + TRANSP + X + IAM tokens + X + L + 4 + + + ZIBMX_TOKEN + A + 4 + APPL2 + P + X + + + + ZIBMX_TOKEN + CLIENT + E + 0001 + X + 0 + C + 000006 + X + CLNT + 000003 + CLNT + + + ZIBMX_TOKEN + SERVICE + E + 0002 + X + 0 + C + 000060 + X + CHAR + 000030 + CHAR + + + ZIBMX_TOKEN + INSTANCE_UID + 0003 + X + ZIBMX_TY_INSTANCE_UID + 0 + X + E + + + ZIBMX_TOKEN + ACCESS_TOKEN + E + 0004 + 0 + g + 000008 + STRG + STRG + + + ZIBMX_TOKEN + REFRESH_TOKEN + E + 0005 + 0 + g + 000008 + STRG + STRG + + + ZIBMX_TOKEN + TOKEN_TYPE + E + 0006 + 0 + g + 000008 + STRG + STRG + + + ZIBMX_TOKEN + EXPIRES_IN + E + 0007 + 0 + X + 000004 + INT4 + 000010 + INT4 + + + ZIBMX_TOKEN + EXPIRES_TS + 0008 + TIMESTAMP + 0 + E + + + ZIBMX_TOKEN + EXPIRATION + E + 0009 + 0 + X + 000004 + INT4 + 000010 + INT4 + + + ZIBMX_TOKEN + SCOPE + E + 0010 + 0 + g + 000008 + STRG + STRG + + + + + \ No newline at end of file diff --git a/src/zibmx_ty_instance_uid.dtel.xml b/src/zibmx_ty_instance_uid.dtel.xml new file mode 100644 index 0000000..bed71ed --- /dev/null +++ b/src/zibmx_ty_instance_uid.dtel.xml @@ -0,0 +1,24 @@ + + + + + + ZIBMX_TY_INSTANCE_UID + E + 55 + 10 + 20 + 40 + Instance GUI + Instance UID + Instance + Instance UID + Instance UID + E + CHAR + 000032 + 000032 + + + + \ No newline at end of file diff --git a/src/zibmx_ty_stringvalue.dtel.xml b/src/zibmx_ty_stringvalue.dtel.xml new file mode 100644 index 0000000..9e016f2 --- /dev/null +++ b/src/zibmx_ty_stringvalue.dtel.xml @@ -0,0 +1,23 @@ + + + + + + ZIBMX_TY_STRINGVALUE + E + ZIBMX_DOM_STRINGVALUE + 55 + 10 + 20 + 40 + Case-sensitive string value + Value + Value + Value + Value + E + D + + + + \ No newline at end of file diff --git a/src/zif_ibmx_service_arch.intf.abap b/src/zif_ibmx_service_arch.intf.abap new file mode 100644 index 0000000..13298d0 --- /dev/null +++ b/src/zif_ibmx_service_arch.intf.abap @@ -0,0 +1,154 @@ +* Copyright 2019, 2024 IBM Corp. All Rights Reserved. +* +* 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. +interface ZIF_IBMX_SERVICE_ARCH + public . + + + types: + boolean(1) type c . + types: + char(1) type c . + types: + begin of ts_http_status, + code type string, + reason type string, + json type string, + end of ts_http_status . + types: + begin of ts_header, + name type string, + value type string, + end of ts_header . + types: + tt_header type standard table of ts_header with non-unique default key . + types: + begin of ts_url, + protocol type string, + host type string, + path_base type string, + path type string, + querystring type string, + end of ts_url . + types: + begin of ts_access_token, + access_token type string, + token_type(32) type c, + expires_ts type timestamp, + end of ts_access_token . + types: + ty_timezone(6) type c . + types: + ty_ssl_id(6) type c . + types: + begin of ts_request_prop, + url type ts_url, + proxy_host type string, + proxy_port type string, + auth_name type string, + auth_type type string, + auth_headername type string, + auth_basic type boolean, + auth_oauth type boolean, + auth_apikey type boolean, + auth_query type boolean, + auth_header type boolean, + auth_body type boolean, + header_accept type string, + header_content_type type string, + headers type tt_header, + body type string, + body_bin type xstring, + username type string, + password type string, + apikey type string, + access_token type ts_access_token, + ssl_id type ty_ssl_id, + end of ts_request_prop . + types: + tt_string type standard table of string with non-unique default key . + types: + begin of TS_FORM_PART, + CONTENT_TYPE type STRING, + CONTENT_DISPOSITION type STRING, + CDATA type STRING, + XDATA type XSTRING, + end of TS_FORM_PART . + types: + TT_FORM_PART type standard table of TS_FORM_PART with non-unique default key . + + + constants C_METHOD_GET type CHAR value 'g' ##NO_TEXT. + constants C_METHOD_POST type CHAR value 'p' ##NO_TEXT. + constants C_METHOD_PATCH type CHAR value 'm' ##NO_TEXT. + constants C_METHOD_CREATE type CHAR value 'c' ##NO_TEXT. + constants C_METHOD_PUT type CHAR value 'u' ##NO_TEXT. + constants C_METHOD_DELETE type CHAR value 'd' ##NO_TEXT. + constants C_NOT_SUPPORTED type STRING value 'not supported' ##NO_TEXT. + constants C_HEADER_CONTENT_TYPE type STRING value 'Content-Type' ##NO_TEXT. + constants C_HEADER_ACCEPT type STRING value 'Accept' ##NO_TEXT. + constants C_HEADER_CONTENT_DISPOSITION type STRING value 'Content-Disposition' ##NO_TEXT. + constants: + begin of c_mediatype, + all type string value '*/*', + appl_gzip type string value 'application/gzip', + appl_html type string value 'application/html', + appl_json type string value 'application/json', + appl_octet_stream type string value 'application/octet-stream', + appl_pdf type string value 'application/pdf', + appl_www_form_urlencoded type string value 'application/x-www-form-urlencoded', + appl_xml type string value 'application/xml', + appl_xhtml_xml type string value 'application/xhtml+xml', + atom_xml type string value 'application/atom+xml', + appl_zip type string value 'application/zip', + audio_all type string value 'audio/*', + audio_mpeg type string value 'audio/mpeg', + audio_ogg type string value 'audio/ogg', + audio_wav type string value 'audio/wav', + image_all type string value 'image/*', + image_bmp type string value 'image/bmp', + image_gif type string value 'image/gif', + image_jpeg type string value 'image/jpeg', + image_png type string value 'image/png', + image_tiff type string value 'image/tiff', + multipart_all type string value 'multipart/*', + multipart_form_data type string value 'multipart/form-data', + multipart_mixed type string value 'multipart/mixed', + text_all type string value 'text/*', + text_css type string value 'text/css', + text_csv type string value 'text/csv', + text_html type string value 'text/html', + text_javascript type string value 'text/javascript', + text_plain type string value 'text/plain', + video_all type string value 'video/*', + video_mp4 type string value 'video/mp4', + video_mpeg type string value 'video/mpeg', + end of c_mediatype . + constants: + begin of c_datatype, + i type char value 'I', + int8 type char value '8', + p type char value 'P', + f type char value 'F', + c type char value 'C', + n type char value 'N', + string type char value 'g', + x type char value 'X', + xstring type char value 'y', + dataref type char value 'l', + objectref type char value 'r', + struct type char value 'u', + struct_deep type char value 'v', + itab type char value 'h', + end of c_datatype . +endinterface. diff --git a/src/zif_ibmx_service_arch.intf.xml b/src/zif_ibmx_service_arch.intf.xml new file mode 100644 index 0000000..76d9556 --- /dev/null +++ b/src/zif_ibmx_service_arch.intf.xml @@ -0,0 +1,15 @@ + + + + + + ZIF_IBMX_SERVICE_ARCH + E + IBM Watson SDK Platform-specifics + 2 + 1 + X + + + + \ No newline at end of file