com.azure.resourcemanager.security.implementation.JitNetworkAccessPoliciesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// 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.JitNetworkAccessPoliciesClient;
import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessPolicyInner;
import com.azure.resourcemanager.security.fluent.models.JitNetworkAccessRequestInner;
import com.azure.resourcemanager.security.models.JitNetworkAccessPolicies;
import com.azure.resourcemanager.security.models.JitNetworkAccessPolicy;
import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyInitiateRequest;
import com.azure.resourcemanager.security.models.JitNetworkAccessRequest;
public final class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies {
private static final ClientLogger LOGGER = new ClientLogger(JitNetworkAccessPoliciesImpl.class);
private final JitNetworkAccessPoliciesClient innerClient;
private final com.azure.resourcemanager.security.SecurityManager serviceManager;
public JitNetworkAccessPoliciesImpl(JitNetworkAccessPoliciesClient 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 JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByRegion(String ascLocation) {
PagedIterable inner = this.serviceClient().listByRegion(ascLocation);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByRegion(String ascLocation, Context context) {
PagedIterable inner = this.serviceClient().listByRegion(ascLocation, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner
= this.serviceClient().listByResourceGroup(resourceGroupName, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroupAndRegion(String resourceGroupName,
String ascLocation) {
PagedIterable inner
= this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroupAndRegion(String resourceGroupName,
String ascLocation, Context context) {
PagedIterable inner
= this.serviceClient().listByResourceGroupAndRegion(resourceGroupName, ascLocation, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new JitNetworkAccessPolicyImpl(inner1, this.manager()));
}
public Response getWithResponse(String resourceGroupName, String ascLocation,
String jitNetworkAccessPolicyName, Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new JitNetworkAccessPolicyImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public JitNetworkAccessPolicy get(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) {
JitNetworkAccessPolicyInner inner
= this.serviceClient().get(resourceGroupName, ascLocation, jitNetworkAccessPolicyName);
if (inner != null) {
return new JitNetworkAccessPolicyImpl(inner, this.manager());
} else {
return null;
}
}
public Response deleteWithResponse(String resourceGroupName, String ascLocation,
String jitNetworkAccessPolicyName, Context context) {
return this.serviceClient()
.deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context);
}
public void delete(String resourceGroupName, String ascLocation, String jitNetworkAccessPolicyName) {
this.serviceClient().delete(resourceGroupName, ascLocation, jitNetworkAccessPolicyName);
}
public Response initiateWithResponse(String resourceGroupName, String ascLocation,
String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body, Context context) {
Response inner = this.serviceClient()
.initiateWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new JitNetworkAccessRequestImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public JitNetworkAccessRequest initiate(String resourceGroupName, String ascLocation,
String jitNetworkAccessPolicyName, JitNetworkAccessPolicyInitiateRequest body) {
JitNetworkAccessRequestInner inner
= this.serviceClient().initiate(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, body);
if (inner != null) {
return new JitNetworkAccessRequestImpl(inner, this.manager());
} else {
return null;
}
}
public JitNetworkAccessPolicy 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 ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations");
if (ascLocation == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id)));
}
String jitNetworkAccessPolicyName = ResourceManagerUtils.getValueFromIdByName(id, "jitNetworkAccessPolicies");
if (jitNetworkAccessPolicyName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", id)));
}
return this.getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, 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 ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations");
if (ascLocation == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id)));
}
String jitNetworkAccessPolicyName = ResourceManagerUtils.getValueFromIdByName(id, "jitNetworkAccessPolicies");
if (jitNetworkAccessPolicyName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", id)));
}
return this.getWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, 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 ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations");
if (ascLocation == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id)));
}
String jitNetworkAccessPolicyName = ResourceManagerUtils.getValueFromIdByName(id, "jitNetworkAccessPolicies");
if (jitNetworkAccessPolicyName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", id)));
}
this.deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, 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 ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations");
if (ascLocation == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id)));
}
String jitNetworkAccessPolicyName = ResourceManagerUtils.getValueFromIdByName(id, "jitNetworkAccessPolicies");
if (jitNetworkAccessPolicyName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(String
.format("The resource ID '%s' is not valid. Missing path segment 'jitNetworkAccessPolicies'.", id)));
}
return this.deleteWithResponse(resourceGroupName, ascLocation, jitNetworkAccessPolicyName, context);
}
private JitNetworkAccessPoliciesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.security.SecurityManager manager() {
return this.serviceManager;
}
public JitNetworkAccessPolicyImpl define(String name) {
return new JitNetworkAccessPolicyImpl(name, this.manager());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy