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