com.azure.resourcemanager.managementgroups.implementation.ManagementGroupSubscriptionsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-managementgroups Show documentation
Show all versions of azure-resourcemanager-managementgroups Show documentation
This package contains Microsoft Azure SDK for ManagementGroups Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Management Groups API enables consolidation of multiple
subscriptions/resources into an organizational hierarchy and centrally
manage access control, policies, alerting and reporting for those resources.
. Package tag package-2021-04.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.managementgroups.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.managementgroups.fluent.ManagementGroupSubscriptionsClient;
import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner;
import com.azure.resourcemanager.managementgroups.models.ManagementGroupSubscriptions;
import com.azure.resourcemanager.managementgroups.models.SubscriptionUnderManagementGroup;
public final class ManagementGroupSubscriptionsImpl implements ManagementGroupSubscriptions {
private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupSubscriptionsImpl.class);
private final ManagementGroupSubscriptionsClient innerClient;
private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
public ManagementGroupSubscriptionsImpl(
ManagementGroupSubscriptionsClient innerClient,
com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public Response createWithResponse(
String groupId, String subscriptionId, String cacheControl, Context context) {
Response inner =
this.serviceClient().createWithResponse(groupId, subscriptionId, cacheControl, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public SubscriptionUnderManagementGroup create(String groupId, String subscriptionId) {
SubscriptionUnderManagementGroupInner inner = this.serviceClient().create(groupId, subscriptionId);
if (inner != null) {
return new SubscriptionUnderManagementGroupImpl(inner, this.manager());
} else {
return null;
}
}
public Response deleteWithResponse(
String groupId, String subscriptionId, String cacheControl, Context context) {
return this.serviceClient().deleteWithResponse(groupId, subscriptionId, cacheControl, context);
}
public void delete(String groupId, String subscriptionId) {
this.serviceClient().delete(groupId, subscriptionId);
}
public Response getSubscriptionWithResponse(
String groupId, String subscriptionId, String cacheControl, Context context) {
Response inner =
this.serviceClient().getSubscriptionWithResponse(groupId, subscriptionId, cacheControl, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public SubscriptionUnderManagementGroup getSubscription(String groupId, String subscriptionId) {
SubscriptionUnderManagementGroupInner inner = this.serviceClient().getSubscription(groupId, subscriptionId);
if (inner != null) {
return new SubscriptionUnderManagementGroupImpl(inner, this.manager());
} else {
return null;
}
}
public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) {
PagedIterable inner =
this.serviceClient().getSubscriptionsUnderManagementGroup(groupId);
return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager()));
}
public PagedIterable getSubscriptionsUnderManagementGroup(
String groupId, String skiptoken, Context context) {
PagedIterable inner =
this.serviceClient().getSubscriptionsUnderManagementGroup(groupId, skiptoken, context);
return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager()));
}
private ManagementGroupSubscriptionsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
return this.serviceManager;
}
}