com.azure.resourcemanager.hybridcompute.implementation.MachineRunCommandsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.
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.hybridcompute.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.hybridcompute.fluent.MachineRunCommandsClient;
import com.azure.resourcemanager.hybridcompute.fluent.models.MachineRunCommandInner;
import com.azure.resourcemanager.hybridcompute.models.MachineRunCommand;
import com.azure.resourcemanager.hybridcompute.models.MachineRunCommands;
public final class MachineRunCommandsImpl implements MachineRunCommands {
private static final ClientLogger LOGGER = new ClientLogger(MachineRunCommandsImpl.class);
private final MachineRunCommandsClient innerClient;
private final com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager;
public MachineRunCommandsImpl(MachineRunCommandsClient innerClient,
com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public void delete(String resourceGroupName, String machineName, String runCommandName) {
this.serviceClient().delete(resourceGroupName, machineName, runCommandName);
}
public void delete(String resourceGroupName, String machineName, String runCommandName, Context context) {
this.serviceClient().delete(resourceGroupName, machineName, runCommandName, context);
}
public Response getWithResponse(String resourceGroupName, String machineName,
String runCommandName, Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, machineName, runCommandName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new MachineRunCommandImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public MachineRunCommand get(String resourceGroupName, String machineName, String runCommandName) {
MachineRunCommandInner inner = this.serviceClient().get(resourceGroupName, machineName, runCommandName);
if (inner != null) {
return new MachineRunCommandImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable list(String resourceGroupName, String machineName) {
PagedIterable inner = this.serviceClient().list(resourceGroupName, machineName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new MachineRunCommandImpl(inner1, this.manager()));
}
public PagedIterable list(String resourceGroupName, String machineName, String expand,
Context context) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, machineName, expand, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new MachineRunCommandImpl(inner1, this.manager()));
}
public MachineRunCommand 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 machineName = ResourceManagerUtils.getValueFromIdByName(id, "machines");
if (machineName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id)));
}
String runCommandName = ResourceManagerUtils.getValueFromIdByName(id, "runCommands");
if (runCommandName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id)));
}
return this.getWithResponse(resourceGroupName, machineName, runCommandName, 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 machineName = ResourceManagerUtils.getValueFromIdByName(id, "machines");
if (machineName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id)));
}
String runCommandName = ResourceManagerUtils.getValueFromIdByName(id, "runCommands");
if (runCommandName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id)));
}
return this.getWithResponse(resourceGroupName, machineName, runCommandName, 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 machineName = ResourceManagerUtils.getValueFromIdByName(id, "machines");
if (machineName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id)));
}
String runCommandName = ResourceManagerUtils.getValueFromIdByName(id, "runCommands");
if (runCommandName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id)));
}
this.delete(resourceGroupName, machineName, runCommandName, 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 machineName = ResourceManagerUtils.getValueFromIdByName(id, "machines");
if (machineName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id)));
}
String runCommandName = ResourceManagerUtils.getValueFromIdByName(id, "runCommands");
if (runCommandName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id)));
}
this.delete(resourceGroupName, machineName, runCommandName, context);
}
private MachineRunCommandsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() {
return this.serviceManager;
}
public MachineRunCommandImpl define(String name) {
return new MachineRunCommandImpl(name, this.manager());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy