-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddafff3
commit a8c57c3
Showing
5 changed files
with
66 additions
and
83 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/commands/createContainerApp/ContainerAppCreateStartingResourcesLogStep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { type ResourceGroup } from "@azure/arm-resources"; | ||
import { LocationListStep, ResourceGroupListStep } from "@microsoft/vscode-azext-azureutils"; | ||
import { nonNullValue, nonNullValueAndProp } from "@microsoft/vscode-azext-utils"; | ||
import { type ManagedEnvironmentItem } from "../../tree/ManagedEnvironmentItem"; | ||
import { StartingResourcesLogStep } from "../StartingResourcesLogStep"; | ||
import { type ContainerAppCreateContext } from "./ContainerAppCreateContext"; | ||
|
||
export class ContainerAppCreateStartingResourcesLogStep<T extends ContainerAppCreateContext> extends StartingResourcesLogStep<T> { | ||
constructor(readonly parentItem: ManagedEnvironmentItem) { | ||
super(); | ||
} | ||
|
||
async configureStartingResources(context: T): Promise<void> { | ||
// Use the same resource group and location as the parent resource (managed environment) | ||
const resourceGroupName: string = nonNullValueAndProp(this.parentItem.resource, 'resourceGroup'); | ||
const resourceGroups: ResourceGroup[] = await ResourceGroupListStep.getResourceGroups(context); | ||
context.resourceGroup = nonNullValue(resourceGroups.find(rg => rg.name === resourceGroupName)); | ||
|
||
await LocationListStep.setLocation(context, nonNullValueAndProp(this.parentItem.resource, 'location')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/commands/deployContainerApp/ContainerAppDeployStartingResourcesLogStep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { type ResourceGroup } from "@azure/arm-resources"; | ||
import { LocationListStep, ResourceGroupListStep } from "@microsoft/vscode-azext-azureutils"; | ||
import { nonNullValue, nonNullValueAndProp } from "@microsoft/vscode-azext-utils"; | ||
import { localize } from "../../utils/localize"; | ||
import { StartingResourcesLogStep } from "../StartingResourcesLogStep"; | ||
import { type ContainerAppDeployContext } from "./ContainerAppDeployContext"; | ||
|
||
export class ContainerAppDeployStartingResourcesLogStep<T extends ContainerAppDeployContext> extends StartingResourcesLogStep<T> { | ||
async configureStartingResources(context: T): Promise<void> { | ||
const resourceGroups: ResourceGroup[] = await ResourceGroupListStep.getResourceGroups(context); | ||
context.resourceGroup = nonNullValue( | ||
resourceGroups.find(rg => rg.name === context.containerApp?.resourceGroup), | ||
localize('containerAppResourceGroup', 'Expected to find the container app\'s resource group.'), | ||
); | ||
await LocationListStep.setLocation(context, nonNullValueAndProp(context.containerApp, 'location')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters