本文整理汇总了Python中moto.mock_autoscaling方法的典型用法代码示例。如果您正苦于以下问题:Python moto.mock_autoscaling方法的具体用法?Python moto.mock_autoscaling怎么用?Python moto.mock_autoscaling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moto
的用法示例。
在下文中一共展示了moto.mock_autoscaling方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: boto_patches
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_autoscaling [as 别名]
def boto_patches(context):
mock_sqs_obj = mock_sqs()
mock_sqs_obj.start()
mock_ec2_obj = mock_ec2()
mock_ec2_obj.start()
mock_autoscaling_obj = mock_autoscaling()
mock_autoscaling_obj.start()
vpc_response = ec2.create_vpc(CidrBlock='10.0.0.0/24')
subnet_response = ec2.create_subnet(
CidrBlock='10.0.0.0/24',
VpcId=vpc_response['Vpc']['VpcId'],
AvailabilityZone='us-west-2a'
)
context.subnet_id = subnet_response['Subnet']['SubnetId']
yield
mock_sqs_obj.stop()
mock_ec2_obj.stop()
mock_autoscaling_obj.stop()
示例2: setup_autoscaling
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_autoscaling [as 别名]
def setup_autoscaling():
mock_autoscaling_obj = moto.mock_autoscaling()
mock_autoscaling_obj.start()
yield
mock_autoscaling_obj.stop()
示例3: autoscaling
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_autoscaling [as 别名]
def autoscaling():
with mock_autoscaling():
yield boto3.client("autoscaling", region_name="us-east-1")
示例4: asg
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_autoscaling [as 别名]
def asg():
"""AutoScaling mock service"""
mock = mock_autoscaling()
mock.start()
client = boto3.client('autoscaling')
groups = []
lcs = []
for i in range(3):
lc_config = dict(
LaunchConfigurationName='lc-{0}'.format(i),
ImageId='ami-xxxxxx',
KeyName='mykey',
InstanceType='c3.xlarge',
)
client.create_launch_configuration(**lc_config)
lcs.append(lc_config)
asg_config = dict(
AutoScalingGroupName='asg-{0}'.format(i),
LaunchConfigurationName='lc-{0}'.format(i),
MaxSize=10,
MinSize=2,
)
client.create_auto_scaling_group(**asg_config)
groups.append(asg_config)
yield {'lcs': lcs, 'groups': groups}
mock.stop()