|
12 | 12 | import com.microsoft.azure.toolkit.intellij.connector.dotazure.AzureModule; |
13 | 13 | import com.microsoft.azure.toolkit.intellij.connector.dotazure.ConnectionManager; |
14 | 14 | import com.microsoft.azure.toolkit.intellij.connector.dotazure.Profile; |
15 | | -import com.microsoft.azure.toolkit.intellij.connector.dotazure.ResourceManager; |
16 | 15 | import com.microsoft.azure.toolkit.lib.Azure; |
17 | 16 | import com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsight; |
18 | 17 | import com.microsoft.azure.toolkit.lib.applicationinsights.AzureApplicationInsights; |
@@ -45,14 +44,11 @@ public void execute() { |
45 | 44 | if (Objects.isNull(profile)) { |
46 | 45 | return; |
47 | 46 | } |
48 | | - final ConnectionManager connectionManager = profile.getConnectionManager(); |
49 | | - final ResourceManager resourceManager = profile.getResourceManager(); |
50 | | - final Connection connection = ConnectionManager.getDefinitionOrDefault(resource.getDefinition(), |
| 47 | + final Connection<?,?> connection = ConnectionManager.getDefinitionOrDefault(resource.getDefinition(), |
51 | 48 | consumer.getDefinition()).define(resource, consumer); |
52 | 49 | if (connection.validate(this.project)) { |
53 | | - Objects.requireNonNull(resourceManager).addResource(resource); |
54 | | - resourceManager.addResource(consumer); |
55 | | - Objects.requireNonNull(connectionManager).addConnection(connection); |
| 50 | + profile.createOrUpdateConnection(connection); |
| 51 | + profile.save(); |
56 | 52 | final String message = String.format("The connection between %s and %s has been successfully created.", |
57 | 53 | resource.getName(), consumer.getName()); |
58 | 54 | AzureMessager.getMessager().success(message); |
|
0 commit comments