com.azure.resourcemanager.machinelearning.implementation.OnlineDeploymentsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-machinelearning Show documentation
Show all versions of azure-resourcemanager-machinelearning Show documentation
This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.machinelearning.implementation;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.machinelearning.fluent.OnlineDeploymentsClient;
import com.azure.resourcemanager.machinelearning.fluent.models.DeploymentLogsInner;
import com.azure.resourcemanager.machinelearning.fluent.models.OnlineDeploymentInner;
import com.azure.resourcemanager.machinelearning.fluent.models.SkuResourceInner;
import com.azure.resourcemanager.machinelearning.models.DeploymentLogs;
import com.azure.resourcemanager.machinelearning.models.DeploymentLogsRequest;
import com.azure.resourcemanager.machinelearning.models.OnlineDeployment;
import com.azure.resourcemanager.machinelearning.models.OnlineDeployments;
import com.azure.resourcemanager.machinelearning.models.SkuResource;
public final class OnlineDeploymentsImpl implements OnlineDeployments {
private static final ClientLogger LOGGER = new ClientLogger(OnlineDeploymentsImpl.class);
private final OnlineDeploymentsClient innerClient;
private final com.azure.resourcemanager.machinelearning.MachineLearningManager serviceManager;
public OnlineDeploymentsImpl(OnlineDeploymentsClient innerClient,
com.azure.resourcemanager.machinelearning.MachineLearningManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list(String resourceGroupName, String workspaceName, String endpointName) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, workspaceName, endpointName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new OnlineDeploymentImpl(inner1, this.manager()));
}
public PagedIterable list(String resourceGroupName, String workspaceName, String endpointName,
String orderBy, Integer top, String skip, Context context) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, workspaceName, endpointName, orderBy, top, skip, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new OnlineDeploymentImpl(inner1, this.manager()));
}
public void delete(String resourceGroupName, String workspaceName, String endpointName, String deploymentName) {
this.serviceClient().delete(resourceGroupName, workspaceName, endpointName, deploymentName);
}
public void delete(String resourceGroupName, String workspaceName, String endpointName, String deploymentName,
Context context) {
this.serviceClient().delete(resourceGroupName, workspaceName, endpointName, deploymentName, context);
}
public Response getWithResponse(String resourceGroupName, String workspaceName,
String endpointName, String deploymentName, Context context) {
Response inner = this.serviceClient()
.getWithResponse(resourceGroupName, workspaceName, endpointName, deploymentName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new OnlineDeploymentImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public OnlineDeployment get(String resourceGroupName, String workspaceName, String endpointName,
String deploymentName) {
OnlineDeploymentInner inner
= this.serviceClient().get(resourceGroupName, workspaceName, endpointName, deploymentName);
if (inner != null) {
return new OnlineDeploymentImpl(inner, this.manager());
} else {
return null;
}
}
public Response getLogsWithResponse(String resourceGroupName, String workspaceName,
String endpointName, String deploymentName, DeploymentLogsRequest body, Context context) {
Response inner = this.serviceClient()
.getLogsWithResponse(resourceGroupName, workspaceName, endpointName, deploymentName, body, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new DeploymentLogsImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public DeploymentLogs getLogs(String resourceGroupName, String workspaceName, String endpointName,
String deploymentName, DeploymentLogsRequest body) {
DeploymentLogsInner inner
= this.serviceClient().getLogs(resourceGroupName, workspaceName, endpointName, deploymentName, body);
if (inner != null) {
return new DeploymentLogsImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable listSkus(String resourceGroupName, String workspaceName, String endpointName,
String deploymentName) {
PagedIterable inner
= this.serviceClient().listSkus(resourceGroupName, workspaceName, endpointName, deploymentName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SkuResourceImpl(inner1, this.manager()));
}
public PagedIterable listSkus(String resourceGroupName, String workspaceName, String endpointName,
String deploymentName, Integer count, String skip, Context context) {
PagedIterable inner = this.serviceClient()
.listSkus(resourceGroupName, workspaceName, endpointName, deploymentName, count, skip, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SkuResourceImpl(inner1, this.manager()));
}
public OnlineDeployment getById(String id) {
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
if (workspaceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
}
String endpointName = ResourceManagerUtils.getValueFromIdByName(id, "onlineEndpoints");
if (endpointName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'onlineEndpoints'.", id)));
}
String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments");
if (deploymentName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id)));
}
return this.getWithResponse(resourceGroupName, workspaceName, endpointName, deploymentName, Context.NONE)
.getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
if (workspaceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
}
String endpointName = ResourceManagerUtils.getValueFromIdByName(id, "onlineEndpoints");
if (endpointName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'onlineEndpoints'.", id)));
}
String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments");
if (deploymentName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id)));
}
return this.getWithResponse(resourceGroupName, workspaceName, endpointName, deploymentName, context);
}
public void deleteById(String id) {
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
if (workspaceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
}
String endpointName = ResourceManagerUtils.getValueFromIdByName(id, "onlineEndpoints");
if (endpointName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'onlineEndpoints'.", id)));
}
String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments");
if (deploymentName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id)));
}
this.delete(resourceGroupName, workspaceName, endpointName, deploymentName, Context.NONE);
}
public void deleteByIdWithResponse(String id, Context context) {
String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces");
if (workspaceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));
}
String endpointName = ResourceManagerUtils.getValueFromIdByName(id, "onlineEndpoints");
if (endpointName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'onlineEndpoints'.", id)));
}
String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments");
if (deploymentName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id)));
}
this.delete(resourceGroupName, workspaceName, endpointName, deploymentName, context);
}
private OnlineDeploymentsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.machinelearning.MachineLearningManager manager() {
return this.serviceManager;
}
public OnlineDeploymentImpl define(String name) {
return new OnlineDeploymentImpl(name, this.manager());
}
}