com.azure.resourcemanager.migrationdiscoverysap.implementation.SapDiscoverySitesImpl 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.migrationdiscoverysap.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.migrationdiscoverysap.fluent.SapDiscoverySitesClient;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.models.OperationStatusResultInner;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.models.SapDiscoverySiteInner;
import com.azure.resourcemanager.migrationdiscoverysap.models.OperationStatusResult;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySite;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySites;
public final class SapDiscoverySitesImpl implements SapDiscoverySites {
private static final ClientLogger LOGGER = new ClientLogger(SapDiscoverySitesImpl.class);
private final SapDiscoverySitesClient innerClient;
private final com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager serviceManager;
public SapDiscoverySitesImpl(SapDiscoverySitesClient innerClient,
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return ResourceManagerUtils.mapPage(inner, inner1 -> new SapDiscoverySiteImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SapDiscoverySiteImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SapDiscoverySiteImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner
= this.serviceClient().listByResourceGroup(resourceGroupName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new SapDiscoverySiteImpl(inner1, this.manager()));
}
public Response getByResourceGroupWithResponse(String resourceGroupName,
String sapDiscoverySiteName, Context context) {
Response inner
= this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new SapDiscoverySiteImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public SapDiscoverySite getByResourceGroup(String resourceGroupName, String sapDiscoverySiteName) {
SapDiscoverySiteInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, sapDiscoverySiteName);
if (inner != null) {
return new SapDiscoverySiteImpl(inner, this.manager());
} else {
return null;
}
}
public void deleteByResourceGroup(String resourceGroupName, String sapDiscoverySiteName) {
this.serviceClient().delete(resourceGroupName, sapDiscoverySiteName);
}
public void delete(String resourceGroupName, String sapDiscoverySiteName, Context context) {
this.serviceClient().delete(resourceGroupName, sapDiscoverySiteName, context);
}
public OperationStatusResult importEntities(String resourceGroupName, String sapDiscoverySiteName) {
OperationStatusResultInner inner = this.serviceClient().importEntities(resourceGroupName, sapDiscoverySiteName);
if (inner != null) {
return new OperationStatusResultImpl(inner, this.manager());
} else {
return null;
}
}
public OperationStatusResult importEntities(String resourceGroupName, String sapDiscoverySiteName,
Context context) {
OperationStatusResultInner inner
= this.serviceClient().importEntities(resourceGroupName, sapDiscoverySiteName, context);
if (inner != null) {
return new OperationStatusResultImpl(inner, this.manager());
} else {
return null;
}
}
public SapDiscoverySite 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 sapDiscoverySiteName = ResourceManagerUtils.getValueFromIdByName(id, "sapDiscoverySites");
if (sapDiscoverySiteName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'sapDiscoverySites'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, 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 sapDiscoverySiteName = ResourceManagerUtils.getValueFromIdByName(id, "sapDiscoverySites");
if (sapDiscoverySiteName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'sapDiscoverySites'.", id)));
}
return this.getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, 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 sapDiscoverySiteName = ResourceManagerUtils.getValueFromIdByName(id, "sapDiscoverySites");
if (sapDiscoverySiteName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'sapDiscoverySites'.", id)));
}
this.delete(resourceGroupName, sapDiscoverySiteName, 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 sapDiscoverySiteName = ResourceManagerUtils.getValueFromIdByName(id, "sapDiscoverySites");
if (sapDiscoverySiteName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'sapDiscoverySites'.", id)));
}
this.delete(resourceGroupName, sapDiscoverySiteName, context);
}
private SapDiscoverySitesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager() {
return this.serviceManager;
}
public SapDiscoverySiteImpl define(String name) {
return new SapDiscoverySiteImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy