本文整理汇总了TypeScript中core/serverGroup/serverGroupReader.service.ServerGroupReader.getServerGroup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.ServerGroupReader.getServerGroup方法的具体用法?TypeScript service.ServerGroupReader.getServerGroup怎么用?TypeScript service.ServerGroupReader.getServerGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/serverGroup/serverGroupReader.service.ServerGroupReader
的用法示例。
在下文中一共展示了service.ServerGroupReader.getServerGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: applyCommandToStage
private applyCommandToStage(command: any): void {
// Push the cluster config into the list of clusters
const cluster = this.awsServerGroupTransformer.convertServerGroupCommandToDeployConfiguration(command);
this.stage.clusters.push(cluster);
// If the ASG we are cloning has a VIP, generate the new VIP
if (command.source && command.source.asgName && command.source.region && command.source.account) {
this.serverGroupReader.getServerGroup(command.application, command.source.account, command.source.region, command.source.asgName).then((asgDetails: ServerGroup) => {
const newOverride: IVipOverride = {
oldVip: undefined,
newVip: undefined,
oldSecureVip: undefined,
newSecureVip: undefined
};
if (asgDetails) {
const discoveryHealth = filter(flatten(map(asgDetails.instances, 'health')), { type: 'Discovery' });
each(discoveryHealth, (health: any) => {
newOverride.oldVip = newOverride.oldVip || health.vipAddress;
newOverride.oldSecureVip = newOverride.oldSecureVip || health.secureVipAddress;
});
newOverride.newVip = this.generateNewVip(newOverride.oldVip, command.freeFormDetails);
newOverride.newSecureVip = this.generateNewVip(newOverride.oldSecureVip, command.freeFormDetails);
}
this.stage.vipOverrides[this.getClusterId(cluster)] = newOverride;
});
}
}
示例2: terminateInstanceAndShrinkServerGroup
public terminateInstanceAndShrinkServerGroup(
instance: IInstance,
application: Application,
params: any = {},
): IPromise<ITask> {
return ServerGroupReader.getServerGroup(
application.name,
instance.account,
instance.region,
instance.serverGroup,
).then((serverGroup: IServerGroup) => {
params.type = 'terminateInstanceAndDecrementServerGroup';
params.instance = instance.id;
params.serverGroupName = instance.serverGroup;
params.asgName = instance.serverGroup; // still needed on the backend
params.region = instance.region;
params.credentials = instance.account;
params.cloudProvider = instance.cloudProvider;
params.adjustMinIfNecessary = true;
params.setMaxToNewDesired = serverGroup.asg.minSize === serverGroup.asg.maxSize;
return TaskExecutor.executeTask({
job: [params],
application,
description: `Terminate instance ${instance.id} and shrink ${instance.serverGroup}`,
});
});
}