Skip to content

Commit

Permalink
Merge pull request #1787 from microsoft/fix-vm
Browse files Browse the repository at this point in the history
Change `IAzureResource` to `IAzureBaseResource`
  • Loading branch information
Flanker32 authored Sep 29, 2021
2 parents 1f8588f + 14d3337 commit 775ec40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package com.microsoft.azure.toolkit.lib.common.action;

import com.microsoft.azure.toolkit.lib.common.bundle.AzureString;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureResource;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource;
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
import com.microsoft.azure.toolkit.lib.common.operation.IAzureOperation;
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
Expand Down Expand Up @@ -109,8 +109,8 @@ public void handle(D source, Object e) {
}

protected void handle(D source, Object e, BiConsumer<D, Object> handler) {
if (source instanceof IAzureResource) {
AzureTelemetry.getActionContext().setProperty("subscriptionId", ((IAzureResource<?>) source).subscriptionId());
if (source instanceof IAzureBaseResource) {
AzureTelemetry.getActionContext().setProperty("subscriptionId", ((IAzureBaseResource<?, ?>) source).subscriptionId());
AzureTelemetry.getActionContext().setProperty("resourceType", source.getClass().getSimpleName());
}
handler.accept(source, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package com.microsoft.azure.toolkit.lib.common.operation;

import com.microsoft.azure.toolkit.lib.common.entity.IAzureResource;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource;
import com.microsoft.azure.toolkit.lib.common.event.AzureEventBus;
import com.microsoft.azure.toolkit.lib.common.event.AzureOperationEvent;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskContext;
Expand Down Expand Up @@ -72,8 +72,8 @@ public void afterThrowing(JoinPoint point, Throwable e) throws Throwable {
final AzureOperationEvent<?> event = new AzureOperationEvent(target, operation, AzureOperationEvent.Stage.ERROR);
AzureEventBus.emit(operation.getName(), event);
}
if (source instanceof IAzureResource) {
((IAzureResource<?>) source).refresh();
if (source instanceof IAzureBaseResource) {
((IAzureBaseResource<?, ?>) source).refresh();
}
if (!(e instanceof RuntimeException)) {
throw e; // do not wrap checked exception
Expand Down

0 comments on commit 775ec40

Please sign in to comment.