com.azure.resourcemanager.netapp.implementation.SubvolumeInfoImpl 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.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.netapp.fluent.models.SubvolumeInfoInner;
import com.azure.resourcemanager.netapp.models.SubvolumeInfo;
import com.azure.resourcemanager.netapp.models.SubvolumeModel;
import com.azure.resourcemanager.netapp.models.SubvolumePatchRequest;
public final class SubvolumeInfoImpl implements SubvolumeInfo, SubvolumeInfo.Definition, SubvolumeInfo.Update {
private SubvolumeInfoInner 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 SystemData systemData() {
return this.innerModel().systemData();
}
public String path() {
return this.innerModel().path();
}
public Long size() {
return this.innerModel().size();
}
public String parentPath() {
return this.innerModel().parentPath();
}
public String provisioningState() {
return this.innerModel().provisioningState();
}
public String resourceGroupName() {
return resourceGroupName;
}
public SubvolumeInfoInner 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 subvolumeName;
private SubvolumePatchRequest updateBody;
public SubvolumeInfoImpl withExistingVolume(String resourceGroupName, String accountName, String poolName,
String volumeName) {
this.resourceGroupName = resourceGroupName;
this.accountName = accountName;
this.poolName = poolName;
this.volumeName = volumeName;
return this;
}
public SubvolumeInfo create() {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.create(resourceGroupName, accountName, poolName, volumeName, subvolumeName, this.innerModel(),
Context.NONE);
return this;
}
public SubvolumeInfo create(Context context) {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.create(resourceGroupName, accountName, poolName, volumeName, subvolumeName, this.innerModel(), context);
return this;
}
SubvolumeInfoImpl(String name, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
this.innerObject = new SubvolumeInfoInner();
this.serviceManager = serviceManager;
this.subvolumeName = name;
}
public SubvolumeInfoImpl update() {
this.updateBody = new SubvolumePatchRequest();
return this;
}
public SubvolumeInfo apply() {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.update(resourceGroupName, accountName, poolName, volumeName, subvolumeName, updateBody, Context.NONE);
return this;
}
public SubvolumeInfo apply(Context context) {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.update(resourceGroupName, accountName, poolName, volumeName, subvolumeName, updateBody, context);
return this;
}
SubvolumeInfoImpl(SubvolumeInfoInner 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.subvolumeName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subvolumes");
}
public SubvolumeInfo refresh() {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.getWithResponse(resourceGroupName, accountName, poolName, volumeName, subvolumeName, Context.NONE)
.getValue();
return this;
}
public SubvolumeInfo refresh(Context context) {
this.innerObject = serviceManager.serviceClient()
.getSubvolumes()
.getWithResponse(resourceGroupName, accountName, poolName, volumeName, subvolumeName, context)
.getValue();
return this;
}
public SubvolumeModel getMetadata() {
return serviceManager.subvolumes()
.getMetadata(resourceGroupName, accountName, poolName, volumeName, subvolumeName);
}
public SubvolumeModel getMetadata(Context context) {
return serviceManager.subvolumes()
.getMetadata(resourceGroupName, accountName, poolName, volumeName, subvolumeName, context);
}
public SubvolumeInfoImpl withPath(String path) {
if (isInCreateMode()) {
this.innerModel().withPath(path);
return this;
} else {
this.updateBody.withPath(path);
return this;
}
}
public SubvolumeInfoImpl withSize(Long size) {
if (isInCreateMode()) {
this.innerModel().withSize(size);
return this;
} else {
this.updateBody.withSize(size);
return this;
}
}
public SubvolumeInfoImpl withParentPath(String parentPath) {
this.innerModel().withParentPath(parentPath);
return this;
}
private boolean isInCreateMode() {
return this.innerModel().id() == null;
}
}