com.azure.resourcemanager.automation.implementation.WebhooksImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.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.WebhooksClient;
import com.azure.resourcemanager.automation.fluent.models.WebhookInner;
import com.azure.resourcemanager.automation.models.Webhook;
import com.azure.resourcemanager.automation.models.Webhooks;
public final class WebhooksImpl implements Webhooks {
private static final ClientLogger LOGGER = new ClientLogger(WebhooksImpl.class);
private final WebhooksClient innerClient;
private final com.azure.resourcemanager.automation.AutomationManager serviceManager;
public WebhooksImpl(WebhooksClient innerClient,
com.azure.resourcemanager.automation.AutomationManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public Response generateUriWithResponse(String resourceGroupName, String automationAccountName,
Context context) {
return this.serviceClient().generateUriWithResponse(resourceGroupName, automationAccountName, context);
}
public String generateUri(String resourceGroupName, String automationAccountName) {
return this.serviceClient().generateUri(resourceGroupName, automationAccountName);
}
public Response deleteWithResponse(String resourceGroupName, String automationAccountName, String webhookName,
Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, automationAccountName, webhookName, context);
}
public void delete(String resourceGroupName, String automationAccountName, String webhookName) {
this.serviceClient().delete(resourceGroupName, automationAccountName, webhookName);
}
public Response getWithResponse(String resourceGroupName, String automationAccountName, String webhookName,
Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, automationAccountName, webhookName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new WebhookImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public Webhook get(String resourceGroupName, String automationAccountName, String webhookName) {
WebhookInner inner = this.serviceClient().get(resourceGroupName, automationAccountName, webhookName);
if (inner != null) {
return new WebhookImpl(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 WebhookImpl(inner1, this.manager()));
}
public PagedIterable listByAutomationAccount(String resourceGroupName, String automationAccountName,
String filter, Context context) {
PagedIterable inner
= this.serviceClient().listByAutomationAccount(resourceGroupName, automationAccountName, filter, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new WebhookImpl(inner1, this.manager()));
}
public Webhook 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 webhookName = ResourceManagerUtils.getValueFromIdByName(id, "webhooks");
if (webhookName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webhooks'.", id)));
}
return this.getWithResponse(resourceGroupName, automationAccountName, webhookName, 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 webhookName = ResourceManagerUtils.getValueFromIdByName(id, "webhooks");
if (webhookName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webhooks'.", id)));
}
return this.getWithResponse(resourceGroupName, automationAccountName, webhookName, 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 webhookName = ResourceManagerUtils.getValueFromIdByName(id, "webhooks");
if (webhookName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webhooks'.", id)));
}
this.deleteWithResponse(resourceGroupName, automationAccountName, webhookName, 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 webhookName = ResourceManagerUtils.getValueFromIdByName(id, "webhooks");
if (webhookName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'webhooks'.", id)));
}
return this.deleteWithResponse(resourceGroupName, automationAccountName, webhookName, context);
}
private WebhooksClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.automation.AutomationManager manager() {
return this.serviceManager;
}
public WebhookImpl define(String name) {
return new WebhookImpl(name, this.manager());
}
}