本文整理匯總了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()