Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async isNameAvailable(name: string, wizardContext: IAzureLogicAppWizardContext): Promise {
let resourceGroupName: string;
if (wizardContext.newResourceGroupName) {
return true;
} else {
resourceGroupName = wizardContext.resourceGroup!.name!;
}
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
addExtensionUserAgent(client);
let workflows = await client.workflows.listByResourceGroup(resourceGroupName);
let nextPageLink = workflows.nextLink;
if (workflows.some((workflow: Workflow) => workflow.name! === name)) {
return false;
}
while (nextPageLink !== undefined) {
workflows = await client.workflows.listByResourceGroupNext(nextPageLink);
if (workflows.some((workflow: Workflow) => workflow.name! === name)) {
return false;
}
nextPageLink = workflows.nextLink;
}
public get kudu(): KuduClient {
if (!this.kuduHostName) {
throw new Error(localize('notSupportedLinux', 'This operation is not supported by this app service plan.'));
}
const kuduClient: KuduClient = new KuduClient(this._subscription.credentials, this.kuduUrl);
addExtensionUserAgent(kuduClient);
return kuduClient;
}
export async function getKuduClient(client: SiteClient): Promise {
if (!client.kuduHostName) {
const asp: AppServicePlan | undefined = await client.getAppServicePlan();
const notSupportedLinux: string = localize('notSupportedLinux', 'This operation is not supported by App Service plans with kind "{0}" and sku tier "{1}".', client.kind, asp && asp.sku && asp.sku.tier);
throw new Error(notSupportedLinux);
}
const user: User = await client.getWebAppPublishCredential();
const cred: BasicAuthenticationCredentials = new BasicAuthenticationCredentials(user.publishingUserName, nonNullProp(user, 'publishingPassword'));
const kuduClient: KuduClient = new KuduClient(cred, client.kuduUrl);
addExtensionUserAgent(kuduClient);
return kuduClient;
}
public async loadMoreChildren(node: IAzureNode, clearCache: boolean): Promise {
if (clearCache) {
this.nextLink = undefined;
}
const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId);
addExtensionUserAgent(client);
const integrationAccounts = this.nextLink === undefined
? await client.integrationAccounts.listBySubscription()
: await client.integrationAccounts.listBySubscriptionNext(this.nextLink);
this.nextLink = integrationAccounts.nextLink;
return integrationAccounts.map((integrationAccount: IntegrationAccount) => new IntegrationAccountTreeItem(client, integrationAccount));
}
public async execute(wizardContext: ISchemaWizardContext): Promise {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
addExtensionUserAgent(client);
const newSchema: IntegrationAccountSchema = await client.integrationAccountSchemas.createOrUpdate(wizardContext.resourceGroup!.name!,
wizardContext.integrationAccountName,
wizardContext.schemaName!,
await createNewSchema(wizardContext.schemaName!));
wizardContext.schema = new IntegrationAccountSchemaTreeItem(client, newSchema);
return wizardContext;
}
}
private async isNameAvailable(name: string, wizardContext: IMapWizardContext): Promise {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
addExtensionUserAgent(client);
let maps = await client.integrationAccountMaps.list(wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
let nextPageLink = maps.nextLink;
if (maps.some((map: IntegrationAccountMap) => map.name! === name)) {
return false;
}
while (nextPageLink) {
maps = await client.integrationAccountMaps.listNext(nextPageLink);
if (maps.some((map: IntegrationAccountMap) => map.name! === name)) {
return false;
}
nextPageLink = maps.nextLink;
}
export async function getAllPartners(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroup: string, integrationAccount: string): Promise {
const client = new LogicAppsManagementClient(credentials, subscriptionId);
addExtensionUserAgent(client);
const partners = await client.integrationAccountPartners.list(resourceGroup, integrationAccount);
let nextPageLink = partners.nextLink;
while (nextPageLink) {
partners.push(...await client.integrationAccountPartners.listNext(nextPageLink));
nextPageLink = partners.nextLink;
}
return partners;
}
private async isNameAvailable(name: string, wizardContext: IIntegrationAccountWizardContext): Promise {
let resourceGroupName: string;
if (wizardContext.newResourceGroupName) {
return true;
} else {
resourceGroupName = wizardContext.resourceGroup!.name!;
}
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
addExtensionUserAgent(client);
let integrationAccounts = await client.integrationAccounts.listByResourceGroup(resourceGroupName);
let nextPageLink = integrationAccounts.nextLink;
if (integrationAccounts.some((integrationAccount: IntegrationAccount) => integrationAccount.name! === name)) {
return false;
}
while (nextPageLink) {
integrationAccounts = await client.integrationAccounts.listByResourceGroupNext(nextPageLink);
if (integrationAccounts.some((integrationAccount: IntegrationAccount) => integrationAccount.name! === name)) {
return false;
}
nextPageLink = integrationAccounts.nextLink;
}
private async isNameAvailable(name: string, wizardContext: ISchemaWizardContext): Promise {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
addExtensionUserAgent(client);
let schemas = await client.integrationAccountSchemas.list(wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
let nextPageLink = schemas.nextLink;
if (schemas.some((schema: IntegrationAccountSchema) => schema.name! === name)) {
return false;
}
while (nextPageLink) {
schemas = await client.integrationAccountSchemas.listNext(nextPageLink);
if (schemas.some((schema: IntegrationAccountSchema) => schema.name! === name)) {
return false;
}
nextPageLink = schemas.nextLink;
}