Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
private async getKuduClient(client: WebSiteManagementClient): Promise {
const user: User = await this.getWebAppPublishCredential(client);
if (!user.publishingUserName || !user.publishingPassword) {
throw new ArgumentError(user);
}
const cred: BasicAuthenticationCredentials = new BasicAuthenticationCredentials(user.publishingUserName, user.publishingPassword);
return new KuduClient(cred, `https://${this.appName}.scm.azurewebsites.net`);
}
}