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