-
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.48 KB
/
RegistryCreateStep.ts
File metadata and controls
32 lines (27 loc) · 1.48 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 { ICreateAcrContext } from "./ICreateAcrContext";
export class RegistryCreateStep extends AzureWizardExecuteStep<ICreateAcrContext> {
public priority: number = 150;
public async execute(context: ICreateAcrContext): Promise<void> {
const client: ContainerRegistryManagementClient = await createContainerRegistryManagementClient(context);
context.registry = await client.registries.beginCreateAndWait(
nonNullProp(context, 'newResourceGroupName'),
nonNullProp(context, 'registryName'),
{
location: (await LocationListStep.getLocation(context)).name,
sku: { name: nonNullProp(context, 'sku') },
adminUserEnabled: true
}
);
}
public shouldExecute(): boolean {
return true;
}
}