Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update SAP Cloud SDK #4

Merged
merged 15 commits into from
Aug 14, 2024
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public AiDeploymentCreationResponse createDeployment() {

final AiDeploymentCreationResponse deployment =
new DeploymentApi(getClient())
.deploymentCreate(
.create(
"default",
new AiDeploymentCreationRequest().configurationId("12345-123-123-123-123456abcdefg"));

Expand All @@ -97,14 +97,14 @@ public AiDeploymentDeletionResponse deleteDeployment(AiDeploymentCreationRespons

if (deployment.getStatus() == Status.RUNNING) {
// Only RUNNING deployments can be STOPPED
client.deploymentModify(
client.modify(
newtork marked this conversation as resolved.
Show resolved Hide resolved
"default",
deployment.getId(),
new AiDeploymentModificationRequest().targetStatus(Status.STOPPED));
}
// Wait a few seconds for the deployment to stop
// Only UNKNOWN and STOPPED deployments can be DELETED
return client.deploymentDelete("default", deployment.getId());
return client.delete("default", deployment.getId());
}
```

Expand Down
8 changes: 3 additions & 5 deletions core/src/main/java/com/sap/ai/sdk/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ public class Core {
*/
@Nonnull
public static ApiClient getOrchestrationClient(@Nonnull final String resourceGroup) {
return getClient(
getDestinationForDeployment(getOrchestrationDeployment(resourceGroup), resourceGroup));

return getClient(
getDestinationForDeployment(getOrchestrationDeployment(resourceGroup), resourceGroup));
}

/**
Expand All @@ -62,8 +61,7 @@ public static ApiClient getOrchestrationClient(@Nonnull final String resourceGro
*/
private static String getOrchestrationDeployment(@Nonnull final String resourceGroup)
throws NoSuchElementException {
final var deployments =
new DeploymentApi(getClient(getDestination())).deploymentQuery(resourceGroup);
final var deployments = new DeploymentApi(getClient(getDestination())).deploymentQuery(resourceGroup);
Objects.requireNonNull(deployments, "Deployment get request failed");

return deployments.getResources().stream()
Expand Down
375 changes: 194 additions & 181 deletions core/src/main/java/com/sap/ai/sdk/core/client/ApplicationApi.java

Large diffs are not rendered by default.

114 changes: 60 additions & 54 deletions core/src/main/java/com/sap/ai/sdk/core/client/ArtifactApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService;
import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient;

import com.sap.ai.sdk.core.client.model.AiArtifact ; //NOPMD
import com.sap.ai.sdk.core.client.model.AiArtifactCreationResponse ; //NOPMD
import com.sap.ai.sdk.core.client.model.AiArtifactList ; //NOPMD
import com.sap.ai.sdk.core.client.model.AiArtifactPostData ; //NOPMD
import com.sap.ai.sdk.core.client.model.ArtifactQuery400Response ; //NOPMD
import com.sap.ai.sdk.core.client.model.AiArtifact;
import com.sap.ai.sdk.core.client.model.AiArtifactCreationResponse;
import com.sap.ai.sdk.core.client.model.AiArtifactList;
import com.sap.ai.sdk.core.client.model.AiArtifactPostData;
import com.sap.ai.sdk.core.client.model.ArtifactQuery400Response;

import java.util.HashMap;
import java.util.List;
Expand All @@ -34,28 +34,27 @@
import com.sap.cloud.sdk.cloudplatform.connectivity.Destination;

/**
* AI Core in version 2.33.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.
*/

* AI Core in version 2.33.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.
*/
public class ArtifactApi extends AbstractOpenApiService {
/**
* Instantiates this API class to invoke operations on the AI Core.
*
* @param httpDestination The destination that API should be used with
*/
* Instantiates this API class to invoke operations on the AI Core.
*
* @param httpDestination The destination that API should be used with
*/
public ArtifactApi( @Nonnull final Destination httpDestination )
{
super(httpDestination);
}

/**
* Instantiates this API class to invoke operations on the AI Core based on a given {@link ApiClient}.
*
* @param apiClient
* ApiClient to invoke the API on
*/
* Instantiates this API class to invoke operations on the AI Core based on a given {@link ApiClient}.
*
* @param apiClient
* ApiClient to invoke the API on
*/
@Beta
public ArtifactApi( @Nonnull final ApiClient apiClient )
{
Expand Down Expand Up @@ -87,7 +86,8 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
* @return Integer
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public Integer artifactCount( @Nonnull final String aiResourceGroup, @Nullable final String scenarioId, @Nullable final String executionId, @Nullable final String name, @Nullable final String kind, @Nullable final String $search, @Nullable final Boolean searchCaseInsensitive, @Nullable final List<String> artifactLabelSelector) throws OpenApiRequestException {
@Nonnull
public Integer artifactCount( @Nonnull final String aiResourceGroup, @Nullable final String scenarioId, @Nullable final String executionId, @Nullable final String name, @Nullable final String kind, @Nullable final String $search, @Nullable final Boolean searchCaseInsensitive, @Nullable final List<String> artifactLabelSelector) throws OpenApiRequestException {
final Object localVarPostBody = null;

// verify the required parameter 'aiResourceGroup' is set
Expand Down Expand Up @@ -127,31 +127,33 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
}

/**
* <p>Get number of artifacts</p>
*<p>Retrieve the number of available artifacts that match the specified filter criteria. Filter criteria include a scenarioId, executionId, an artifact name, artifact kind, or artifact labels. Search by substring of artifact name or description is also possible. </p>
* <p>Get number of artifacts</p>
* <p>Retrieve the number of available artifacts that match the specified filter criteria. Filter criteria include a scenarioId, executionId, an artifact name, artifact kind, or artifact labels. Search by substring of artifact name or description is also possible. </p>
* <p><b>200</b> - Number of artifacts
* <p><b>400</b> - The specification of the resource was incorrect
* @param aiResourceGroup
Specify a resource group id
* @return Integer
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
* @param aiResourceGroup
* Specify a resource group id
* @return Integer
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public Integer artifactCount( @Nonnull final String aiResourceGroup) throws OpenApiRequestException {
@Nonnull
public Integer artifactCount( @Nonnull final String aiResourceGroup) throws OpenApiRequestException {
return artifactCount(aiResourceGroup, null, null, null, null, null, null, null);
}
/**
* <p>Register artifact</p>
*<p>Register an artifact for use in a configuration, for example a model or a dataset.</p>
* <p>Register artifact</p>
* <p>Register an artifact for use in a configuration, for example a model or a dataset.</p>
* <p><b>201</b> - The artifact has been registered successfully
* <p><b>400</b> - The specification of the resource was incorrect
* @param aiResourceGroup
Specify a resource group id
* @param aiArtifactPostData
The value for the parameter aiArtifactPostData
* @return AiArtifactCreationResponse
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
* @param aiResourceGroup
* Specify a resource group id
* @param aiArtifactPostData
* The value for the parameter aiArtifactPostData
* @return AiArtifactCreationResponse
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public AiArtifactCreationResponse artifactCreate( @Nonnull final String aiResourceGroup, @Nonnull final AiArtifactPostData aiArtifactPostData) throws OpenApiRequestException {
@Nonnull
public AiArtifactCreationResponse artifactCreate( @Nonnull final String aiResourceGroup, @Nonnull final AiArtifactPostData aiArtifactPostData) throws OpenApiRequestException {
final Object localVarPostBody = aiArtifactPostData;

// verify the required parameter 'aiResourceGroup' is set
Expand Down Expand Up @@ -203,7 +205,8 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
* @return AiArtifact
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public AiArtifact artifactGet( @Nonnull final String aiResourceGroup, @Nonnull final String artifactId, @Nullable final String $expand) throws OpenApiRequestException {
@Nonnull
public AiArtifact artifactGet( @Nonnull final String aiResourceGroup, @Nonnull final String artifactId, @Nullable final String $expand) throws OpenApiRequestException {
final Object localVarPostBody = null;

// verify the required parameter 'aiResourceGroup' is set
Expand Down Expand Up @@ -245,19 +248,20 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
}

/**
* <p>Get artifact by ID</p>
*<p>Retrieve details for artifact with artifactId.</p>
* <p>Get artifact by ID</p>
* <p>Retrieve details for artifact with artifactId.</p>
* <p><b>200</b> - An artifact
* <p><b>400</b> - The specification of the resource was incorrect
* <p><b>404</b> - The specified resource was not found
* @param aiResourceGroup
Specify a resource group id
* @param artifactId
Artifact identifier
* @return AiArtifact
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
* @param aiResourceGroup
* Specify a resource group id
* @param artifactId
* Artifact identifier
* @return AiArtifact
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public AiArtifact artifactGet( @Nonnull final String aiResourceGroup, @Nonnull final String artifactId) throws OpenApiRequestException {
@Nonnull
public AiArtifact artifactGet( @Nonnull final String aiResourceGroup, @Nonnull final String artifactId) throws OpenApiRequestException {
return artifactGet(aiResourceGroup, artifactId, null);
}

Expand Down Expand Up @@ -291,7 +295,8 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
* @return AiArtifactList
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public AiArtifactList artifactQuery( @Nonnull final String aiResourceGroup, @Nullable final String scenarioId, @Nullable final String executionId, @Nullable final String name, @Nullable final String kind, @Nullable final List<String> artifactLabelSelector, @Nullable final Integer $top, @Nullable final Integer $skip, @Nullable final String $search, @Nullable final Boolean searchCaseInsensitive, @Nullable final String $expand) throws OpenApiRequestException {
@Nonnull
public AiArtifactList artifactQuery( @Nonnull final String aiResourceGroup, @Nullable final String scenarioId, @Nullable final String executionId, @Nullable final String name, @Nullable final String kind, @Nullable final List<String> artifactLabelSelector, @Nullable final Integer $top, @Nullable final Integer $skip, @Nullable final String $search, @Nullable final Boolean searchCaseInsensitive, @Nullable final String $expand) throws OpenApiRequestException {
final Object localVarPostBody = null;

// verify the required parameter 'aiResourceGroup' is set
Expand Down Expand Up @@ -334,16 +339,17 @@ public ArtifactApi( @Nonnull final ApiClient apiClient )
}

/**
* <p>Get list of artifacts</p>
*<p>Retrieve a list of artifacts that matches the specified filter criteria. Filter criteria include scenario ID, execution ID, an artifact name, artifact kind, or artifact labels. Use top/skip parameters to paginate the result list. Search by substring of artifact name or description, if required. </p>
* <p>Get list of artifacts</p>
* <p>Retrieve a list of artifacts that matches the specified filter criteria. Filter criteria include scenario ID, execution ID, an artifact name, artifact kind, or artifact labels. Use top/skip parameters to paginate the result list. Search by substring of artifact name or description, if required. </p>
* <p><b>200</b> - A list of artifacts
* <p><b>400</b> - The specification of the resource was incorrect
* @param aiResourceGroup
Specify a resource group id
* @return AiArtifactList
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
* @param aiResourceGroup
* Specify a resource group id
* @return AiArtifactList
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nullable public AiArtifactList artifactQuery( @Nonnull final String aiResourceGroup) throws OpenApiRequestException {
@Nonnull
public AiArtifactList artifactQuery( @Nonnull final String aiResourceGroup) throws OpenApiRequestException {
return artifactQuery(aiResourceGroup, null, null, null, null, null, null, null, null, null, null);
}
}
Loading