-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTargetPortUpdateStep.ts
More file actions
30 lines (24 loc) · 1.66 KB
/
TargetPortUpdateStep.ts
File metadata and controls
30 lines (24 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { nonNullProp, nonNullValueAndProp } from "@microsoft/vscode-azext-utils";
import type { Progress } from "vscode";
import { localize } from "../../../utils/localize";
import type { IngressContext } from "../IngressContext";
import { IngressUpdateBaseStep } from "../IngressUpdateBaseStep";
export class TargetPortUpdateStep extends IngressUpdateBaseStep<IngressContext> {
public priority: number = 280;
public async execute(context: IngressContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
const containerApp = nonNullProp(context, 'containerApp');
const ingress = nonNullValueAndProp(containerApp.configuration, 'ingress');
ingress.targetPort = context.targetPort;
const working: string = localize('updatingTargetPort', 'Updating target port...');
const workCompleted: string = localize('updatedTargetPort', 'Updated target port to {0} for container app "{1}"', context.targetPort, containerApp.name);
context.activityTitle = localize('updateTargetPort', 'Update target port to {0} for container app "{1}"', context.targetPort, containerApp.name);
await this.updateIngressSettings(context, progress, { ingress, working, workCompleted });
}
public shouldExecute(): boolean {
return true;
}
}