All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.netapp.implementation.CapacityPoolImpl Maven / Gradle / Ivy

Go to download

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-preview-2024-07-01-preview.

There is a newer version: 1.6.0-beta.1
Show newest version
// 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.CapacityPoolInner;
import com.azure.resourcemanager.netapp.models.CapacityPool;
import com.azure.resourcemanager.netapp.models.CapacityPoolPatch;
import com.azure.resourcemanager.netapp.models.EncryptionType;
import com.azure.resourcemanager.netapp.models.QosType;
import com.azure.resourcemanager.netapp.models.ServiceLevel;
import java.util.Collections;
import java.util.Map;

public final class CapacityPoolImpl implements CapacityPool, CapacityPool.Definition, CapacityPool.Update {
    private CapacityPoolInner 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 String etag() {
        return this.innerModel().etag();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public String poolId() {
        return this.innerModel().poolId();
    }

    public long size() {
        return this.innerModel().size();
    }

    public ServiceLevel serviceLevel() {
        return this.innerModel().serviceLevel();
    }

    public String provisioningState() {
        return this.innerModel().provisioningState();
    }

    public Float totalThroughputMibps() {
        return this.innerModel().totalThroughputMibps();
    }

    public Float utilizedThroughputMibps() {
        return this.innerModel().utilizedThroughputMibps();
    }

    public QosType qosType() {
        return this.innerModel().qosType();
    }

    public Boolean coolAccess() {
        return this.innerModel().coolAccess();
    }

    public EncryptionType encryptionType() {
        return this.innerModel().encryptionType();
    }

    public Region region() {
        return Region.fromName(this.regionName());
    }

    public String regionName() {
        return this.location();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public CapacityPoolInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.netapp.NetAppFilesManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String accountName;

    private String poolName;

    private CapacityPoolPatch updateBody;

    public CapacityPoolImpl withExistingNetAppAccount(String resourceGroupName, String accountName) {
        this.resourceGroupName = resourceGroupName;
        this.accountName = accountName;
        return this;
    }

    public CapacityPool create() {
        this.innerObject = serviceManager.serviceClient().getPools().createOrUpdate(resourceGroupName, accountName,
            poolName, this.innerModel(), Context.NONE);
        return this;
    }

    public CapacityPool create(Context context) {
        this.innerObject = serviceManager.serviceClient().getPools().createOrUpdate(resourceGroupName, accountName,
            poolName, this.innerModel(), context);
        return this;
    }

    CapacityPoolImpl(String name, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
        this.innerObject = new CapacityPoolInner();
        this.serviceManager = serviceManager;
        this.poolName = name;
    }

    public CapacityPoolImpl update() {
        this.updateBody = new CapacityPoolPatch();
        return this;
    }

    public CapacityPool apply() {
        this.innerObject = serviceManager.serviceClient().getPools().update(resourceGroupName, accountName, poolName,
            updateBody, Context.NONE);
        return this;
    }

    public CapacityPool apply(Context context) {
        this.innerObject = serviceManager.serviceClient().getPools().update(resourceGroupName, accountName, poolName,
            updateBody, context);
        return this;
    }

    CapacityPoolImpl(CapacityPoolInner innerObject,
        com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.accountName = Utils.getValueFromIdByName(innerObject.id(), "netAppAccounts");
        this.poolName = Utils.getValueFromIdByName(innerObject.id(), "capacityPools");
    }

    public CapacityPool refresh() {
        this.innerObject = serviceManager.serviceClient().getPools()
            .getWithResponse(resourceGroupName, accountName, poolName, Context.NONE).getValue();
        return this;
    }

    public CapacityPool refresh(Context context) {
        this.innerObject = serviceManager.serviceClient().getPools()
            .getWithResponse(resourceGroupName, accountName, poolName, context).getValue();
        return this;
    }

    public CapacityPoolImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public CapacityPoolImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public CapacityPoolImpl withSize(long size) {
        this.innerModel().withSize(size);
        return this;
    }

    public CapacityPoolImpl withServiceLevel(ServiceLevel serviceLevel) {
        this.innerModel().withServiceLevel(serviceLevel);
        return this;
    }

    public CapacityPoolImpl withTags(Map tags) {
        if (isInCreateMode()) {
            this.innerModel().withTags(tags);
            return this;
        } else {
            this.updateBody.withTags(tags);
            return this;
        }
    }

    public CapacityPoolImpl withQosType(QosType qosType) {
        if (isInCreateMode()) {
            this.innerModel().withQosType(qosType);
            return this;
        } else {
            this.updateBody.withQosType(qosType);
            return this;
        }
    }

    public CapacityPoolImpl withCoolAccess(Boolean coolAccess) {
        if (isInCreateMode()) {
            this.innerModel().withCoolAccess(coolAccess);
            return this;
        } else {
            this.updateBody.withCoolAccess(coolAccess);
            return this;
        }
    }

    public CapacityPoolImpl withEncryptionType(EncryptionType encryptionType) {
        this.innerModel().withEncryptionType(encryptionType);
        return this;
    }

    public CapacityPoolImpl withSize(Long size) {
        this.updateBody.withSize(size);
        return this;
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy