com.azure.resourcemanager.botservice.implementation.BotsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-botservice Show documentation
Show all versions of azure-resourcemanager-botservice Show documentation
This package contains Microsoft Azure SDK for BotService Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Bot Service is a platform for creating smart conversational agents. Package tag package-2021-03-01.
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.botservice.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.botservice.fluent.BotsClient;
import com.azure.resourcemanager.botservice.fluent.models.BotInner;
import com.azure.resourcemanager.botservice.fluent.models.CheckNameAvailabilityResponseBodyInner;
import com.azure.resourcemanager.botservice.models.Bot;
import com.azure.resourcemanager.botservice.models.Bots;
import com.azure.resourcemanager.botservice.models.CheckNameAvailabilityRequestBody;
import com.azure.resourcemanager.botservice.models.CheckNameAvailabilityResponseBody;
public final class BotsImpl implements Bots {
private static final ClientLogger LOGGER = new ClientLogger(BotsImpl.class);
private final BotsClient innerClient;
private final com.azure.resourcemanager.botservice.BotServiceManager serviceManager;
public BotsImpl(BotsClient innerClient, com.azure.resourcemanager.botservice.BotServiceManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceName,
Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, context);
}
public void deleteByResourceGroup(String resourceGroupName, String resourceName) {
this.serviceClient().delete(resourceGroupName, resourceName);
}
public Response getByResourceGroupWithResponse(String resourceGroupName, String resourceName,
Context context) {
Response inner
= this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new BotImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public Bot getByResourceGroup(String resourceGroupName, String resourceName) {
BotInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName);
if (inner != null) {
return new BotImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new BotImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new BotImpl(inner1, this.manager()));
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return ResourceManagerUtils.mapPage(inner, inner1 -> new BotImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new BotImpl(inner1, this.manager()));
}
public Response
getCheckNameAvailabilityWithResponse(CheckNameAvailabilityRequestBody parameters, Context context) {
Response inner
= this.serviceClient().getCheckNameAvailabilityWithResponse(parameters, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new CheckNameAvailabilityResponseBodyImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public CheckNameAvailabilityResponseBody getCheckNameAvailability(CheckNameAvailabilityRequestBody parameters) {
CheckNameAvailabilityResponseBodyInner inner = this.serviceClient().getCheckNameAvailability(parameters);
if (inner != null) {
return new CheckNameAvailabilityResponseBodyImpl(inner, this.manager());
} else {
return null;
}
}
public Bot 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "botServices");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'botServices'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "botServices");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'botServices'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "botServices");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'botServices'.", id)));
}
this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = ResourceManagerUtils.getValueFromIdByName(id, "botServices");
if (resourceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'botServices'.", id)));
}
return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, context);
}
private BotsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.botservice.BotServiceManager manager() {
return this.serviceManager;
}
public BotImpl define(String name) {
return new BotImpl(name, this.manager());
}
}