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

Remove requireNonNull #24

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ public AiDeploymentCreationResponse createDeployment() {
AiDeploymentCreationRequest.create()
.configurationId("12345-123-123-123-123456abcdefg"));

Objects.requireNonNull(deployment, "Deployment creation failed");

String id = deployment.getId();
AiExecutionStatus status = deployment.getStatus();

Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/com/sap/ai/sdk/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import javax.annotation.Nonnull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
Expand Down Expand Up @@ -62,7 +61,6 @@ 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);
Objects.requireNonNull(deployments, "Deployment get request failed");

return deployments.getResources().stream()
.filter(deployment -> "orchestration".equals(deployment.getScenarioId()))
Expand Down Expand Up @@ -244,7 +242,6 @@ private static String getDeploymentForModel(
@Nonnull final String modelName, @Nonnull final String resourceGroup)
throws NoSuchElementException {
final var deployments = new DeploymentApi(getClient()).deploymentQuery(resourceGroup);
Objects.requireNonNull(deployments, "Deployment get request failed");

return deployments.getResources().stream()
.filter(deployment -> isDeploymentOfModel(modelName, deployment))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.sap.ai.sdk.core.client.model.AiDeploymentModificationResponse;
import com.sap.ai.sdk.core.client.model.AiDeploymentTargetStatus;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -44,7 +43,7 @@ public AiDeploymentDeletionResponse createAndDeleteDeploymentByConfigId(

// shortly after creation, the deployment will be status UNKNOWN.
// We can directly DELETE it, without going through STOPPED
return API.deploymentDelete("default", Objects.requireNonNull(deployment).getId());
return API.deploymentDelete("default", deployment.getId());
}

/**
Expand Down Expand Up @@ -108,7 +107,7 @@ public List<AiDeploymentDeletionResponse> deleteByConfigId(
public List<AiDeployment> getAllByConfigId(@Nonnull @PathVariable("id") final String configId) {
final AiDeploymentList deploymentList = API.deploymentQuery("default");

return Objects.requireNonNull(deploymentList).getResources().stream()
return deploymentList.getResources().stream()
.filter(deployment -> configId.equals(deployment.getConfigurationId()))
.toList();
}
Expand Down