![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.implementation.Python2PackagesImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automation.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.automation.fluent.Python2PackagesClient;
import com.azure.resourcemanager.automation.fluent.models.ModuleInner;
import com.azure.resourcemanager.automation.models.Module;
import com.azure.resourcemanager.automation.models.Python2Packages;
public final class Python2PackagesImpl implements Python2Packages {
private static final ClientLogger LOGGER = new ClientLogger(Python2PackagesImpl.class);
private final Python2PackagesClient innerClient;
private final com.azure.resourcemanager.automation.AutomationManager serviceManager;
public Python2PackagesImpl(Python2PackagesClient innerClient,
com.azure.resourcemanager.automation.AutomationManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public Response deleteWithResponse(String resourceGroupName, String automationAccountName, String packageName,
Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, automationAccountName, packageName, context);
}
public void delete(String resourceGroupName, String automationAccountName, String packageName) {
this.serviceClient().delete(resourceGroupName, automationAccountName, packageName);
}
public Response getWithResponse(String resourceGroupName, String automationAccountName, String packageName,
Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, automationAccountName, packageName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new ModuleImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public Module get(String resourceGroupName, String automationAccountName, String packageName) {
ModuleInner inner = this.serviceClient().get(resourceGroupName, automationAccountName, packageName);
if (inner != null) {
return new ModuleImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable listByAutomationAccount(String resourceGroupName, String automationAccountName) {
PagedIterable inner
= this.serviceClient().listByAutomationAccount(resourceGroupName, automationAccountName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ModuleImpl(inner1, this.manager()));
}
public PagedIterable listByAutomationAccount(String resourceGroupName, String automationAccountName,
Context context) {
PagedIterable inner
= this.serviceClient().listByAutomationAccount(resourceGroupName, automationAccountName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ModuleImpl(inner1, this.manager()));
}
public Module 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 automationAccountName = ResourceManagerUtils.getValueFromIdByName(id, "automationAccounts");
if (automationAccountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'automationAccounts'.", id)));
}
String packageName = ResourceManagerUtils.getValueFromIdByName(id, "python2Packages");
if (packageName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'python2Packages'.", id)));
}
return this.getWithResponse(resourceGroupName, automationAccountName, packageName, 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 automationAccountName = ResourceManagerUtils.getValueFromIdByName(id, "automationAccounts");
if (automationAccountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'automationAccounts'.", id)));
}
String packageName = ResourceManagerUtils.getValueFromIdByName(id, "python2Packages");
if (packageName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'python2Packages'.", id)));
}
return this.getWithResponse(resourceGroupName, automationAccountName, packageName, 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 automationAccountName = ResourceManagerUtils.getValueFromIdByName(id, "automationAccounts");
if (automationAccountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'automationAccounts'.", id)));
}
String packageName = ResourceManagerUtils.getValueFromIdByName(id, "python2Packages");
if (packageName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'python2Packages'.", id)));
}
this.deleteWithResponse(resourceGroupName, automationAccountName, packageName, Context.NONE);
}
public Response 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 automationAccountName = ResourceManagerUtils.getValueFromIdByName(id, "automationAccounts");
if (automationAccountName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'automationAccounts'.", id)));
}
String packageName = ResourceManagerUtils.getValueFromIdByName(id, "python2Packages");
if (packageName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'python2Packages'.", id)));
}
return this.deleteWithResponse(resourceGroupName, automationAccountName, packageName, context);
}
private Python2PackagesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.automation.AutomationManager manager() {
return this.serviceManager;
}
public ModuleImpl define(String name) {
return new ModuleImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy