
com.azure.resourcemanager.datafactory.implementation.LinkedServicesImpl 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.datafactory.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.datafactory.fluent.LinkedServicesClient;
import com.azure.resourcemanager.datafactory.fluent.models.LinkedServiceResourceInner;
import com.azure.resourcemanager.datafactory.models.LinkedServiceResource;
import com.azure.resourcemanager.datafactory.models.LinkedServices;
public final class LinkedServicesImpl implements LinkedServices {
private static final ClientLogger LOGGER = new ClientLogger(LinkedServicesImpl.class);
private final LinkedServicesClient innerClient;
private final com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager;
public LinkedServicesImpl(LinkedServicesClient innerClient,
com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable listByFactory(String resourceGroupName, String factoryName) {
PagedIterable inner
= this.serviceClient().listByFactory(resourceGroupName, factoryName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new LinkedServiceResourceImpl(inner1, this.manager()));
}
public PagedIterable listByFactory(String resourceGroupName, String factoryName,
Context context) {
PagedIterable inner
= this.serviceClient().listByFactory(resourceGroupName, factoryName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new LinkedServiceResourceImpl(inner1, this.manager()));
}
public Response getWithResponse(String resourceGroupName, String factoryName,
String linkedServiceName, String ifNoneMatch, Context context) {
Response inner = this.serviceClient()
.getWithResponse(resourceGroupName, factoryName, linkedServiceName, ifNoneMatch, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new LinkedServiceResourceImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public LinkedServiceResource get(String resourceGroupName, String factoryName, String linkedServiceName) {
LinkedServiceResourceInner inner = this.serviceClient().get(resourceGroupName, factoryName, linkedServiceName);
if (inner != null) {
return new LinkedServiceResourceImpl(inner, this.manager());
} else {
return null;
}
}
public Response deleteWithResponse(String resourceGroupName, String factoryName, String linkedServiceName,
Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, factoryName, linkedServiceName, context);
}
public void delete(String resourceGroupName, String factoryName, String linkedServiceName) {
this.serviceClient().delete(resourceGroupName, factoryName, linkedServiceName);
}
public LinkedServiceResource 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 factoryName = ResourceManagerUtils.getValueFromIdByName(id, "factories");
if (factoryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));
}
String linkedServiceName = ResourceManagerUtils.getValueFromIdByName(id, "linkedservices");
if (linkedServiceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'linkedservices'.", id)));
}
String localIfNoneMatch = null;
return this.getWithResponse(resourceGroupName, factoryName, linkedServiceName, localIfNoneMatch, Context.NONE)
.getValue();
}
public Response getByIdWithResponse(String id, String ifNoneMatch, 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 factoryName = ResourceManagerUtils.getValueFromIdByName(id, "factories");
if (factoryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));
}
String linkedServiceName = ResourceManagerUtils.getValueFromIdByName(id, "linkedservices");
if (linkedServiceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'linkedservices'.", id)));
}
return this.getWithResponse(resourceGroupName, factoryName, linkedServiceName, ifNoneMatch, 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 factoryName = ResourceManagerUtils.getValueFromIdByName(id, "factories");
if (factoryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));
}
String linkedServiceName = ResourceManagerUtils.getValueFromIdByName(id, "linkedservices");
if (linkedServiceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'linkedservices'.", id)));
}
this.deleteWithResponse(resourceGroupName, factoryName, linkedServiceName, 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 factoryName = ResourceManagerUtils.getValueFromIdByName(id, "factories");
if (factoryName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));
}
String linkedServiceName = ResourceManagerUtils.getValueFromIdByName(id, "linkedservices");
if (linkedServiceName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'linkedservices'.", id)));
}
return this.deleteWithResponse(resourceGroupName, factoryName, linkedServiceName, context);
}
private LinkedServicesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.datafactory.DataFactoryManager manager() {
return this.serviceManager;
}
public LinkedServiceResourceImpl define(String name) {
return new LinkedServiceResourceImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy