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

com.azure.resourcemanager.qumulo.implementation.FileSystemResourceImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Qumulo Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-06-19.

The 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.qumulo.implementation;

import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.qumulo.fluent.models.FileSystemResourceInner;
import com.azure.resourcemanager.qumulo.models.FileSystemResource;
import com.azure.resourcemanager.qumulo.models.FileSystemResourceUpdate;
import com.azure.resourcemanager.qumulo.models.FileSystemResourceUpdateProperties;
import com.azure.resourcemanager.qumulo.models.ManagedServiceIdentity;
import com.azure.resourcemanager.qumulo.models.MarketplaceDetails;
import com.azure.resourcemanager.qumulo.models.ProvisioningState;
import com.azure.resourcemanager.qumulo.models.UserDetails;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class FileSystemResourceImpl
    implements FileSystemResource, FileSystemResource.Definition, FileSystemResource.Update {
    private FileSystemResourceInner innerObject;

    private final com.azure.resourcemanager.qumulo.QumuloManager 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 ManagedServiceIdentity identity() {
        return this.innerModel().identity();
    }

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

    public MarketplaceDetails marketplaceDetails() {
        return this.innerModel().marketplaceDetails();
    }

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

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

    public UserDetails userDetails() {
        return this.innerModel().userDetails();
    }

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

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

    public List privateIPs() {
        List inner = this.innerModel().privateIPs();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

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

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

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

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

    private com.azure.resourcemanager.qumulo.QumuloManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String fileSystemName;

    private FileSystemResourceUpdate updateProperties;

    public FileSystemResourceImpl withExistingResourceGroup(String resourceGroupName) {
        this.resourceGroupName = resourceGroupName;
        return this;
    }

    public FileSystemResource create() {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .createOrUpdate(resourceGroupName, fileSystemName, this.innerModel(), Context.NONE);
        return this;
    }

    public FileSystemResource create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .createOrUpdate(resourceGroupName, fileSystemName, this.innerModel(), context);
        return this;
    }

    FileSystemResourceImpl(String name, com.azure.resourcemanager.qumulo.QumuloManager serviceManager) {
        this.innerObject = new FileSystemResourceInner();
        this.serviceManager = serviceManager;
        this.fileSystemName = name;
    }

    public FileSystemResourceImpl update() {
        this.updateProperties = new FileSystemResourceUpdate();
        return this;
    }

    public FileSystemResource apply() {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .updateWithResponse(resourceGroupName, fileSystemName, updateProperties, Context.NONE)
            .getValue();
        return this;
    }

    public FileSystemResource apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .updateWithResponse(resourceGroupName, fileSystemName, updateProperties, context)
            .getValue();
        return this;
    }

    FileSystemResourceImpl(FileSystemResourceInner innerObject,
        com.azure.resourcemanager.qumulo.QumuloManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.fileSystemName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fileSystems");
    }

    public FileSystemResource refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .getByResourceGroupWithResponse(resourceGroupName, fileSystemName, Context.NONE)
            .getValue();
        return this;
    }

    public FileSystemResource refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getFileSystems()
            .getByResourceGroupWithResponse(resourceGroupName, fileSystemName, context)
            .getValue();
        return this;
    }

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

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

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

    public FileSystemResourceImpl withIdentity(ManagedServiceIdentity identity) {
        if (isInCreateMode()) {
            this.innerModel().withIdentity(identity);
            return this;
        } else {
            this.updateProperties.withIdentity(identity);
            return this;
        }
    }

    public FileSystemResourceImpl withMarketplaceDetails(MarketplaceDetails marketplaceDetails) {
        this.innerModel().withMarketplaceDetails(marketplaceDetails);
        return this;
    }

    public FileSystemResourceImpl withStorageSku(String storageSku) {
        this.innerModel().withStorageSku(storageSku);
        return this;
    }

    public FileSystemResourceImpl withUserDetails(UserDetails userDetails) {
        this.innerModel().withUserDetails(userDetails);
        return this;
    }

    public FileSystemResourceImpl withDelegatedSubnetId(String delegatedSubnetId) {
        this.innerModel().withDelegatedSubnetId(delegatedSubnetId);
        return this;
    }

    public FileSystemResourceImpl withClusterLoginUrl(String clusterLoginUrl) {
        this.innerModel().withClusterLoginUrl(clusterLoginUrl);
        return this;
    }

    public FileSystemResourceImpl withPrivateIPs(List privateIPs) {
        this.innerModel().withPrivateIPs(privateIPs);
        return this;
    }

    public FileSystemResourceImpl withAdminPassword(String adminPassword) {
        this.innerModel().withAdminPassword(adminPassword);
        return this;
    }

    public FileSystemResourceImpl withAvailabilityZone(String availabilityZone) {
        this.innerModel().withAvailabilityZone(availabilityZone);
        return this;
    }

    public FileSystemResourceImpl withProperties(FileSystemResourceUpdateProperties properties) {
        this.updateProperties.withProperties(properties);
        return this;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy