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

com.microsoft.azure.toolkit.lib.common.model.AbstractEmulatableAzResource Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */
package com.microsoft.azure.toolkit.lib.common.model;


import javax.annotation.Nonnull;

public abstract class AbstractEmulatableAzResource , P extends AzResource, R> extends AbstractAzResource implements Emulatable {

    protected AbstractEmulatableAzResource(@Nonnull String name, @Nonnull String resourceGroupName, @Nonnull AbstractAzResourceModule module) {
        super(name, resourceGroupName, module);
    }

    @Override
    public boolean exists() {
        return this.isEmulatorResource() ? this.getParent().exists() && this.remoteOptional().isPresent() : super.exists();
    }

    protected AbstractEmulatableAzResource(@Nonnull String name, @Nonnull AbstractAzResourceModule module) {
        super(name, module);
    }

    protected AbstractEmulatableAzResource(@Nonnull AbstractAzResource origin) {
        super(origin);
    }

    public boolean isAuthRequired() {
        return !isEmulatorResource() && super.isAuthRequired();
    }

    @Override
    public boolean isEmulatorResource() {
        return this.getParent() instanceof Emulatable && ((Emulatable) this.getParent()).isEmulatorResource();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy