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

com.azure.resourcemanager.netapp.implementation.NetAppAccountImpl 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-2024-03.

There is a newer version: 1.4.0
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.NetAppAccountInner;
import com.azure.resourcemanager.netapp.models.AccountEncryption;
import com.azure.resourcemanager.netapp.models.ActiveDirectory;
import com.azure.resourcemanager.netapp.models.ChangeKeyVault;
import com.azure.resourcemanager.netapp.models.EncryptionTransitionRequest;
import com.azure.resourcemanager.netapp.models.ManagedServiceIdentity;
import com.azure.resourcemanager.netapp.models.NetAppAccount;
import com.azure.resourcemanager.netapp.models.NetAppAccountPatch;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class NetAppAccountImpl implements NetAppAccount, NetAppAccount.Definition, NetAppAccount.Update {
    private NetAppAccountInner 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 ManagedServiceIdentity identity() {
        return this.innerModel().identity();
    }

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

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

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

    public AccountEncryption encryption() {
        return this.innerModel().encryption();
    }

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

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

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

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

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

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

    private String resourceGroupName;

    private String accountName;

    private NetAppAccountPatch updateBody;

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

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

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

    NetAppAccountImpl(String name, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) {
        this.innerObject = new NetAppAccountInner();
        this.serviceManager = serviceManager;
        this.accountName = name;
    }

    public NetAppAccountImpl update() {
        this.updateBody = new NetAppAccountPatch();
        return this;
    }

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

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

    NetAppAccountImpl(NetAppAccountInner 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");
    }

    public NetAppAccount refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getAccounts()
            .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE)
            .getValue();
        return this;
    }

    public NetAppAccount refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getAccounts()
            .getByResourceGroupWithResponse(resourceGroupName, accountName, context)
            .getValue();
        return this;
    }

    public void renewCredentials() {
        serviceManager.accounts().renewCredentials(resourceGroupName, accountName);
    }

    public void renewCredentials(Context context) {
        serviceManager.accounts().renewCredentials(resourceGroupName, accountName, context);
    }

    public void transitionToCmk() {
        serviceManager.accounts().transitionToCmk(resourceGroupName, accountName);
    }

    public void transitionToCmk(EncryptionTransitionRequest body, Context context) {
        serviceManager.accounts().transitionToCmk(resourceGroupName, accountName, body, context);
    }

    public void getChangeKeyVaultInformation() {
        serviceManager.accounts().getChangeKeyVaultInformation(resourceGroupName, accountName);
    }

    public void getChangeKeyVaultInformation(Context context) {
        serviceManager.accounts().getChangeKeyVaultInformation(resourceGroupName, accountName, context);
    }

    public void changeKeyVault() {
        serviceManager.accounts().changeKeyVault(resourceGroupName, accountName);
    }

    public void changeKeyVault(ChangeKeyVault body, Context context) {
        serviceManager.accounts().changeKeyVault(resourceGroupName, accountName, body, context);
    }

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

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

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

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

    public NetAppAccountImpl withActiveDirectories(List activeDirectories) {
        if (isInCreateMode()) {
            this.innerModel().withActiveDirectories(activeDirectories);
            return this;
        } else {
            this.updateBody.withActiveDirectories(activeDirectories);
            return this;
        }
    }

    public NetAppAccountImpl withEncryption(AccountEncryption encryption) {
        if (isInCreateMode()) {
            this.innerModel().withEncryption(encryption);
            return this;
        } else {
            this.updateBody.withEncryption(encryption);
            return this;
        }
    }

    public NetAppAccountImpl withNfsV4IdDomain(String nfsV4IdDomain) {
        if (isInCreateMode()) {
            this.innerModel().withNfsV4IdDomain(nfsV4IdDomain);
            return this;
        } else {
            this.updateBody.withNfsV4IdDomain(nfsV4IdDomain);
            return this;
        }
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy