Package com.sap.ai.sdk.core.client

# Class FileApi

java.lang.Object
com.sap.cloud.sdk.services.openapi.apache.apiclient.BaseApi
com.sap.ai.sdk.core.client.FileApi

public class FileApi extends com.sap.cloud.sdk.services.openapi.apache.apiclient.BaseApi
AI Core in version 2.42.0.

Provides tools to manage your scenarios and workflows in SAP AI Core. Execute pipelines as a batch job, for example to pre-process or train your models, or perform batch inference. Serve inference requests of trained models. Deploy а trained machine learning model as a web service to serve inference requests with high performance. Register your own Docker registry, synchronize your AI content from your own git repository, and register your own object store for training data and trained models.

- ## Field Summary

  ### Fields inherited from class com.sap.cloud.sdk.services.openapi.apache.apiclient.BaseApi

  `apiClient, defaultHeaders`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileApi()`
  Instantiates this API class to invoke operations on the AI Core
  `FileApi(AiCoreService aiCoreService)`
  Instantiates this API class to invoke operations on the AI Core

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiResponse`
  `delete(String path)`
  Delete file
  `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiResponse`
  `delete(String path, String aiResourceGroup)`
  Delete file
  `File`
  `download(String path)`
  Download file
  `File`
  `download(String path, String aiResourceGroup)`
  Download file
  `DSetFileCreationResponse`
  `upload(String path)`
  Upload file (size <= 100Mb)
  `DSetFileCreationResponse`
  `upload(String path, String aiResourceGroup, Boolean overwrite, Object body)`
  Upload file (size <= 100Mb)
  `FileApi`
  `withDefaultHeaders(Map<String,String> defaultHeaders)`
  Creates a new API instance with additional default headers.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FileApi

    public FileApi()
    Instantiates this API class to invoke operations on the AI Core

  - ### FileApi

    public FileApi(@Nonnull AiCoreService aiCoreService)
    Instantiates this API class to invoke operations on the AI Core
    Parameters:
      `aiCoreService` - The configured connectivity instance to AI Core

- ## Method Details

  - ### withDefaultHeaders

    public FileApi withDefaultHeaders(@Nonnull Map<String,String> defaultHeaders)
    Creates a new API instance with additional default headers.
    Parameters:
      `defaultHeaders` - Additional headers to include in all requests
    Returns:
      A new API instance with the combined headers

  - ### delete

    @Nonnull public com.sap.cloud.sdk.services.openapi.apache.core.OpenApiResponse delete(@Nonnull String path, @Nullable String aiResourceGroup) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Delete file

    Delete the file specified by the path parameter.

    204 - The request was processed successfully.

    400 - The specification of the resource was incorrect

    404 - The specified resource was not found

    Parameters:
      `path` - (required) path relative to the object store root URL in the secret
      `aiResourceGroup` - (optional) Specify a resource group id
    Returns:
      An OpenApiResponse containing the status code of the HttpResponse.
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API

  - ### delete

    @Nonnull public com.sap.cloud.sdk.services.openapi.apache.core.OpenApiResponse delete(@Nonnull String path) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Delete file

    Delete the file specified by the path parameter.

    204 - The request was processed successfully.

    400 - The specification of the resource was incorrect

    404 - The specified resource was not found

    Parameters:
      `path` - path relative to the object store root URL in the secret
    Returns:
      An OpenApiResponse containing the status code of the HttpResponse.
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API

  - ### download

    @Nonnull public File download(@Nonnull String path, @Nullable String aiResourceGroup) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Download file

    Endpoint for downloading file. The path must point to an individual file.

    200 - OK

    400 - The specification of the resource was incorrect

    404 - The specified resource was not found

    Parameters:
      `path` - (required) path relative to the object store root URL in the secret
      `aiResourceGroup` - (optional) Specify a resource group id
    Returns:
      File
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API

  - ### download

    @Nonnull public File download(@Nonnull String path) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Download file

    Endpoint for downloading file. The path must point to an individual file.

    200 - OK

    400 - The specification of the resource was incorrect

    404 - The specified resource was not found

    Parameters:
      `path` - path relative to the object store root URL in the secret
    Returns:
      File
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API

  - ### upload

    @Nonnull public DSetFileCreationResponse upload(@Nonnull String path, @Nullable String aiResourceGroup, @Nullable Boolean overwrite, @Nullable Object body) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Upload file (size <= 100Mb)

    Endpoint for uploading file. The maximum file size depends on the actual implementation but must not exceed 100MB. The actual file size limit can be obtained by querying the AI API Runtime Capabilities Endpoint and checking the limits in the section of the `fileUpload` extension. Path cannot be a prefix, it must be a path to an object. Clients may group the objects in any manner they choose by specifying path prefixes. Allowed mime-types will be decided by the implementation. Content-Type header can be set to \"application/octet-stream\" but the implementation is responsible for detecting the actual mime type and checking against the allowed list of mime types. For security reasons, implementations cannot trust the mime type sent by the client. Example URLs: /files/dar/schemas/schema.json /files/icr/datasets/training/20201001/20201001-01.csv /files/icr/datasets/training/20201001/20201001-02.csv /files/mask-detection/training/mask-detection-20210301.tar.gz

    201 - Created

    400 - The specification of the resource was incorrect

    409 - The specified file already exists and cannot be overwritten.

    413 - The file size exceeds the supported limit.

    Parameters:
      `path` - (required) path relative to the object store root URL in the secret
      `aiResourceGroup` - (optional) Specify a resource group id
      `overwrite` - (optional) If true, then file is overwritten. Default is false.
      `body` - (optional) Body of the file upload request
    Returns:
      DSetFileCreationResponse
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API

  - ### upload

    @Nonnull public DSetFileCreationResponse upload(@Nonnull String path) throws com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException
    Upload file (size <= 100Mb)

    Endpoint for uploading file. The maximum file size depends on the actual implementation but must not exceed 100MB. The actual file size limit can be obtained by querying the AI API Runtime Capabilities Endpoint and checking the limits in the section of the `fileUpload` extension. Path cannot be a prefix, it must be a path to an object. Clients may group the objects in any manner they choose by specifying path prefixes. Allowed mime-types will be decided by the implementation. Content-Type header can be set to \"application/octet-stream\" but the implementation is responsible for detecting the actual mime type and checking against the allowed list of mime types. For security reasons, implementations cannot trust the mime type sent by the client. Example URLs: /files/dar/schemas/schema.json /files/icr/datasets/training/20201001/20201001-01.csv /files/icr/datasets/training/20201001/20201001-02.csv /files/mask-detection/training/mask-detection-20210301.tar.gz

    201 - Created

    400 - The specification of the resource was incorrect

    409 - The specified file already exists and cannot be overwritten.

    413 - The file size exceeds the supported limit.

    Parameters:
      `path` - path relative to the object store root URL in the secret
    Returns:
      DSetFileCreationResponse
    Throws:
      `com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException` - if an error occurs while attempting to invoke the API