com.azure.resourcemanager.security.implementation.ConnectorsImpl 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.security.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.security.fluent.ConnectorsClient;
import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner;
import com.azure.resourcemanager.security.models.ConnectorSetting;
import com.azure.resourcemanager.security.models.Connectors;
public final class ConnectorsImpl implements Connectors {
private static final ClientLogger LOGGER = new ClientLogger(ConnectorsImpl.class);
private final ConnectorsClient innerClient;
private final com.azure.resourcemanager.security.SecurityManager serviceManager;
public ConnectorsImpl(ConnectorsClient innerClient,
com.azure.resourcemanager.security.SecurityManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
return ResourceManagerUtils.mapPage(inner, inner1 -> new ConnectorSettingImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new ConnectorSettingImpl(inner1, this.manager()));
}
public Response getWithResponse(String connectorName, Context context) {
Response inner = this.serviceClient().getWithResponse(connectorName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new ConnectorSettingImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public ConnectorSetting get(String connectorName) {
ConnectorSettingInner inner = this.serviceClient().get(connectorName);
if (inner != null) {
return new ConnectorSettingImpl(inner, this.manager());
} else {
return null;
}
}
public Response deleteWithResponse(String connectorName, Context context) {
return this.serviceClient().deleteWithResponse(connectorName, context);
}
public void delete(String connectorName) {
this.serviceClient().delete(connectorName);
}
public ConnectorSetting getById(String id) {
String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors");
if (connectorName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id)));
}
return this.getWithResponse(connectorName, Context.NONE).getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors");
if (connectorName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id)));
}
return this.getWithResponse(connectorName, context);
}
public void deleteById(String id) {
String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors");
if (connectorName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id)));
}
this.deleteWithResponse(connectorName, Context.NONE);
}
public Response deleteByIdWithResponse(String id, Context context) {
String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors");
if (connectorName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id)));
}
return this.deleteWithResponse(connectorName, context);
}
private ConnectorsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.security.SecurityManager manager() {
return this.serviceManager;
}
public ConnectorSettingImpl define(String name) {
return new ConnectorSettingImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy