-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathRegistryCreateStep.ts
More file actions
32 lines (27 loc) · 1.56 KB
/
RegistryCreateStep.ts
File metadata and controls
32 lines (27 loc) · 1.56 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
31
32
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ContainerRegistryManagementClient } from "@azure/arm-containerregistry";
import { LocationListStep } from "@microsoft/vscode-azext-azureutils";
import { AzureWizardExecuteStep, nonNullProp } from "@microsoft/vscode-azext-utils";
import { createContainerRegistryManagementClient } from "../../../../../../utils/azureClients";
import { CreateAcrContext } from "./CreateAcrContext";
export class RegistryCreateStep extends AzureWizardExecuteStep<CreateAcrContext> {
public priority: number = 150;
public async execute(context: CreateAcrContext): Promise<void> {
const client: ContainerRegistryManagementClient = await createContainerRegistryManagementClient(context);
context.registry = await client.registries.beginCreateAndWait(
nonNullProp(context, 'newResourceGroupName'),
nonNullProp(context, 'newRegistryName'),
{
location: (await LocationListStep.getLocation(context)).name,
sku: { name: nonNullProp(context, 'newRegistrySku') },
adminUserEnabled: true
}
);
}
public shouldExecute(context: CreateAcrContext): boolean {
return !!context.newRegistryName && !!context.newRegistrySku;
}
}