com.azure.resourcemanager.netapp.implementation.VolumeQuotaRuleImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-netapp Show documentation
Show all versions of azure-resourcemanager-netapp Show documentation
This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-2024-03.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.netapp.implementation;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.netapp.fluent.models.VolumeQuotaRuleInner;
import com.azure.resourcemanager.netapp.models.ProvisioningState;
import com.azure.resourcemanager.netapp.models.Type;
import com.azure.resourcemanager.netapp.models.VolumeQuotaRule;
import com.azure.resourcemanager.netapp.models.VolumeQuotaRulePatch;
import java.util.Collections;
import java.util.Map;
public final class VolumeQuotaRuleImpl implements VolumeQuotaRule, VolumeQuotaRule.Definition, VolumeQuotaRule.Update {
private VolumeQuotaRuleInner innerObject;
private final com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager;
public String id() {
return this.innerModel().id();
}
public String name() {
return this.innerModel().name();
}
public String type() {
return this.innerModel().type();
}
public String location() {
return this.innerModel().location();
}
public Map tags() {
Map inner = this.innerModel().tags();
if (inner != null) {
return Collections.unmodifiableMap(inner);
} else {
return Collections.emptyMap();
}
}
public SystemData systemData() {
return this.innerModel().systemData();
}
public ProvisioningState provisioningState() {
return this.innerModel().provisioningState();
}
public Long quotaSizeInKiBs() {
return this.innerModel().quotaSizeInKiBs();
}
public Type quotaType() {
return this.innerModel().quotaType();
}
public String quotaTarget() {
return this.innerModel().quotaTarget();
}
public Region region() {
return Region.fromName(this.regionName());
}
public String regionName() {
return this.location();
}
public String resourceGroupName() {
return resourceGroupName;
}
public VolumeQuotaRuleInner innerModel() {
return this.innerObject;
}
private com.azure.resourcemanager.netapp.NetAppFilesManager manager() {
return this.serviceManager;
}
private String resourceGroupName;
private String accountName;
private String poolName;
private String volumeName;
private String volumeQuotaRuleName;
private VolumeQuotaRulePatch updateBody;
public VolumeQuotaRuleImpl withExistingVolume(String resourceGroupName, String accountName, String poolName,
String volumeName) {
this.resourceGroupName = resourceGroupName;
this.accountName = accountName;
this.poolName = poolName;
this.volumeName = volumeName;
return this;
}
public VolumeQuotaRule create() {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.create(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, this.innerModel(),
Context.NONE);
return this;
}
public VolumeQuotaRule create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.create(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, this.innerModel(),
context);
return this;
}
VolumeQuotaRuleImpl(String name, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
this.innerObject = new VolumeQuotaRuleInner();
this.serviceManager = serviceManager;
this.volumeQuotaRuleName = name;
}
public VolumeQuotaRuleImpl update() {
this.updateBody = new VolumeQuotaRulePatch();
return this;
}
public VolumeQuotaRule apply() {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.update(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, updateBody,
Context.NONE);
return this;
}
public VolumeQuotaRule apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.update(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, updateBody, context);
return this;
}
VolumeQuotaRuleImpl(VolumeQuotaRuleInner innerObject,
com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "netAppAccounts");
this.poolName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "capacityPools");
this.volumeName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "volumes");
this.volumeQuotaRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "volumeQuotaRules");
}
public VolumeQuotaRule refresh() {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.getWithResponse(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, Context.NONE)
.getValue();
return this;
}
public VolumeQuotaRule refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getVolumeQuotaRules()
.getWithResponse(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, context)
.getValue();
return this;
}
public VolumeQuotaRuleImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
}
public VolumeQuotaRuleImpl withRegion(String location) {
this.innerModel().withLocation(location);
return this;
}
public VolumeQuotaRuleImpl withTags(Map tags) {
if (isInCreateMode()) {
this.innerModel().withTags(tags);
return this;
} else {
this.updateBody.withTags(tags);
return this;
}
}
public VolumeQuotaRuleImpl withQuotaSizeInKiBs(Long quotaSizeInKiBs) {
if (isInCreateMode()) {
this.innerModel().withQuotaSizeInKiBs(quotaSizeInKiBs);
return this;
} else {
this.updateBody.withQuotaSizeInKiBs(quotaSizeInKiBs);
return this;
}
}
public VolumeQuotaRuleImpl withQuotaType(Type quotaType) {
this.innerModel().withQuotaType(quotaType);
return this;
}
public VolumeQuotaRuleImpl withQuotaTarget(String quotaTarget) {
this.innerModel().withQuotaTarget(quotaTarget);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}