com.azure.resourcemanager.azurestackhci.implementation.UpdateRunsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-azurestackhci Show documentation
Show all versions of azure-resourcemanager-azurestackhci Show documentation
This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. 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.azurestackhci.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.azurestackhci.fluent.UpdateRunsClient;
import com.azure.resourcemanager.azurestackhci.fluent.models.UpdateRunInner;
import com.azure.resourcemanager.azurestackhci.models.UpdateRun;
import com.azure.resourcemanager.azurestackhci.models.UpdateRuns;
public final class UpdateRunsImpl implements UpdateRuns {
private static final ClientLogger LOGGER = new ClientLogger(UpdateRunsImpl.class);
private final UpdateRunsClient innerClient;
private final com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager;
public UpdateRunsImpl(UpdateRunsClient innerClient,
com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list(String resourceGroupName, String clusterName, String updateName) {
PagedIterable inner = this.serviceClient().list(resourceGroupName, clusterName, updateName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new UpdateRunImpl(inner1, this.manager()));
}
public PagedIterable list(String resourceGroupName, String clusterName, String updateName,
Context context) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, clusterName, updateName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new UpdateRunImpl(inner1, this.manager()));
}
public void delete(String resourceGroupName, String clusterName, String updateName, String updateRunName) {
this.serviceClient().delete(resourceGroupName, clusterName, updateName, updateRunName);
}
public void delete(String resourceGroupName, String clusterName, String updateName, String updateRunName,
Context context) {
this.serviceClient().delete(resourceGroupName, clusterName, updateName, updateRunName, context);
}
public Response getWithResponse(String resourceGroupName, String clusterName, String updateName,
String updateRunName, Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, clusterName, updateName, updateRunName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new UpdateRunImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public UpdateRun get(String resourceGroupName, String clusterName, String updateName, String updateRunName) {
UpdateRunInner inner = this.serviceClient().get(resourceGroupName, clusterName, updateName, updateRunName);
if (inner != null) {
return new UpdateRunImpl(inner, this.manager());
} else {
return null;
}
}
public UpdateRun 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 clusterName = ResourceManagerUtils.getValueFromIdByName(id, "clusters");
if (clusterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id)));
}
String updateName = ResourceManagerUtils.getValueFromIdByName(id, "updates");
if (updateName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updates'.", id)));
}
String updateRunName = ResourceManagerUtils.getValueFromIdByName(id, "updateRuns");
if (updateRunName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updateRuns'.", id)));
}
return this.getWithResponse(resourceGroupName, clusterName, updateName, updateRunName, 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 clusterName = ResourceManagerUtils.getValueFromIdByName(id, "clusters");
if (clusterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id)));
}
String updateName = ResourceManagerUtils.getValueFromIdByName(id, "updates");
if (updateName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updates'.", id)));
}
String updateRunName = ResourceManagerUtils.getValueFromIdByName(id, "updateRuns");
if (updateRunName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updateRuns'.", id)));
}
return this.getWithResponse(resourceGroupName, clusterName, updateName, updateRunName, 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 clusterName = ResourceManagerUtils.getValueFromIdByName(id, "clusters");
if (clusterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id)));
}
String updateName = ResourceManagerUtils.getValueFromIdByName(id, "updates");
if (updateName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updates'.", id)));
}
String updateRunName = ResourceManagerUtils.getValueFromIdByName(id, "updateRuns");
if (updateRunName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updateRuns'.", id)));
}
this.delete(resourceGroupName, clusterName, updateName, updateRunName, 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 clusterName = ResourceManagerUtils.getValueFromIdByName(id, "clusters");
if (clusterName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id)));
}
String updateName = ResourceManagerUtils.getValueFromIdByName(id, "updates");
if (updateName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updates'.", id)));
}
String updateRunName = ResourceManagerUtils.getValueFromIdByName(id, "updateRuns");
if (updateRunName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'updateRuns'.", id)));
}
this.delete(resourceGroupName, clusterName, updateName, updateRunName, context);
}
private UpdateRunsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.azurestackhci.AzureStackHciManager manager() {
return this.serviceManager;
}
public UpdateRunImpl define(String name) {
return new UpdateRunImpl(name, this.manager());
}
}