当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript js.default.getAppServiceDetails方法代码示例

本文整理汇总了TypeScript中azurerest-common/azurerestutility.js.default.getAppServiceDetails方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default.getAppServiceDetails方法的具体用法?TypeScript js.default.getAppServiceDetails怎么用?TypeScript js.default.getAppServiceDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在azurerest-common/azurerestutility.js.default的用法示例。


在下文中一共展示了js.default.getAppServiceDetails方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: waitForAppServiceToStart

async function waitForAppServiceToStart(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName) {

    while(true) {
        var appServiceDetails = await azureRmUtil.getAppServiceDetails(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName);
        if(appServiceDetails.hasOwnProperty("properties") && appServiceDetails.properties.hasOwnProperty("state")) {
            tl.debug('App Service State : ' + appServiceDetails.properties.state);
            if(appServiceDetails.properties.state == "Running" || appServiceDetails.properties.state == "running") {
                tl.debug('App Service is in Running State');
                break;
            }
            else {
                tl.debug('App Service State : ' + appServiceDetails.properties.state);
                continue;
            }
        }
        tl.debug('Unable to find state of the App Service.');
        break;
    }
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:19,代码来源:azureappservicemanage.ts

示例2: run

async function run() {
    try {
        tl.setResourcePath(path.join( __dirname, 'task.json'));
        var connectedServiceName = tl.getInput('ConnectedServiceName', true);
        var action = tl.getInput('Action', true);
        var webAppName: string = tl.getInput('WebAppName', true);
        var resourceGroupName: string = tl.getInput('ResourceGroupName', false);
        var specifySlotFlag: boolean = tl.getBoolInput('SpecifySlot', false);
        var slotName: string = tl.getInput('Slot', false);
        var sourceSlot: string = tl.getInput('SourceSlot', false);
        var swapWithProduction = tl.getBoolInput('SwapWithProduction', false);
        var targetSlot: string = tl.getInput('TargetSlot', false);
        var preserveVnet: boolean = tl.getBoolInput('PreserveVnet', false);
        var extensionList = tl.getInput('ExtensionsList', false);
        var endPointAuthCreds = tl.getEndpointAuthorization(connectedServiceName, true);
        var subscriptionId = tl.getEndpointDataParameter(connectedServiceName, 'subscriptionid', true);
        var taskResult = true;
        var errorMessage: string = "";
        var updateDeploymentStatus: boolean = true;

        var endPoint = new Array();
        endPoint["servicePrincipalClientID"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'serviceprincipalid', true);
        endPoint["servicePrincipalKey"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'serviceprincipalkey', true);
        endPoint["tenantID"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'tenantid', true);
        endPoint["subscriptionId"] = tl.getEndpointDataParameter(connectedServiceName, 'subscriptionid', true);
        endPoint["envAuthUrl"] = tl.getEndpointDataParameter(connectedServiceName, 'environmentAuthorityUrl', true);
        endPoint["url"] = tl.getEndpointUrl(connectedServiceName, true);

        if(resourceGroupName === null) {
            resourceGroupName = await azureRmUtil.getResourceGroupName(endPoint, webAppName);
        }
        switch(action) {
            case "Start Azure App Service": {
                console.log(await azureRmUtil.startAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
                var appServiceDetails = await azureRmUtil.getAppServiceDetails(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName);
                if(appServiceDetails.hasOwnProperty("properties") && appServiceDetails.properties.hasOwnProperty("state"))
                {
                    while(!(appServiceDetails.properties.state == "Running" || appServiceDetails.properties.state == "running"))
                    {
                        appServiceDetails = await azureRmUtil.getAppServiceDetails(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName);
                    }
                }
                break;
            }
            case "Stop Azure App Service": {
                console.log(await azureRmUtil.stopAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
                break;
            }
            case "Install Extensions": {
                resourceGroupName = (specifySlotFlag ? resourceGroupName : await azureRmUtil.getResourceGroupName(endPoint, webAppName));
                var publishingProfile = await azureRmUtil.getAzureRMWebAppPublishProfile(endPoint, webAppName, resourceGroupName, specifySlotFlag, slotName);
                tl.debug('Retrieved publishing Profile');
                var anyExtensionInstalled = await extensionManage.installExtensions(publishingProfile, extensionList.split(','));
                if(!anyExtensionInstalled) {
                    tl.debug('No new extension installed. Skipping Restart App Service.');
                    break;
                }
            }
            case "Restart Azure App Service": {
                console.log(await azureRmUtil.restartAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
                break;
            }
            case "Swap Slots": {
                if (swapWithProduction) {
                    targetSlot = "production";
                }
                if (sourceSlot === targetSlot) {
                    updateDeploymentStatus = false;
                    throw new Error(tl.loc("SourceAndTargetSlotCannotBeSame"));
                }
                await swapSlot(endPoint, resourceGroupName, webAppName, sourceSlot, swapWithProduction, targetSlot, preserveVnet);
                break;
            }
            default:
                throw Error(tl.loc('InvalidAction'));
        }
    }
    catch(exception) {
        taskResult = false;
        errorMessage = exception;
    }
    if (updateDeploymentStatus) {
        var customMessage = {
            type: action
        }
        var deploymentId = kuduLogUtil.generateDeploymentId();

        if(action === "Swap Slots") {
            customMessage['type'] = 'SlotSwap'; // for Ibiza CD flow
            customMessage['sourceSlot'] = sourceSlot;
            customMessage['targetSlot'] = swapWithProduction ? "Production" : targetSlot;

            await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, true, sourceSlot, taskResult, customMessage, deploymentId);
            await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, !(swapWithProduction), targetSlot, taskResult, customMessage, deploymentId);
        }
        else {
            customMessage['slotName'] =  (specifySlotFlag) ? slotName : 'Production';
            await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, specifySlotFlag, slotName, taskResult, customMessage, deploymentId);
        }
    }
//.........这里部分代码省略.........
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:101,代码来源:azureappservicemanage.ts


注:本文中的azurerest-common/azurerestutility.js.default.getAppServiceDetails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。