content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
Project Euler - Problem Solution 039
Problem Title - Integer right triangles
Copyright (c) Justin McGettigan. All rights reserved.
https://github.com/jwmcgettigan/project-euler-solutions
"""
def pythagorean_triplet_solutions(p):
''' Finds the pythagorean triplets
for the given perimeter (p). '''
seen = set()
for a in range(1, p // 3 + 1):
for b in range(a + 1, p // 2 + 1):
c = p - a - b
if (a * a + b * b == c * c):
if(a + b + c == p):
seen.add((a, b, c))
return seen
def integer_right_triangles(limit):
''' Finds the maximum number of
solutions for perimeters under a limit. '''
max_solutions = 0, 0
for p in range(limit):
solutions = len(pythagorean_triplet_solutions(p))
if solutions > max_solutions[0]:
max_solutions = solutions, p
return max_solutions[1]
if __name__ == "__main__":
print(integer_right_triangles(1000)) | """
Project Euler - Problem Solution 039
Problem Title - Integer right triangles
Copyright (c) Justin McGettigan. All rights reserved.
https://github.com/jwmcgettigan/project-euler-solutions
"""
def pythagorean_triplet_solutions(p):
""" Finds the pythagorean triplets
for the given perimeter (p). """
seen = set()
for a in range(1, p // 3 + 1):
for b in range(a + 1, p // 2 + 1):
c = p - a - b
if a * a + b * b == c * c:
if a + b + c == p:
seen.add((a, b, c))
return seen
def integer_right_triangles(limit):
""" Finds the maximum number of
solutions for perimeters under a limit. """
max_solutions = (0, 0)
for p in range(limit):
solutions = len(pythagorean_triplet_solutions(p))
if solutions > max_solutions[0]:
max_solutions = (solutions, p)
return max_solutions[1]
if __name__ == '__main__':
print(integer_right_triangles(1000)) |
SOS_token = 0
EOS_token = 1
class Lang:
def __init__(self, name):
self.name = name
self.word2index = {}
self.word2count = {}
self.index2word = {0: "SOS", 1: "EOS"}
self.n_words = 2 # Count SOS and EOS
def addSentence(self, sentence):
for word in sentence.split(' '):
self.addWord(word)
def addWord(self, word):
if word not in self.word2index:
self.word2index[word] = self.n_words
self.word2count[word] = 1
self.index2word[self.n_words] = word
self.n_words += 1
else:
self.word2count[word] += 1
| sos_token = 0
eos_token = 1
class Lang:
def __init__(self, name):
self.name = name
self.word2index = {}
self.word2count = {}
self.index2word = {0: 'SOS', 1: 'EOS'}
self.n_words = 2
def add_sentence(self, sentence):
for word in sentence.split(' '):
self.addWord(word)
def add_word(self, word):
if word not in self.word2index:
self.word2index[word] = self.n_words
self.word2count[word] = 1
self.index2word[self.n_words] = word
self.n_words += 1
else:
self.word2count[word] += 1 |
# MYSQL_HOST = "jbw-1.cpmvfibm3vjp.ap-southeast-1.rds.amazonaws.com"
MYSQL_HOST = "localhost"
MYSQL_PORT = 3306
MYSQL_USER = "redatom"
MYSQL_PWD = "redatom"
MYSQL_DB = "redatom"
Config = {
"mysql": {
"connection": 'mysql://%s:%s@%s:%s/%s?charset=utf8' % (MYSQL_USER, MYSQL_PWD, MYSQL_HOST, MYSQL_PORT, MYSQL_DB)
}
}
| mysql_host = 'localhost'
mysql_port = 3306
mysql_user = 'redatom'
mysql_pwd = 'redatom'
mysql_db = 'redatom'
config = {'mysql': {'connection': 'mysql://%s:%s@%s:%s/%s?charset=utf8' % (MYSQL_USER, MYSQL_PWD, MYSQL_HOST, MYSQL_PORT, MYSQL_DB)}} |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
def attach_instances(InstanceIds=None, AutoScalingGroupName=None):
"""
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.
If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.
For more information, see Attach EC2 Instances to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified instance to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_instances(
InstanceIds=[
'string',
],
AutoScalingGroupName='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:return: response = client.attach_instances(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def attach_load_balancer_target_groups(AutoScalingGroupName=None, TargetGroupARNs=None):
"""
Attaches one or more target groups to the specified Auto Scaling group.
To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups API. To detach the target group from the Auto Scaling group, call the DetachLoadBalancerTargetGroups API.
With Application Load Balancers and Network Load Balancers, instances are registered as targets with a target group. With Classic Load Balancers, instances are registered with the load balancer. For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified target group to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_load_balancer_target_groups(
AutoScalingGroupName='string',
TargetGroupARNs=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type TargetGroupARNs: list
:param TargetGroupARNs: [REQUIRED]\nThe Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target groups.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example attaches the specified target group to the specified Auto Scaling group.
response = client.attach_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
TargetGroupARNs=[
'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def attach_load_balancers(AutoScalingGroupName=None, LoadBalancerNames=None):
"""
Attaches one or more Classic Load Balancers to the specified Auto Scaling group. Amazon EC2 Auto Scaling registers the running instances with these Classic Load Balancers.
To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers API. To detach the load balancer from the Auto Scaling group, call the DetachLoadBalancers API.
For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified load balancer to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_load_balancers(
AutoScalingGroupName='string',
LoadBalancerNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LoadBalancerNames: list
:param LoadBalancerNames: [REQUIRED]\nThe names of the load balancers. You can specify up to 10 load balancers.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example attaches the specified load balancer to the specified Auto Scaling group.
response = client.attach_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
LoadBalancerNames=[
'my-load-balancer',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def batch_delete_scheduled_action(AutoScalingGroupName=None, ScheduledActionNames=None):
"""
Deletes one or more scheduled actions for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
:example: response = client.batch_delete_scheduled_action(
AutoScalingGroupName='string',
ScheduledActionNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScheduledActionNames: list
:param ScheduledActionNames: [REQUIRED]\nThe names of the scheduled actions to delete. The maximum number allowed is 50.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{
'FailedScheduledActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
(dict) --
FailedScheduledActions (list) --
The names of the scheduled actions that could not be deleted, including an error message.
(dict) --
Describes a scheduled action that could not be created, updated, or deleted.
ScheduledActionName (string) --
The name of the scheduled action.
ErrorCode (string) --
The error code.
ErrorMessage (string) --
The error message accompanying the error code.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
:return: {
'FailedScheduledActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def batch_put_scheduled_update_group_action(AutoScalingGroupName=None, ScheduledUpdateGroupActions=None):
"""
Creates or updates one or more scheduled scaling actions for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
See also: AWS API Documentation
Exceptions
:example: response = client.batch_put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledUpdateGroupActions=[
{
'ScheduledActionName': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScheduledUpdateGroupActions: list
:param ScheduledUpdateGroupActions: [REQUIRED]\nOne or more scheduled actions. The maximum number allowed is 50.\n\n(dict) --Describes information used for one or more scheduled scaling action updates in a BatchPutScheduledUpdateGroupAction operation.\nWhen updating a scheduled scaling action, all optional parameters are left unchanged if not specified.\n\nScheduledActionName (string) -- [REQUIRED]The name of the scaling action.\n\nStartTime (datetime) --The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, '2019-06-01T00:00:00Z' ).\nIf you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.\nIf you try to schedule the action in the past, Amazon EC2 Auto Scaling returns an error message.\n\nEndTime (datetime) --The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.\n\nRecurrence (string) --The recurring schedule for the action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, '30 0 1 1,6,12 *' ). For more information about this format, see Crontab .\nWhen StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.\n\nMinSize (integer) --The minimum size of the Auto Scaling group.\n\nMaxSize (integer) --The maximum size of the Auto Scaling group.\n\nDesiredCapacity (integer) --The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.\n\n\n\n\n
:rtype: dict
ReturnsResponse Syntax
{
'FailedScheduledUpdateGroupActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
(dict) --
FailedScheduledUpdateGroupActions (list) --
The names of the scheduled actions that could not be created or updated, including an error message.
(dict) --
Describes a scheduled action that could not be created, updated, or deleted.
ScheduledActionName (string) --
The name of the scheduled action.
ErrorCode (string) --
The error code.
ErrorMessage (string) --
The error message accompanying the error code.
Exceptions
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
:return: {
'FailedScheduledUpdateGroupActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
"""
pass
def complete_lifecycle_action(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleActionToken=None, LifecycleActionResult=None, InstanceId=None):
"""
Completes the lifecycle action for the specified token or instance with the specified result.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.
Expected Output:
:example: response = client.complete_lifecycle_action(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleActionToken='string',
LifecycleActionResult='string',
InstanceId='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]\nThe name of the lifecycle hook.\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LifecycleActionToken: string
:param LifecycleActionToken: A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
:type LifecycleActionResult: string
:param LifecycleActionResult: [REQUIRED]\nThe action for the group to take. This parameter can be either CONTINUE or ABANDON .\n
:type InstanceId: string
:param InstanceId: The ID of the instance.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.
response = client.complete_lifecycle_action(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleActionResult='CONTINUE',
LifecycleActionToken='bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleActionToken (string) -- A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
LifecycleActionResult (string) -- [REQUIRED]
The action for the group to take. This parameter can be either CONTINUE or ABANDON .
InstanceId (string) -- The ID of the instance.
"""
pass
def create_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, LaunchTemplate=None, MixedInstancesPolicy=None, InstanceId=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, LoadBalancerNames=None, TargetGroupARNs=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None, LifecycleHookSpecificationList=None, Tags=None, ServiceLinkedRoleARN=None, MaxInstanceLifetime=None):
"""
Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
For introductory exercises for creating an Auto Scaling group, see Getting Started with Amazon EC2 Auto Scaling and Tutorial: Set Up a Scaled and Load-Balanced Application in the Amazon EC2 Auto Scaling User Guide . For more information, see Auto Scaling Groups in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example creates an Auto Scaling group.
Expected Output:
This example creates an Auto Scaling group and attaches the specified Classic Load Balancer.
Expected Output:
This example creates an Auto Scaling group and attaches the specified target group.
Expected Output:
:example: response = client.create_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
LaunchTemplate={
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
MixedInstancesPolicy={
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
InstanceId='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
LoadBalancerNames=[
'string',
],
TargetGroupARNs=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
LifecycleHookSpecificationList=[
{
'LifecycleHookName': 'string',
'LifecycleTransition': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'DefaultResult': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string'
},
],
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
ServiceLinkedRoleARN='string',
MaxInstanceLifetime=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group. This name must be unique per Region per account.\n
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration to use when an instance is launched. To get the launch configuration name, use the DescribeLaunchConfigurations API operation. New launch configurations can be created with the CreateLaunchConfiguration API.\nYou must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .\n
:type LaunchTemplate: dict
:param LaunchTemplate: Parameters used to specify the launch template and version to use when an instance is launched.\nFor more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .\nYou can alternatively associate a launch template to the Auto Scaling group by using the MixedInstancesPolicy parameter.\nYou must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .\n\nLaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nLaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nVersion (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.\nIf the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .\n\n\n
:type MixedInstancesPolicy: dict
:param MixedInstancesPolicy: An embedded object that specifies a mixed instances policy. The required parameters must be specified. If optional parameters are unspecified, their default values are used.\nThe policy includes parameters that not only define the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacity, but also the parameters that specify the instance configuration information\xe2\x80\x94the launch template and instance types.\nFor more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .\nYou must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .\n\nLaunchTemplate (dict) --The launch template and instance types (overrides).\nThis parameter must be specified when creating a mixed instances policy.\n\nLaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.\n\nLaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nLaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nVersion (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.\nIf the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .\n\n\n\nOverrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.\nIf not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.\n\n(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.\nThe maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.\n\nInstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.\nFor information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.\n\nWeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.\nFor more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .\nValid Range: Minimum value of 1. Maximum value of 999.\n\n\n\n\n\n\n\nInstancesDistribution (dict) --The instances distribution to use.\nIf you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.\n\nOnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.\nThe only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.\n\nOnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group\'s capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.\nDefault if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group\'s desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.\n\nNote\nAn update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.\n\n\nOnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .\nDefault if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.\n\nNote\nAn update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.\n\nValid Range: Minimum value of 0. Maximum value of 100.\n\nSpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.\nIf the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.\nThe default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .\nValid values: lowest-price | capacity-optimized\n\nSpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.\nUsed only when the Spot allocation strategy is lowest-price .\nValid Range: Minimum value of 1. Maximum value of 20.\n\nSpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.\nTo remove a value that you previously set, include the parameter but leave the value blank.\n\n\n\n\n
:type InstanceId: string
:param InstanceId: The ID of the instance used to create a launch configuration for the group. To get the instance ID, use the Amazon EC2 DescribeInstances API operation.\nWhen you specify an ID of an instance, Amazon EC2 Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, except for the block device mapping.\nYou must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .\n
:type MinSize: integer
:param MinSize: [REQUIRED]\nThe minimum size of the group.\n
:type MaxSize: integer
:param MaxSize: [REQUIRED]\nThe maximum size of the group.\n\nNote\nWith a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).\n\n
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group at the time of its creation and the capacity it attempts to maintain. It can scale beyond this capacity if you configure automatic scaling.\nThis number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.\n
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 .\nFor more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .\n
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group. This parameter is optional if you specify one or more subnets for VPCZoneIdentifier .\nConditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into EC2-Classic.\n\n(string) --\n\n
:type LoadBalancerNames: list
:param LoadBalancerNames: A list of Classic Load Balancers associated with this Auto Scaling group. For Application Load Balancers and Network Load Balancers, specify a list of target groups using the TargetGroupARNs property instead.\nFor more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .\n\n(string) --\n\n
:type TargetGroupARNs: list
:param TargetGroupARNs: The Amazon Resource Names (ARN) of the target groups to associate with the Auto Scaling group. Instances are registered as targets in a target group, and traffic is routed to the target group.\nFor more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .\n\n(string) --\n\n
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB . The default value is EC2 . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.\nFor more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .\n
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. During this time, any health check failures for the instance are ignored. The default value is 0 .\nFor more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .\nConditional: This parameter is required if you are adding an ELB health check.\n
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet IDs for your virtual private cloud (VPC).\nIf you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.\nConditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into a VPC.\n
:type TerminationPolicies: list
:param TerminationPolicies: One or more termination policies used to select the instance to terminate. These policies are executed in the order that they are listed.\nFor more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .\n\n(string) --\n\n
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.\nFor more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .\n
:type LifecycleHookSpecificationList: list
:param LifecycleHookSpecificationList: One or more lifecycle hooks.\n\n(dict) --Describes information used to specify a lifecycle hook for an Auto Scaling group.\nA lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).\nThis step is a part of the procedure for creating a lifecycle hook for an Auto Scaling group:\n\n(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.\n(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.\nCreate the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.\nIf you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.\nIf you finish before the timeout period ends, complete the lifecycle action.\n\nFor more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .\n\nLifecycleHookName (string) -- [REQUIRED]The name of the lifecycle hook.\n\nLifecycleTransition (string) -- [REQUIRED]The state of the EC2 instance to which you want to attach the lifecycle hook. The valid values are:\n\nautoscaling:EC2_INSTANCE_LAUNCHING\nautoscaling:EC2_INSTANCE_TERMINATING\n\n\nNotificationMetadata (string) --Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.\n\nHeartbeatTimeout (integer) --The maximum time, in seconds, that can elapse before the lifecycle hook times out.\nIf the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat .\n\nDefaultResult (string) --Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON . The default value is ABANDON .\n\nNotificationTargetARN (string) --The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.\n\nRoleARN (string) --The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.\n\n\n\n\n
:type Tags: list
:param Tags: One or more tags. You can tag your Auto Scaling group and propagate the tags to the Amazon EC2 instances it launches.\nTags are not propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch template but use caution. If the launch template specifies an instance tag with a key that is also specified for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the value of that instance tag with the value specified by the Auto Scaling group.\nFor more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .\n\n(dict) --Describes a tag for an Auto Scaling group.\n\nResourceId (string) --The name of the group.\n\nResourceType (string) --The type of resource. The only supported value is auto-scaling-group .\n\nKey (string) -- [REQUIRED]The tag key.\n\nValue (string) --The tag value.\n\nPropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.\n\n\n\n\n
:type ServiceLinkedRoleARN: string
:param ServiceLinkedRoleARN: The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. By default, Amazon EC2 Auto Scaling uses a service-linked role named AWSServiceRoleForAutoScaling, which it creates if it does not exist. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
:type MaxInstanceLifetime: integer
:param MaxInstanceLifetime: The maximum amount of time, in seconds, that an instance can be in service. The default is null.\nThis parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.\nFor more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .\nValid Range: Minimum value of 0.\n
:return: response = client.create_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='my-launch-config',
MaxSize=3,
MinSize=1,
VPCZoneIdentifier='subnet-4176792c',
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def create_launch_configuration(LaunchConfigurationName=None, ImageId=None, KeyName=None, SecurityGroups=None, ClassicLinkVPCId=None, ClassicLinkVPCSecurityGroups=None, UserData=None, InstanceId=None, InstanceType=None, KernelId=None, RamdiskId=None, BlockDeviceMappings=None, InstanceMonitoring=None, SpotPrice=None, IamInstanceProfile=None, EbsOptimized=None, AssociatePublicIpAddress=None, PlacementTenancy=None):
"""
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
For more information, see Launch Configurations in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example creates a launch configuration.
Expected Output:
:example: response = client.create_launch_configuration(
LaunchConfigurationName='string',
ImageId='string',
KeyName='string',
SecurityGroups=[
'string',
],
ClassicLinkVPCId='string',
ClassicLinkVPCSecurityGroups=[
'string',
],
UserData='string',
InstanceId='string',
InstanceType='string',
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
InstanceMonitoring={
'Enabled': True|False
},
SpotPrice='string',
IamInstanceProfile='string',
EbsOptimized=True|False,
AssociatePublicIpAddress=True|False,
PlacementTenancy='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]\nThe name of the launch configuration. This name must be unique per Region per account.\n
:type ImageId: string
:param ImageId: The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances .\nIf you do not specify InstanceId , you must specify ImageId .\n
:type KeyName: string
:param KeyName: The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances .
:type SecurityGroups: list
:param SecurityGroups: A list that contains the security groups to assign to the instances in the Auto Scaling group.\n[EC2-VPC] Specify the security group IDs. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .\n[EC2-Classic] Specify either the security group names or the security group IDs. For more information, see Amazon EC2 Security Groups in the Amazon EC2 User Guide for Linux Instances .\n\n(string) --\n\n
:type ClassicLinkVPCId: string
:param ClassicLinkVPCId: The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .\nThis parameter can only be used if you are launching EC2-Classic instances.\n
:type ClassicLinkVPCSecurityGroups: list
:param ClassicLinkVPCSecurityGroups: The IDs of one or more security groups for the specified ClassicLink-enabled VPC. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .\nIf you specify the ClassicLinkVPCId parameter, you must specify this parameter.\n\n(string) --\n\n
:type UserData: string
:param UserData: The Base64-encoded user data to make available to the launched EC2 instances. For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances .\n\nThis value will be base64 encoded automatically. Do not base64 encode this value prior to performing the operation.\n
:type InstanceId: string
:param InstanceId: The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for the block device mapping.\nTo create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.\nFor more information, see Create a Launch Configuration Using an EC2 Instance in the Amazon EC2 Auto Scaling User Guide .\nIf you do not specify InstanceId , you must specify both ImageId and InstanceType .\n
:type InstanceType: string
:param InstanceType: Specifies the instance type of the EC2 instance.\nFor information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.\nIf you do not specify InstanceId , you must specify InstanceType .\n
:type KernelId: string
:param KernelId: The ID of the kernel associated with the AMI.
:type RamdiskId: string
:param RamdiskId: The ID of the RAM disk to select.
:type BlockDeviceMappings: list
:param BlockDeviceMappings: A block device mapping, which specifies the block devices for the instance. You can specify virtual devices and EBS volumes. For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances .\n\n(dict) --Describes a block device mapping.\n\nVirtualName (string) --The name of the virtual device (for example, ephemeral0 ).\nYou can specify either VirtualName or Ebs , but not both.\n\nDeviceName (string) -- [REQUIRED]The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ). For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances .\n\nEbs (dict) --Parameters used to automatically set up EBS volumes when an instance is launched.\nYou can specify either VirtualName or Ebs , but not both.\n\nSnapshotId (string) --The snapshot ID of the volume to use.\nConditional: This parameter is optional if you specify a volume size. If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot.\n\nVolumeSize (integer) --The volume size, in Gibibytes (GiB).\nThis can be a number from 1-1,024 for standard , 4-16,384 for io1 , 1-16,384 for gp2 , and 500-16,384 for st1 and sc1 . If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.\nDefault: If you create a volume from a snapshot and you don\'t specify a volume size, the default is the snapshot size.\n\nNote\nAt least one of VolumeSize or SnapshotId is required.\n\n\nVolumeType (string) --The volume type, which can be standard for Magnetic, io1 for Provisioned IOPS SSD, gp2 for General Purpose SSD, st1 for Throughput Optimized HDD, or sc1 for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .\nValid Values: standard | io1 | gp2 | st1 | sc1\n\nDeleteOnTermination (boolean) --Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is true .\n\nIops (integer) --The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .\nConditional: This parameter is required when the volume type is io1 . (Not used with standard , gp2 , st1 , or sc1 volumes.)\n\nEncrypted (boolean) --Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types.\n\nNote\nIf you are creating a volume from a snapshot, you cannot specify an encryption value. Volumes that are created from encrypted snapshots are automatically encrypted, and volumes that are created from unencrypted snapshots are automatically unencrypted. By default, encrypted snapshots use the AWS managed CMK that is used for EBS encryption, but you can specify a custom CMK when you create the snapshot. The ability to encrypt a snapshot during copying also allows you to apply a new CMK to an already-encrypted snapshot. Volumes restored from the resulting copy are only accessible using the new CMK.\nEnabling encryption by default results in all EBS volumes being encrypted with the AWS managed CMK or a customer managed CMK, whether or not the snapshot was encrypted.\n\nFor more information, see Using Encryption with EBS-Backed AMIs in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy for Use with Encrypted Volumes in the Amazon EC2 Auto Scaling User Guide .\n\n\n\nNoDevice (boolean) --Setting this value to true suppresses the specified device included in the block device mapping of the AMI.\nIf NoDevice is true for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.\nIf you specify NoDevice , you cannot specify Ebs .\n\n\n\n\n
:type InstanceMonitoring: dict
:param InstanceMonitoring: Controls whether instances in this group are launched with detailed (true ) or basic (false ) monitoring.\nThe default value is true (enabled).\n\nWarning\nWhen detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .\n\n\nEnabled (boolean) --If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.\n\n\n
:type SpotPrice: string
:param SpotPrice: The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .\n\nNote\nWhen you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.\n\n
:type IamInstanceProfile: string
:param IamInstanceProfile: The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role.\nFor more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide .\n
:type EbsOptimized: boolean
:param EbsOptimized: Specifies whether the launch configuration is optimized for EBS I/O (true ) or not (false ). The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances .\nThe default value is false .\n
:type AssociatePublicIpAddress: boolean
:param AssociatePublicIpAddress: For Auto Scaling groups that are running in a virtual private cloud (VPC), specifies whether to assign a public IP address to the group\'s instances. If you specify true , each instance in the Auto Scaling group receives a unique public IP address. For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide .\nIf you specify this parameter, you must specify at least one subnet for VPCZoneIdentifier when you create your group.\n\nNote\nIf the instance is launched into a default subnet, the default is to assign a public IP address, unless you disabled the option to assign a public IP address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IP address, unless you enabled the option to assign a public IP address on the subnet.\n\n
:type PlacementTenancy: string
:param PlacementTenancy: The tenancy of the instance. An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.\nTo launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default ), you must set the value of this parameter to dedicated .\nIf you specify PlacementTenancy , you must specify at least one subnet for VPCZoneIdentifier when you create your group.\nFor more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide .\nValid Values: default | dedicated\n
:return: response = client.create_launch_configuration(
IamInstanceProfile='my-iam-role',
ImageId='ami-12345678',
InstanceType='m3.medium',
LaunchConfigurationName='my-launch-config',
SecurityGroups=[
'sg-eb2af88e',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def create_or_update_tags(Tags=None):
"""
Creates or updates tags for the specified Auto Scaling group.
When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds two tags to the specified Auto Scaling group.
Expected Output:
:example: response = client.create_or_update_tags(
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type Tags: list
:param Tags: [REQUIRED]\nOne or more tags.\n\n(dict) --Describes a tag for an Auto Scaling group.\n\nResourceId (string) --The name of the group.\n\nResourceType (string) --The type of resource. The only supported value is auto-scaling-group .\n\nKey (string) -- [REQUIRED]The tag key.\n\nValue (string) --The tag value.\n\nPropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.\n\n\n\n\n
:return: response = client.create_or_update_tags(
Tags=[
{
'Key': 'Role',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'WebServer',
},
{
'Key': 'Dept',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
],
)
print(response)
"""
pass
def delete_auto_scaling_group(AutoScalingGroupName=None, ForceDelete=None):
"""
Deletes the specified Auto Scaling group.
If the group has instances or scaling activities in progress, you must specify the option to force the deletion in order for it to succeed.
If the group has policies, deleting the group deletes the policies, the underlying alarm actions, and any alarm that no longer has an associated action.
To remove instances from the Auto Scaling group before deleting it, call the DetachInstances API with the list of instances and the option to decrement the desired capacity. This ensures that Amazon EC2 Auto Scaling does not launch replacement instances.
To terminate all instances before deleting the Auto Scaling group, call the UpdateAutoScalingGroup API and set the minimum size and desired capacity of the Auto Scaling group to zero.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified Auto Scaling group.
Expected Output:
This example deletes the specified Auto Scaling group and all its instances.
Expected Output:
:example: response = client.delete_auto_scaling_group(
AutoScalingGroupName='string',
ForceDelete=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ForceDelete: boolean
:param ForceDelete: Specifies that the group is to be deleted along with all instances associated with the group, without waiting for all instances to be terminated. This parameter also deletes any lifecycle actions associated with the group.
:return: response = client.delete_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_launch_configuration(LaunchConfigurationName=None):
"""
Deletes the specified launch configuration.
The launch configuration must not be attached to an Auto Scaling group. When this call completes, the launch configuration is no longer available for use.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified launch configuration.
Expected Output:
:example: response = client.delete_launch_configuration(
LaunchConfigurationName='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]\nThe name of the launch configuration.\n
:return: response = client.delete_launch_configuration(
LaunchConfigurationName='my-launch-config',
)
print(response)
"""
pass
def delete_lifecycle_hook(LifecycleHookName=None, AutoScalingGroupName=None):
"""
Deletes the specified lifecycle hook.
If there are any outstanding lifecycle actions, they are completed first (ABANDON for launching instances, CONTINUE for terminating instances).
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified lifecycle hook.
Expected Output:
:example: response = client.delete_lifecycle_hook(
LifecycleHookName='string',
AutoScalingGroupName='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]\nThe name of the lifecycle hook.\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example deletes the specified lifecycle hook.
response = client.delete_lifecycle_hook(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def delete_notification_configuration(AutoScalingGroupName=None, TopicARN=None):
"""
Deletes the specified notification.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified notification from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_notification_configuration(
AutoScalingGroupName='string',
TopicARN='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type TopicARN: string
:param TopicARN: [REQUIRED]\nThe Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.\n
:return: response = client.delete_notification_configuration(
AutoScalingGroupName='my-auto-scaling-group',
TopicARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_policy(AutoScalingGroupName=None, PolicyName=None):
"""
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Deleting a Scaling Policy in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified Auto Scaling policy.
Expected Output:
:example: response = client.delete_policy(
AutoScalingGroupName='string',
PolicyName='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyName: string
:param PolicyName: [REQUIRED]\nThe name or Amazon Resource Name (ARN) of the policy.\n
:return: response = client.delete_policy(
AutoScalingGroupName='my-auto-scaling-group',
PolicyName='ScaleIn',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def delete_scheduled_action(AutoScalingGroupName=None, ScheduledActionName=None):
"""
Deletes the specified scheduled action.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified scheduled action from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_scheduled_action(
AutoScalingGroupName='string',
ScheduledActionName='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]\nThe name of the action to delete.\n
:return: response = client.delete_scheduled_action(
AutoScalingGroupName='my-auto-scaling-group',
ScheduledActionName='my-scheduled-action',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_tags(Tags=None):
"""
Deletes the specified tags.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified tag from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_tags(
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type Tags: list
:param Tags: [REQUIRED]\nOne or more tags.\n\n(dict) --Describes a tag for an Auto Scaling group.\n\nResourceId (string) --The name of the group.\n\nResourceType (string) --The type of resource. The only supported value is auto-scaling-group .\n\nKey (string) -- [REQUIRED]The tag key.\n\nValue (string) --The tag value.\n\nPropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.\n\n\n\n\n
:return: response = client.delete_tags(
Tags=[
{
'Key': 'Dept',
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
],
)
print(response)
"""
pass
def describe_account_limits():
"""
Describes the current Amazon EC2 Auto Scaling resource quotas for your AWS account.
For information about requesting an increase, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the Auto Scaling limits for your AWS account.
Expected Output:
:example: response = client.describe_account_limits()
:rtype: dict
ReturnsResponse Syntax{
'MaxNumberOfAutoScalingGroups': 123,
'MaxNumberOfLaunchConfigurations': 123,
'NumberOfAutoScalingGroups': 123,
'NumberOfLaunchConfigurations': 123
}
Response Structure
(dict) --
MaxNumberOfAutoScalingGroups (integer) --The maximum number of groups allowed for your AWS account. The default is 200 groups per AWS Region.
MaxNumberOfLaunchConfigurations (integer) --The maximum number of launch configurations allowed for your AWS account. The default is 200 launch configurations per AWS Region.
NumberOfAutoScalingGroups (integer) --The current number of groups for your AWS account.
NumberOfLaunchConfigurations (integer) --The current number of launch configurations for your AWS account.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the Auto Scaling limits for your AWS account.
response = client.describe_account_limits(
)
print(response)
Expected Output:
{
'MaxNumberOfAutoScalingGroups': 20,
'MaxNumberOfLaunchConfigurations': 100,
'NumberOfAutoScalingGroups': 3,
'NumberOfLaunchConfigurations': 5,
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'MaxNumberOfAutoScalingGroups': 123,
'MaxNumberOfLaunchConfigurations': 123,
'NumberOfAutoScalingGroups': 123,
'NumberOfLaunchConfigurations': 123
}
"""
pass
def describe_adjustment_types():
"""
Describes the available adjustment types for Amazon EC2 Auto Scaling scaling policies. These settings apply to step scaling policies and simple scaling policies; they do not apply to target tracking scaling policies.
The following adjustment types are supported:
See also: AWS API Documentation
Exceptions
Examples
This example describes the available adjustment types.
Expected Output:
:example: response = client.describe_adjustment_types()
:rtype: dict
ReturnsResponse Syntax{
'AdjustmentTypes': [
{
'AdjustmentType': 'string'
},
]
}
Response Structure
(dict) --
AdjustmentTypes (list) --The policy adjustment types.
(dict) --Describes a policy adjustment type.
AdjustmentType (string) --The policy adjustment type. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available adjustment types.
response = client.describe_adjustment_types(
)
print(response)
Expected Output:
{
'AdjustmentTypes': [
{
'AdjustmentType': 'ChangeInCapacity',
},
{
'AdjustmentType': 'ExactCapcity',
},
{
'AdjustmentType': 'PercentChangeInCapacity',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AdjustmentTypes': [
{
'AdjustmentType': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_auto_scaling_groups(AutoScalingGroupNames=None, NextToken=None, MaxRecords=None):
"""
Describes one or more Auto Scaling groups.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_auto_scaling_groups(
AutoScalingGroupNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupNames: list
:param AutoScalingGroupNames: The names of the Auto Scaling groups. Each name can be a maximum of 1600 characters. By default, you can only specify up to 50 names. You can optionally increase this limit using the MaxRecords parameter.\nIf you omit this parameter, all Auto Scaling groups are described.\n\n(string) --\n\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'AutoScalingGroups': [
{
'AutoScalingGroupName': 'string',
'AutoScalingGroupARN': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'MixedInstancesPolicy': {
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123,
'DefaultCooldown': 123,
'AvailabilityZones': [
'string',
],
'LoadBalancerNames': [
'string',
],
'TargetGroupARNs': [
'string',
],
'HealthCheckType': 'string',
'HealthCheckGracePeriod': 123,
'Instances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'Pending'|'Pending:Wait'|'Pending:Proceed'|'Quarantined'|'InService'|'Terminating'|'Terminating:Wait'|'Terminating:Proceed'|'Terminated'|'Detaching'|'Detached'|'EnteringStandby'|'Standby',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'CreatedTime': datetime(2015, 1, 1),
'SuspendedProcesses': [
{
'ProcessName': 'string',
'SuspensionReason': 'string'
},
],
'PlacementGroup': 'string',
'VPCZoneIdentifier': 'string',
'EnabledMetrics': [
{
'Metric': 'string',
'Granularity': 'string'
},
],
'Status': 'string',
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'TerminationPolicies': [
'string',
],
'NewInstancesProtectedFromScaleIn': True|False,
'ServiceLinkedRoleARN': 'string',
'MaxInstanceLifetime': 123
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
AutoScalingGroups (list) --
The groups.
(dict) --
Describes an Auto Scaling group.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
AutoScalingGroupARN (string) --
The Amazon Resource Name (ARN) of the Auto Scaling group.
LaunchConfigurationName (string) --
The name of the associated launch configuration.
LaunchTemplate (dict) --
The launch template for the group.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
MixedInstancesPolicy (dict) --
The mixed instances policy for the group.
LaunchTemplate (dict) --
The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --
The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --
Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --
Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --
The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --
The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --
The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --
Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --
The minimum amount of the Auto Scaling group\'s capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group\'s desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --
Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --
Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --
The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --
The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
MinSize (integer) --
The minimum size of the group.
MaxSize (integer) --
The maximum size of the group.
DesiredCapacity (integer) --
The desired size of the group.
DefaultCooldown (integer) --
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
AvailabilityZones (list) --
One or more Availability Zones for the group.
(string) --
LoadBalancerNames (list) --
One or more load balancers associated with the group.
(string) --
TargetGroupARNs (list) --
The Amazon Resource Names (ARN) of the target groups for your load balancer.
(string) --
HealthCheckType (string) --
The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
HealthCheckGracePeriod (integer) --
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
Instances (list) --
The EC2 instances associated with the group.
(dict) --
Describes an EC2 instance.
InstanceId (string) --
The ID of the instance.
InstanceType (string) --
The instance type of the EC2 instance.
AvailabilityZone (string) --
The Availability Zone in which the instance is running.
LifecycleState (string) --
A description of the current lifecycle state. The Quarantined state is not used.
HealthStatus (string) --
The last reported health status of the instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it.
LaunchConfigurationName (string) --
The launch configuration associated with the instance.
LaunchTemplate (dict) --
The launch template for the instance.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
ProtectedFromScaleIn (boolean) --
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity (string) --
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
CreatedTime (datetime) --
The date and time the group was created.
SuspendedProcesses (list) --
The suspended processes associated with the group.
(dict) --
Describes an automatic scaling process that has been suspended.
For more information, see Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
ProcessName (string) --
The name of the suspended process.
SuspensionReason (string) --
The reason that the process was suspended.
PlacementGroup (string) --
The name of the placement group into which to launch your instances, if any.
VPCZoneIdentifier (string) --
One or more subnet IDs, if applicable, separated by commas.
EnabledMetrics (list) --
The metrics enabled for the group.
(dict) --
Describes an enabled metric.
Metric (string) --
One of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
GroupInServiceCapacity
GroupPendingCapacity
GroupStandbyCapacity
GroupTerminatingCapacity
GroupTotalCapacity
Granularity (string) --
The granularity of the metric. The only valid value is 1Minute .
Status (string) --
The current state of the group when the DeleteAutoScalingGroup operation is in progress.
Tags (list) --
The tags for the group.
(dict) --
Describes a tag for an Auto Scaling group.
ResourceId (string) --
The name of the group.
ResourceType (string) --
The type of resource. The only supported value is auto-scaling-group .
Key (string) --
The tag key.
Value (string) --
The tag value.
PropagateAtLaunch (boolean) --
Determines whether the tag is added to new instances as they are launched in the group.
TerminationPolicies (list) --
The termination policies for the group.
(string) --
NewInstancesProtectedFromScaleIn (boolean) --
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
ServiceLinkedRoleARN (string) --
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf.
MaxInstanceLifetime (integer) --
The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 0.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified Auto Scaling group.
response = client.describe_auto_scaling_groups(
AutoScalingGroupNames=[
'my-auto-scaling-group',
],
)
print(response)
Expected Output:
{
'AutoScalingGroups': [
{
'AutoScalingGroupARN': 'arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:930d940e-891e-4781-a11a-7b0acd480f03:autoScalingGroupName/my-auto-scaling-group',
'AutoScalingGroupName': 'my-auto-scaling-group',
'AvailabilityZones': [
'us-west-2c',
],
'CreatedTime': datetime(2013, 8, 19, 20, 53, 25, 0, 231, 0),
'DefaultCooldown': 300,
'DesiredCapacity': 1,
'EnabledMetrics': [
],
'HealthCheckGracePeriod': 300,
'HealthCheckType': 'EC2',
'Instances': [
{
'AvailabilityZone': 'us-west-2c',
'HealthStatus': 'Healthy',
'InstanceId': 'i-4ba0837f',
'LaunchConfigurationName': 'my-launch-config',
'LifecycleState': 'InService',
'ProtectedFromScaleIn': False,
},
],
'LaunchConfigurationName': 'my-launch-config',
'LoadBalancerNames': [
],
'MaxSize': 1,
'MinSize': 0,
'NewInstancesProtectedFromScaleIn': False,
'SuspendedProcesses': [
],
'Tags': [
],
'TerminationPolicies': [
'Default',
],
'VPCZoneIdentifier': 'subnet-12345678',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingGroups': [
{
'AutoScalingGroupName': 'string',
'AutoScalingGroupARN': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'MixedInstancesPolicy': {
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123,
'DefaultCooldown': 123,
'AvailabilityZones': [
'string',
],
'LoadBalancerNames': [
'string',
],
'TargetGroupARNs': [
'string',
],
'HealthCheckType': 'string',
'HealthCheckGracePeriod': 123,
'Instances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'Pending'|'Pending:Wait'|'Pending:Proceed'|'Quarantined'|'InService'|'Terminating'|'Terminating:Wait'|'Terminating:Proceed'|'Terminated'|'Detaching'|'Detached'|'EnteringStandby'|'Standby',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'CreatedTime': datetime(2015, 1, 1),
'SuspendedProcesses': [
{
'ProcessName': 'string',
'SuspensionReason': 'string'
},
],
'PlacementGroup': 'string',
'VPCZoneIdentifier': 'string',
'EnabledMetrics': [
{
'Metric': 'string',
'Granularity': 'string'
},
],
'Status': 'string',
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'TerminationPolicies': [
'string',
],
'NewInstancesProtectedFromScaleIn': True|False,
'ServiceLinkedRoleARN': 'string',
'MaxInstanceLifetime': 123
},
],
'NextToken': 'string'
}
:returns:
(string) --
"""
pass
def describe_auto_scaling_instances(InstanceIds=None, MaxRecords=None, NextToken=None):
"""
Describes one or more Auto Scaling instances.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified Auto Scaling instance.
Expected Output:
:example: response = client.describe_auto_scaling_instances(
InstanceIds=[
'string',
],
MaxRecords=123,
NextToken='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to MaxRecords IDs. If you omit this parameter, all Auto Scaling instances are described. If you specify an ID that does not exist, it is ignored with no error.\n\n(string) --\n\n
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 50 .
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:rtype: dict
ReturnsResponse Syntax
{
'AutoScalingInstances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AutoScalingGroupName': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'string',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
AutoScalingInstances (list) --
The instances.
(dict) --
Describes an EC2 instance associated with an Auto Scaling group.
InstanceId (string) --
The ID of the instance.
InstanceType (string) --
The instance type of the EC2 instance.
AutoScalingGroupName (string) --
The name of the Auto Scaling group for the instance.
AvailabilityZone (string) --
The Availability Zone for the instance.
LifecycleState (string) --
The lifecycle state for the instance.
HealthStatus (string) --
The last reported health status of this instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it.
LaunchConfigurationName (string) --
The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.
LaunchTemplate (dict) --
The launch template for the instance.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
ProtectedFromScaleIn (boolean) --
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity (string) --
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified Auto Scaling instance.
response = client.describe_auto_scaling_instances(
InstanceIds=[
'i-4ba0837f',
],
)
print(response)
Expected Output:
{
'AutoScalingInstances': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'AvailabilityZone': 'us-west-2c',
'HealthStatus': 'HEALTHY',
'InstanceId': 'i-4ba0837f',
'LaunchConfigurationName': 'my-launch-config',
'LifecycleState': 'InService',
'ProtectedFromScaleIn': False,
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingInstances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AutoScalingGroupName': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'string',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_auto_scaling_notification_types():
"""
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
See also: AWS API Documentation
Exceptions
Examples
This example describes the available notification types.
Expected Output:
:example: response = client.describe_auto_scaling_notification_types()
:rtype: dict
ReturnsResponse Syntax{
'AutoScalingNotificationTypes': [
'string',
]
}
Response Structure
(dict) --
AutoScalingNotificationTypes (list) --The notification types.
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available notification types.
response = client.describe_auto_scaling_notification_types(
)
print(response)
Expected Output:
{
'AutoScalingNotificationTypes': [
'autoscaling:EC2_INSTANCE_LAUNCH',
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
'autoscaling:EC2_INSTANCE_TERMINATE',
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
'autoscaling:TEST_NOTIFICATION',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingNotificationTypes': [
'string',
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_launch_configurations(LaunchConfigurationNames=None, NextToken=None, MaxRecords=None):
"""
Describes one or more launch configurations.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified launch configuration.
Expected Output:
:example: response = client.describe_launch_configurations(
LaunchConfigurationNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type LaunchConfigurationNames: list
:param LaunchConfigurationNames: The launch configuration names. If you omit this parameter, all launch configurations are described.\n\n(string) --\n\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LaunchConfigurations': [
{
'LaunchConfigurationName': 'string',
'LaunchConfigurationARN': 'string',
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
'string',
],
'ClassicLinkVPCId': 'string',
'ClassicLinkVPCSecurityGroups': [
'string',
],
'UserData': 'string',
'InstanceType': 'string',
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
'InstanceMonitoring': {
'Enabled': True|False
},
'SpotPrice': 'string',
'IamInstanceProfile': 'string',
'CreatedTime': datetime(2015, 1, 1),
'EbsOptimized': True|False,
'AssociatePublicIpAddress': True|False,
'PlacementTenancy': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LaunchConfigurations (list) --
The launch configurations.
(dict) --
Describes a launch configuration.
LaunchConfigurationName (string) --
The name of the launch configuration.
LaunchConfigurationARN (string) --
The Amazon Resource Name (ARN) of the launch configuration.
ImageId (string) --
The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.
For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances .
KeyName (string) --
The name of the key pair.
For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances .
SecurityGroups (list) --
A list that contains the security groups to assign to the instances in the Auto Scaling group.
For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
(string) --
ClassicLinkVPCId (string) --
The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to.
For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
ClassicLinkVPCSecurityGroups (list) --
The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId .
For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
(string) --
UserData (string) --
The Base64-encoded user data to make available to the launched EC2 instances.
For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances .
InstanceType (string) --
The instance type for the instances.
For information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.
KernelId (string) --
The ID of the kernel associated with the AMI.
RamdiskId (string) --
The ID of the RAM disk associated with the AMI.
BlockDeviceMappings (list) --
A block device mapping, which specifies the block devices for the instance.
For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances .
(dict) --
Describes a block device mapping.
VirtualName (string) --
The name of the virtual device (for example, ephemeral0 ).
You can specify either VirtualName or Ebs , but not both.
DeviceName (string) --
The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ). For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances .
Ebs (dict) --
Parameters used to automatically set up EBS volumes when an instance is launched.
You can specify either VirtualName or Ebs , but not both.
SnapshotId (string) --
The snapshot ID of the volume to use.
Conditional: This parameter is optional if you specify a volume size. If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot.
VolumeSize (integer) --
The volume size, in Gibibytes (GiB).
This can be a number from 1-1,024 for standard , 4-16,384 for io1 , 1-16,384 for gp2 , and 500-16,384 for st1 and sc1 . If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.
Default: If you create a volume from a snapshot and you don\'t specify a volume size, the default is the snapshot size.
Note
At least one of VolumeSize or SnapshotId is required.
VolumeType (string) --
The volume type, which can be standard for Magnetic, io1 for Provisioned IOPS SSD, gp2 for General Purpose SSD, st1 for Throughput Optimized HDD, or sc1 for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Valid Values: standard | io1 | gp2 | st1 | sc1
DeleteOnTermination (boolean) --
Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is true .
Iops (integer) --
The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Conditional: This parameter is required when the volume type is io1 . (Not used with standard , gp2 , st1 , or sc1 volumes.)
Encrypted (boolean) --
Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
Note
If you are creating a volume from a snapshot, you cannot specify an encryption value. Volumes that are created from encrypted snapshots are automatically encrypted, and volumes that are created from unencrypted snapshots are automatically unencrypted. By default, encrypted snapshots use the AWS managed CMK that is used for EBS encryption, but you can specify a custom CMK when you create the snapshot. The ability to encrypt a snapshot during copying also allows you to apply a new CMK to an already-encrypted snapshot. Volumes restored from the resulting copy are only accessible using the new CMK.
Enabling encryption by default results in all EBS volumes being encrypted with the AWS managed CMK or a customer managed CMK, whether or not the snapshot was encrypted.
For more information, see Using Encryption with EBS-Backed AMIs in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy for Use with Encrypted Volumes in the Amazon EC2 Auto Scaling User Guide .
NoDevice (boolean) --
Setting this value to true suppresses the specified device included in the block device mapping of the AMI.
If NoDevice is true for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.
If you specify NoDevice , you cannot specify Ebs .
InstanceMonitoring (dict) --
Controls whether instances in this group are launched with detailed (true ) or basic (false ) monitoring.
For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
Enabled (boolean) --
If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
SpotPrice (string) --
The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price.
For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
IamInstanceProfile (string) --
The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role.
For more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide .
CreatedTime (datetime) --
The creation date and time for the launch configuration.
EbsOptimized (boolean) --
Specifies whether the launch configuration is optimized for EBS I/O (true ) or not (false ).
For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances .
AssociatePublicIpAddress (boolean) --
For Auto Scaling groups that are running in a VPC, specifies whether to assign a public IP address to the group\'s instances.
For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide .
PlacementTenancy (string) --
The tenancy of the instance, either default or dedicated . An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.
For more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide .
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified launch configuration.
response = client.describe_launch_configurations(
LaunchConfigurationNames=[
'my-launch-config',
],
)
print(response)
Expected Output:
{
'LaunchConfigurations': [
{
'AssociatePublicIpAddress': True,
'BlockDeviceMappings': [
],
'CreatedTime': datetime(2014, 5, 7, 17, 39, 28, 2, 127, 0),
'EbsOptimized': False,
'ImageId': 'ami-043a5034',
'InstanceMonitoring': {
'Enabled': True,
},
'InstanceType': 't1.micro',
'LaunchConfigurationARN': 'arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config',
'LaunchConfigurationName': 'my-launch-config',
'SecurityGroups': [
'sg-67ef0308',
],
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LaunchConfigurations': [
{
'LaunchConfigurationName': 'string',
'LaunchConfigurationARN': 'string',
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
'string',
],
'ClassicLinkVPCId': 'string',
'ClassicLinkVPCSecurityGroups': [
'string',
],
'UserData': 'string',
'InstanceType': 'string',
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
'InstanceMonitoring': {
'Enabled': True|False
},
'SpotPrice': 'string',
'IamInstanceProfile': 'string',
'CreatedTime': datetime(2015, 1, 1),
'EbsOptimized': True|False,
'AssociatePublicIpAddress': True|False,
'PlacementTenancy': 'string'
},
],
'NextToken': 'string'
}
:returns:
(string) --
"""
pass
def describe_lifecycle_hook_types():
"""
Describes the available types of lifecycle hooks.
The following hook types are supported:
See also: AWS API Documentation
Exceptions
Examples
This example describes the available lifecycle hook types.
Expected Output:
:example: response = client.describe_lifecycle_hook_types()
:rtype: dict
ReturnsResponse Syntax{
'LifecycleHookTypes': [
'string',
]
}
Response Structure
(dict) --
LifecycleHookTypes (list) --The lifecycle hook types.
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available lifecycle hook types.
response = client.describe_lifecycle_hook_types(
)
print(response)
Expected Output:
{
'LifecycleHookTypes': [
'autoscaling:EC2_INSTANCE_LAUNCHING',
'autoscaling:EC2_INSTANCE_TERMINATING',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LifecycleHookTypes': [
'string',
]
}
:returns:
(string) --
"""
pass
def describe_lifecycle_hooks(AutoScalingGroupName=None, LifecycleHookNames=None):
"""
Describes the lifecycle hooks for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the lifecycle hooks for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_lifecycle_hooks(
AutoScalingGroupName='string',
LifecycleHookNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LifecycleHookNames: list
:param LifecycleHookNames: The names of one or more lifecycle hooks. If you omit this parameter, all lifecycle hooks are described.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{
'LifecycleHooks': [
{
'LifecycleHookName': 'string',
'AutoScalingGroupName': 'string',
'LifecycleTransition': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'GlobalTimeout': 123,
'DefaultResult': 'string'
},
]
}
Response Structure
(dict) --
LifecycleHooks (list) --
The lifecycle hooks for the specified group.
(dict) --
Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that you want to perform an action whenever it launches instances or terminates instances.
LifecycleHookName (string) --
The name of the lifecycle hook.
AutoScalingGroupName (string) --
The name of the Auto Scaling group for the lifecycle hook.
LifecycleTransition (string) --
The state of the EC2 instance to which to attach the lifecycle hook. The following are possible values:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
NotificationTargetARN (string) --
The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.
RoleARN (string) --
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
NotificationMetadata (string) --
Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout (integer) --
The maximum time, in seconds, that can elapse before the lifecycle hook times out. If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter.
GlobalTimeout (integer) --
The maximum time, in seconds, that an instance can remain in a Pending:Wait or Terminating:Wait state. The maximum is 172800 seconds (48 hours) or 100 times HeartbeatTimeout , whichever is smaller.
DefaultResult (string) --
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The possible values are CONTINUE and ABANDON .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the lifecycle hooks for the specified Auto Scaling group.
response = client.describe_lifecycle_hooks(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LifecycleHooks': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'DefaultResult': 'ABANDON',
'GlobalTimeout': 172800,
'HeartbeatTimeout': 3600,
'LifecycleHookName': 'my-lifecycle-hook',
'LifecycleTransition': 'autoscaling:EC2_INSTANCE_LAUNCHING',
'NotificationTargetARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic',
'RoleARN': 'arn:aws:iam::123456789012:role/my-auto-scaling-role',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LifecycleHooks': [
{
'LifecycleHookName': 'string',
'AutoScalingGroupName': 'string',
'LifecycleTransition': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'GlobalTimeout': 123,
'DefaultResult': 'string'
},
]
}
:returns:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
"""
pass
def describe_load_balancer_target_groups(AutoScalingGroupName=None, NextToken=None, MaxRecords=None):
"""
Describes the target groups for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the target groups attached to the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_load_balancer_target_groups(
AutoScalingGroupName='string',
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LoadBalancerTargetGroups (list) --
Information about the target groups.
(dict) --
Describes the state of a target group.
If you attach a target group to an existing Auto Scaling group, the initial state is Adding . The state transitions to Added after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled, the state transitions to InService after at least one Auto Scaling instance passes the health check. If EC2 health checks are enabled instead, the target group remains in the Added state.
LoadBalancerTargetGroupARN (string) --
The Amazon Resource Name (ARN) of the target group.
State (string) --
The state of the target group.
Adding - The Auto Scaling instances are being registered with the target group.
Added - All Auto Scaling instances are registered with the target group.
InService - At least one Auto Scaling instance passed an ELB health check.
Removing - The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All Auto Scaling instances are deregistered from the target group.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the target groups attached to the specified Auto Scaling group.
response = client.describe_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
'State': 'Added',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
:returns:
Adding - The Auto Scaling instances are being registered with the target group.
Added - All Auto Scaling instances are registered with the target group.
InService - At least one Auto Scaling instance passed an ELB health check.
Removing - The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All Auto Scaling instances are deregistered from the target group.
"""
pass
def describe_load_balancers(AutoScalingGroupName=None, NextToken=None, MaxRecords=None):
"""
Describes the load balancers for the specified Auto Scaling group.
This operation describes only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use the DescribeLoadBalancerTargetGroups API instead.
See also: AWS API Documentation
Exceptions
Examples
This example describes the load balancers attached to the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_load_balancers(
AutoScalingGroupName='string',
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LoadBalancers': [
{
'LoadBalancerName': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LoadBalancers (list) --
The load balancers.
(dict) --
Describes the state of a Classic Load Balancer.
If you specify a load balancer when creating the Auto Scaling group, the state of the load balancer is InService .
If you attach a load balancer to an existing Auto Scaling group, the initial state is Adding . The state transitions to Added after all instances in the group are registered with the load balancer. If Elastic Load Balancing health checks are enabled for the load balancer, the state transitions to InService after at least one instance in the group passes the health check. If EC2 health checks are enabled instead, the load balancer remains in the Added state.
LoadBalancerName (string) --
The name of the load balancer.
State (string) --
One of the following load balancer states:
Adding - The instances in the group are being registered with the load balancer.
Added - All instances in the group are registered with the load balancer.
InService - At least one instance in the group passed an ELB health check.
Removing - The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All instances in the group are deregistered from the load balancer.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the load balancers attached to the specified Auto Scaling group.
response = client.describe_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LoadBalancers': [
{
'LoadBalancerName': 'my-load-balancer',
'State': 'Added',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LoadBalancers': [
{
'LoadBalancerName': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
:returns:
Adding - The instances in the group are being registered with the load balancer.
Added - All instances in the group are registered with the load balancer.
InService - At least one instance in the group passed an ELB health check.
Removing - The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All instances in the group are deregistered from the load balancer.
"""
pass
def describe_metric_collection_types():
"""
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
The GroupStandbyInstances metric is not returned by default. You must explicitly request this metric when calling the EnableMetricsCollection API.
See also: AWS API Documentation
Exceptions
Examples
This example describes the available metric collection types.
Expected Output:
:example: response = client.describe_metric_collection_types()
:rtype: dict
ReturnsResponse Syntax{
'Metrics': [
{
'Metric': 'string'
},
],
'Granularities': [
{
'Granularity': 'string'
},
]
}
Response Structure
(dict) --
Metrics (list) --One or more metrics.
(dict) --Describes a metric.
Metric (string) --One of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
Granularities (list) --The granularities for the metrics.
(dict) --Describes a granularity of a metric.
Granularity (string) --The granularity. The only valid value is 1Minute .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available metric collection types.
response = client.describe_metric_collection_types(
)
print(response)
Expected Output:
{
'Granularities': [
{
'Granularity': '1Minute',
},
],
'Metrics': [
{
'Metric': 'GroupMinSize',
},
{
'Metric': 'GroupMaxSize',
},
{
'Metric': 'GroupDesiredCapacity',
},
{
'Metric': 'GroupInServiceInstances',
},
{
'Metric': 'GroupPendingInstances',
},
{
'Metric': 'GroupTerminatingInstances',
},
{
'Metric': 'GroupStandbyInstances',
},
{
'Metric': 'GroupTotalInstances',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Metrics': [
{
'Metric': 'string'
},
],
'Granularities': [
{
'Granularity': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_notification_configurations(AutoScalingGroupNames=None, NextToken=None, MaxRecords=None):
"""
Describes the notification actions associated with the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the notification configurations for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_notification_configurations(
AutoScalingGroupNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupNames: list
:param AutoScalingGroupNames: The name of the Auto Scaling group.\n\n(string) --\n\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'string',
'TopicARN': 'string',
'NotificationType': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
NotificationConfigurations (list) --
The notification configurations.
(dict) --
Describes a notification.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
TopicARN (string) --
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
NotificationType (string) --
One of the following event notification types:
autoscaling:EC2_INSTANCE_LAUNCH
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
autoscaling:EC2_INSTANCE_TERMINATE
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
autoscaling:TEST_NOTIFICATION
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the notification configurations for the specified Auto Scaling group.
response = client.describe_notification_configurations(
AutoScalingGroupNames=[
'my-auto-scaling-group',
],
)
print(response)
Expected Output:
{
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'NotificationType': 'autoscaling:TEST_NOTIFICATION',
'TopicARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic-2',
},
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'NotificationType': 'autoscaling:TEST_NOTIFICATION',
'TopicARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'string',
'TopicARN': 'string',
'NotificationType': 'string'
},
],
'NextToken': 'string'
}
:returns:
autoscaling:EC2_INSTANCE_LAUNCH
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
autoscaling:EC2_INSTANCE_TERMINATE
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
autoscaling:TEST_NOTIFICATION
"""
pass
def describe_policies(AutoScalingGroupName=None, PolicyNames=None, PolicyTypes=None, NextToken=None, MaxRecords=None):
"""
Describes the policies for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the policies for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_policies(
AutoScalingGroupName='string',
PolicyNames=[
'string',
],
PolicyTypes=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyNames: list
:param PolicyNames: The names of one or more policies. If you omit this parameter, all policies are described. If a group name is provided, the results are limited to that group. This list is limited to 50 items. If you specify an unknown policy name, it is ignored with no error.\n\n(string) --\n\n
:type PolicyTypes: list
:param PolicyTypes: One or more policy types. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling .\n\n(string) --\n\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to be returned with each call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'ScalingPolicies': [
{
'AutoScalingGroupName': 'string',
'PolicyName': 'string',
'PolicyARN': 'string',
'PolicyType': 'string',
'AdjustmentType': 'string',
'MinAdjustmentStep': 123,
'MinAdjustmentMagnitude': 123,
'ScalingAdjustment': 123,
'Cooldown': 123,
'StepAdjustments': [
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
'MetricAggregationType': 'string',
'EstimatedInstanceWarmup': 123,
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
],
'TargetTrackingConfiguration': {
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
'Enabled': True|False
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ScalingPolicies (list) --
The scaling policies.
(dict) --
Describes a scaling policy.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
PolicyName (string) --
The name of the scaling policy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
PolicyType (string) --
The policy type. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling .
AdjustmentType (string) --
The adjustment type, which specifies how ScalingAdjustment is interpreted. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
MinAdjustmentStep (integer) --
Available for backward compatibility. Use MinAdjustmentMagnitude instead.
MinAdjustmentMagnitude (integer) --
The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity , the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError .
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
Cooldown (integer) --
The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start.
StepAdjustments (list) --
A set of adjustments that enable you to scale based on the size of the alarm breach.
(dict) --
Describes information used to create a step adjustment for a step scaling policy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can\'t overlap or have a gap.
At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can\'t be null in the same step adjustment.
For more information, see Step Adjustments in the Amazon EC2 Auto Scaling User Guide .
MetricIntervalLowerBound (float) --
The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --
The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
MetricAggregationType (string) --
The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average .
EstimatedInstanceWarmup (integer) --
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
Alarms (list) --
The CloudWatch alarms related to the policy.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.
TargetTrackingConfiguration (dict) --
A target tracking scaling policy.
PredefinedMetricSpecification (dict) --
A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType (string) --
The metric type. The following predefined metrics are available:
ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group.
ASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group.
ASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group.
ALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.
ResourceLabel (string) --
Identifies the resource associated with the metric type. You can\'t specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group.
The format is ``app/load-balancer-name /load-balancer-id /targetgroup/target-group-name /target-group-id `` , where
``app/load-balancer-name /load-balancer-id `` is the final portion of the load balancer ARN, and
``targetgroup/target-group-name /target-group-id `` is the final portion of the target group ARN.
CustomizedMetricSpecification (dict) --
A customized metric. You must specify either a predefined metric or a customized metric.
MetricName (string) --
The name of the metric.
Namespace (string) --
The namespace of the metric.
Dimensions (list) --
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
(dict) --
Describes the dimension of a metric.
Name (string) --
The name of the dimension.
Value (string) --
The value of the dimension.
Statistic (string) --
The statistic of the metric.
Unit (string) --
The unit of the metric.
TargetValue (float) --
The target value for the metric.
DisableScaleIn (boolean) --
Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn\'t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .
Enabled (boolean) --
Indicates whether the policy is enabled (true ) or disabled (false ).
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example describes the policies for the specified Auto Scaling group.
response = client.describe_policies(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'ScalingPolicies': [
{
'AdjustmentType': 'ChangeInCapacity',
'Alarms': [
],
'AutoScalingGroupName': 'my-auto-scaling-group',
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn',
'PolicyName': 'ScaleIn',
'ScalingAdjustment': -1,
},
{
'AdjustmentType': 'PercentChangeInCapacity',
'Alarms': [
],
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cooldown': 60,
'MinAdjustmentStep': 2,
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2b435159-cf77-4e89-8c0e-d63b497baad7:autoScalingGroupName/my-auto-scaling-group:policyName/ScalePercentChange',
'PolicyName': 'ScalePercentChange',
'ScalingAdjustment': 25,
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'ScalingPolicies': [
{
'AutoScalingGroupName': 'string',
'PolicyName': 'string',
'PolicyARN': 'string',
'PolicyType': 'string',
'AdjustmentType': 'string',
'MinAdjustmentStep': 123,
'MinAdjustmentMagnitude': 123,
'ScalingAdjustment': 123,
'Cooldown': 123,
'StepAdjustments': [
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
'MetricAggregationType': 'string',
'EstimatedInstanceWarmup': 123,
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
],
'TargetTrackingConfiguration': {
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
'Enabled': True|False
},
],
'NextToken': 'string'
}
:returns:
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
"""
pass
def describe_scaling_activities(ActivityIds=None, AutoScalingGroupName=None, MaxRecords=None, NextToken=None):
"""
Describes one or more scaling activities for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the scaling activities for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_scaling_activities(
ActivityIds=[
'string',
],
AutoScalingGroupName='string',
MaxRecords=123,
NextToken='string'
)
:type ActivityIds: list
:param ActivityIds: The activity IDs of the desired scaling activities. You can specify up to 50 IDs. If you omit this parameter, all activities for the past six weeks are described. If unknown activities are requested, they are ignored with no error. If you specify an Auto Scaling group, the results are limited to that group.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Activities (list) --
The scaling activities. Activities are sorted by start time. Activities still in progress are described first.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the scaling activities for the specified Auto Scaling group.
response = client.describe_scaling_activities(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': 'f9f2d65b-f1f2-43e7-b46d-d86756459699',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2013-08-19T20:53:25Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2013-08-19T20:53:29Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.',
'Description': 'Launching a new EC2 instance: i-4ba0837f',
'Details': 'details',
'EndTime': datetime(2013, 8, 19, 20, 54, 2, 0, 231, 0),
'Progress': 100,
'StartTime': datetime(2013, 8, 19, 20, 53, 29, 0, 231, 0),
'StatusCode': 'Successful',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_scaling_process_types():
"""
Describes the scaling process types for use with the ResumeProcesses and SuspendProcesses APIs.
See also: AWS API Documentation
Exceptions
Examples
This example describes the Auto Scaling process types.
Expected Output:
:example: response = client.describe_scaling_process_types()
:rtype: dict
ReturnsResponse Syntax{
'Processes': [
{
'ProcessName': 'string'
},
]
}
Response Structure
(dict) --
Processes (list) --The names of the process types.
(dict) --Describes a process type.
For more information, see Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
ProcessName (string) --One of the following processes:
Launch
Terminate
AddToLoadBalancer
AlarmNotification
AZRebalance
HealthCheck
ReplaceUnhealthy
ScheduledActions
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the Auto Scaling process types.
response = client.describe_scaling_process_types(
)
print(response)
Expected Output:
{
'Processes': [
{
'ProcessName': 'AZRebalance',
},
{
'ProcessName': 'AddToLoadBalancer',
},
{
'ProcessName': 'AlarmNotification',
},
{
'ProcessName': 'HealthCheck',
},
{
'ProcessName': 'Launch',
},
{
'ProcessName': 'ReplaceUnhealthy',
},
{
'ProcessName': 'ScheduledActions',
},
{
'ProcessName': 'Terminate',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Processes': [
{
'ProcessName': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_scheduled_actions(AutoScalingGroupName=None, ScheduledActionNames=None, StartTime=None, EndTime=None, NextToken=None, MaxRecords=None):
"""
Describes the actions scheduled for your Auto Scaling group that haven\'t run or that have not reached their end time. To describe the actions that have already run, call the DescribeScalingActivities API.
See also: AWS API Documentation
Exceptions
Examples
This example describes the scheduled actions for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_scheduled_actions(
AutoScalingGroupName='string',
ScheduledActionNames=[
'string',
],
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type ScheduledActionNames: list
:param ScheduledActionNames: The names of one or more scheduled actions. You can specify up to 50 actions. If you omit this parameter, all scheduled actions are described. If you specify an unknown scheduled action, it is ignored with no error.\n\n(string) --\n\n
:type StartTime: datetime
:param StartTime: The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
:type EndTime: datetime
:param EndTime: The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'string',
'ScheduledActionName': 'string',
'ScheduledActionARN': 'string',
'Time': datetime(2015, 1, 1),
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ScheduledUpdateGroupActions (list) --
The scheduled actions.
(dict) --
Describes a scheduled scaling action.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
ScheduledActionName (string) --
The name of the scheduled action.
ScheduledActionARN (string) --
The Amazon Resource Name (ARN) of the scheduled action.
Time (datetime) --
This parameter is no longer used.
StartTime (datetime) --
The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z" .
EndTime (datetime) --
The date and time in UTC for the recurring schedule to end. For example, "2019-06-01T00:00:00Z" .
Recurrence (string) --
The recurring schedule for the action, in Unix cron syntax format.
When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
MinSize (integer) --
The minimum size of the Auto Scaling group.
MaxSize (integer) --
The maximum size of the Auto Scaling group.
DesiredCapacity (integer) --
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the scheduled actions for the specified Auto Scaling group.
response = client.describe_scheduled_actions(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'DesiredCapacity': 4,
'MaxSize': 6,
'MinSize': 2,
'Recurrence': '30 0 1 12 0',
'ScheduledActionARN': 'arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-auto-scaling-group:scheduledActionName/my-scheduled-action',
'ScheduledActionName': 'my-scheduled-action',
'StartTime': datetime(2016, 12, 1, 0, 30, 0, 3, 336, 0),
'Time': datetime(2016, 12, 1, 0, 30, 0, 3, 336, 0),
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'string',
'ScheduledActionName': 'string',
'ScheduledActionARN': 'string',
'Time': datetime(2015, 1, 1),
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_tags(Filters=None, NextToken=None, MaxRecords=None):
"""
Describes the specified tags.
You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.
You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there\'s no match, no special message is returned.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the tags for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_tags(
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxRecords=123
)
:type Filters: list
:param Filters: One or more filters to scope the tags to return. The maximum number of filters per filter type (for example, auto-scaling-group ) is 1000.\n\n(dict) --Describes a filter that is used to return a more specific list of results when describing tags.\nFor more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .\n\nName (string) --The name of the filter. The valid values are: auto-scaling-group , key , value , and propagate-at-launch .\n\nValues (list) --One or more filter values. Filter values are case-sensitive.\n\n(string) --\n\n\n\n\n\n
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Tags (list) --
One or more tags.
(dict) --
Describes a tag for an Auto Scaling group.
ResourceId (string) --
The name of the group.
ResourceType (string) --
The type of resource. The only supported value is auto-scaling-group .
Key (string) --
The tag key.
Value (string) --
The tag value.
PropagateAtLaunch (boolean) --
Determines whether the tag is added to new instances as they are launched in the group.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the tags for the specified Auto Scaling group.
response = client.describe_tags(
Filters=[
{
'Name': 'auto-scaling-group',
'Values': [
'my-auto-scaling-group',
],
},
],
)
print(response)
Expected Output:
{
'Tags': [
{
'Key': 'Dept',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
{
'Key': 'Role',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'WebServer',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_termination_policy_types():
"""
Describes the termination policies supported by Amazon EC2 Auto Scaling.
For more information, see Controlling Which Auto Scaling Instances Terminate During Scale In in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the available termination policy types.
Expected Output:
:example: response = client.describe_termination_policy_types()
:rtype: dict
ReturnsResponse Syntax{
'TerminationPolicyTypes': [
'string',
]
}
Response Structure
(dict) --
TerminationPolicyTypes (list) --The termination policies supported by Amazon EC2 Auto Scaling: OldestInstance , OldestLaunchConfiguration , NewestInstance , ClosestToNextInstanceHour , Default , OldestLaunchTemplate , and AllocationStrategy .
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available termination policy types.
response = client.describe_termination_policy_types(
)
print(response)
Expected Output:
{
'TerminationPolicyTypes': [
'ClosestToNextInstanceHour',
'Default',
'NewestInstance',
'OldestInstance',
'OldestLaunchConfiguration',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'TerminationPolicyTypes': [
'string',
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def detach_instances(InstanceIds=None, AutoScalingGroupName=None, ShouldDecrementDesiredCapacity=None):
"""
Removes one or more instances from the specified Auto Scaling group.
After the instances are detached, you can manage them independent of the Auto Scaling group.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are detached.
If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.
For more information, see Detach EC2 Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified instance from the specified Auto Scaling group.
Expected Output:
:example: response = client.detach_instances(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]\nIndicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.\n
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to detaching the instances from the Auto Scaling group.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified instance from the specified Auto Scaling group.
response = client.detach_instances(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ShouldDecrementDesiredCapacity=True,
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': '5091cb52-547a-47ce-a236-c9ccbc2cb2c9',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:02:16Z instance i-93633f9b was detached in response to a user request, shrinking the capacity from 2 to 1.',
'Description': 'Detaching EC2 instance: i-93633f9b',
'Details': 'details',
'Progress': 50,
'StartTime': datetime(2015, 4, 12, 15, 2, 16, 6, 102, 0),
'StatusCode': 'InProgress',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def detach_load_balancer_target_groups(AutoScalingGroupName=None, TargetGroupARNs=None):
"""
Detaches one or more target groups from the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified target group from the specified Auto Scaling group
Expected Output:
:example: response = client.detach_load_balancer_target_groups(
AutoScalingGroupName='string',
TargetGroupARNs=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type TargetGroupARNs: list
:param TargetGroupARNs: [REQUIRED]\nThe Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target groups.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified target group from the specified Auto Scaling group
response = client.detach_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
TargetGroupARNs=[
'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def detach_load_balancers(AutoScalingGroupName=None, LoadBalancerNames=None):
"""
Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
This operation detaches only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use the DetachLoadBalancerTargetGroups API instead.
When you detach a load balancer, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using the DescribeLoadBalancers API call. The instances remain running.
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified load balancer from the specified Auto Scaling group.
Expected Output:
:example: response = client.detach_load_balancers(
AutoScalingGroupName='string',
LoadBalancerNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LoadBalancerNames: list
:param LoadBalancerNames: [REQUIRED]\nThe names of the load balancers. You can specify up to 10 load balancers.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified load balancer from the specified Auto Scaling group.
response = client.detach_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
LoadBalancerNames=[
'my-load-balancer',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def disable_metrics_collection(AutoScalingGroupName=None, Metrics=None):
"""
Disables group metrics for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group.
Expected Output:
:example: response = client.disable_metrics_collection(
AutoScalingGroupName='string',
Metrics=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type Metrics: list
:param Metrics: Specifies one or more of the following metrics:\n\nGroupMinSize\nGroupMaxSize\nGroupDesiredCapacity\nGroupInServiceInstances\nGroupPendingInstances\nGroupStandbyInstances\nGroupTerminatingInstances\nGroupTotalInstances\nGroupInServiceCapacity\nGroupPendingCapacity\nGroupStandbyCapacity\nGroupTerminatingCapacity\nGroupTotalCapacity\n\nIf you omit this parameter, all metrics are disabled.\n\n(string) --\n\n
:return: response = client.disable_metrics_collection(
AutoScalingGroupName='my-auto-scaling-group',
Metrics=[
'GroupDesiredCapacity',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def enable_metrics_collection(AutoScalingGroupName=None, Metrics=None, Granularity=None):
"""
Enables group metrics for the specified Auto Scaling group. For more information, see Monitoring Your Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example enables data collection for the specified Auto Scaling group.
Expected Output:
:example: response = client.enable_metrics_collection(
AutoScalingGroupName='string',
Metrics=[
'string',
],
Granularity='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type Metrics: list
:param Metrics: Specifies which group-level metrics to start collecting. You can specify one or more of the following metrics:\n\nGroupMinSize\nGroupMaxSize\nGroupDesiredCapacity\nGroupInServiceInstances\nGroupPendingInstances\nGroupStandbyInstances\nGroupTerminatingInstances\nGroupTotalInstances\n\nThe instance weighting feature supports the following additional metrics:\n\nGroupInServiceCapacity\nGroupPendingCapacity\nGroupStandbyCapacity\nGroupTerminatingCapacity\nGroupTotalCapacity\n\nIf you omit this parameter, all metrics are enabled.\n\n(string) --\n\n
:type Granularity: string
:param Granularity: [REQUIRED]\nThe granularity to associate with the metrics to collect. The only valid value is 1Minute .\n
:return: response = client.enable_metrics_collection(
AutoScalingGroupName='my-auto-scaling-group',
Granularity='1Minute',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def enter_standby(InstanceIds=None, AutoScalingGroupName=None, ShouldDecrementDesiredCapacity=None):
"""
Moves the specified instances into the standby state.
If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.
If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example puts the specified instance into standby mode.
Expected Output:
:example: response = client.enter_standby(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]\nIndicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to Standby mode.\n
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to moving instances into Standby mode.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example puts the specified instance into standby mode.
response = client.enter_standby(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ShouldDecrementDesiredCapacity=True,
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': 'ffa056b4-6ed3-41ba-ae7c-249dfae6eba1',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:10:23Z instance i-93633f9b was moved to standby in response to a user request, shrinking the capacity from 2 to 1.',
'Description': 'Moving EC2 instance to Standby: i-93633f9b',
'Details': 'details',
'Progress': 50,
'StartTime': datetime(2015, 4, 12, 15, 10, 23, 6, 102, 0),
'StatusCode': 'InProgress',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def execute_policy(AutoScalingGroupName=None, PolicyName=None, HonorCooldown=None, MetricValue=None, BreachThreshold=None):
"""
Executes the specified policy.
See also: AWS API Documentation
Exceptions
Examples
This example executes the specified Auto Scaling policy for the specified Auto Scaling group.
Expected Output:
:example: response = client.execute_policy(
AutoScalingGroupName='string',
PolicyName='string',
HonorCooldown=True|False,
MetricValue=123.0,
BreachThreshold=123.0
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyName: string
:param PolicyName: [REQUIRED]\nThe name or ARN of the policy.\n
:type HonorCooldown: boolean
:param HonorCooldown: Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.\nThis parameter is not supported if the policy type is StepScaling or TargetTrackingScaling .\nFor more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .\n
:type MetricValue: float
:param MetricValue: The metric value to compare to BreachThreshold . This enables you to execute a policy of type StepScaling and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.\nIf you specify a metric value that doesn\'t correspond to a step adjustment for the policy, the call returns an error.\nConditional: This parameter is required if the policy type is StepScaling and not supported otherwise.\n
:type BreachThreshold: float
:param BreachThreshold: The breach threshold for the alarm.\nConditional: This parameter is required if the policy type is StepScaling and not supported otherwise.\n
:return: response = client.execute_policy(
AutoScalingGroupName='my-auto-scaling-group',
HonorCooldown=True,
PolicyName='ScaleIn',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def exit_standby(InstanceIds=None, AutoScalingGroupName=None):
"""
Moves the specified instances out of the standby state.
After you put the instances back in service, the desired capacity is incremented.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example moves the specified instance out of standby mode.
Expected Output:
:example: response = client.exit_standby(
InstanceIds=[
'string',
],
AutoScalingGroupName='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to moving instances out of Standby mode.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example moves the specified instance out of standby mode.
response = client.exit_standby(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': '142928e1-a2dc-453a-9b24-b85ad6735928',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:14:29Z instance i-93633f9b was moved out of standby in response to a user request, increasing the capacity from 1 to 2.',
'Description': 'Moving EC2 instance out of Standby: i-93633f9b',
'Details': 'details',
'Progress': 30,
'StartTime': datetime(2015, 4, 12, 15, 14, 29, 6, 102, 0),
'StatusCode': 'PreInService',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to\nClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model.
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
ReturnsA paginator object.
"""
pass
def get_waiter(waiter_name=None):
"""
Returns an object that can wait for some condition.
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters.
:rtype: botocore.waiter.Waiter
"""
pass
def put_lifecycle_hook(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleTransition=None, RoleARN=None, NotificationTargetARN=None, NotificationMetadata=None, HeartbeatTimeout=None, DefaultResult=None):
"""
Creates or updates a lifecycle hook for the specified Auto Scaling group.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails.
You can view the lifecycle hooks for an Auto Scaling group using the DescribeLifecycleHooks API call. If you are no longer using a lifecycle hook, you can delete it by calling the DeleteLifecycleHook API.
See also: AWS API Documentation
Exceptions
Examples
This example creates a lifecycle hook.
Expected Output:
:example: response = client.put_lifecycle_hook(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleTransition='string',
RoleARN='string',
NotificationTargetARN='string',
NotificationMetadata='string',
HeartbeatTimeout=123,
DefaultResult='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]\nThe name of the lifecycle hook.\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LifecycleTransition: string
:param LifecycleTransition: The instance state to which you want to attach the lifecycle hook. The valid values are:\n\nautoscaling:EC2_INSTANCE_LAUNCHING\nautoscaling:EC2_INSTANCE_TERMINATING\n\nConditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.\n
:type RoleARN: string
:param RoleARN: The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.\nConditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.\n
:type NotificationTargetARN: string
:param NotificationTargetARN: The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic.\nIf you specify an empty string, this overrides the current ARN.\nThis operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.\nWhen you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair: 'Event': 'autoscaling:TEST_NOTIFICATION' .\n
:type NotificationMetadata: string
:param NotificationMetadata: Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
:type HeartbeatTimeout: integer
:param HeartbeatTimeout: The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).\nIf the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling the RecordLifecycleActionHeartbeat API.\n
:type DefaultResult: string
:param DefaultResult: Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either CONTINUE or ABANDON . The default value is ABANDON .
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example creates a lifecycle hook.
response = client.put_lifecycle_hook(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleHookName='my-lifecycle-hook',
LifecycleTransition='autoscaling:EC2_INSTANCE_LAUNCHING',
NotificationTargetARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic --role-arn',
RoleARN='arn:aws:iam::123456789012:role/my-auto-scaling-role',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleTransition (string) -- The instance state to which you want to attach the lifecycle hook. The valid values are:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
RoleARN (string) -- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
NotificationTargetARN (string) -- The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic.
If you specify an empty string, this overrides the current ARN.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.
When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION" .
NotificationMetadata (string) -- Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout (integer) -- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).
If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling the RecordLifecycleActionHeartbeat API.
DefaultResult (string) -- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either CONTINUE or ABANDON . The default value is ABANDON .
"""
pass
def put_notification_configuration(AutoScalingGroupName=None, TopicARN=None, NotificationTypes=None):
"""
Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.
This configuration overwrites any existing configuration.
For more information, see Getting Amazon SNS Notifications When Your Auto Scaling Group Scales in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified notification to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_notification_configuration(
AutoScalingGroupName='string',
TopicARN='string',
NotificationTypes=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type TopicARN: string
:param TopicARN: [REQUIRED]\nThe Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.\n
:type NotificationTypes: list
:param NotificationTypes: [REQUIRED]\nThe type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes API.\n\n(string) --\n\n
:return: response = client.put_notification_configuration(
AutoScalingGroupName='my-auto-scaling-group',
NotificationTypes=[
'autoscaling:TEST_NOTIFICATION',
],
TopicARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic',
)
print(response)
:returns:
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def put_scaling_policy(AutoScalingGroupName=None, PolicyName=None, PolicyType=None, AdjustmentType=None, MinAdjustmentStep=None, MinAdjustmentMagnitude=None, ScalingAdjustment=None, Cooldown=None, MetricAggregationType=None, StepAdjustments=None, EstimatedInstanceWarmup=None, TargetTrackingConfiguration=None, Enabled=None):
"""
Creates or updates a scaling policy for an Auto Scaling group.
For more information about using scaling policies to scale your Auto Scaling group, see Target Tracking Scaling Policies and Step and Simple Scaling Policies in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified policy to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scaling_policy(
AutoScalingGroupName='string',
PolicyName='string',
PolicyType='string',
AdjustmentType='string',
MinAdjustmentStep=123,
MinAdjustmentMagnitude=123,
ScalingAdjustment=123,
Cooldown=123,
MetricAggregationType='string',
StepAdjustments=[
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
EstimatedInstanceWarmup=123,
TargetTrackingConfiguration={
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
Enabled=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type PolicyName: string
:param PolicyName: [REQUIRED]\nThe name of the policy.\n
:type PolicyType: string
:param PolicyType: The policy type. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling . If the policy type is null, the value is treated as SimpleScaling .
:type AdjustmentType: string
:param AdjustmentType: Specifies whether the ScalingAdjustment parameter is an absolute number or a percentage of the current capacity. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .\nValid only if the policy type is StepScaling or SimpleScaling . For more information, see Scaling Adjustment Types in the Amazon EC2 Auto Scaling User Guide .\n
:type MinAdjustmentStep: integer
:param MinAdjustmentStep: Available for backward compatibility. Use MinAdjustmentMagnitude instead.
:type MinAdjustmentMagnitude: integer
:param MinAdjustmentMagnitude: The minimum value to scale by when scaling by percentages. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.\nValid only if the policy type is StepScaling or SimpleScaling and the adjustment type is PercentChangeInCapacity . For more information, see Scaling Adjustment Types in the Amazon EC2 Auto Scaling User Guide .\n
:type ScalingAdjustment: integer
:param ScalingAdjustment: The amount by which a simple scaling policy scales the Auto Scaling group in response to an alarm breach. The adjustment is based on the value that you specified in the AdjustmentType parameter (either an absolute number or a percentage). A positive value adds to the current capacity and a negative value subtracts from the current capacity. For exact capacity, you must specify a positive value.\nConditional: If you specify SimpleScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)\n
:type Cooldown: integer
:param Cooldown: The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start. If this parameter is not specified, the default cooldown period for the group applies.\nValid only if the policy type is SimpleScaling . For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .\n
:type MetricAggregationType: string
:param MetricAggregationType: The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .\nValid only if the policy type is StepScaling .\n
:type StepAdjustments: list
:param StepAdjustments: A set of adjustments that enable you to scale based on the size of the alarm breach.\nConditional: If you specify StepScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)\n\n(dict) --Describes information used to create a step adjustment for a step scaling policy.\nFor the following examples, suppose that you have an alarm with a breach threshold of 50:\n\nTo trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.\nTo trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.\n\nThere are a few rules for the step adjustments for your step policy:\n\nThe ranges of your step adjustments can\'t overlap or have a gap.\nAt most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.\nAt most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.\nThe upper and lower bound can\'t be null in the same step adjustment.\n\nFor more information, see Step Adjustments in the Amazon EC2 Auto Scaling User Guide .\n\nMetricIntervalLowerBound (float) --The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.\n\nMetricIntervalUpperBound (float) --The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.\nThe upper bound must be greater than the lower bound.\n\nScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.\n\n\n\n\n
:type EstimatedInstanceWarmup: integer
:param EstimatedInstanceWarmup: The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.\nValid only if the policy type is StepScaling or TargetTrackingScaling .\n
:type TargetTrackingConfiguration: dict
:param TargetTrackingConfiguration: A target tracking scaling policy. Includes support for predefined or customized metrics.\nFor more information, see TargetTrackingConfiguration in the Amazon EC2 Auto Scaling API Reference .\nConditional: If you specify TargetTrackingScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)\n\nPredefinedMetricSpecification (dict) --A predefined metric. You must specify either a predefined metric or a customized metric.\n\nPredefinedMetricType (string) -- [REQUIRED]The metric type. The following predefined metrics are available:\n\nASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group.\nASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group.\nASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group.\nALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.\n\n\nResourceLabel (string) --Identifies the resource associated with the metric type. You can\'t specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group.\nThe format is ``app/load-balancer-name /load-balancer-id /targetgroup/target-group-name /target-group-id `` , where\n\n``app/load-balancer-name /load-balancer-id `` is the final portion of the load balancer ARN, and\n``targetgroup/target-group-name /target-group-id `` is the final portion of the target group ARN.\n\n\n\n\nCustomizedMetricSpecification (dict) --A customized metric. You must specify either a predefined metric or a customized metric.\n\nMetricName (string) -- [REQUIRED]The name of the metric.\n\nNamespace (string) -- [REQUIRED]The namespace of the metric.\n\nDimensions (list) --The dimensions of the metric.\nConditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.\n\n(dict) --Describes the dimension of a metric.\n\nName (string) -- [REQUIRED]The name of the dimension.\n\nValue (string) -- [REQUIRED]The value of the dimension.\n\n\n\n\n\nStatistic (string) -- [REQUIRED]The statistic of the metric.\n\nUnit (string) --The unit of the metric.\n\n\n\nTargetValue (float) -- [REQUIRED]The target value for the metric.\n\nDisableScaleIn (boolean) --Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn\'t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .\n\n\n
:type Enabled: boolean
:param Enabled: Indicates whether the scaling policy is enabled or disabled. The default is enabled. For more information, see Disabling a Scaling Policy for an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
:rtype: dict
ReturnsResponse Syntax
{
'PolicyARN': 'string',
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
]
}
Response Structure
(dict) --
Contains the output of PutScalingPolicy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
Alarms (list) --
The CloudWatch alarms created for the target tracking scaling policy.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example adds the specified policy to the specified Auto Scaling group.
response = client.put_scaling_policy(
AdjustmentType='ChangeInCapacity',
AutoScalingGroupName='my-auto-scaling-group',
PolicyName='ScaleIn',
ScalingAdjustment=-1,
)
print(response)
Expected Output:
{
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn',
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'PolicyARN': 'string',
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def put_scheduled_update_group_action(AutoScalingGroupName=None, ScheduledActionName=None, Time=None, StartTime=None, EndTime=None, Recurrence=None, MinSize=None, MaxSize=None, DesiredCapacity=None):
"""
Creates or updates a scheduled scaling action for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
For more information, see Scheduled Scaling in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified scheduled action to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledActionName='string',
Time=datetime(2015, 1, 1),
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Recurrence='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]\nThe name of this scaling action.\n
:type Time: datetime
:param Time: This parameter is no longer used.
:type StartTime: datetime
:param StartTime: The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, '2019-06-01T00:00:00Z' ).\nIf you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.\nIf you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.\n
:type EndTime: datetime
:param EndTime: The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.
:type Recurrence: string
:param Recurrence: The recurring schedule for this action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, '30 0 1 1,6,12 *' ). For more information about this format, see Crontab .\nWhen StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.\n
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.
:return: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=4,
EndTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
MaxSize=6,
MinSize=2,
ScheduledActionName='my-scheduled-action',
StartTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def record_lifecycle_action_heartbeat(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleActionToken=None, InstanceId=None):
"""
Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the timeout by the length of time defined using the PutLifecycleHook API call.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Auto Scaling Lifecycle in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example records a lifecycle action heartbeat to keep the instance in a pending state.
Expected Output:
:example: response = client.record_lifecycle_action_heartbeat(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleActionToken='string',
InstanceId='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]\nThe name of the lifecycle hook.\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LifecycleActionToken: string
:param LifecycleActionToken: A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
:type InstanceId: string
:param InstanceId: The ID of the instance.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example records a lifecycle action heartbeat to keep the instance in a pending state.
response = client.record_lifecycle_action_heartbeat(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleActionToken='bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleActionToken (string) -- A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
InstanceId (string) -- The ID of the instance.
"""
pass
def resume_processes(AutoScalingGroupName=None, ScalingProcesses=None):
"""
Resumes the specified suspended automatic scaling processes, or all suspended process, for the specified Auto Scaling group.
For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example resumes the specified suspended scaling process for the specified Auto Scaling group.
Expected Output:
:example: response = client.resume_processes(
AutoScalingGroupName='string',
ScalingProcesses=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScalingProcesses: list
:param ScalingProcesses: One or more of the following processes. If you omit this parameter, all processes are specified.\n\nLaunch\nTerminate\nHealthCheck\nReplaceUnhealthy\nAZRebalance\nAlarmNotification\nScheduledActions\nAddToLoadBalancer\n\n\n(string) --\n\n
:return: response = client.resume_processes(
AutoScalingGroupName='my-auto-scaling-group',
ScalingProcesses=[
'AlarmNotification',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_desired_capacity(AutoScalingGroupName=None, DesiredCapacity=None, HonorCooldown=None):
"""
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.
For more information, see Manual Scaling in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example sets the desired capacity for the specified Auto Scaling group.
Expected Output:
:example: response = client.set_desired_capacity(
AutoScalingGroupName='string',
DesiredCapacity=123,
HonorCooldown=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type DesiredCapacity: integer
:param DesiredCapacity: [REQUIRED]\nThe desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.\n
:type HonorCooldown: boolean
:param HonorCooldown: Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.
:return: response = client.set_desired_capacity(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=2,
HonorCooldown=True,
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_instance_health(InstanceId=None, HealthStatus=None, ShouldRespectGracePeriod=None):
"""
Sets the health status of the specified instance.
For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example sets the health status of the specified instance to Unhealthy.
Expected Output:
:example: response = client.set_instance_health(
InstanceId='string',
HealthStatus='string',
ShouldRespectGracePeriod=True|False
)
:type InstanceId: string
:param InstanceId: [REQUIRED]\nThe ID of the instance.\n
:type HealthStatus: string
:param HealthStatus: [REQUIRED]\nThe health status of the instance. Set to Healthy to have the instance remain in service. Set to Unhealthy to have the instance be out of service. Amazon EC2 Auto Scaling terminates and replaces the unhealthy instance.\n
:type ShouldRespectGracePeriod: boolean
:param ShouldRespectGracePeriod: If the Auto Scaling group of the specified instance has a HealthCheckGracePeriod specified for the group, by default, this call respects the grace period. Set this to False , to have the call not respect the grace period associated with the group.\nFor more information about the health check grace period, see CreateAutoScalingGroup in the Amazon EC2 Auto Scaling API Reference .\n
:return: response = client.set_instance_health(
HealthStatus='Unhealthy',
InstanceId='i-93633f9b',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_instance_protection(InstanceIds=None, AutoScalingGroupName=None, ProtectedFromScaleIn=None):
"""
Updates the instance protection settings of the specified instances.
For more information about preventing instances that are part of an Auto Scaling group from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example enables instance protection for the specified instance.
Expected Output:
This example disables instance protection for the specified instance.
Expected Output:
:example: response = client.set_instance_protection(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ProtectedFromScaleIn=True|False
)
:type InstanceIds: list
:param InstanceIds: [REQUIRED]\nOne or more instance IDs.\n\n(string) --\n\n
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ProtectedFromScaleIn: boolean
:param ProtectedFromScaleIn: [REQUIRED]\nIndicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example enables instance protection for the specified instance.
response = client.set_instance_protection(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ProtectedFromScaleIn=True,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
This example disables instance protection for the specified instance.
response = client.set_instance_protection(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ProtectedFromScaleIn=False,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def suspend_processes(AutoScalingGroupName=None, ScalingProcesses=None):
"""
Suspends the specified automatic scaling processes, or all processes, for the specified Auto Scaling group.
If you suspend either the Launch or Terminate process types, it can prevent other process types from functioning properly. For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
To resume processes that have been suspended, call the ResumeProcesses API.
See also: AWS API Documentation
Exceptions
Examples
This example suspends the specified scaling process for the specified Auto Scaling group.
Expected Output:
:example: response = client.suspend_processes(
AutoScalingGroupName='string',
ScalingProcesses=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type ScalingProcesses: list
:param ScalingProcesses: One or more of the following processes. If you omit this parameter, all processes are specified.\n\nLaunch\nTerminate\nHealthCheck\nReplaceUnhealthy\nAZRebalance\nAlarmNotification\nScheduledActions\nAddToLoadBalancer\n\n\n(string) --\n\n
:return: response = client.suspend_processes(
AutoScalingGroupName='my-auto-scaling-group',
ScalingProcesses=[
'AlarmNotification',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def terminate_instance_in_auto_scaling_group(InstanceId=None, ShouldDecrementDesiredCapacity=None):
"""
Terminates the specified instance and optionally adjusts the desired group size.
This call simply makes a termination request. The instance is not terminated immediately. When an instance is terminated, the instance status changes to terminated . You can\'t connect to or start an instance after you\'ve terminated it.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are terminated.
By default, Amazon EC2 Auto Scaling balances instances across all Availability Zones. If you decrement the desired capacity, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries to rebalance the group, and rebalancing might terminate instances in other zones. For more information, see Rebalancing Activities in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates.
Expected Output:
:example: response = client.terminate_instance_in_auto_scaling_group(
InstanceId='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceId: string
:param InstanceId: [REQUIRED]\nThe ID of the instance.\n
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]\nIndicates whether terminating the instance also decrements the size of the Auto Scaling group.\n
:rtype: dict
ReturnsResponse Syntax
{
'Activity': {
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
}
}
Response Structure
(dict) --
Activity (dict) --
A scaling activity.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates.
response = client.terminate_instance_in_auto_scaling_group(
InstanceId='i-93633f9b',
ShouldDecrementDesiredCapacity=False,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activity': {
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
}
}
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def update_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, LaunchTemplate=None, MixedInstancesPolicy=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None, ServiceLinkedRoleARN=None, MaxInstanceLifetime=None):
"""
Updates the configuration for the specified Auto Scaling group.
To update an Auto Scaling group, specify the name of the group and the parameter that you want to change. Any parameters that you don\'t specify are not changed by this update request. The new settings take effect on any scaling activities after this call returns.
If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get the updated configuration. Existing instances continue to run with the configuration that they were originally launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or template, existing instances may be replaced to match the new purchasing options that you specified in the policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that updating your group does not compromise the performance or availability of your application.
Note the following about changing DesiredCapacity , MaxSize , or MinSize :
To see which parameters have been set, call the DescribeAutoScalingGroups API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies API. If the group has scaling policies, you can update them by calling the PutScalingPolicy API.
See also: AWS API Documentation
Exceptions
Examples
This example updates the launch configuration of the specified Auto Scaling group.
Expected Output:
This example updates the minimum size and maximum size of the specified Auto Scaling group.
Expected Output:
This example enables instance protection for the specified Auto Scaling group.
Expected Output:
:example: response = client.update_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
LaunchTemplate={
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
MixedInstancesPolicy={
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
ServiceLinkedRoleARN='string',
MaxInstanceLifetime=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]\nThe name of the Auto Scaling group.\n
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration. If you specify LaunchConfigurationName in your update request, you can\'t specify LaunchTemplate or MixedInstancesPolicy .
:type LaunchTemplate: dict
:param LaunchTemplate: The launch template and version to use to specify the updates. If you specify LaunchTemplate in your update request, you can\'t specify LaunchConfigurationName or MixedInstancesPolicy .\nFor more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .\n\nLaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nLaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nVersion (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.\nIf the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .\n\n\n
:type MixedInstancesPolicy: dict
:param MixedInstancesPolicy: An embedded object that specifies a mixed instances policy.\nIn your call to UpdateAutoScalingGroup , you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.\nFor more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .\n\nLaunchTemplate (dict) --The launch template and instance types (overrides).\nThis parameter must be specified when creating a mixed instances policy.\n\nLaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.\n\nLaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nLaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.\nYou must specify either a template ID or a template name.\n\nVersion (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.\nIf the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .\n\n\n\nOverrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.\nIf not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.\n\n(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.\nThe maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.\n\nInstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.\nFor information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.\n\nWeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.\nFor more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .\nValid Range: Minimum value of 1. Maximum value of 999.\n\n\n\n\n\n\n\nInstancesDistribution (dict) --The instances distribution to use.\nIf you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.\n\nOnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.\nThe only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.\n\nOnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group\'s capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.\nDefault if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group\'s desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.\n\nNote\nAn update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.\n\n\nOnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .\nDefault if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.\n\nNote\nAn update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.\n\nValid Range: Minimum value of 0. Maximum value of 100.\n\nSpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.\nIf the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.\nThe default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .\nValid values: lowest-price | capacity-optimized\n\nSpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.\nUsed only when the Spot allocation strategy is lowest-price .\nValid Range: Minimum value of 1. Maximum value of 20.\n\nSpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.\nTo remove a value that you previously set, include the parameter but leave the value blank.\n\n\n\n\n
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.\n\nNote\nWith a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).\n\n
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.\nThis number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.\n
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 . This cooldown period is not used when a scaling-specific cooldown is specified.\nCooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .\n
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group.\n\n(string) --\n\n
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default value is 0 .\nFor more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .\nConditional: This parameter is required if you are adding an ELB health check.\n
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet IDs for virtual private cloud (VPC).\nIf you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.\n
:type TerminationPolicies: list
:param TerminationPolicies: A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.\nFor more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .\n\n(string) --\n\n
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.\nFor more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .\n
:type ServiceLinkedRoleARN: string
:param ServiceLinkedRoleARN: The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
:type MaxInstanceLifetime: integer
:param MaxInstanceLifetime: The maximum amount of time, in seconds, that an instance can be in service. The default is null.\nThis parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.\nFor more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .\nValid Range: Minimum value of 0.\n
:return: response = client.update_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='new-launch-config',
)
print(response)
:returns:
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LaunchConfigurationName (string) -- The name of the launch configuration. If you specify LaunchConfigurationName in your update request, you can\'t specify LaunchTemplate or MixedInstancesPolicy .
LaunchTemplate (dict) -- The launch template and version to use to specify the updates. If you specify LaunchTemplate in your update request, you can\'t specify LaunchConfigurationName or MixedInstancesPolicy .
For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
MixedInstancesPolicy (dict) -- An embedded object that specifies a mixed instances policy.
In your call to UpdateAutoScalingGroup , you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.
For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .
LaunchTemplate (dict) --The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group\'s capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group\'s desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
MinSize (integer) -- The minimum size of the Auto Scaling group.
MaxSize (integer) -- The maximum size of the Auto Scaling group.
Note
With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).
DesiredCapacity (integer) -- The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
DefaultCooldown (integer) -- The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 . This cooldown period is not used when a scaling-specific cooldown is specified.
Cooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
AvailabilityZones (list) -- One or more Availability Zones for the group.
(string) --
HealthCheckType (string) -- The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
HealthCheckGracePeriod (integer) -- The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default value is 0 .
For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .
Conditional: This parameter is required if you are adding an ELB health check.
PlacementGroup (string) -- The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
VPCZoneIdentifier (string) -- A comma-separated list of subnet IDs for virtual private cloud (VPC).
If you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.
TerminationPolicies (list) -- A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .
(string) --
NewInstancesProtectedFromScaleIn (boolean) -- Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
ServiceLinkedRoleARN (string) -- The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
MaxInstanceLifetime (integer) -- The maximum amount of time, in seconds, that an instance can be in service. The default is null.
This parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.
For more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 0.
"""
pass
| """
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
def attach_instances(InstanceIds=None, AutoScalingGroupName=None):
"""
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.
If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.
For more information, see Attach EC2 Instances to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified instance to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_instances(
InstanceIds=[
'string',
],
AutoScalingGroupName='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:return: response = client.attach_instances(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def attach_load_balancer_target_groups(AutoScalingGroupName=None, TargetGroupARNs=None):
"""
Attaches one or more target groups to the specified Auto Scaling group.
To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups API. To detach the target group from the Auto Scaling group, call the DetachLoadBalancerTargetGroups API.
With Application Load Balancers and Network Load Balancers, instances are registered as targets with a target group. With Classic Load Balancers, instances are registered with the load balancer. For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified target group to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_load_balancer_target_groups(
AutoScalingGroupName='string',
TargetGroupARNs=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type TargetGroupARNs: list
:param TargetGroupARNs: [REQUIRED]
The Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target groups.
(string) --
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example attaches the specified target group to the specified Auto Scaling group.
response = client.attach_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
TargetGroupARNs=[
'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def attach_load_balancers(AutoScalingGroupName=None, LoadBalancerNames=None):
"""
Attaches one or more Classic Load Balancers to the specified Auto Scaling group. Amazon EC2 Auto Scaling registers the running instances with these Classic Load Balancers.
To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers API. To detach the load balancer from the Auto Scaling group, call the DetachLoadBalancers API.
For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example attaches the specified load balancer to the specified Auto Scaling group.
Expected Output:
:example: response = client.attach_load_balancers(
AutoScalingGroupName='string',
LoadBalancerNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LoadBalancerNames: list
:param LoadBalancerNames: [REQUIRED]
The names of the load balancers. You can specify up to 10 load balancers.
(string) --
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example attaches the specified load balancer to the specified Auto Scaling group.
response = client.attach_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
LoadBalancerNames=[
'my-load-balancer',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def batch_delete_scheduled_action(AutoScalingGroupName=None, ScheduledActionNames=None):
"""
Deletes one or more scheduled actions for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
:example: response = client.batch_delete_scheduled_action(
AutoScalingGroupName='string',
ScheduledActionNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScheduledActionNames: list
:param ScheduledActionNames: [REQUIRED]
The names of the scheduled actions to delete. The maximum number allowed is 50.
(string) --
:rtype: dict
ReturnsResponse Syntax
{
'FailedScheduledActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
(dict) --
FailedScheduledActions (list) --
The names of the scheduled actions that could not be deleted, including an error message.
(dict) --
Describes a scheduled action that could not be created, updated, or deleted.
ScheduledActionName (string) --
The name of the scheduled action.
ErrorCode (string) --
The error code.
ErrorMessage (string) --
The error message accompanying the error code.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
:return: {
'FailedScheduledActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def batch_put_scheduled_update_group_action(AutoScalingGroupName=None, ScheduledUpdateGroupActions=None):
"""
Creates or updates one or more scheduled scaling actions for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
See also: AWS API Documentation
Exceptions
:example: response = client.batch_put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledUpdateGroupActions=[
{
'ScheduledActionName': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScheduledUpdateGroupActions: list
:param ScheduledUpdateGroupActions: [REQUIRED]
One or more scheduled actions. The maximum number allowed is 50.
(dict) --Describes information used for one or more scheduled scaling action updates in a BatchPutScheduledUpdateGroupAction operation.
When updating a scheduled scaling action, all optional parameters are left unchanged if not specified.
ScheduledActionName (string) -- [REQUIRED]The name of the scaling action.
StartTime (datetime) --The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, '2019-06-01T00:00:00Z' ).
If you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
If you try to schedule the action in the past, Amazon EC2 Auto Scaling returns an error message.
EndTime (datetime) --The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.
Recurrence (string) --The recurring schedule for the action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, '30 0 1 1,6,12 *' ). For more information about this format, see Crontab .
When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
MinSize (integer) --The minimum size of the Auto Scaling group.
MaxSize (integer) --The maximum size of the Auto Scaling group.
DesiredCapacity (integer) --The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
:rtype: dict
ReturnsResponse Syntax
{
'FailedScheduledUpdateGroupActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
(dict) --
FailedScheduledUpdateGroupActions (list) --
The names of the scheduled actions that could not be created or updated, including an error message.
(dict) --
Describes a scheduled action that could not be created, updated, or deleted.
ScheduledActionName (string) --
The name of the scheduled action.
ErrorCode (string) --
The error code.
ErrorMessage (string) --
The error message accompanying the error code.
Exceptions
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
:return: {
'FailedScheduledUpdateGroupActions': [
{
'ScheduledActionName': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you'd normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator('create_foo').
"""
pass
def complete_lifecycle_action(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleActionToken=None, LifecycleActionResult=None, InstanceId=None):
"""
Completes the lifecycle action for the specified token or instance with the specified result.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.
Expected Output:
:example: response = client.complete_lifecycle_action(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleActionToken='string',
LifecycleActionResult='string',
InstanceId='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]
The name of the lifecycle hook.
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LifecycleActionToken: string
:param LifecycleActionToken: A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
:type LifecycleActionResult: string
:param LifecycleActionResult: [REQUIRED]
The action for the group to take. This parameter can be either CONTINUE or ABANDON .
:type InstanceId: string
:param InstanceId: The ID of the instance.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.
response = client.complete_lifecycle_action(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleActionResult='CONTINUE',
LifecycleActionToken='bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleActionToken (string) -- A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
LifecycleActionResult (string) -- [REQUIRED]
The action for the group to take. This parameter can be either CONTINUE or ABANDON .
InstanceId (string) -- The ID of the instance.
"""
pass
def create_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, LaunchTemplate=None, MixedInstancesPolicy=None, InstanceId=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, LoadBalancerNames=None, TargetGroupARNs=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None, LifecycleHookSpecificationList=None, Tags=None, ServiceLinkedRoleARN=None, MaxInstanceLifetime=None):
"""
Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
For introductory exercises for creating an Auto Scaling group, see Getting Started with Amazon EC2 Auto Scaling and Tutorial: Set Up a Scaled and Load-Balanced Application in the Amazon EC2 Auto Scaling User Guide . For more information, see Auto Scaling Groups in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example creates an Auto Scaling group.
Expected Output:
This example creates an Auto Scaling group and attaches the specified Classic Load Balancer.
Expected Output:
This example creates an Auto Scaling group and attaches the specified target group.
Expected Output:
:example: response = client.create_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
LaunchTemplate={
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
MixedInstancesPolicy={
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
InstanceId='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
LoadBalancerNames=[
'string',
],
TargetGroupARNs=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
LifecycleHookSpecificationList=[
{
'LifecycleHookName': 'string',
'LifecycleTransition': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'DefaultResult': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string'
},
],
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
ServiceLinkedRoleARN='string',
MaxInstanceLifetime=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group. This name must be unique per Region per account.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration to use when an instance is launched. To get the launch configuration name, use the DescribeLaunchConfigurations API operation. New launch configurations can be created with the CreateLaunchConfiguration API.
You must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .
:type LaunchTemplate: dict
:param LaunchTemplate: Parameters used to specify the launch template and version to use when an instance is launched.
For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .
You can alternatively associate a launch template to the Auto Scaling group by using the MixedInstancesPolicy parameter.
You must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
:type MixedInstancesPolicy: dict
:param MixedInstancesPolicy: An embedded object that specifies a mixed instances policy. The required parameters must be specified. If optional parameters are unspecified, their default values are used.
The policy includes parameters that not only define the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacity, but also the parameters that specify the instance configuration informationâ\x80\x94the launch template and instance types.
For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .
You must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .
LaunchTemplate (dict) --The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
:type InstanceId: string
:param InstanceId: The ID of the instance used to create a launch configuration for the group. To get the instance ID, use the Amazon EC2 DescribeInstances API operation.
When you specify an ID of an instance, Amazon EC2 Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, except for the block device mapping.
You must specify one of the following parameters in your request: LaunchConfigurationName , LaunchTemplate , InstanceId , or MixedInstancesPolicy .
:type MinSize: integer
:param MinSize: [REQUIRED]
The minimum size of the group.
:type MaxSize: integer
:param MaxSize: [REQUIRED]
The maximum size of the group.
Note
With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group at the time of its creation and the capacity it attempts to maintain. It can scale beyond this capacity if you configure automatic scaling.
This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 .
For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group. This parameter is optional if you specify one or more subnets for VPCZoneIdentifier .
Conditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into EC2-Classic.
(string) --
:type LoadBalancerNames: list
:param LoadBalancerNames: A list of Classic Load Balancers associated with this Auto Scaling group. For Application Load Balancers and Network Load Balancers, specify a list of target groups using the TargetGroupARNs property instead.
For more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
(string) --
:type TargetGroupARNs: list
:param TargetGroupARNs: The Amazon Resource Names (ARN) of the target groups to associate with the Auto Scaling group. Instances are registered as targets in a target group, and traffic is routed to the target group.
For more information, see Using a Load Balancer with an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB . The default value is EC2 . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. During this time, any health check failures for the instance are ignored. The default value is 0 .
For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .
Conditional: This parameter is required if you are adding an ELB health check.
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet IDs for your virtual private cloud (VPC).
If you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.
Conditional: If your account supports EC2-Classic and VPC, this parameter is required to launch instances into a VPC.
:type TerminationPolicies: list
:param TerminationPolicies: One or more termination policies used to select the instance to terminate. These policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
:type LifecycleHookSpecificationList: list
:param LifecycleHookSpecificationList: One or more lifecycle hooks.
(dict) --Describes information used to specify a lifecycle hook for an Auto Scaling group.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for creating a lifecycle hook for an Auto Scaling group:
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.
If you finish before the timeout period ends, complete the lifecycle action.
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .
LifecycleHookName (string) -- [REQUIRED]The name of the lifecycle hook.
LifecycleTransition (string) -- [REQUIRED]The state of the EC2 instance to which you want to attach the lifecycle hook. The valid values are:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
NotificationMetadata (string) --Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout (integer) --The maximum time, in seconds, that can elapse before the lifecycle hook times out.
If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat .
DefaultResult (string) --Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON . The default value is ABANDON .
NotificationTargetARN (string) --The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.
RoleARN (string) --The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
:type Tags: list
:param Tags: One or more tags. You can tag your Auto Scaling group and propagate the tags to the Amazon EC2 instances it launches.
Tags are not propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch template but use caution. If the launch template specifies an instance tag with a key that is also specified for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the value of that instance tag with the value specified by the Auto Scaling group.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
(dict) --Describes a tag for an Auto Scaling group.
ResourceId (string) --The name of the group.
ResourceType (string) --The type of resource. The only supported value is auto-scaling-group .
Key (string) -- [REQUIRED]The tag key.
Value (string) --The tag value.
PropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.
:type ServiceLinkedRoleARN: string
:param ServiceLinkedRoleARN: The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. By default, Amazon EC2 Auto Scaling uses a service-linked role named AWSServiceRoleForAutoScaling, which it creates if it does not exist. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
:type MaxInstanceLifetime: integer
:param MaxInstanceLifetime: The maximum amount of time, in seconds, that an instance can be in service. The default is null.
This parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.
For more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 0.
:return: response = client.create_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='my-launch-config',
MaxSize=3,
MinSize=1,
VPCZoneIdentifier='subnet-4176792c',
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def create_launch_configuration(LaunchConfigurationName=None, ImageId=None, KeyName=None, SecurityGroups=None, ClassicLinkVPCId=None, ClassicLinkVPCSecurityGroups=None, UserData=None, InstanceId=None, InstanceType=None, KernelId=None, RamdiskId=None, BlockDeviceMappings=None, InstanceMonitoring=None, SpotPrice=None, IamInstanceProfile=None, EbsOptimized=None, AssociatePublicIpAddress=None, PlacementTenancy=None):
"""
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
For more information, see Launch Configurations in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example creates a launch configuration.
Expected Output:
:example: response = client.create_launch_configuration(
LaunchConfigurationName='string',
ImageId='string',
KeyName='string',
SecurityGroups=[
'string',
],
ClassicLinkVPCId='string',
ClassicLinkVPCSecurityGroups=[
'string',
],
UserData='string',
InstanceId='string',
InstanceType='string',
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
InstanceMonitoring={
'Enabled': True|False
},
SpotPrice='string',
IamInstanceProfile='string',
EbsOptimized=True|False,
AssociatePublicIpAddress=True|False,
PlacementTenancy='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]
The name of the launch configuration. This name must be unique per Region per account.
:type ImageId: string
:param ImageId: The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances .
If you do not specify InstanceId , you must specify ImageId .
:type KeyName: string
:param KeyName: The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances .
:type SecurityGroups: list
:param SecurityGroups: A list that contains the security groups to assign to the instances in the Auto Scaling group.
[EC2-VPC] Specify the security group IDs. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
[EC2-Classic] Specify either the security group names or the security group IDs. For more information, see Amazon EC2 Security Groups in the Amazon EC2 User Guide for Linux Instances .
(string) --
:type ClassicLinkVPCId: string
:param ClassicLinkVPCId: The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
This parameter can only be used if you are launching EC2-Classic instances.
:type ClassicLinkVPCSecurityGroups: list
:param ClassicLinkVPCSecurityGroups: The IDs of one or more security groups for the specified ClassicLink-enabled VPC. For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
If you specify the ClassicLinkVPCId parameter, you must specify this parameter.
(string) --
:type UserData: string
:param UserData: The Base64-encoded user data to make available to the launched EC2 instances. For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances .
This value will be base64 encoded automatically. Do not base64 encode this value prior to performing the operation.
:type InstanceId: string
:param InstanceId: The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for the block device mapping.
To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.
For more information, see Create a Launch Configuration Using an EC2 Instance in the Amazon EC2 Auto Scaling User Guide .
If you do not specify InstanceId , you must specify both ImageId and InstanceType .
:type InstanceType: string
:param InstanceType: Specifies the instance type of the EC2 instance.
For information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.
If you do not specify InstanceId , you must specify InstanceType .
:type KernelId: string
:param KernelId: The ID of the kernel associated with the AMI.
:type RamdiskId: string
:param RamdiskId: The ID of the RAM disk to select.
:type BlockDeviceMappings: list
:param BlockDeviceMappings: A block device mapping, which specifies the block devices for the instance. You can specify virtual devices and EBS volumes. For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances .
(dict) --Describes a block device mapping.
VirtualName (string) --The name of the virtual device (for example, ephemeral0 ).
You can specify either VirtualName or Ebs , but not both.
DeviceName (string) -- [REQUIRED]The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ). For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances .
Ebs (dict) --Parameters used to automatically set up EBS volumes when an instance is launched.
You can specify either VirtualName or Ebs , but not both.
SnapshotId (string) --The snapshot ID of the volume to use.
Conditional: This parameter is optional if you specify a volume size. If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot.
VolumeSize (integer) --The volume size, in Gibibytes (GiB).
This can be a number from 1-1,024 for standard , 4-16,384 for io1 , 1-16,384 for gp2 , and 500-16,384 for st1 and sc1 . If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.
Default: If you create a volume from a snapshot and you don't specify a volume size, the default is the snapshot size.
Note
At least one of VolumeSize or SnapshotId is required.
VolumeType (string) --The volume type, which can be standard for Magnetic, io1 for Provisioned IOPS SSD, gp2 for General Purpose SSD, st1 for Throughput Optimized HDD, or sc1 for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Valid Values: standard | io1 | gp2 | st1 | sc1
DeleteOnTermination (boolean) --Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is true .
Iops (integer) --The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Conditional: This parameter is required when the volume type is io1 . (Not used with standard , gp2 , st1 , or sc1 volumes.)
Encrypted (boolean) --Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
Note
If you are creating a volume from a snapshot, you cannot specify an encryption value. Volumes that are created from encrypted snapshots are automatically encrypted, and volumes that are created from unencrypted snapshots are automatically unencrypted. By default, encrypted snapshots use the AWS managed CMK that is used for EBS encryption, but you can specify a custom CMK when you create the snapshot. The ability to encrypt a snapshot during copying also allows you to apply a new CMK to an already-encrypted snapshot. Volumes restored from the resulting copy are only accessible using the new CMK.
Enabling encryption by default results in all EBS volumes being encrypted with the AWS managed CMK or a customer managed CMK, whether or not the snapshot was encrypted.
For more information, see Using Encryption with EBS-Backed AMIs in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy for Use with Encrypted Volumes in the Amazon EC2 Auto Scaling User Guide .
NoDevice (boolean) --Setting this value to true suppresses the specified device included in the block device mapping of the AMI.
If NoDevice is true for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.
If you specify NoDevice , you cannot specify Ebs .
:type InstanceMonitoring: dict
:param InstanceMonitoring: Controls whether instances in this group are launched with detailed (true ) or basic (false ) monitoring.
The default value is true (enabled).
Warning
When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
Enabled (boolean) --If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
:type SpotPrice: string
:param SpotPrice: The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
Note
When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.
:type IamInstanceProfile: string
:param IamInstanceProfile: The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role.
For more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide .
:type EbsOptimized: boolean
:param EbsOptimized: Specifies whether the launch configuration is optimized for EBS I/O (true ) or not (false ). The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances .
The default value is false .
:type AssociatePublicIpAddress: boolean
:param AssociatePublicIpAddress: For Auto Scaling groups that are running in a virtual private cloud (VPC), specifies whether to assign a public IP address to the group's instances. If you specify true , each instance in the Auto Scaling group receives a unique public IP address. For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide .
If you specify this parameter, you must specify at least one subnet for VPCZoneIdentifier when you create your group.
Note
If the instance is launched into a default subnet, the default is to assign a public IP address, unless you disabled the option to assign a public IP address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IP address, unless you enabled the option to assign a public IP address on the subnet.
:type PlacementTenancy: string
:param PlacementTenancy: The tenancy of the instance. An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.
To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default ), you must set the value of this parameter to dedicated .
If you specify PlacementTenancy , you must specify at least one subnet for VPCZoneIdentifier when you create your group.
For more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide .
Valid Values: default | dedicated
:return: response = client.create_launch_configuration(
IamInstanceProfile='my-iam-role',
ImageId='ami-12345678',
InstanceType='m3.medium',
LaunchConfigurationName='my-launch-config',
SecurityGroups=[
'sg-eb2af88e',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def create_or_update_tags(Tags=None):
"""
Creates or updates tags for the specified Auto Scaling group.
When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds two tags to the specified Auto Scaling group.
Expected Output:
:example: response = client.create_or_update_tags(
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type Tags: list
:param Tags: [REQUIRED]
One or more tags.
(dict) --Describes a tag for an Auto Scaling group.
ResourceId (string) --The name of the group.
ResourceType (string) --The type of resource. The only supported value is auto-scaling-group .
Key (string) -- [REQUIRED]The tag key.
Value (string) --The tag value.
PropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.
:return: response = client.create_or_update_tags(
Tags=[
{
'Key': 'Role',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'WebServer',
},
{
'Key': 'Dept',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
],
)
print(response)
"""
pass
def delete_auto_scaling_group(AutoScalingGroupName=None, ForceDelete=None):
"""
Deletes the specified Auto Scaling group.
If the group has instances or scaling activities in progress, you must specify the option to force the deletion in order for it to succeed.
If the group has policies, deleting the group deletes the policies, the underlying alarm actions, and any alarm that no longer has an associated action.
To remove instances from the Auto Scaling group before deleting it, call the DetachInstances API with the list of instances and the option to decrement the desired capacity. This ensures that Amazon EC2 Auto Scaling does not launch replacement instances.
To terminate all instances before deleting the Auto Scaling group, call the UpdateAutoScalingGroup API and set the minimum size and desired capacity of the Auto Scaling group to zero.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified Auto Scaling group.
Expected Output:
This example deletes the specified Auto Scaling group and all its instances.
Expected Output:
:example: response = client.delete_auto_scaling_group(
AutoScalingGroupName='string',
ForceDelete=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ForceDelete: boolean
:param ForceDelete: Specifies that the group is to be deleted along with all instances associated with the group, without waiting for all instances to be terminated. This parameter also deletes any lifecycle actions associated with the group.
:return: response = client.delete_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_launch_configuration(LaunchConfigurationName=None):
"""
Deletes the specified launch configuration.
The launch configuration must not be attached to an Auto Scaling group. When this call completes, the launch configuration is no longer available for use.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified launch configuration.
Expected Output:
:example: response = client.delete_launch_configuration(
LaunchConfigurationName='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]
The name of the launch configuration.
:return: response = client.delete_launch_configuration(
LaunchConfigurationName='my-launch-config',
)
print(response)
"""
pass
def delete_lifecycle_hook(LifecycleHookName=None, AutoScalingGroupName=None):
"""
Deletes the specified lifecycle hook.
If there are any outstanding lifecycle actions, they are completed first (ABANDON for launching instances, CONTINUE for terminating instances).
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified lifecycle hook.
Expected Output:
:example: response = client.delete_lifecycle_hook(
LifecycleHookName='string',
AutoScalingGroupName='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]
The name of the lifecycle hook.
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example deletes the specified lifecycle hook.
response = client.delete_lifecycle_hook(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def delete_notification_configuration(AutoScalingGroupName=None, TopicARN=None):
"""
Deletes the specified notification.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified notification from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_notification_configuration(
AutoScalingGroupName='string',
TopicARN='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type TopicARN: string
:param TopicARN: [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
:return: response = client.delete_notification_configuration(
AutoScalingGroupName='my-auto-scaling-group',
TopicARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_policy(AutoScalingGroupName=None, PolicyName=None):
"""
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Deleting a Scaling Policy in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified Auto Scaling policy.
Expected Output:
:example: response = client.delete_policy(
AutoScalingGroupName='string',
PolicyName='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyName: string
:param PolicyName: [REQUIRED]
The name or Amazon Resource Name (ARN) of the policy.
:return: response = client.delete_policy(
AutoScalingGroupName='my-auto-scaling-group',
PolicyName='ScaleIn',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def delete_scheduled_action(AutoScalingGroupName=None, ScheduledActionName=None):
"""
Deletes the specified scheduled action.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified scheduled action from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_scheduled_action(
AutoScalingGroupName='string',
ScheduledActionName='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]
The name of the action to delete.
:return: response = client.delete_scheduled_action(
AutoScalingGroupName='my-auto-scaling-group',
ScheduledActionName='my-scheduled-action',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def delete_tags(Tags=None):
"""
Deletes the specified tags.
See also: AWS API Documentation
Exceptions
Examples
This example deletes the specified tag from the specified Auto Scaling group.
Expected Output:
:example: response = client.delete_tags(
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type Tags: list
:param Tags: [REQUIRED]
One or more tags.
(dict) --Describes a tag for an Auto Scaling group.
ResourceId (string) --The name of the group.
ResourceType (string) --The type of resource. The only supported value is auto-scaling-group .
Key (string) -- [REQUIRED]The tag key.
Value (string) --The tag value.
PropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.
:return: response = client.delete_tags(
Tags=[
{
'Key': 'Dept',
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
],
)
print(response)
"""
pass
def describe_account_limits():
"""
Describes the current Amazon EC2 Auto Scaling resource quotas for your AWS account.
For information about requesting an increase, see Amazon EC2 Auto Scaling Service Quotas in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the Auto Scaling limits for your AWS account.
Expected Output:
:example: response = client.describe_account_limits()
:rtype: dict
ReturnsResponse Syntax{
'MaxNumberOfAutoScalingGroups': 123,
'MaxNumberOfLaunchConfigurations': 123,
'NumberOfAutoScalingGroups': 123,
'NumberOfLaunchConfigurations': 123
}
Response Structure
(dict) --
MaxNumberOfAutoScalingGroups (integer) --The maximum number of groups allowed for your AWS account. The default is 200 groups per AWS Region.
MaxNumberOfLaunchConfigurations (integer) --The maximum number of launch configurations allowed for your AWS account. The default is 200 launch configurations per AWS Region.
NumberOfAutoScalingGroups (integer) --The current number of groups for your AWS account.
NumberOfLaunchConfigurations (integer) --The current number of launch configurations for your AWS account.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the Auto Scaling limits for your AWS account.
response = client.describe_account_limits(
)
print(response)
Expected Output:
{
'MaxNumberOfAutoScalingGroups': 20,
'MaxNumberOfLaunchConfigurations': 100,
'NumberOfAutoScalingGroups': 3,
'NumberOfLaunchConfigurations': 5,
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'MaxNumberOfAutoScalingGroups': 123,
'MaxNumberOfLaunchConfigurations': 123,
'NumberOfAutoScalingGroups': 123,
'NumberOfLaunchConfigurations': 123
}
"""
pass
def describe_adjustment_types():
"""
Describes the available adjustment types for Amazon EC2 Auto Scaling scaling policies. These settings apply to step scaling policies and simple scaling policies; they do not apply to target tracking scaling policies.
The following adjustment types are supported:
See also: AWS API Documentation
Exceptions
Examples
This example describes the available adjustment types.
Expected Output:
:example: response = client.describe_adjustment_types()
:rtype: dict
ReturnsResponse Syntax{
'AdjustmentTypes': [
{
'AdjustmentType': 'string'
},
]
}
Response Structure
(dict) --
AdjustmentTypes (list) --The policy adjustment types.
(dict) --Describes a policy adjustment type.
AdjustmentType (string) --The policy adjustment type. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available adjustment types.
response = client.describe_adjustment_types(
)
print(response)
Expected Output:
{
'AdjustmentTypes': [
{
'AdjustmentType': 'ChangeInCapacity',
},
{
'AdjustmentType': 'ExactCapcity',
},
{
'AdjustmentType': 'PercentChangeInCapacity',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AdjustmentTypes': [
{
'AdjustmentType': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_auto_scaling_groups(AutoScalingGroupNames=None, NextToken=None, MaxRecords=None):
"""
Describes one or more Auto Scaling groups.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_auto_scaling_groups(
AutoScalingGroupNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupNames: list
:param AutoScalingGroupNames: The names of the Auto Scaling groups. Each name can be a maximum of 1600 characters. By default, you can only specify up to 50 names. You can optionally increase this limit using the MaxRecords parameter.
If you omit this parameter, all Auto Scaling groups are described.
(string) --
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'AutoScalingGroups': [
{
'AutoScalingGroupName': 'string',
'AutoScalingGroupARN': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'MixedInstancesPolicy': {
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123,
'DefaultCooldown': 123,
'AvailabilityZones': [
'string',
],
'LoadBalancerNames': [
'string',
],
'TargetGroupARNs': [
'string',
],
'HealthCheckType': 'string',
'HealthCheckGracePeriod': 123,
'Instances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'Pending'|'Pending:Wait'|'Pending:Proceed'|'Quarantined'|'InService'|'Terminating'|'Terminating:Wait'|'Terminating:Proceed'|'Terminated'|'Detaching'|'Detached'|'EnteringStandby'|'Standby',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'CreatedTime': datetime(2015, 1, 1),
'SuspendedProcesses': [
{
'ProcessName': 'string',
'SuspensionReason': 'string'
},
],
'PlacementGroup': 'string',
'VPCZoneIdentifier': 'string',
'EnabledMetrics': [
{
'Metric': 'string',
'Granularity': 'string'
},
],
'Status': 'string',
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'TerminationPolicies': [
'string',
],
'NewInstancesProtectedFromScaleIn': True|False,
'ServiceLinkedRoleARN': 'string',
'MaxInstanceLifetime': 123
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
AutoScalingGroups (list) --
The groups.
(dict) --
Describes an Auto Scaling group.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
AutoScalingGroupARN (string) --
The Amazon Resource Name (ARN) of the Auto Scaling group.
LaunchConfigurationName (string) --
The name of the associated launch configuration.
LaunchTemplate (dict) --
The launch template for the group.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
MixedInstancesPolicy (dict) --
The mixed instances policy for the group.
LaunchTemplate (dict) --
The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --
The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --
Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --
Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --
The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --
The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --
The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --
Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --
The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --
Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --
Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --
The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --
The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
MinSize (integer) --
The minimum size of the group.
MaxSize (integer) --
The maximum size of the group.
DesiredCapacity (integer) --
The desired size of the group.
DefaultCooldown (integer) --
The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
AvailabilityZones (list) --
One or more Availability Zones for the group.
(string) --
LoadBalancerNames (list) --
One or more load balancers associated with the group.
(string) --
TargetGroupARNs (list) --
The Amazon Resource Names (ARN) of the target groups for your load balancer.
(string) --
HealthCheckType (string) --
The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
HealthCheckGracePeriod (integer) --
The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
Instances (list) --
The EC2 instances associated with the group.
(dict) --
Describes an EC2 instance.
InstanceId (string) --
The ID of the instance.
InstanceType (string) --
The instance type of the EC2 instance.
AvailabilityZone (string) --
The Availability Zone in which the instance is running.
LifecycleState (string) --
A description of the current lifecycle state. The Quarantined state is not used.
HealthStatus (string) --
The last reported health status of the instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it.
LaunchConfigurationName (string) --
The launch configuration associated with the instance.
LaunchTemplate (dict) --
The launch template for the instance.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
ProtectedFromScaleIn (boolean) --
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity (string) --
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
CreatedTime (datetime) --
The date and time the group was created.
SuspendedProcesses (list) --
The suspended processes associated with the group.
(dict) --
Describes an automatic scaling process that has been suspended.
For more information, see Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
ProcessName (string) --
The name of the suspended process.
SuspensionReason (string) --
The reason that the process was suspended.
PlacementGroup (string) --
The name of the placement group into which to launch your instances, if any.
VPCZoneIdentifier (string) --
One or more subnet IDs, if applicable, separated by commas.
EnabledMetrics (list) --
The metrics enabled for the group.
(dict) --
Describes an enabled metric.
Metric (string) --
One of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
GroupInServiceCapacity
GroupPendingCapacity
GroupStandbyCapacity
GroupTerminatingCapacity
GroupTotalCapacity
Granularity (string) --
The granularity of the metric. The only valid value is 1Minute .
Status (string) --
The current state of the group when the DeleteAutoScalingGroup operation is in progress.
Tags (list) --
The tags for the group.
(dict) --
Describes a tag for an Auto Scaling group.
ResourceId (string) --
The name of the group.
ResourceType (string) --
The type of resource. The only supported value is auto-scaling-group .
Key (string) --
The tag key.
Value (string) --
The tag value.
PropagateAtLaunch (boolean) --
Determines whether the tag is added to new instances as they are launched in the group.
TerminationPolicies (list) --
The termination policies for the group.
(string) --
NewInstancesProtectedFromScaleIn (boolean) --
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
ServiceLinkedRoleARN (string) --
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf.
MaxInstanceLifetime (integer) --
The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 0.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified Auto Scaling group.
response = client.describe_auto_scaling_groups(
AutoScalingGroupNames=[
'my-auto-scaling-group',
],
)
print(response)
Expected Output:
{
'AutoScalingGroups': [
{
'AutoScalingGroupARN': 'arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:930d940e-891e-4781-a11a-7b0acd480f03:autoScalingGroupName/my-auto-scaling-group',
'AutoScalingGroupName': 'my-auto-scaling-group',
'AvailabilityZones': [
'us-west-2c',
],
'CreatedTime': datetime(2013, 8, 19, 20, 53, 25, 0, 231, 0),
'DefaultCooldown': 300,
'DesiredCapacity': 1,
'EnabledMetrics': [
],
'HealthCheckGracePeriod': 300,
'HealthCheckType': 'EC2',
'Instances': [
{
'AvailabilityZone': 'us-west-2c',
'HealthStatus': 'Healthy',
'InstanceId': 'i-4ba0837f',
'LaunchConfigurationName': 'my-launch-config',
'LifecycleState': 'InService',
'ProtectedFromScaleIn': False,
},
],
'LaunchConfigurationName': 'my-launch-config',
'LoadBalancerNames': [
],
'MaxSize': 1,
'MinSize': 0,
'NewInstancesProtectedFromScaleIn': False,
'SuspendedProcesses': [
],
'Tags': [
],
'TerminationPolicies': [
'Default',
],
'VPCZoneIdentifier': 'subnet-12345678',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingGroups': [
{
'AutoScalingGroupName': 'string',
'AutoScalingGroupARN': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'MixedInstancesPolicy': {
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123,
'DefaultCooldown': 123,
'AvailabilityZones': [
'string',
],
'LoadBalancerNames': [
'string',
],
'TargetGroupARNs': [
'string',
],
'HealthCheckType': 'string',
'HealthCheckGracePeriod': 123,
'Instances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'Pending'|'Pending:Wait'|'Pending:Proceed'|'Quarantined'|'InService'|'Terminating'|'Terminating:Wait'|'Terminating:Proceed'|'Terminated'|'Detaching'|'Detached'|'EnteringStandby'|'Standby',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'CreatedTime': datetime(2015, 1, 1),
'SuspendedProcesses': [
{
'ProcessName': 'string',
'SuspensionReason': 'string'
},
],
'PlacementGroup': 'string',
'VPCZoneIdentifier': 'string',
'EnabledMetrics': [
{
'Metric': 'string',
'Granularity': 'string'
},
],
'Status': 'string',
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'TerminationPolicies': [
'string',
],
'NewInstancesProtectedFromScaleIn': True|False,
'ServiceLinkedRoleARN': 'string',
'MaxInstanceLifetime': 123
},
],
'NextToken': 'string'
}
:returns:
(string) --
"""
pass
def describe_auto_scaling_instances(InstanceIds=None, MaxRecords=None, NextToken=None):
"""
Describes one or more Auto Scaling instances.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified Auto Scaling instance.
Expected Output:
:example: response = client.describe_auto_scaling_instances(
InstanceIds=[
'string',
],
MaxRecords=123,
NextToken='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to MaxRecords IDs. If you omit this parameter, all Auto Scaling instances are described. If you specify an ID that does not exist, it is ignored with no error.
(string) --
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 50 .
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:rtype: dict
ReturnsResponse Syntax
{
'AutoScalingInstances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AutoScalingGroupName': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'string',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
AutoScalingInstances (list) --
The instances.
(dict) --
Describes an EC2 instance associated with an Auto Scaling group.
InstanceId (string) --
The ID of the instance.
InstanceType (string) --
The instance type of the EC2 instance.
AutoScalingGroupName (string) --
The name of the Auto Scaling group for the instance.
AvailabilityZone (string) --
The Availability Zone for the instance.
LifecycleState (string) --
The lifecycle state for the instance.
HealthStatus (string) --
The last reported health status of this instance. "Healthy" means that the instance is healthy and should remain in service. "Unhealthy" means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it.
LaunchConfigurationName (string) --
The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.
LaunchTemplate (dict) --
The launch template for the instance.
LaunchTemplateId (string) --
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --
The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
ProtectedFromScaleIn (boolean) --
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity (string) --
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified Auto Scaling instance.
response = client.describe_auto_scaling_instances(
InstanceIds=[
'i-4ba0837f',
],
)
print(response)
Expected Output:
{
'AutoScalingInstances': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'AvailabilityZone': 'us-west-2c',
'HealthStatus': 'HEALTHY',
'InstanceId': 'i-4ba0837f',
'LaunchConfigurationName': 'my-launch-config',
'LifecycleState': 'InService',
'ProtectedFromScaleIn': False,
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingInstances': [
{
'InstanceId': 'string',
'InstanceType': 'string',
'AutoScalingGroupName': 'string',
'AvailabilityZone': 'string',
'LifecycleState': 'string',
'HealthStatus': 'string',
'LaunchConfigurationName': 'string',
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'ProtectedFromScaleIn': True|False,
'WeightedCapacity': 'string'
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_auto_scaling_notification_types():
"""
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
See also: AWS API Documentation
Exceptions
Examples
This example describes the available notification types.
Expected Output:
:example: response = client.describe_auto_scaling_notification_types()
:rtype: dict
ReturnsResponse Syntax{
'AutoScalingNotificationTypes': [
'string',
]
}
Response Structure
(dict) --
AutoScalingNotificationTypes (list) --The notification types.
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available notification types.
response = client.describe_auto_scaling_notification_types(
)
print(response)
Expected Output:
{
'AutoScalingNotificationTypes': [
'autoscaling:EC2_INSTANCE_LAUNCH',
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
'autoscaling:EC2_INSTANCE_TERMINATE',
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
'autoscaling:TEST_NOTIFICATION',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'AutoScalingNotificationTypes': [
'string',
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_launch_configurations(LaunchConfigurationNames=None, NextToken=None, MaxRecords=None):
"""
Describes one or more launch configurations.
See also: AWS API Documentation
Exceptions
Examples
This example describes the specified launch configuration.
Expected Output:
:example: response = client.describe_launch_configurations(
LaunchConfigurationNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type LaunchConfigurationNames: list
:param LaunchConfigurationNames: The launch configuration names. If you omit this parameter, all launch configurations are described.
(string) --
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LaunchConfigurations': [
{
'LaunchConfigurationName': 'string',
'LaunchConfigurationARN': 'string',
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
'string',
],
'ClassicLinkVPCId': 'string',
'ClassicLinkVPCSecurityGroups': [
'string',
],
'UserData': 'string',
'InstanceType': 'string',
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
'InstanceMonitoring': {
'Enabled': True|False
},
'SpotPrice': 'string',
'IamInstanceProfile': 'string',
'CreatedTime': datetime(2015, 1, 1),
'EbsOptimized': True|False,
'AssociatePublicIpAddress': True|False,
'PlacementTenancy': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LaunchConfigurations (list) --
The launch configurations.
(dict) --
Describes a launch configuration.
LaunchConfigurationName (string) --
The name of the launch configuration.
LaunchConfigurationARN (string) --
The Amazon Resource Name (ARN) of the launch configuration.
ImageId (string) --
The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.
For more information, see Finding an AMI in the Amazon EC2 User Guide for Linux Instances .
KeyName (string) --
The name of the key pair.
For more information, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances .
SecurityGroups (list) --
A list that contains the security groups to assign to the instances in the Auto Scaling group.
For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
(string) --
ClassicLinkVPCId (string) --
The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to.
For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
ClassicLinkVPCSecurityGroups (list) --
The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId .
For more information, see ClassicLink in the Amazon EC2 User Guide for Linux Instances and Linking EC2-Classic Instances to a VPC in the Amazon EC2 Auto Scaling User Guide .
(string) --
UserData (string) --
The Base64-encoded user data to make available to the launched EC2 instances.
For more information, see Instance Metadata and User Data in the Amazon EC2 User Guide for Linux Instances .
InstanceType (string) --
The instance type for the instances.
For information about available instance types, see Available Instance Types in the Amazon EC2 User Guide for Linux Instances.
KernelId (string) --
The ID of the kernel associated with the AMI.
RamdiskId (string) --
The ID of the RAM disk associated with the AMI.
BlockDeviceMappings (list) --
A block device mapping, which specifies the block devices for the instance.
For more information, see Block Device Mapping in the Amazon EC2 User Guide for Linux Instances .
(dict) --
Describes a block device mapping.
VirtualName (string) --
The name of the virtual device (for example, ephemeral0 ).
You can specify either VirtualName or Ebs , but not both.
DeviceName (string) --
The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ). For more information, see Device Naming on Linux Instances in the Amazon EC2 User Guide for Linux Instances .
Ebs (dict) --
Parameters used to automatically set up EBS volumes when an instance is launched.
You can specify either VirtualName or Ebs , but not both.
SnapshotId (string) --
The snapshot ID of the volume to use.
Conditional: This parameter is optional if you specify a volume size. If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot.
VolumeSize (integer) --
The volume size, in Gibibytes (GiB).
This can be a number from 1-1,024 for standard , 4-16,384 for io1 , 1-16,384 for gp2 , and 500-16,384 for st1 and sc1 . If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.
Default: If you create a volume from a snapshot and you don't specify a volume size, the default is the snapshot size.
Note
At least one of VolumeSize or SnapshotId is required.
VolumeType (string) --
The volume type, which can be standard for Magnetic, io1 for Provisioned IOPS SSD, gp2 for General Purpose SSD, st1 for Throughput Optimized HDD, or sc1 for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Valid Values: standard | io1 | gp2 | st1 | sc1
DeleteOnTermination (boolean) --
Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is true .
Iops (integer) --
The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Conditional: This parameter is required when the volume type is io1 . (Not used with standard , gp2 , st1 , or sc1 volumes.)
Encrypted (boolean) --
Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported Instance Types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
Note
If you are creating a volume from a snapshot, you cannot specify an encryption value. Volumes that are created from encrypted snapshots are automatically encrypted, and volumes that are created from unencrypted snapshots are automatically unencrypted. By default, encrypted snapshots use the AWS managed CMK that is used for EBS encryption, but you can specify a custom CMK when you create the snapshot. The ability to encrypt a snapshot during copying also allows you to apply a new CMK to an already-encrypted snapshot. Volumes restored from the resulting copy are only accessible using the new CMK.
Enabling encryption by default results in all EBS volumes being encrypted with the AWS managed CMK or a customer managed CMK, whether or not the snapshot was encrypted.
For more information, see Using Encryption with EBS-Backed AMIs in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy for Use with Encrypted Volumes in the Amazon EC2 Auto Scaling User Guide .
NoDevice (boolean) --
Setting this value to true suppresses the specified device included in the block device mapping of the AMI.
If NoDevice is true for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.
If you specify NoDevice , you cannot specify Ebs .
InstanceMonitoring (dict) --
Controls whether instances in this group are launched with detailed (true ) or basic (false ) monitoring.
For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
Enabled (boolean) --
If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
SpotPrice (string) --
The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price.
For more information, see Launching Spot Instances in Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
IamInstanceProfile (string) --
The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role.
For more information, see IAM Role for Applications That Run on Amazon EC2 Instances in the Amazon EC2 Auto Scaling User Guide .
CreatedTime (datetime) --
The creation date and time for the launch configuration.
EbsOptimized (boolean) --
Specifies whether the launch configuration is optimized for EBS I/O (true ) or not (false ).
For more information, see Amazon EBS-Optimized Instances in the Amazon EC2 User Guide for Linux Instances .
AssociatePublicIpAddress (boolean) --
For Auto Scaling groups that are running in a VPC, specifies whether to assign a public IP address to the group's instances.
For more information, see Launching Auto Scaling Instances in a VPC in the Amazon EC2 Auto Scaling User Guide .
PlacementTenancy (string) --
The tenancy of the instance, either default or dedicated . An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.
For more information, see Instance Placement Tenancy in the Amazon EC2 Auto Scaling User Guide .
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the specified launch configuration.
response = client.describe_launch_configurations(
LaunchConfigurationNames=[
'my-launch-config',
],
)
print(response)
Expected Output:
{
'LaunchConfigurations': [
{
'AssociatePublicIpAddress': True,
'BlockDeviceMappings': [
],
'CreatedTime': datetime(2014, 5, 7, 17, 39, 28, 2, 127, 0),
'EbsOptimized': False,
'ImageId': 'ami-043a5034',
'InstanceMonitoring': {
'Enabled': True,
},
'InstanceType': 't1.micro',
'LaunchConfigurationARN': 'arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config',
'LaunchConfigurationName': 'my-launch-config',
'SecurityGroups': [
'sg-67ef0308',
],
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LaunchConfigurations': [
{
'LaunchConfigurationName': 'string',
'LaunchConfigurationARN': 'string',
'ImageId': 'string',
'KeyName': 'string',
'SecurityGroups': [
'string',
],
'ClassicLinkVPCId': 'string',
'ClassicLinkVPCSecurityGroups': [
'string',
],
'UserData': 'string',
'InstanceType': 'string',
'KernelId': 'string',
'RamdiskId': 'string',
'BlockDeviceMappings': [
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
'InstanceMonitoring': {
'Enabled': True|False
},
'SpotPrice': 'string',
'IamInstanceProfile': 'string',
'CreatedTime': datetime(2015, 1, 1),
'EbsOptimized': True|False,
'AssociatePublicIpAddress': True|False,
'PlacementTenancy': 'string'
},
],
'NextToken': 'string'
}
:returns:
(string) --
"""
pass
def describe_lifecycle_hook_types():
"""
Describes the available types of lifecycle hooks.
The following hook types are supported:
See also: AWS API Documentation
Exceptions
Examples
This example describes the available lifecycle hook types.
Expected Output:
:example: response = client.describe_lifecycle_hook_types()
:rtype: dict
ReturnsResponse Syntax{
'LifecycleHookTypes': [
'string',
]
}
Response Structure
(dict) --
LifecycleHookTypes (list) --The lifecycle hook types.
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available lifecycle hook types.
response = client.describe_lifecycle_hook_types(
)
print(response)
Expected Output:
{
'LifecycleHookTypes': [
'autoscaling:EC2_INSTANCE_LAUNCHING',
'autoscaling:EC2_INSTANCE_TERMINATING',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LifecycleHookTypes': [
'string',
]
}
:returns:
(string) --
"""
pass
def describe_lifecycle_hooks(AutoScalingGroupName=None, LifecycleHookNames=None):
"""
Describes the lifecycle hooks for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the lifecycle hooks for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_lifecycle_hooks(
AutoScalingGroupName='string',
LifecycleHookNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LifecycleHookNames: list
:param LifecycleHookNames: The names of one or more lifecycle hooks. If you omit this parameter, all lifecycle hooks are described.
(string) --
:rtype: dict
ReturnsResponse Syntax
{
'LifecycleHooks': [
{
'LifecycleHookName': 'string',
'AutoScalingGroupName': 'string',
'LifecycleTransition': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'GlobalTimeout': 123,
'DefaultResult': 'string'
},
]
}
Response Structure
(dict) --
LifecycleHooks (list) --
The lifecycle hooks for the specified group.
(dict) --
Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that you want to perform an action whenever it launches instances or terminates instances.
LifecycleHookName (string) --
The name of the lifecycle hook.
AutoScalingGroupName (string) --
The name of the Auto Scaling group for the lifecycle hook.
LifecycleTransition (string) --
The state of the EC2 instance to which to attach the lifecycle hook. The following are possible values:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
NotificationTargetARN (string) --
The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in the transition state for the lifecycle hook. The notification target can be either an SQS queue or an SNS topic.
RoleARN (string) --
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
NotificationMetadata (string) --
Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout (integer) --
The maximum time, in seconds, that can elapse before the lifecycle hook times out. If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter.
GlobalTimeout (integer) --
The maximum time, in seconds, that an instance can remain in a Pending:Wait or Terminating:Wait state. The maximum is 172800 seconds (48 hours) or 100 times HeartbeatTimeout , whichever is smaller.
DefaultResult (string) --
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The possible values are CONTINUE and ABANDON .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the lifecycle hooks for the specified Auto Scaling group.
response = client.describe_lifecycle_hooks(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LifecycleHooks': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'DefaultResult': 'ABANDON',
'GlobalTimeout': 172800,
'HeartbeatTimeout': 3600,
'LifecycleHookName': 'my-lifecycle-hook',
'LifecycleTransition': 'autoscaling:EC2_INSTANCE_LAUNCHING',
'NotificationTargetARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic',
'RoleARN': 'arn:aws:iam::123456789012:role/my-auto-scaling-role',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LifecycleHooks': [
{
'LifecycleHookName': 'string',
'AutoScalingGroupName': 'string',
'LifecycleTransition': 'string',
'NotificationTargetARN': 'string',
'RoleARN': 'string',
'NotificationMetadata': 'string',
'HeartbeatTimeout': 123,
'GlobalTimeout': 123,
'DefaultResult': 'string'
},
]
}
:returns:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
"""
pass
def describe_load_balancer_target_groups(AutoScalingGroupName=None, NextToken=None, MaxRecords=None):
"""
Describes the target groups for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the target groups attached to the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_load_balancer_target_groups(
AutoScalingGroupName='string',
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LoadBalancerTargetGroups (list) --
Information about the target groups.
(dict) --
Describes the state of a target group.
If you attach a target group to an existing Auto Scaling group, the initial state is Adding . The state transitions to Added after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled, the state transitions to InService after at least one Auto Scaling instance passes the health check. If EC2 health checks are enabled instead, the target group remains in the Added state.
LoadBalancerTargetGroupARN (string) --
The Amazon Resource Name (ARN) of the target group.
State (string) --
The state of the target group.
Adding - The Auto Scaling instances are being registered with the target group.
Added - All Auto Scaling instances are registered with the target group.
InService - At least one Auto Scaling instance passed an ELB health check.
Removing - The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All Auto Scaling instances are deregistered from the target group.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the target groups attached to the specified Auto Scaling group.
response = client.describe_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
'State': 'Added',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LoadBalancerTargetGroups': [
{
'LoadBalancerTargetGroupARN': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
:returns:
Adding - The Auto Scaling instances are being registered with the target group.
Added - All Auto Scaling instances are registered with the target group.
InService - At least one Auto Scaling instance passed an ELB health check.
Removing - The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All Auto Scaling instances are deregistered from the target group.
"""
pass
def describe_load_balancers(AutoScalingGroupName=None, NextToken=None, MaxRecords=None):
"""
Describes the load balancers for the specified Auto Scaling group.
This operation describes only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use the DescribeLoadBalancerTargetGroups API instead.
See also: AWS API Documentation
Exceptions
Examples
This example describes the load balancers attached to the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_load_balancers(
AutoScalingGroupName='string',
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'LoadBalancers': [
{
'LoadBalancerName': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
LoadBalancers (list) --
The load balancers.
(dict) --
Describes the state of a Classic Load Balancer.
If you specify a load balancer when creating the Auto Scaling group, the state of the load balancer is InService .
If you attach a load balancer to an existing Auto Scaling group, the initial state is Adding . The state transitions to Added after all instances in the group are registered with the load balancer. If Elastic Load Balancing health checks are enabled for the load balancer, the state transitions to InService after at least one instance in the group passes the health check. If EC2 health checks are enabled instead, the load balancer remains in the Added state.
LoadBalancerName (string) --
The name of the load balancer.
State (string) --
One of the following load balancer states:
Adding - The instances in the group are being registered with the load balancer.
Added - All instances in the group are registered with the load balancer.
InService - At least one instance in the group passed an ELB health check.
Removing - The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All instances in the group are deregistered from the load balancer.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the load balancers attached to the specified Auto Scaling group.
response = client.describe_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'LoadBalancers': [
{
'LoadBalancerName': 'my-load-balancer',
'State': 'Added',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'LoadBalancers': [
{
'LoadBalancerName': 'string',
'State': 'string'
},
],
'NextToken': 'string'
}
:returns:
Adding - The instances in the group are being registered with the load balancer.
Added - All instances in the group are registered with the load balancer.
InService - At least one instance in the group passed an ELB health check.
Removing - The instances in the group are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances.
Removed - All instances in the group are deregistered from the load balancer.
"""
pass
def describe_metric_collection_types():
"""
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
The GroupStandbyInstances metric is not returned by default. You must explicitly request this metric when calling the EnableMetricsCollection API.
See also: AWS API Documentation
Exceptions
Examples
This example describes the available metric collection types.
Expected Output:
:example: response = client.describe_metric_collection_types()
:rtype: dict
ReturnsResponse Syntax{
'Metrics': [
{
'Metric': 'string'
},
],
'Granularities': [
{
'Granularity': 'string'
},
]
}
Response Structure
(dict) --
Metrics (list) --One or more metrics.
(dict) --Describes a metric.
Metric (string) --One of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
Granularities (list) --The granularities for the metrics.
(dict) --Describes a granularity of a metric.
Granularity (string) --The granularity. The only valid value is 1Minute .
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available metric collection types.
response = client.describe_metric_collection_types(
)
print(response)
Expected Output:
{
'Granularities': [
{
'Granularity': '1Minute',
},
],
'Metrics': [
{
'Metric': 'GroupMinSize',
},
{
'Metric': 'GroupMaxSize',
},
{
'Metric': 'GroupDesiredCapacity',
},
{
'Metric': 'GroupInServiceInstances',
},
{
'Metric': 'GroupPendingInstances',
},
{
'Metric': 'GroupTerminatingInstances',
},
{
'Metric': 'GroupStandbyInstances',
},
{
'Metric': 'GroupTotalInstances',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Metrics': [
{
'Metric': 'string'
},
],
'Granularities': [
{
'Granularity': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_notification_configurations(AutoScalingGroupNames=None, NextToken=None, MaxRecords=None):
"""
Describes the notification actions associated with the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the notification configurations for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_notification_configurations(
AutoScalingGroupNames=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupNames: list
:param AutoScalingGroupNames: The name of the Auto Scaling group.
(string) --
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'string',
'TopicARN': 'string',
'NotificationType': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
NotificationConfigurations (list) --
The notification configurations.
(dict) --
Describes a notification.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
TopicARN (string) --
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
NotificationType (string) --
One of the following event notification types:
autoscaling:EC2_INSTANCE_LAUNCH
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
autoscaling:EC2_INSTANCE_TERMINATE
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
autoscaling:TEST_NOTIFICATION
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the notification configurations for the specified Auto Scaling group.
response = client.describe_notification_configurations(
AutoScalingGroupNames=[
'my-auto-scaling-group',
],
)
print(response)
Expected Output:
{
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'NotificationType': 'autoscaling:TEST_NOTIFICATION',
'TopicARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic-2',
},
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'NotificationType': 'autoscaling:TEST_NOTIFICATION',
'TopicARN': 'arn:aws:sns:us-west-2:123456789012:my-sns-topic',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'NotificationConfigurations': [
{
'AutoScalingGroupName': 'string',
'TopicARN': 'string',
'NotificationType': 'string'
},
],
'NextToken': 'string'
}
:returns:
autoscaling:EC2_INSTANCE_LAUNCH
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
autoscaling:EC2_INSTANCE_TERMINATE
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
autoscaling:TEST_NOTIFICATION
"""
pass
def describe_policies(AutoScalingGroupName=None, PolicyNames=None, PolicyTypes=None, NextToken=None, MaxRecords=None):
"""
Describes the policies for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the policies for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_policies(
AutoScalingGroupName='string',
PolicyNames=[
'string',
],
PolicyTypes=[
'string',
],
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyNames: list
:param PolicyNames: The names of one or more policies. If you omit this parameter, all policies are described. If a group name is provided, the results are limited to that group. This list is limited to 50 items. If you specify an unknown policy name, it is ignored with no error.
(string) --
:type PolicyTypes: list
:param PolicyTypes: One or more policy types. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling .
(string) --
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to be returned with each call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'ScalingPolicies': [
{
'AutoScalingGroupName': 'string',
'PolicyName': 'string',
'PolicyARN': 'string',
'PolicyType': 'string',
'AdjustmentType': 'string',
'MinAdjustmentStep': 123,
'MinAdjustmentMagnitude': 123,
'ScalingAdjustment': 123,
'Cooldown': 123,
'StepAdjustments': [
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
'MetricAggregationType': 'string',
'EstimatedInstanceWarmup': 123,
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
],
'TargetTrackingConfiguration': {
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
'Enabled': True|False
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ScalingPolicies (list) --
The scaling policies.
(dict) --
Describes a scaling policy.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
PolicyName (string) --
The name of the scaling policy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
PolicyType (string) --
The policy type. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling .
AdjustmentType (string) --
The adjustment type, which specifies how ScalingAdjustment is interpreted. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
MinAdjustmentStep (integer) --
Available for backward compatibility. Use MinAdjustmentMagnitude instead.
MinAdjustmentMagnitude (integer) --
The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity , the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError .
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
Cooldown (integer) --
The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start.
StepAdjustments (list) --
A set of adjustments that enable you to scale based on the size of the alarm breach.
(dict) --
Describes information used to create a step adjustment for a step scaling policy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
For more information, see Step Adjustments in the Amazon EC2 Auto Scaling User Guide .
MetricIntervalLowerBound (float) --
The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --
The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
MetricAggregationType (string) --
The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average .
EstimatedInstanceWarmup (integer) --
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
Alarms (list) --
The CloudWatch alarms related to the policy.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.
TargetTrackingConfiguration (dict) --
A target tracking scaling policy.
PredefinedMetricSpecification (dict) --
A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType (string) --
The metric type. The following predefined metrics are available:
ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group.
ASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group.
ASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group.
ALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.
ResourceLabel (string) --
Identifies the resource associated with the metric type. You can't specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group.
The format is ``app/load-balancer-name /load-balancer-id /targetgroup/target-group-name /target-group-id `` , where
``app/load-balancer-name /load-balancer-id `` is the final portion of the load balancer ARN, and
``targetgroup/target-group-name /target-group-id `` is the final portion of the target group ARN.
CustomizedMetricSpecification (dict) --
A customized metric. You must specify either a predefined metric or a customized metric.
MetricName (string) --
The name of the metric.
Namespace (string) --
The namespace of the metric.
Dimensions (list) --
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
(dict) --
Describes the dimension of a metric.
Name (string) --
The name of the dimension.
Value (string) --
The value of the dimension.
Statistic (string) --
The statistic of the metric.
Unit (string) --
The unit of the metric.
TargetValue (float) --
The target value for the metric.
DisableScaleIn (boolean) --
Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .
Enabled (boolean) --
Indicates whether the policy is enabled (true ) or disabled (false ).
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example describes the policies for the specified Auto Scaling group.
response = client.describe_policies(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'ScalingPolicies': [
{
'AdjustmentType': 'ChangeInCapacity',
'Alarms': [
],
'AutoScalingGroupName': 'my-auto-scaling-group',
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn',
'PolicyName': 'ScaleIn',
'ScalingAdjustment': -1,
},
{
'AdjustmentType': 'PercentChangeInCapacity',
'Alarms': [
],
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cooldown': 60,
'MinAdjustmentStep': 2,
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2b435159-cf77-4e89-8c0e-d63b497baad7:autoScalingGroupName/my-auto-scaling-group:policyName/ScalePercentChange',
'PolicyName': 'ScalePercentChange',
'ScalingAdjustment': 25,
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'ScalingPolicies': [
{
'AutoScalingGroupName': 'string',
'PolicyName': 'string',
'PolicyARN': 'string',
'PolicyType': 'string',
'AdjustmentType': 'string',
'MinAdjustmentStep': 123,
'MinAdjustmentMagnitude': 123,
'ScalingAdjustment': 123,
'Cooldown': 123,
'StepAdjustments': [
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
'MetricAggregationType': 'string',
'EstimatedInstanceWarmup': 123,
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
],
'TargetTrackingConfiguration': {
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
'Enabled': True|False
},
],
'NextToken': 'string'
}
:returns:
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
"""
pass
def describe_scaling_activities(ActivityIds=None, AutoScalingGroupName=None, MaxRecords=None, NextToken=None):
"""
Describes one or more scaling activities for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example describes the scaling activities for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_scaling_activities(
ActivityIds=[
'string',
],
AutoScalingGroupName='string',
MaxRecords=123,
NextToken='string'
)
:type ActivityIds: list
:param ActivityIds: The activity IDs of the desired scaling activities. You can specify up to 50 IDs. If you omit this parameter, all activities for the past six weeks are described. If unknown activities are requested, they are ignored with no error. If you specify an Auto Scaling group, the results are limited to that group.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 100 and the maximum value is 100 .
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Activities (list) --
The scaling activities. Activities are sorted by start time. Activities still in progress are described first.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the scaling activities for the specified Auto Scaling group.
response = client.describe_scaling_activities(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': 'f9f2d65b-f1f2-43e7-b46d-d86756459699',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2013-08-19T20:53:25Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2013-08-19T20:53:29Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.',
'Description': 'Launching a new EC2 instance: i-4ba0837f',
'Details': 'details',
'EndTime': datetime(2013, 8, 19, 20, 54, 2, 0, 231, 0),
'Progress': 100,
'StartTime': datetime(2013, 8, 19, 20, 53, 29, 0, 231, 0),
'StatusCode': 'Successful',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_scaling_process_types():
"""
Describes the scaling process types for use with the ResumeProcesses and SuspendProcesses APIs.
See also: AWS API Documentation
Exceptions
Examples
This example describes the Auto Scaling process types.
Expected Output:
:example: response = client.describe_scaling_process_types()
:rtype: dict
ReturnsResponse Syntax{
'Processes': [
{
'ProcessName': 'string'
},
]
}
Response Structure
(dict) --
Processes (list) --The names of the process types.
(dict) --Describes a process type.
For more information, see Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
ProcessName (string) --One of the following processes:
Launch
Terminate
AddToLoadBalancer
AlarmNotification
AZRebalance
HealthCheck
ReplaceUnhealthy
ScheduledActions
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the Auto Scaling process types.
response = client.describe_scaling_process_types(
)
print(response)
Expected Output:
{
'Processes': [
{
'ProcessName': 'AZRebalance',
},
{
'ProcessName': 'AddToLoadBalancer',
},
{
'ProcessName': 'AlarmNotification',
},
{
'ProcessName': 'HealthCheck',
},
{
'ProcessName': 'Launch',
},
{
'ProcessName': 'ReplaceUnhealthy',
},
{
'ProcessName': 'ScheduledActions',
},
{
'ProcessName': 'Terminate',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Processes': [
{
'ProcessName': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_scheduled_actions(AutoScalingGroupName=None, ScheduledActionNames=None, StartTime=None, EndTime=None, NextToken=None, MaxRecords=None):
"""
Describes the actions scheduled for your Auto Scaling group that haven't run or that have not reached their end time. To describe the actions that have already run, call the DescribeScalingActivities API.
See also: AWS API Documentation
Exceptions
Examples
This example describes the scheduled actions for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_scheduled_actions(
AutoScalingGroupName='string',
ScheduledActionNames=[
'string',
],
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
NextToken='string',
MaxRecords=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type ScheduledActionNames: list
:param ScheduledActionNames: The names of one or more scheduled actions. You can specify up to 50 actions. If you omit this parameter, all scheduled actions are described. If you specify an unknown scheduled action, it is ignored with no error.
(string) --
:type StartTime: datetime
:param StartTime: The earliest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
:type EndTime: datetime
:param EndTime: The latest scheduled start time to return. If scheduled action names are provided, this parameter is ignored.
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'string',
'ScheduledActionName': 'string',
'ScheduledActionARN': 'string',
'Time': datetime(2015, 1, 1),
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ScheduledUpdateGroupActions (list) --
The scheduled actions.
(dict) --
Describes a scheduled scaling action.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
ScheduledActionName (string) --
The name of the scheduled action.
ScheduledActionARN (string) --
The Amazon Resource Name (ARN) of the scheduled action.
Time (datetime) --
This parameter is no longer used.
StartTime (datetime) --
The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z" .
EndTime (datetime) --
The date and time in UTC for the recurring schedule to end. For example, "2019-06-01T00:00:00Z" .
Recurrence (string) --
The recurring schedule for the action, in Unix cron syntax format.
When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
MinSize (integer) --
The minimum size of the Auto Scaling group.
MaxSize (integer) --
The maximum size of the Auto Scaling group.
DesiredCapacity (integer) --
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the scheduled actions for the specified Auto Scaling group.
response = client.describe_scheduled_actions(
AutoScalingGroupName='my-auto-scaling-group',
)
print(response)
Expected Output:
{
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'my-auto-scaling-group',
'DesiredCapacity': 4,
'MaxSize': 6,
'MinSize': 2,
'Recurrence': '30 0 1 12 0',
'ScheduledActionARN': 'arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-auto-scaling-group:scheduledActionName/my-scheduled-action',
'ScheduledActionName': 'my-scheduled-action',
'StartTime': datetime(2016, 12, 1, 0, 30, 0, 3, 336, 0),
'Time': datetime(2016, 12, 1, 0, 30, 0, 3, 336, 0),
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'ScheduledUpdateGroupActions': [
{
'AutoScalingGroupName': 'string',
'ScheduledActionName': 'string',
'ScheduledActionARN': 'string',
'Time': datetime(2015, 1, 1),
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'Recurrence': 'string',
'MinSize': 123,
'MaxSize': 123,
'DesiredCapacity': 123
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_tags(Filters=None, NextToken=None, MaxRecords=None):
"""
Describes the specified tags.
You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.
You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the tags for the specified Auto Scaling group.
Expected Output:
:example: response = client.describe_tags(
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
NextToken='string',
MaxRecords=123
)
:type Filters: list
:param Filters: One or more filters to scope the tags to return. The maximum number of filters per filter type (for example, auto-scaling-group ) is 1000.
(dict) --Describes a filter that is used to return a more specific list of results when describing tags.
For more information, see Tagging Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
Name (string) --The name of the filter. The valid values are: auto-scaling-group , key , value , and propagate-at-launch .
Values (list) --One or more filter values. Filter values are case-sensitive.
(string) --
:type NextToken: string
:param NextToken: The token for the next set of items to return. (You received this token from a previous call.)
:type MaxRecords: integer
:param MaxRecords: The maximum number of items to return with this call. The default value is 50 and the maximum value is 100 .
:rtype: dict
ReturnsResponse Syntax
{
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Tags (list) --
One or more tags.
(dict) --
Describes a tag for an Auto Scaling group.
ResourceId (string) --
The name of the group.
ResourceType (string) --
The type of resource. The only supported value is auto-scaling-group .
Key (string) --
The tag key.
Value (string) --
The tag value.
PropagateAtLaunch (boolean) --
Determines whether the tag is added to new instances as they are launched in the group.
NextToken (string) --
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the NextToken value when requesting the next set of items. This value is null when there are no more items to return.
Exceptions
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the tags for the specified Auto Scaling group.
response = client.describe_tags(
Filters=[
{
'Name': 'auto-scaling-group',
'Values': [
'my-auto-scaling-group',
],
},
],
)
print(response)
Expected Output:
{
'Tags': [
{
'Key': 'Dept',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'Research',
},
{
'Key': 'Role',
'PropagateAtLaunch': True,
'ResourceId': 'my-auto-scaling-group',
'ResourceType': 'auto-scaling-group',
'Value': 'WebServer',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Tags': [
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
],
'NextToken': 'string'
}
:returns:
AutoScaling.Client.exceptions.InvalidNextToken
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def describe_termination_policy_types():
"""
Describes the termination policies supported by Amazon EC2 Auto Scaling.
For more information, see Controlling Which Auto Scaling Instances Terminate During Scale In in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example describes the available termination policy types.
Expected Output:
:example: response = client.describe_termination_policy_types()
:rtype: dict
ReturnsResponse Syntax{
'TerminationPolicyTypes': [
'string',
]
}
Response Structure
(dict) --
TerminationPolicyTypes (list) --The termination policies supported by Amazon EC2 Auto Scaling: OldestInstance , OldestLaunchConfiguration , NewestInstance , ClosestToNextInstanceHour , Default , OldestLaunchTemplate , and AllocationStrategy .
(string) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example describes the available termination policy types.
response = client.describe_termination_policy_types(
)
print(response)
Expected Output:
{
'TerminationPolicyTypes': [
'ClosestToNextInstanceHour',
'Default',
'NewestInstance',
'OldestInstance',
'OldestLaunchConfiguration',
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'TerminationPolicyTypes': [
'string',
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def detach_instances(InstanceIds=None, AutoScalingGroupName=None, ShouldDecrementDesiredCapacity=None):
"""
Removes one or more instances from the specified Auto Scaling group.
After the instances are detached, you can manage them independent of the Auto Scaling group.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are detached.
If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.
For more information, see Detach EC2 Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified instance from the specified Auto Scaling group.
Expected Output:
:example: response = client.detach_instances(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]
Indicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to detaching the instances from the Auto Scaling group.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified instance from the specified Auto Scaling group.
response = client.detach_instances(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ShouldDecrementDesiredCapacity=True,
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': '5091cb52-547a-47ce-a236-c9ccbc2cb2c9',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:02:16Z instance i-93633f9b was detached in response to a user request, shrinking the capacity from 2 to 1.',
'Description': 'Detaching EC2 instance: i-93633f9b',
'Details': 'details',
'Progress': 50,
'StartTime': datetime(2015, 4, 12, 15, 2, 16, 6, 102, 0),
'StatusCode': 'InProgress',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def detach_load_balancer_target_groups(AutoScalingGroupName=None, TargetGroupARNs=None):
"""
Detaches one or more target groups from the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified target group from the specified Auto Scaling group
Expected Output:
:example: response = client.detach_load_balancer_target_groups(
AutoScalingGroupName='string',
TargetGroupARNs=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type TargetGroupARNs: list
:param TargetGroupARNs: [REQUIRED]
The Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target groups.
(string) --
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified target group from the specified Auto Scaling group
response = client.detach_load_balancer_target_groups(
AutoScalingGroupName='my-auto-scaling-group',
TargetGroupARNs=[
'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def detach_load_balancers(AutoScalingGroupName=None, LoadBalancerNames=None):
"""
Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
This operation detaches only Classic Load Balancers. If you have Application Load Balancers or Network Load Balancers, use the DetachLoadBalancerTargetGroups API instead.
When you detach a load balancer, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using the DescribeLoadBalancers API call. The instances remain running.
See also: AWS API Documentation
Exceptions
Examples
This example detaches the specified load balancer from the specified Auto Scaling group.
Expected Output:
:example: response = client.detach_load_balancers(
AutoScalingGroupName='string',
LoadBalancerNames=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LoadBalancerNames: list
:param LoadBalancerNames: [REQUIRED]
The names of the load balancers. You can specify up to 10 load balancers.
(string) --
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example detaches the specified load balancer from the specified Auto Scaling group.
response = client.detach_load_balancers(
AutoScalingGroupName='my-auto-scaling-group',
LoadBalancerNames=[
'my-load-balancer',
],
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def disable_metrics_collection(AutoScalingGroupName=None, Metrics=None):
"""
Disables group metrics for the specified Auto Scaling group.
See also: AWS API Documentation
Exceptions
Examples
This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group.
Expected Output:
:example: response = client.disable_metrics_collection(
AutoScalingGroupName='string',
Metrics=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type Metrics: list
:param Metrics: Specifies one or more of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
GroupInServiceCapacity
GroupPendingCapacity
GroupStandbyCapacity
GroupTerminatingCapacity
GroupTotalCapacity
If you omit this parameter, all metrics are disabled.
(string) --
:return: response = client.disable_metrics_collection(
AutoScalingGroupName='my-auto-scaling-group',
Metrics=[
'GroupDesiredCapacity',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def enable_metrics_collection(AutoScalingGroupName=None, Metrics=None, Granularity=None):
"""
Enables group metrics for the specified Auto Scaling group. For more information, see Monitoring Your Auto Scaling Groups and Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example enables data collection for the specified Auto Scaling group.
Expected Output:
:example: response = client.enable_metrics_collection(
AutoScalingGroupName='string',
Metrics=[
'string',
],
Granularity='string'
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type Metrics: list
:param Metrics: Specifies which group-level metrics to start collecting. You can specify one or more of the following metrics:
GroupMinSize
GroupMaxSize
GroupDesiredCapacity
GroupInServiceInstances
GroupPendingInstances
GroupStandbyInstances
GroupTerminatingInstances
GroupTotalInstances
The instance weighting feature supports the following additional metrics:
GroupInServiceCapacity
GroupPendingCapacity
GroupStandbyCapacity
GroupTerminatingCapacity
GroupTotalCapacity
If you omit this parameter, all metrics are enabled.
(string) --
:type Granularity: string
:param Granularity: [REQUIRED]
The granularity to associate with the metrics to collect. The only valid value is 1Minute .
:return: response = client.enable_metrics_collection(
AutoScalingGroupName='my-auto-scaling-group',
Granularity='1Minute',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def enter_standby(InstanceIds=None, AutoScalingGroupName=None, ShouldDecrementDesiredCapacity=None):
"""
Moves the specified instances into the standby state.
If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.
If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example puts the specified instance into standby mode.
Expected Output:
:example: response = client.enter_standby(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]
Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to Standby mode.
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to moving instances into Standby mode.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example puts the specified instance into standby mode.
response = client.enter_standby(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ShouldDecrementDesiredCapacity=True,
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': 'ffa056b4-6ed3-41ba-ae7c-249dfae6eba1',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:10:23Z instance i-93633f9b was moved to standby in response to a user request, shrinking the capacity from 2 to 1.',
'Description': 'Moving EC2 instance to Standby: i-93633f9b',
'Details': 'details',
'Progress': 50,
'StartTime': datetime(2015, 4, 12, 15, 10, 23, 6, 102, 0),
'StatusCode': 'InProgress',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def execute_policy(AutoScalingGroupName=None, PolicyName=None, HonorCooldown=None, MetricValue=None, BreachThreshold=None):
"""
Executes the specified policy.
See also: AWS API Documentation
Exceptions
Examples
This example executes the specified Auto Scaling policy for the specified Auto Scaling group.
Expected Output:
:example: response = client.execute_policy(
AutoScalingGroupName='string',
PolicyName='string',
HonorCooldown=True|False,
MetricValue=123.0,
BreachThreshold=123.0
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: The name of the Auto Scaling group.
:type PolicyName: string
:param PolicyName: [REQUIRED]
The name or ARN of the policy.
:type HonorCooldown: boolean
:param HonorCooldown: Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.
This parameter is not supported if the policy type is StepScaling or TargetTrackingScaling .
For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
:type MetricValue: float
:param MetricValue: The metric value to compare to BreachThreshold . This enables you to execute a policy of type StepScaling and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.
If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.
Conditional: This parameter is required if the policy type is StepScaling and not supported otherwise.
:type BreachThreshold: float
:param BreachThreshold: The breach threshold for the alarm.
Conditional: This parameter is required if the policy type is StepScaling and not supported otherwise.
:return: response = client.execute_policy(
AutoScalingGroupName='my-auto-scaling-group',
HonorCooldown=True,
PolicyName='ScaleIn',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def exit_standby(InstanceIds=None, AutoScalingGroupName=None):
"""
Moves the specified instances out of the standby state.
After you put the instances back in service, the desired capacity is incremented.
For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example moves the specified instance out of standby mode.
Expected Output:
:example: response = client.exit_standby(
InstanceIds=[
'string',
],
AutoScalingGroupName='string'
)
:type InstanceIds: list
:param InstanceIds: The IDs of the instances. You can specify up to 20 instances.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:rtype: dict
ReturnsResponse Syntax
{
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
Response Structure
(dict) --
Activities (list) --
The activities related to moving instances out of Standby mode.
(dict) --
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example moves the specified instance out of standby mode.
response = client.exit_standby(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
)
print(response)
Expected Output:
{
'Activities': [
{
'ActivityId': '142928e1-a2dc-453a-9b24-b85ad6735928',
'AutoScalingGroupName': 'my-auto-scaling-group',
'Cause': 'At 2015-04-12T15:14:29Z instance i-93633f9b was moved out of standby in response to a user request, increasing the capacity from 1 to 2.',
'Description': 'Moving EC2 instance out of Standby: i-93633f9b',
'Details': 'details',
'Progress': 30,
'StartTime': datetime(2015, 4, 12, 15, 14, 29, 6, 102, 0),
'StatusCode': 'PreInService',
},
],
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activities': [
{
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to
ClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid
for. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By
default, the http method is whatever is used in the method's model.
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you'd normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
ReturnsA paginator object.
"""
pass
def get_waiter(waiter_name=None):
"""
Returns an object that can wait for some condition.
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters
section of the service docs for a list of available waiters.
:rtype: botocore.waiter.Waiter
"""
pass
def put_lifecycle_hook(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleTransition=None, RoleARN=None, NotificationTargetARN=None, NotificationMetadata=None, HeartbeatTimeout=None, DefaultResult=None):
"""
Creates or updates a lifecycle hook for the specified Auto Scaling group.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Amazon EC2 Auto Scaling Lifecycle Hooks in the Amazon EC2 Auto Scaling User Guide .
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails.
You can view the lifecycle hooks for an Auto Scaling group using the DescribeLifecycleHooks API call. If you are no longer using a lifecycle hook, you can delete it by calling the DeleteLifecycleHook API.
See also: AWS API Documentation
Exceptions
Examples
This example creates a lifecycle hook.
Expected Output:
:example: response = client.put_lifecycle_hook(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleTransition='string',
RoleARN='string',
NotificationTargetARN='string',
NotificationMetadata='string',
HeartbeatTimeout=123,
DefaultResult='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]
The name of the lifecycle hook.
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LifecycleTransition: string
:param LifecycleTransition: The instance state to which you want to attach the lifecycle hook. The valid values are:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
:type RoleARN: string
:param RoleARN: The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
:type NotificationTargetARN: string
:param NotificationTargetARN: The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic.
If you specify an empty string, this overrides the current ARN.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.
When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair: 'Event': 'autoscaling:TEST_NOTIFICATION' .
:type NotificationMetadata: string
:param NotificationMetadata: Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
:type HeartbeatTimeout: integer
:param HeartbeatTimeout: The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).
If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling the RecordLifecycleActionHeartbeat API.
:type DefaultResult: string
:param DefaultResult: Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either CONTINUE or ABANDON . The default value is ABANDON .
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example creates a lifecycle hook.
response = client.put_lifecycle_hook(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleHookName='my-lifecycle-hook',
LifecycleTransition='autoscaling:EC2_INSTANCE_LAUNCHING',
NotificationTargetARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic --role-arn',
RoleARN='arn:aws:iam::123456789012:role/my-auto-scaling-role',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleTransition (string) -- The instance state to which you want to attach the lifecycle hook. The valid values are:
autoscaling:EC2_INSTANCE_LAUNCHING
autoscaling:EC2_INSTANCE_TERMINATING
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
RoleARN (string) -- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
Conditional: This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
NotificationTargetARN (string) -- The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic.
If you specify an empty string, this overrides the current ARN.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.
When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair: "Event": "autoscaling:TEST_NOTIFICATION" .
NotificationMetadata (string) -- Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout (integer) -- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).
If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult parameter. You can prevent the lifecycle hook from timing out by calling the RecordLifecycleActionHeartbeat API.
DefaultResult (string) -- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either CONTINUE or ABANDON . The default value is ABANDON .
"""
pass
def put_notification_configuration(AutoScalingGroupName=None, TopicARN=None, NotificationTypes=None):
"""
Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.
This configuration overwrites any existing configuration.
For more information, see Getting Amazon SNS Notifications When Your Auto Scaling Group Scales in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified notification to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_notification_configuration(
AutoScalingGroupName='string',
TopicARN='string',
NotificationTypes=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type TopicARN: string
:param TopicARN: [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.
:type NotificationTypes: list
:param NotificationTypes: [REQUIRED]
The type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes API.
(string) --
:return: response = client.put_notification_configuration(
AutoScalingGroupName='my-auto-scaling-group',
NotificationTypes=[
'autoscaling:TEST_NOTIFICATION',
],
TopicARN='arn:aws:sns:us-west-2:123456789012:my-sns-topic',
)
print(response)
:returns:
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def put_scaling_policy(AutoScalingGroupName=None, PolicyName=None, PolicyType=None, AdjustmentType=None, MinAdjustmentStep=None, MinAdjustmentMagnitude=None, ScalingAdjustment=None, Cooldown=None, MetricAggregationType=None, StepAdjustments=None, EstimatedInstanceWarmup=None, TargetTrackingConfiguration=None, Enabled=None):
"""
Creates or updates a scaling policy for an Auto Scaling group.
For more information about using scaling policies to scale your Auto Scaling group, see Target Tracking Scaling Policies and Step and Simple Scaling Policies in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified policy to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scaling_policy(
AutoScalingGroupName='string',
PolicyName='string',
PolicyType='string',
AdjustmentType='string',
MinAdjustmentStep=123,
MinAdjustmentMagnitude=123,
ScalingAdjustment=123,
Cooldown=123,
MetricAggregationType='string',
StepAdjustments=[
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
EstimatedInstanceWarmup=123,
TargetTrackingConfiguration={
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget',
'ResourceLabel': 'string'
},
'CustomizedMetricSpecification': {
'MetricName': 'string',
'Namespace': 'string',
'Dimensions': [
{
'Name': 'string',
'Value': 'string'
},
],
'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum',
'Unit': 'string'
},
'TargetValue': 123.0,
'DisableScaleIn': True|False
},
Enabled=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type PolicyName: string
:param PolicyName: [REQUIRED]
The name of the policy.
:type PolicyType: string
:param PolicyType: The policy type. The valid values are SimpleScaling , StepScaling , and TargetTrackingScaling . If the policy type is null, the value is treated as SimpleScaling .
:type AdjustmentType: string
:param AdjustmentType: Specifies whether the ScalingAdjustment parameter is an absolute number or a percentage of the current capacity. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
Valid only if the policy type is StepScaling or SimpleScaling . For more information, see Scaling Adjustment Types in the Amazon EC2 Auto Scaling User Guide .
:type MinAdjustmentStep: integer
:param MinAdjustmentStep: Available for backward compatibility. Use MinAdjustmentMagnitude instead.
:type MinAdjustmentMagnitude: integer
:param MinAdjustmentMagnitude: The minimum value to scale by when scaling by percentages. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.
Valid only if the policy type is StepScaling or SimpleScaling and the adjustment type is PercentChangeInCapacity . For more information, see Scaling Adjustment Types in the Amazon EC2 Auto Scaling User Guide .
:type ScalingAdjustment: integer
:param ScalingAdjustment: The amount by which a simple scaling policy scales the Auto Scaling group in response to an alarm breach. The adjustment is based on the value that you specified in the AdjustmentType parameter (either an absolute number or a percentage). A positive value adds to the current capacity and a negative value subtracts from the current capacity. For exact capacity, you must specify a positive value.
Conditional: If you specify SimpleScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)
:type Cooldown: integer
:param Cooldown: The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start. If this parameter is not specified, the default cooldown period for the group applies.
Valid only if the policy type is SimpleScaling . For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
:type MetricAggregationType: string
:param MetricAggregationType: The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .
Valid only if the policy type is StepScaling .
:type StepAdjustments: list
:param StepAdjustments: A set of adjustments that enable you to scale based on the size of the alarm breach.
Conditional: If you specify StepScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)
(dict) --Describes information used to create a step adjustment for a step scaling policy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
For more information, see Step Adjustments in the Amazon EC2 Auto Scaling User Guide .
MetricIntervalLowerBound (float) --The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
:type EstimatedInstanceWarmup: integer
:param EstimatedInstanceWarmup: The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.
Valid only if the policy type is StepScaling or TargetTrackingScaling .
:type TargetTrackingConfiguration: dict
:param TargetTrackingConfiguration: A target tracking scaling policy. Includes support for predefined or customized metrics.
For more information, see TargetTrackingConfiguration in the Amazon EC2 Auto Scaling API Reference .
Conditional: If you specify TargetTrackingScaling for the policy type, you must specify this parameter. (Not used with any other policy type.)
PredefinedMetricSpecification (dict) --A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType (string) -- [REQUIRED]The metric type. The following predefined metrics are available:
ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group.
ASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group.
ASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group.
ALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.
ResourceLabel (string) --Identifies the resource associated with the metric type. You can't specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group.
The format is ``app/load-balancer-name /load-balancer-id /targetgroup/target-group-name /target-group-id `` , where
``app/load-balancer-name /load-balancer-id `` is the final portion of the load balancer ARN, and
``targetgroup/target-group-name /target-group-id `` is the final portion of the target group ARN.
CustomizedMetricSpecification (dict) --A customized metric. You must specify either a predefined metric or a customized metric.
MetricName (string) -- [REQUIRED]The name of the metric.
Namespace (string) -- [REQUIRED]The namespace of the metric.
Dimensions (list) --The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
(dict) --Describes the dimension of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value of the dimension.
Statistic (string) -- [REQUIRED]The statistic of the metric.
Unit (string) --The unit of the metric.
TargetValue (float) -- [REQUIRED]The target value for the metric.
DisableScaleIn (boolean) --Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .
:type Enabled: boolean
:param Enabled: Indicates whether the scaling policy is enabled or disabled. The default is enabled. For more information, see Disabling a Scaling Policy for an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide .
:rtype: dict
ReturnsResponse Syntax
{
'PolicyARN': 'string',
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
]
}
Response Structure
(dict) --
Contains the output of PutScalingPolicy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
Alarms (list) --
The CloudWatch alarms created for the target tracking scaling policy.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
Examples
This example adds the specified policy to the specified Auto Scaling group.
response = client.put_scaling_policy(
AdjustmentType='ChangeInCapacity',
AutoScalingGroupName='my-auto-scaling-group',
PolicyName='ScaleIn',
ScalingAdjustment=-1,
)
print(response)
Expected Output:
{
'PolicyARN': 'arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn',
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'PolicyARN': 'string',
'Alarms': [
{
'AlarmName': 'string',
'AlarmARN': 'string'
},
]
}
:returns:
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
AutoScaling.Client.exceptions.ServiceLinkedRoleFailure
"""
pass
def put_scheduled_update_group_action(AutoScalingGroupName=None, ScheduledActionName=None, Time=None, StartTime=None, EndTime=None, Recurrence=None, MinSize=None, MaxSize=None, DesiredCapacity=None):
"""
Creates or updates a scheduled scaling action for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.
For more information, see Scheduled Scaling in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example adds the specified scheduled action to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledActionName='string',
Time=datetime(2015, 1, 1),
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Recurrence='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]
The name of this scaling action.
:type Time: datetime
:param Time: This parameter is no longer used.
:type StartTime: datetime
:param StartTime: The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, '2019-06-01T00:00:00Z' ).
If you specify Recurrence and StartTime , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.
:type EndTime: datetime
:param EndTime: The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.
:type Recurrence: string
:param Recurrence: The recurring schedule for this action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, '30 0 1 1,6,12 *' ). For more information about this format, see Crontab .
When StartTime and EndTime are specified with Recurrence , they form the boundaries of when the recurring action starts and stops.
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.
:return: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=4,
EndTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
MaxSize=6,
MinSize=2,
ScheduledActionName='my-scheduled-action',
StartTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
)
print(response)
:returns:
AutoScaling.Client.exceptions.AlreadyExistsFault
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def record_lifecycle_action_heartbeat(LifecycleHookName=None, AutoScalingGroupName=None, LifecycleActionToken=None, InstanceId=None):
"""
Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the timeout by the length of time defined using the PutLifecycleHook API call.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
For more information, see Auto Scaling Lifecycle in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example records a lifecycle action heartbeat to keep the instance in a pending state.
Expected Output:
:example: response = client.record_lifecycle_action_heartbeat(
LifecycleHookName='string',
AutoScalingGroupName='string',
LifecycleActionToken='string',
InstanceId='string'
)
:type LifecycleHookName: string
:param LifecycleHookName: [REQUIRED]
The name of the lifecycle hook.
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LifecycleActionToken: string
:param LifecycleActionToken: A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
:type InstanceId: string
:param InstanceId: The ID of the instance.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example records a lifecycle action heartbeat to keep the instance in a pending state.
response = client.record_lifecycle_action_heartbeat(
AutoScalingGroupName='my-auto-scaling-group',
LifecycleActionToken='bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635',
LifecycleHookName='my-lifecycle-hook',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
LifecycleHookName (string) -- [REQUIRED]
The name of the lifecycle hook.
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LifecycleActionToken (string) -- A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
InstanceId (string) -- The ID of the instance.
"""
pass
def resume_processes(AutoScalingGroupName=None, ScalingProcesses=None):
"""
Resumes the specified suspended automatic scaling processes, or all suspended process, for the specified Auto Scaling group.
For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example resumes the specified suspended scaling process for the specified Auto Scaling group.
Expected Output:
:example: response = client.resume_processes(
AutoScalingGroupName='string',
ScalingProcesses=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScalingProcesses: list
:param ScalingProcesses: One or more of the following processes. If you omit this parameter, all processes are specified.
Launch
Terminate
HealthCheck
ReplaceUnhealthy
AZRebalance
AlarmNotification
ScheduledActions
AddToLoadBalancer
(string) --
:return: response = client.resume_processes(
AutoScalingGroupName='my-auto-scaling-group',
ScalingProcesses=[
'AlarmNotification',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_desired_capacity(AutoScalingGroupName=None, DesiredCapacity=None, HonorCooldown=None):
"""
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.
For more information, see Manual Scaling in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example sets the desired capacity for the specified Auto Scaling group.
Expected Output:
:example: response = client.set_desired_capacity(
AutoScalingGroupName='string',
DesiredCapacity=123,
HonorCooldown=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: [REQUIRED]
The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
:type HonorCooldown: boolean
:param HonorCooldown: Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.
:return: response = client.set_desired_capacity(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=2,
HonorCooldown=True,
)
print(response)
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_instance_health(InstanceId=None, HealthStatus=None, ShouldRespectGracePeriod=None):
"""
Sets the health status of the specified instance.
For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example sets the health status of the specified instance to Unhealthy.
Expected Output:
:example: response = client.set_instance_health(
InstanceId='string',
HealthStatus='string',
ShouldRespectGracePeriod=True|False
)
:type InstanceId: string
:param InstanceId: [REQUIRED]
The ID of the instance.
:type HealthStatus: string
:param HealthStatus: [REQUIRED]
The health status of the instance. Set to Healthy to have the instance remain in service. Set to Unhealthy to have the instance be out of service. Amazon EC2 Auto Scaling terminates and replaces the unhealthy instance.
:type ShouldRespectGracePeriod: boolean
:param ShouldRespectGracePeriod: If the Auto Scaling group of the specified instance has a HealthCheckGracePeriod specified for the group, by default, this call respects the grace period. Set this to False , to have the call not respect the grace period associated with the group.
For more information about the health check grace period, see CreateAutoScalingGroup in the Amazon EC2 Auto Scaling API Reference .
:return: response = client.set_instance_health(
HealthStatus='Unhealthy',
InstanceId='i-93633f9b',
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def set_instance_protection(InstanceIds=None, AutoScalingGroupName=None, ProtectedFromScaleIn=None):
"""
Updates the instance protection settings of the specified instances.
For more information about preventing instances that are part of an Auto Scaling group from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example enables instance protection for the specified instance.
Expected Output:
This example disables instance protection for the specified instance.
Expected Output:
:example: response = client.set_instance_protection(
InstanceIds=[
'string',
],
AutoScalingGroupName='string',
ProtectedFromScaleIn=True|False
)
:type InstanceIds: list
:param InstanceIds: [REQUIRED]
One or more instance IDs.
(string) --
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ProtectedFromScaleIn: boolean
:param ProtectedFromScaleIn: [REQUIRED]
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
AutoScaling.Client.exceptions.LimitExceededFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example enables instance protection for the specified instance.
response = client.set_instance_protection(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ProtectedFromScaleIn=True,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
This example disables instance protection for the specified instance.
response = client.set_instance_protection(
AutoScalingGroupName='my-auto-scaling-group',
InstanceIds=[
'i-93633f9b',
],
ProtectedFromScaleIn=False,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {}
:returns:
(dict) --
"""
pass
def suspend_processes(AutoScalingGroupName=None, ScalingProcesses=None):
"""
Suspends the specified automatic scaling processes, or all processes, for the specified Auto Scaling group.
If you suspend either the Launch or Terminate process types, it can prevent other process types from functioning properly. For more information, see Suspending and Resuming Scaling Processes in the Amazon EC2 Auto Scaling User Guide .
To resume processes that have been suspended, call the ResumeProcesses API.
See also: AWS API Documentation
Exceptions
Examples
This example suspends the specified scaling process for the specified Auto Scaling group.
Expected Output:
:example: response = client.suspend_processes(
AutoScalingGroupName='string',
ScalingProcesses=[
'string',
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type ScalingProcesses: list
:param ScalingProcesses: One or more of the following processes. If you omit this parameter, all processes are specified.
Launch
Terminate
HealthCheck
ReplaceUnhealthy
AZRebalance
AlarmNotification
ScheduledActions
AddToLoadBalancer
(string) --
:return: response = client.suspend_processes(
AutoScalingGroupName='my-auto-scaling-group',
ScalingProcesses=[
'AlarmNotification',
],
)
print(response)
:returns:
AutoScaling.Client.exceptions.ResourceInUseFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def terminate_instance_in_auto_scaling_group(InstanceId=None, ShouldDecrementDesiredCapacity=None):
"""
Terminates the specified instance and optionally adjusts the desired group size.
This call simply makes a termination request. The instance is not terminated immediately. When an instance is terminated, the instance status changes to terminated . You can't connect to or start an instance after you've terminated it.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are terminated.
By default, Amazon EC2 Auto Scaling balances instances across all Availability Zones. If you decrement the desired capacity, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries to rebalance the group, and rebalancing might terminate instances in other zones. For more information, see Rebalancing Activities in the Amazon EC2 Auto Scaling User Guide .
See also: AWS API Documentation
Exceptions
Examples
This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates.
Expected Output:
:example: response = client.terminate_instance_in_auto_scaling_group(
InstanceId='string',
ShouldDecrementDesiredCapacity=True|False
)
:type InstanceId: string
:param InstanceId: [REQUIRED]
The ID of the instance.
:type ShouldDecrementDesiredCapacity: boolean
:param ShouldDecrementDesiredCapacity: [REQUIRED]
Indicates whether terminating the instance also decrements the size of the Auto Scaling group.
:rtype: dict
ReturnsResponse Syntax
{
'Activity': {
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
}
}
Response Structure
(dict) --
Activity (dict) --
A scaling activity.
ActivityId (string) --
The ID of the activity.
AutoScalingGroupName (string) --
The name of the Auto Scaling group.
Description (string) --
A friendly, more verbose description of the activity.
Cause (string) --
The reason the activity began.
StartTime (datetime) --
The start time of the activity.
EndTime (datetime) --
The end time of the activity.
StatusCode (string) --
The current status of the activity.
StatusMessage (string) --
A friendly, more verbose description of the activity status.
Progress (integer) --
A value between 0 and 100 that indicates the progress of the activity.
Details (string) --
The details about the activity.
Exceptions
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
Examples
This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates.
response = client.terminate_instance_in_auto_scaling_group(
InstanceId='i-93633f9b',
ShouldDecrementDesiredCapacity=False,
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
:return: {
'Activity': {
'ActivityId': 'string',
'AutoScalingGroupName': 'string',
'Description': 'string',
'Cause': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'StatusCode': 'PendingSpotBidPlacement'|'WaitingForSpotInstanceRequestId'|'WaitingForSpotInstanceId'|'WaitingForInstanceId'|'PreInService'|'InProgress'|'WaitingForELBConnectionDraining'|'MidLifecycleAction'|'WaitingForInstanceWarmup'|'Successful'|'Failed'|'Cancelled',
'StatusMessage': 'string',
'Progress': 123,
'Details': 'string'
}
}
:returns:
AutoScaling.Client.exceptions.ScalingActivityInProgressFault
AutoScaling.Client.exceptions.ResourceContentionFault
"""
pass
def update_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, LaunchTemplate=None, MixedInstancesPolicy=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None, ServiceLinkedRoleARN=None, MaxInstanceLifetime=None):
"""
Updates the configuration for the specified Auto Scaling group.
To update an Auto Scaling group, specify the name of the group and the parameter that you want to change. Any parameters that you don't specify are not changed by this update request. The new settings take effect on any scaling activities after this call returns.
If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get the updated configuration. Existing instances continue to run with the configuration that they were originally launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or template, existing instances may be replaced to match the new purchasing options that you specified in the policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that updating your group does not compromise the performance or availability of your application.
Note the following about changing DesiredCapacity , MaxSize , or MinSize :
To see which parameters have been set, call the DescribeAutoScalingGroups API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies API. If the group has scaling policies, you can update them by calling the PutScalingPolicy API.
See also: AWS API Documentation
Exceptions
Examples
This example updates the launch configuration of the specified Auto Scaling group.
Expected Output:
This example updates the minimum size and maximum size of the specified Auto Scaling group.
Expected Output:
This example enables instance protection for the specified Auto Scaling group.
Expected Output:
:example: response = client.update_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
LaunchTemplate={
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
MixedInstancesPolicy={
'LaunchTemplate': {
'LaunchTemplateSpecification': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'Version': 'string'
},
'Overrides': [
{
'InstanceType': 'string',
'WeightedCapacity': 'string'
},
]
},
'InstancesDistribution': {
'OnDemandAllocationStrategy': 'string',
'OnDemandBaseCapacity': 123,
'OnDemandPercentageAboveBaseCapacity': 123,
'SpotAllocationStrategy': 'string',
'SpotInstancePools': 123,
'SpotMaxPrice': 'string'
}
},
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
ServiceLinkedRoleARN='string',
MaxInstanceLifetime=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration. If you specify LaunchConfigurationName in your update request, you can't specify LaunchTemplate or MixedInstancesPolicy .
:type LaunchTemplate: dict
:param LaunchTemplate: The launch template and version to use to specify the updates. If you specify LaunchTemplate in your update request, you can't specify LaunchConfigurationName or MixedInstancesPolicy .
For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
:type MixedInstancesPolicy: dict
:param MixedInstancesPolicy: An embedded object that specifies a mixed instances policy.
In your call to UpdateAutoScalingGroup , you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.
For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .
LaunchTemplate (dict) --The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.
Note
With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).
:type DesiredCapacity: integer
:param DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 . This cooldown period is not used when a scaling-specific cooldown is specified.
Cooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group.
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default value is 0 .
For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .
Conditional: This parameter is required if you are adding an ELB health check.
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet IDs for virtual private cloud (VPC).
If you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.
:type TerminationPolicies: list
:param TerminationPolicies: A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
:type ServiceLinkedRoleARN: string
:param ServiceLinkedRoleARN: The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
:type MaxInstanceLifetime: integer
:param MaxInstanceLifetime: The maximum amount of time, in seconds, that an instance can be in service. The default is null.
This parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.
For more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 0.
:return: response = client.update_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='new-launch-config',
)
print(response)
:returns:
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LaunchConfigurationName (string) -- The name of the launch configuration. If you specify LaunchConfigurationName in your update request, you can't specify LaunchTemplate or MixedInstancesPolicy .
LaunchTemplate (dict) -- The launch template and version to use to specify the updates. If you specify LaunchTemplate in your update request, you can't specify LaunchConfigurationName or MixedInstancesPolicy .
For more information, see LaunchTemplateSpecification in the Amazon EC2 Auto Scaling API Reference .
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
MixedInstancesPolicy (dict) -- An embedded object that specifies a mixed instances policy.
In your call to UpdateAutoScalingGroup , you can make changes to the policy that is specified. All optional parameters are left unchanged if not specified.
For more information, see MixedInstancesPolicy in the Amazon EC2 Auto Scaling API Reference and Auto Scaling Groups with Multiple Instance Types and Purchase Options in the Amazon EC2 Auto Scaling User Guide .
LaunchTemplate (dict) --The launch template and instance types (overrides).
This parameter must be specified when creating a mixed instances policy.
LaunchTemplateSpecification (dict) --The launch template to use. You must specify either the launch template ID or launch template name in the request.
LaunchTemplateId (string) --The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
LaunchTemplateName (string) --The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
You must specify either a template ID or a template name.
Version (string) --The version number, $Latest , or $Default . To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API.
If the value is $Latest , Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default , Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default .
Overrides (list) --Any parameters that you specify override the same parameters in the launch template. Currently, the only supported override is instance type. You can specify between 1 and 20 instance types.
If not provided, Amazon EC2 Auto Scaling will use the instance type specified in the launch template to launch instances.
(dict) --Describes an override for a launch template. Currently, the only supported override is instance type.
The maximum number of instance type overrides that can be associated with an Auto Scaling group is 20.
InstanceType (string) --The instance type. You must use an instance type that is supported in your requested Region and Availability Zones.
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
WeightedCapacity (string) --The number of capacity units, which gives the instance type a proportional weight to other instance types. For example, larger instance types are generally weighted more than smaller instance types. These are the same units that you chose to set the desired capacity in terms of instances, or a performance attribute such as vCPUs, memory, or I/O.
For more information, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 1. Maximum value of 999.
InstancesDistribution (dict) --The instances distribution to use.
If you leave this parameter unspecified, the value for each parameter in InstancesDistribution uses a default value.
OnDemandAllocationStrategy (string) --Indicates how to allocate instance types to fulfill On-Demand capacity.
The only valid value is prioritized , which is also the default value. This strategy uses the order of instance type overrides for the LaunchTemplate to define the launch priority of each instance type. The first instance type in the array is prioritized higher than the last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then the Auto Scaling groups launches the remaining capacity using the second priority instance type, and so on.
OnDemandBaseCapacity (integer) --The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the OnDemandPercentageAboveBaseCapacity setting.
Note
An update to this setting means a gradual replacement of instances to maintain the specified number of On-Demand Instances for your base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
OnDemandPercentageAboveBaseCapacity (integer) --Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity .
Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances.
Note
An update to this setting means a gradual replacement of instances to maintain the percentage of On-Demand Instances for your additional capacity above the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones.
Valid Range: Minimum value of 0. Maximum value of 100.
SpotAllocationStrategy (string) --Indicates how to allocate instances across Spot Instance pools.
If the allocation strategy is lowest-price , the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. If the allocation strategy is capacity-optimized , the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
The default Spot allocation strategy for calls that you make through the API, the AWS CLI, or the AWS SDKs is lowest-price . The default Spot allocation strategy for the AWS Management Console is capacity-optimized .
Valid values: lowest-price | capacity-optimized
SpotInstancePools (integer) --The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate . Default if not set is 2.
Used only when the Spot allocation strategy is lowest-price .
Valid Range: Minimum value of 1. Maximum value of 20.
SpotMaxPrice (string) --The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price.
To remove a value that you previously set, include the parameter but leave the value blank.
MinSize (integer) -- The minimum size of the Auto Scaling group.
MaxSize (integer) -- The maximum size of the Auto Scaling group.
Note
With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above MaxSize to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more than your maximum instance weight (weights that define how many capacity units each instance contributes to the capacity of the group).
DesiredCapacity (integer) -- The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
DefaultCooldown (integer) -- The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default value is 300 . This cooldown period is not used when a scaling-specific cooldown is specified.
Cooldown periods are not supported for target tracking scaling policies, step scaling policies, or scheduled scaling. For more information, see Scaling Cooldowns in the Amazon EC2 Auto Scaling User Guide .
AvailabilityZones (list) -- One or more Availability Zones for the group.
(string) --
HealthCheckType (string) -- The service to use for the health checks. The valid values are EC2 and ELB . If you configure an Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
HealthCheckGracePeriod (integer) -- The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default value is 0 .
For more information, see Health Check Grace Period in the Amazon EC2 Auto Scaling User Guide .
Conditional: This parameter is required if you are adding an ELB health check.
PlacementGroup (string) -- The name of the placement group into which to launch your instances, if any. A placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a placement group. For more information, see Placement Groups in the Amazon EC2 User Guide for Linux Instances .
VPCZoneIdentifier (string) -- A comma-separated list of subnet IDs for virtual private cloud (VPC).
If you specify VPCZoneIdentifier with AvailabilityZones , the subnets that you specify for this parameter must reside in those Availability Zones.
TerminationPolicies (list) -- A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Amazon EC2 Auto Scaling User Guide .
(string) --
NewInstancesProtectedFromScaleIn (boolean) -- Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
For more information about preventing instances from terminating on scale in, see Instance Protection in the Amazon EC2 Auto Scaling User Guide .
ServiceLinkedRoleARN (string) -- The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS services on your behalf. For more information, see Service-Linked Roles in the Amazon EC2 Auto Scaling User Guide .
MaxInstanceLifetime (integer) -- The maximum amount of time, in seconds, that an instance can be in service. The default is null.
This parameter is optional, but if you specify a value for it, you must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, specify a new value of 0.
For more information, see Replacing Auto Scaling Instances Based on Maximum Instance Lifetime in the Amazon EC2 Auto Scaling User Guide .
Valid Range: Minimum value of 0.
"""
pass |
def gen_tumor_ic_file(file_dir, dp):
# write to file
inpf = open(file_dir + dp.tumor_ic_file, 'w')
inpf.write("type, cx, cy, cz, tum_rx, tum_ry, tum_rz, hyp_rx, hyp_ry, hyp_rz\n")
# type = 1 -- spherical tumor core
# type = 2 -- elliptical tumor core (sharp)
# type = 3 -- spherical tumor core and then spherical hypoxic core
# type = 5 -- spherical tumor core (sharp)
ic_type = dp.tumor_ic_type
center = dp.tumor_ic_center
r = dp.tumor_ic_radius
for i in range(len(center)):
inpf.write("{}, {}, {}, {}, {}, {}, {}, {}, {}, {}\n".format(ic_type[i], center[i][0], center[i][1], center[i][2], r[i][0], r[i][1], r[i][2], r[i][0], r[i][1], r[i][2]))
inpf.close()
| def gen_tumor_ic_file(file_dir, dp):
inpf = open(file_dir + dp.tumor_ic_file, 'w')
inpf.write('type, cx, cy, cz, tum_rx, tum_ry, tum_rz, hyp_rx, hyp_ry, hyp_rz\n')
ic_type = dp.tumor_ic_type
center = dp.tumor_ic_center
r = dp.tumor_ic_radius
for i in range(len(center)):
inpf.write('{}, {}, {}, {}, {}, {}, {}, {}, {}, {}\n'.format(ic_type[i], center[i][0], center[i][1], center[i][2], r[i][0], r[i][1], r[i][2], r[i][0], r[i][1], r[i][2]))
inpf.close() |
'''traversetree module
Module with functions to traverse our triangle.
'''
__all__ = ['maximum_pathsum']
__author__ = 'Alexandre Pierre'
def pairs(iterator):
'''Given an iterator yields its elements in pairs in which the first
element will assume values from first to second-last and the second element
of the pair will range from second to last iterator elements.'''
try:
previous = next(iterator)
except StopIteration:
return
for current in iterator:
yield previous, current
previous = current
def maximum_pathsum(triangle):
'''Given a triangle returns the maximum topdown path sum'''
acc = (0 for _ in triangle[-1])
for triangle_row in triangle[:0:-1]:
row = map(sum, zip(acc, triangle_row))
acc = map(max, pairs(row))
return triangle[0][0] + next(acc)
| """traversetree module
Module with functions to traverse our triangle.
"""
__all__ = ['maximum_pathsum']
__author__ = 'Alexandre Pierre'
def pairs(iterator):
"""Given an iterator yields its elements in pairs in which the first
element will assume values from first to second-last and the second element
of the pair will range from second to last iterator elements."""
try:
previous = next(iterator)
except StopIteration:
return
for current in iterator:
yield (previous, current)
previous = current
def maximum_pathsum(triangle):
"""Given a triangle returns the maximum topdown path sum"""
acc = (0 for _ in triangle[-1])
for triangle_row in triangle[:0:-1]:
row = map(sum, zip(acc, triangle_row))
acc = map(max, pairs(row))
return triangle[0][0] + next(acc) |
# -*- coding: UTF-8 -*-
# [1,2,3]
a = [1,2,3]
print(a)
# [1,2,3]
b = a
print(b)
# True
print(id(a) == id(b))
b[0] = 3
# [3,2,3]
print(b)
# [3,2,3]
print(a)
# True
print(id(a) == id(b)) | a = [1, 2, 3]
print(a)
b = a
print(b)
print(id(a) == id(b))
b[0] = 3
print(b)
print(a)
print(id(a) == id(b)) |
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
"""import sqlite3
from students import Students
conn = sqlite3.connect('school.db')
c= conn.cursor()
#c.execute(""""CREATE TABLE students("""
# Fname message_text,
# Sname message_text,
# Id_No integer,
# T_Id integer,
# subject message_text )""")
#c.execute("INSERT INTO students VALUES ('Alicia','Kings', 203319899,8021,'Kiswahili')")
#c.execute("DELETE FROM students WHERE Fname='John'")
"""c.execute("SELECT * FROM students")
print(c.fetchall())
conn.commit()
conn.close()"""
| def print_hi(name):
print(f'Hi, {name}')
if __name__ == '__main__':
print_hi('PyCharm')
"import sqlite3\nfrom students import Students\nconn = sqlite3.connect('school.db')\n\nc= conn.cursor()\n#c.execute(CREATE TABLE students("
'c.execute("SELECT * FROM students")\nprint(c.fetchall())\nconn.commit()\nconn.close()' |
"""
Given a sequence of integers, find the longest increasing subsequence (LIS).
You code should return the length of the LIS.
"""
__author__ = 'Danyang'
class Solution:
def longestIncreasingSubsequence(self, nums):
"""
let f(i) be the LIS END WITH A[i]
f(i) = max(f(j)+1) if A[i]>=A[j] \forall j, j<i
notice:
* return the maximum rather than f[-1]
* O(n^2)
:param nums: The integer array
:return: The length of LIS
"""
n = len(nums)
if n == 0:
return 0
maxa = 1
f = [1 for _ in xrange(n)]
for i in xrange(n):
for j in xrange(i):
if nums[i] >= nums[j]:
f[i] = max(f[i], f[j]+1)
maxa = max(maxa, f[i])
return maxa # rather than f[-1]
if __name__ == "__main__":
assert Solution().longestIncreasingSubsequence(
[88, 4, 24, 82, 86, 1, 56, 74, 71, 9, 8, 18, 26, 53, 77, 87, 60, 27, 69, 17, 76, 23, 67, 14, 98, 13, 10, 83, 20,
43, 39, 29, 92, 31, 0, 30, 90, 70, 37, 59]) == 10 | """
Given a sequence of integers, find the longest increasing subsequence (LIS).
You code should return the length of the LIS.
"""
__author__ = 'Danyang'
class Solution:
def longest_increasing_subsequence(self, nums):
"""
let f(i) be the LIS END WITH A[i]
f(i) = max(f(j)+1) if A[i]>=A[j] \x0corall j, j<i
notice:
* return the maximum rather than f[-1]
* O(n^2)
:param nums: The integer array
:return: The length of LIS
"""
n = len(nums)
if n == 0:
return 0
maxa = 1
f = [1 for _ in xrange(n)]
for i in xrange(n):
for j in xrange(i):
if nums[i] >= nums[j]:
f[i] = max(f[i], f[j] + 1)
maxa = max(maxa, f[i])
return maxa
if __name__ == '__main__':
assert solution().longestIncreasingSubsequence([88, 4, 24, 82, 86, 1, 56, 74, 71, 9, 8, 18, 26, 53, 77, 87, 60, 27, 69, 17, 76, 23, 67, 14, 98, 13, 10, 83, 20, 43, 39, 29, 92, 31, 0, 30, 90, 70, 37, 59]) == 10 |
class SqlQueries:
songplay_table_insert = ("""
INSERT INTO songplays (playid, start_time, userid, level, songid, artist_id, session_id, location, user_agent)
SELECT
md5(events.sessionid || events.start_time) AS playid,
events.start_time AS start_time,
events.userid AS userid,
events.level AS level,
songs.song_id AS songid,
songs.artist_id AS artist_id,
events.sessionid AS session_id,
events.location AS location,
events.useragent AS user_agent
FROM (SELECT TIMESTAMP 'epoch' + ts/1000 * interval '1 second' AS start_time, *
FROM staging_events
WHERE page='NextSong') events
LEFT JOIN staging_songs songs
ON events.song = songs.title
AND events.artist = songs.artist_name
AND events.length = songs.duration
""")
user_table_insert = ("""
INSERT INTO users (userid, first_name, last_name, gender, level)
SELECT distinct userid AS userid,
firstname AS first_name,
lastname AS last_name,
gender AS gender,
level AS level
FROM staging_events
WHERE page='NextSong'
""")
song_table_insert = ("""
INSERT INTO songs (songid, title, artistid, year, duration)
SELECT distinct song_id AS songid,
title,
artist_id AS artistid,
year,
duration
FROM staging_songs
""")
artist_table_insert = ("""
INSERT INTO artists (artistid, name, location, lattitude, longitude)
SELECT distinct artist_id AS artistid,
artist_name AS name,
artist_location AS location,
artist_latitude AS lattitude,
artist_longitude AS longitude
FROM staging_songs
""")
time_table_insert = ("""
INSERT INTO time (start_time, hour, day, week, month, year, weekday)
SELECT start_time,
extract(hour from start_time) AS hour,
extract(day from start_time) AS day,
extract(week from start_time) AS week,
extract(month from start_time) AS month,
extract(year from start_time) AS year,
extract(dayofweek from start_time) AS weekday
FROM songplays
""")
| class Sqlqueries:
songplay_table_insert = "\n INSERT INTO songplays (playid, start_time, userid, level, songid, artist_id, session_id, location, user_agent) \n SELECT\n md5(events.sessionid || events.start_time) AS playid,\n events.start_time AS start_time, \n events.userid AS userid, \n events.level AS level, \n songs.song_id AS songid, \n songs.artist_id AS artist_id, \n events.sessionid AS session_id, \n events.location AS location, \n events.useragent AS user_agent\n FROM (SELECT TIMESTAMP 'epoch' + ts/1000 * interval '1 second' AS start_time, *\n FROM staging_events\n WHERE page='NextSong') events\n LEFT JOIN staging_songs songs\n ON events.song = songs.title\n AND events.artist = songs.artist_name\n AND events.length = songs.duration\n "
user_table_insert = "\n INSERT INTO users (userid, first_name, last_name, gender, level) \n SELECT distinct userid AS userid, \n firstname AS first_name, \n lastname AS last_name, \n gender AS gender, \n level AS level\n FROM staging_events\n WHERE page='NextSong'\n "
song_table_insert = '\n INSERT INTO songs (songid, title, artistid, year, duration) \n SELECT distinct song_id AS songid, \n title, \n artist_id AS artistid, \n year, \n duration\n FROM staging_songs\n '
artist_table_insert = '\n INSERT INTO artists (artistid, name, location, lattitude, longitude)\n SELECT distinct artist_id AS artistid, \n artist_name AS name, \n artist_location AS location, \n artist_latitude AS lattitude, \n artist_longitude AS longitude\n FROM staging_songs\n '
time_table_insert = '\n INSERT INTO time (start_time, hour, day, week, month, year, weekday)\n SELECT start_time, \n extract(hour from start_time) AS hour, \n extract(day from start_time) AS day, \n extract(week from start_time) AS week, \n extract(month from start_time) AS month, \n extract(year from start_time) AS year, \n extract(dayofweek from start_time) AS weekday\n FROM songplays\n ' |
__author__ = 'makarenok'
class Contact:
def __init__(self, first_name, middle_name, last_name, nick, title, company, address, tel_home, email):
self.first_name = first_name
self.middle_name = middle_name
self.last_name = last_name
self.nick = nick
self.title = title
self.company = company
self.address = address
self.tel_home = tel_home
self.email = email | __author__ = 'makarenok'
class Contact:
def __init__(self, first_name, middle_name, last_name, nick, title, company, address, tel_home, email):
self.first_name = first_name
self.middle_name = middle_name
self.last_name = last_name
self.nick = nick
self.title = title
self.company = company
self.address = address
self.tel_home = tel_home
self.email = email |
with open("input") as f:
map = f.readlines()
# want to make my life easier with bounds checking
# so i'm going to pad the map
for i in range(len(map)):
map[i] = ' ' + map[i].strip('\n') + ' '
# add the extra row at the end
map.append(' '*len(map[0]))
row = 0
# find entry at the top
for i in map[0]:
if i != ' ':
col = map[0].index(i)
# our first direction will be down
row_step = 1
col_step = 0
step_count = 0
path = ''
while True:
if map[row][col].isalpha():
# found a letter, add it in
path += map[row][col]
if map[row][col] == ' ':
# no more path, the end
break
if map[row][col] == '+':
# found a change of direction
if row_step != 0:
# if we were heading north/south,
# find out if we are going east or west
row_step = 0
if map[row][col-1] != ' ':
col_step = -1
else:
col_step = 1
else:
# if we were heading east/west,
# find out if we are going north or south
col_step = 0
if map[row-1][col] != ' ':
row_step = -1
else:
row_step = 1
step_count += 1
# move to next pos
row += row_step
col += col_step
print("part 1", path)
print("part 2", step_count) | with open('input') as f:
map = f.readlines()
for i in range(len(map)):
map[i] = ' ' + map[i].strip('\n') + ' '
map.append(' ' * len(map[0]))
row = 0
for i in map[0]:
if i != ' ':
col = map[0].index(i)
row_step = 1
col_step = 0
step_count = 0
path = ''
while True:
if map[row][col].isalpha():
path += map[row][col]
if map[row][col] == ' ':
break
if map[row][col] == '+':
if row_step != 0:
row_step = 0
if map[row][col - 1] != ' ':
col_step = -1
else:
col_step = 1
else:
col_step = 0
if map[row - 1][col] != ' ':
row_step = -1
else:
row_step = 1
step_count += 1
row += row_step
col += col_step
print('part 1', path)
print('part 2', step_count) |
class Solution:
def minDominoRotations(self, tops: List[int], bottoms: List[int]) -> int:
total = len(tops)
top_fr, bot_fr, val_total = [0]*7, [0]*7, [total]*7
for top, bot in zip(tops, bottoms):
if top == bot:
val_total[top] -= 1
else:
top_fr[top] += 1
bot_fr[bot] += 1
for val in range(1, 7):
if (val_total[val] - top_fr[val]) == bot_fr[val]:
return min(top_fr[val], bot_fr[val])
return -1
| class Solution:
def min_domino_rotations(self, tops: List[int], bottoms: List[int]) -> int:
total = len(tops)
(top_fr, bot_fr, val_total) = ([0] * 7, [0] * 7, [total] * 7)
for (top, bot) in zip(tops, bottoms):
if top == bot:
val_total[top] -= 1
else:
top_fr[top] += 1
bot_fr[bot] += 1
for val in range(1, 7):
if val_total[val] - top_fr[val] == bot_fr[val]:
return min(top_fr[val], bot_fr[val])
return -1 |
class A:
def __contains__(self, e):
return False
a = A()
print(0 in a)
| class A:
def __contains__(self, e):
return False
a = a()
print(0 in a) |
def long_text_to_list():
string = open('longtext.txt').read()
return string.split()
def word_frequency_dict(wordList):
wordDict = {}
for word in wordList:
if word in wordDict:
wordDict[word] = wordDict[word] + 1
else:
wordDict[word] = 1
return wordDict
def print_250_most_common_words(wordDict):
sortedDict = sorted(wordDict.items(), key=lambda item: (item[1], item[0]))
top250 = 0
print("250 most common words and number of occurrences:")
while (top250 <= 250):
print(sortedDict.pop())
top250 += 1
print_250_most_common_words(word_frequency_dict(long_text_to_list()))
| def long_text_to_list():
string = open('longtext.txt').read()
return string.split()
def word_frequency_dict(wordList):
word_dict = {}
for word in wordList:
if word in wordDict:
wordDict[word] = wordDict[word] + 1
else:
wordDict[word] = 1
return wordDict
def print_250_most_common_words(wordDict):
sorted_dict = sorted(wordDict.items(), key=lambda item: (item[1], item[0]))
top250 = 0
print('250 most common words and number of occurrences:')
while top250 <= 250:
print(sortedDict.pop())
top250 += 1
print_250_most_common_words(word_frequency_dict(long_text_to_list())) |
# -*- coding: utf-8 -*-
class Registry(object):
__registry = {}
def add(self, command):
self.__registry.update({
command.name: command
})
def get_all(self):
return self.__registry.copy()
def get_command(self, name, default=None):
return self.__registry.get(name, default)
registry = Registry()
| class Registry(object):
__registry = {}
def add(self, command):
self.__registry.update({command.name: command})
def get_all(self):
return self.__registry.copy()
def get_command(self, name, default=None):
return self.__registry.get(name, default)
registry = registry() |
def map(soup, payload, mappings, tag_prop):
for source_key, payload_key in mappings.items():
tag = soup.find('meta', attrs={tag_prop:source_key})
if tag:
payload[payload_key] = tag.get('content')
| def map(soup, payload, mappings, tag_prop):
for (source_key, payload_key) in mappings.items():
tag = soup.find('meta', attrs={tag_prop: source_key})
if tag:
payload[payload_key] = tag.get('content') |
serv_ver_info = "Connected to MySQL Server version"
conn_success_info = "You're connected to database"
conn_error_info = "Error while connecting to MySQL"
conn_close_info = "MySQL connection is closed"
error_insert_info = "Failed to insert data to table in MySQL"
error_create_info = "Failed to create table in MySQL"
error_drop_info = "Failed to remove tables in MySQL" | serv_ver_info = 'Connected to MySQL Server version'
conn_success_info = "You're connected to database"
conn_error_info = 'Error while connecting to MySQL'
conn_close_info = 'MySQL connection is closed'
error_insert_info = 'Failed to insert data to table in MySQL'
error_create_info = 'Failed to create table in MySQL'
error_drop_info = 'Failed to remove tables in MySQL' |
def writer(mat_export):
canvas = open("dipinto_magnified.ppm","w")
canvas.write(lines[0] + "\n")
canvas.write(str(width) +" "+ str(height) + "\n")
canvas.write(lines[2] + "\n")
for a in range (0,height):
for b in range (0,width):
for c in range (0,3):
canvas.write(mat_export[a][b][c] + "\n")
def stroke(matrix,radius,coord_x,coord_y,red,green,blue):
matrix_c =[[[]for g in range(0,len(matrix[0]))] for i in range(0,len(matrix))]
for a in range(0,len(matrix)):
for b in range(0,len(matrix[a])):
matrix_c[a][b] = matrix[a][b][0:len(matrix[a][b])]
for c in range(0,height):
for b in range (0,width):
if ((coord_x-b)**2+(coord_y-c)**2)**0.5 < radius:
#if (c**2+b**2)**0.5 < radius:
matrix_c[c][b][0]=(str(red))
matrix_c[c][b][1]=(str(green))
matrix_c[c][b][2]=(str(blue))
return matrix_c
raw = open("dipinto.ppm","r")
raw2 = raw.read()
lines = raw2.split("\n")
width = int(lines[1].split(" ")[0])
height = int(lines[1].split(" ")[1])
raw_instructions = open("strokesjournal.dat","r")
raw_inst2 = raw_instructions.read()
lines_inst = raw_inst2.split("\n")
del lines_inst[-1]
strokelist = []#[] for i in range(0,len(lines_inst))]
for a in lines_inst:
strokelist.append(lines_inst[lines_inst.index(a)].split(",")[:-1])
magnification = 10
height = height * magnification
width = width * magnification
matrix_mag = [[[]for m in range (0,width)]for n in range(0,height)]
for c in range(0,height):
for b in range (0,width):
greyscale = str(int(c*b/(height*width)*255))
matrix_mag[c][b] = ["0","0","0"]
for i in strokelist:
print(i)
for g in range(0,len(i)-3):
i[g] = float(float(i[g]) * magnification)
matrix_mag = stroke(matrix_mag, i[0], i[1], i[2], i[3], i[4], i[5])
writer(matrix_mag) | def writer(mat_export):
canvas = open('dipinto_magnified.ppm', 'w')
canvas.write(lines[0] + '\n')
canvas.write(str(width) + ' ' + str(height) + '\n')
canvas.write(lines[2] + '\n')
for a in range(0, height):
for b in range(0, width):
for c in range(0, 3):
canvas.write(mat_export[a][b][c] + '\n')
def stroke(matrix, radius, coord_x, coord_y, red, green, blue):
matrix_c = [[[] for g in range(0, len(matrix[0]))] for i in range(0, len(matrix))]
for a in range(0, len(matrix)):
for b in range(0, len(matrix[a])):
matrix_c[a][b] = matrix[a][b][0:len(matrix[a][b])]
for c in range(0, height):
for b in range(0, width):
if ((coord_x - b) ** 2 + (coord_y - c) ** 2) ** 0.5 < radius:
matrix_c[c][b][0] = str(red)
matrix_c[c][b][1] = str(green)
matrix_c[c][b][2] = str(blue)
return matrix_c
raw = open('dipinto.ppm', 'r')
raw2 = raw.read()
lines = raw2.split('\n')
width = int(lines[1].split(' ')[0])
height = int(lines[1].split(' ')[1])
raw_instructions = open('strokesjournal.dat', 'r')
raw_inst2 = raw_instructions.read()
lines_inst = raw_inst2.split('\n')
del lines_inst[-1]
strokelist = []
for a in lines_inst:
strokelist.append(lines_inst[lines_inst.index(a)].split(',')[:-1])
magnification = 10
height = height * magnification
width = width * magnification
matrix_mag = [[[] for m in range(0, width)] for n in range(0, height)]
for c in range(0, height):
for b in range(0, width):
greyscale = str(int(c * b / (height * width) * 255))
matrix_mag[c][b] = ['0', '0', '0']
for i in strokelist:
print(i)
for g in range(0, len(i) - 3):
i[g] = float(float(i[g]) * magnification)
matrix_mag = stroke(matrix_mag, i[0], i[1], i[2], i[3], i[4], i[5])
writer(matrix_mag) |
def try_get_item(list, index):
"""
Returns an item from a list on the specified index.
If index is out or range, returns `None`.
Keyword arguments:
list -- the list
index -- the index of the item
"""
return list[index] if index < len(list) else None
def union(A, B):
"""
Returns a union of two lists.
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A) or ib < len(B):
a = try_get_item(A, ia)
b = try_get_item(B, ib)
if a is None or (b is not None and a > b):
# Don't add duplicates
if len(output) == 0 or b != output[-1]:
output.append(b)
ib += 1
elif b is None or a < b:
# Don't add duplicates
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
elif a == b:
# Don't add duplicates
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
ib += 1
return output
def intersection(A, B):
"""
Returns an intersection of two lists.
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A) and ib < len(B):
a = A[ia]
b = B[ib]
if a == b:
# Don't add duplicates
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
ib += 1
elif a < b:
ia += 1
else: # if a > b:
ib += 1
return output
def relative_complement(A, B):
"""
Returns a relative complement of two lists (B in A).
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A):
a = try_get_item(A, ia)
b = try_get_item(B, ib)
if a == b:
ia += 1
ib += 1
elif b is None or a < b:
# Don't add duplicates
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
else: # if a > b:
ib += 1
return output
# Tests
"""
l = [1, 2, 3]
r = [1, 2, 4, 5]
e = []
print("union")
print(union(l, l))
print(union(l, r))
print(union(l, e))
print(union(r, l))
print(union(r, r))
print(union(r, e))
print(union(e, l))
print(union(e, r))
print(union(e, e))
print("intersection")
print(intersection(l, l))
print(intersection(l, r))
print(intersection(l, e))
print(intersection(r, l))
print(intersection(r, r))
print(intersection(r, e))
print(intersection(e, l))
print(intersection(e, r))
print(intersection(e, e))
print("relative_complement")
print(relative_complement(l, l))
print(relative_complement(l, r))
print(relative_complement(l, e))
print(relative_complement(r, l))
print(relative_complement(r, r))
print(relative_complement(r, e))
print(relative_complement(e, l))
print(relative_complement(e, r))
print(relative_complement(e, e))
print("duplicates")
print(union([1, 2, 2, 3, 3], [1, 1, 2, 2, 3]))
print(intersection([1, 1, 2, 2, 3, 3], [1, 1, 2, 2, 3, 3]))
print(relative_complement([1, 1, 2, 2, 3, 3], []))
"""
| def try_get_item(list, index):
"""
Returns an item from a list on the specified index.
If index is out or range, returns `None`.
Keyword arguments:
list -- the list
index -- the index of the item
"""
return list[index] if index < len(list) else None
def union(A, B):
"""
Returns a union of two lists.
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A) or ib < len(B):
a = try_get_item(A, ia)
b = try_get_item(B, ib)
if a is None or (b is not None and a > b):
if len(output) == 0 or b != output[-1]:
output.append(b)
ib += 1
elif b is None or a < b:
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
elif a == b:
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
ib += 1
return output
def intersection(A, B):
"""
Returns an intersection of two lists.
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A) and ib < len(B):
a = A[ia]
b = B[ib]
if a == b:
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
ib += 1
elif a < b:
ia += 1
else:
ib += 1
return output
def relative_complement(A, B):
"""
Returns a relative complement of two lists (B in A).
Keyword arguments:
A -- the first list
B -- the second list
"""
ia = 0
ib = 0
output = []
while ia < len(A):
a = try_get_item(A, ia)
b = try_get_item(B, ib)
if a == b:
ia += 1
ib += 1
elif b is None or a < b:
if len(output) == 0 or a != output[-1]:
output.append(a)
ia += 1
else:
ib += 1
return output
'\nl = [1, 2, 3]\nr = [1, 2, 4, 5]\ne = []\n\nprint("union")\nprint(union(l, l))\nprint(union(l, r))\nprint(union(l, e))\nprint(union(r, l))\nprint(union(r, r))\nprint(union(r, e))\nprint(union(e, l))\nprint(union(e, r))\nprint(union(e, e))\n\nprint("intersection")\nprint(intersection(l, l))\nprint(intersection(l, r))\nprint(intersection(l, e))\nprint(intersection(r, l))\nprint(intersection(r, r))\nprint(intersection(r, e))\nprint(intersection(e, l))\nprint(intersection(e, r))\nprint(intersection(e, e))\n\nprint("relative_complement")\nprint(relative_complement(l, l))\nprint(relative_complement(l, r))\nprint(relative_complement(l, e))\nprint(relative_complement(r, l))\nprint(relative_complement(r, r))\nprint(relative_complement(r, e))\nprint(relative_complement(e, l))\nprint(relative_complement(e, r))\nprint(relative_complement(e, e))\n\nprint("duplicates")\nprint(union([1, 2, 2, 3, 3], [1, 1, 2, 2, 3]))\nprint(intersection([1, 1, 2, 2, 3, 3], [1, 1, 2, 2, 3, 3]))\nprint(relative_complement([1, 1, 2, 2, 3, 3], []))\n' |
{
'targets': [
{'target_name': 'libspedye',
'type': 'static_library',
'dependencies': [
'deps/http-parser/http_parser.gyp:http_parser',
'deps/uv/uv.gyp:uv',
'deps/openssl/openssl.gyp:openssl',
'deps/spdylay.gyp:spdylay',
],
'export_dependent_settings': [
'deps/http-parser/http_parser.gyp:http_parser',
'deps/uv/uv.gyp:uv',
'deps/openssl/openssl.gyp:openssl',
'deps/spdylay.gyp:spdylay',
],
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'cflags': [ '--std=c89' ],
'defines': [ '_GNU_SOURCE' ]
}],
],
'sources': [
'src/spedye.h',
'src/spedye_error.h',
'src/spedye_init.c',
'src/spedye_master.c',
'src/spedye_worker.c',
'src/spedye_conf.c',
'src/spedye_error.c',
],
'include_dirs': [
'src',
'deps/uv/src/ares'
],
'direct_dependent_settings': {
'include_dirs': [
'src',
'deps/uv/src/ares'
]
},
},
{
'target_name': 'spedye',
'type': 'executable',
'dependencies': [
'libspedye',
],
'sources': [
'src/spedye_main.c',
],
'msvs-settings': {
'VCLinkerTool': {
'SubSystem': 1, # /subsystem:console
},
},
'conditions': [
['OS == "linux"', {
'libraries': ['-ldl'],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'cflags': [ '--std=c89' ],
'defines': [ '_GNU_SOURCE' ]
}]
],
},
],
}
| {'targets': [{'target_name': 'libspedye', 'type': 'static_library', 'dependencies': ['deps/http-parser/http_parser.gyp:http_parser', 'deps/uv/uv.gyp:uv', 'deps/openssl/openssl.gyp:openssl', 'deps/spdylay.gyp:spdylay'], 'export_dependent_settings': ['deps/http-parser/http_parser.gyp:http_parser', 'deps/uv/uv.gyp:uv', 'deps/openssl/openssl.gyp:openssl', 'deps/spdylay.gyp:spdylay'], 'conditions': [['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {'cflags': ['--std=c89'], 'defines': ['_GNU_SOURCE']}]], 'sources': ['src/spedye.h', 'src/spedye_error.h', 'src/spedye_init.c', 'src/spedye_master.c', 'src/spedye_worker.c', 'src/spedye_conf.c', 'src/spedye_error.c'], 'include_dirs': ['src', 'deps/uv/src/ares'], 'direct_dependent_settings': {'include_dirs': ['src', 'deps/uv/src/ares']}}, {'target_name': 'spedye', 'type': 'executable', 'dependencies': ['libspedye'], 'sources': ['src/spedye_main.c'], 'msvs-settings': {'VCLinkerTool': {'SubSystem': 1}}, 'conditions': [['OS == "linux"', {'libraries': ['-ldl']}], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {'cflags': ['--std=c89'], 'defines': ['_GNU_SOURCE']}]]}]} |
#!/usr/bin/python3
"""
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-place, return the new length of the array.
Follow up:
Could you solve it using only O(1) extra space?
"""
class Solution:
def compress(self, chars):
"""
tedious pointer manipulation
:type chars: List[str]
:rtype: int
"""
ret = 1
s = 0 # start index of current char
for i in range(1, len(chars) + 1):
if i < len(chars) and chars[i] == chars[s]:
continue
l = i - s
if l > 1:
for digit in str(l):
chars[ret] = digit
ret += 1
if i < len(chars):
chars[ret] = chars[i]
ret += 1
s = i
return ret
def compress_error(self, chars):
"""
tedious pointer manipulation
:type chars: List[str]
:rtype: int
"""
s = 0
for idx in range(1, len(chars) + 1):
if idx < len(chars) and chars[idx] == chars[s]:
continue
l = idx - s
if l == 1:
s = min(s + 1, len(chars) - 1)
else:
for digit in str(l):
s += 1
chars[s] = digit
if idx < len(chars):
s += 1
chars[s] = chars[idx]
return s + 1
if __name__ == "__main__":
assert Solution().compress(["a"]) == 1
assert Solution().compress(["a","a","b","b","c","c","c"]) == 6
assert Solution().compress(["a","b","b","b","b","b","b","b","b","b","b","b","b"]) == 4
| """
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-place, return the new length of the array.
Follow up:
Could you solve it using only O(1) extra space?
"""
class Solution:
def compress(self, chars):
"""
tedious pointer manipulation
:type chars: List[str]
:rtype: int
"""
ret = 1
s = 0
for i in range(1, len(chars) + 1):
if i < len(chars) and chars[i] == chars[s]:
continue
l = i - s
if l > 1:
for digit in str(l):
chars[ret] = digit
ret += 1
if i < len(chars):
chars[ret] = chars[i]
ret += 1
s = i
return ret
def compress_error(self, chars):
"""
tedious pointer manipulation
:type chars: List[str]
:rtype: int
"""
s = 0
for idx in range(1, len(chars) + 1):
if idx < len(chars) and chars[idx] == chars[s]:
continue
l = idx - s
if l == 1:
s = min(s + 1, len(chars) - 1)
else:
for digit in str(l):
s += 1
chars[s] = digit
if idx < len(chars):
s += 1
chars[s] = chars[idx]
return s + 1
if __name__ == '__main__':
assert solution().compress(['a']) == 1
assert solution().compress(['a', 'a', 'b', 'b', 'c', 'c', 'c']) == 6
assert solution().compress(['a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b']) == 4 |
ninjas = {
"Kakashi": "Jonin",
"Shikamaru": "Chunin",
"Naruto": "Genin"
}
print(ninjas)
ninjas.update({"Kakashi": "Hokage", "Shikamaru": "Jonin"})
print(ninjas) | ninjas = {'Kakashi': 'Jonin', 'Shikamaru': 'Chunin', 'Naruto': 'Genin'}
print(ninjas)
ninjas.update({'Kakashi': 'Hokage', 'Shikamaru': 'Jonin'})
print(ninjas) |
class Solution:
def numberToWords(self, num: int) -> str:
below_100 = ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
below_20 = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten',
'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
result = []
def numberToString(num):
if num >= 10 ** 9:
numberToString(num // (10**9))
result.append('Billion')
numberToString(num % (10 ** 9))
elif num >= 10 ** 6:
numberToString(num // (10**6))
result.append('Million')
numberToString(num % (10 ** 6))
elif num >= 1000:
numberToString(num // 1000)
result.append('Thousand')
numberToString(num % 1000)
elif num >= 100:
numberToString(num // 100)
result.append('Hundred')
numberToString(num % 100)
elif num >= 20:
result.append(below_100[num // 10 - 2])
numberToString(num % 10)
elif num >= 1:
result.append(below_20[num - 1])
if num == 0:
return 'Zero'
else:
numberToString(num)
return ' '.join(result)
| class Solution:
def number_to_words(self, num: int) -> str:
below_100 = ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
below_20 = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
result = []
def number_to_string(num):
if num >= 10 ** 9:
number_to_string(num // 10 ** 9)
result.append('Billion')
number_to_string(num % 10 ** 9)
elif num >= 10 ** 6:
number_to_string(num // 10 ** 6)
result.append('Million')
number_to_string(num % 10 ** 6)
elif num >= 1000:
number_to_string(num // 1000)
result.append('Thousand')
number_to_string(num % 1000)
elif num >= 100:
number_to_string(num // 100)
result.append('Hundred')
number_to_string(num % 100)
elif num >= 20:
result.append(below_100[num // 10 - 2])
number_to_string(num % 10)
elif num >= 1:
result.append(below_20[num - 1])
if num == 0:
return 'Zero'
else:
number_to_string(num)
return ' '.join(result) |
class Knapsack:
"""
Knapsack objects provide an intuitive means of binding
the problem data
"""
def __init__(self, cap):
"""
Initialize new knapsack object
with capacity and empty items list
"""
self.capacity = cap
self.items = []
def setCapacity(self, cap):
self.capacity = cap
def addItem(self, weight, value):
"""
add an item to this knapsack list of items
"""
self.items.append([weight, value])
def findBest(self, i, j):
"""
Solve the subproblem of finding i items out of the first j items in the pool
return the optimal (combined) value
"""
# check for first cache row
if i == 0: return 0
# check for cached result
if self.cache[i][j] >= 0: return self.cache[i][j]
# grab item for current row
weight, val = self.items[i-1]
# check if the current item exceeds weight limit
# and adjust cache accordingly
if weight > j:
# pass down this call
new = self.findBest(i-1, j)
# add result to cache
self.cache[i][j] = new
return new
else:
# candidates for best value
bestOld = self.findBest(i-1, j)
bestNew = self.findBest(i-1, j-weight) + val
new = max(bestOld, bestNew)
# add result to cache
self.cache[i][j] = new
return new
def solve(self):
"""
Solve the knapsack problem by finding the item subset with
maximum cummulative value whose combined weigth is less than
the knapsack capacity.
"""
# setup cache
self.cache = [[-1]*(self.capacity+1) for _ in xrange(len(self.items)+1)]
self.cache[0] = [0 for _ in xrange(self.capacity+1)]
# fill cache in a non-recursive way
for i in xrange(len(self.items)+1):
self.findBest(i, self.capacity)
# find optimal subset from cached subproblem solutions
optimalSubset = []
col = self.capacity
for i in xrange(len(self.items), 0, -1):
if self.cache[i][col] != self.cache[i-1][col]:
col -= self.items[i-1][0]
optimalSubset.append(self.items[i-1])
return self.findBest(len(self.items), self.capacity), optimalSubset
| class Knapsack:
"""
Knapsack objects provide an intuitive means of binding
the problem data
"""
def __init__(self, cap):
"""
Initialize new knapsack object
with capacity and empty items list
"""
self.capacity = cap
self.items = []
def set_capacity(self, cap):
self.capacity = cap
def add_item(self, weight, value):
"""
add an item to this knapsack list of items
"""
self.items.append([weight, value])
def find_best(self, i, j):
"""
Solve the subproblem of finding i items out of the first j items in the pool
return the optimal (combined) value
"""
if i == 0:
return 0
if self.cache[i][j] >= 0:
return self.cache[i][j]
(weight, val) = self.items[i - 1]
if weight > j:
new = self.findBest(i - 1, j)
self.cache[i][j] = new
return new
else:
best_old = self.findBest(i - 1, j)
best_new = self.findBest(i - 1, j - weight) + val
new = max(bestOld, bestNew)
self.cache[i][j] = new
return new
def solve(self):
"""
Solve the knapsack problem by finding the item subset with
maximum cummulative value whose combined weigth is less than
the knapsack capacity.
"""
self.cache = [[-1] * (self.capacity + 1) for _ in xrange(len(self.items) + 1)]
self.cache[0] = [0 for _ in xrange(self.capacity + 1)]
for i in xrange(len(self.items) + 1):
self.findBest(i, self.capacity)
optimal_subset = []
col = self.capacity
for i in xrange(len(self.items), 0, -1):
if self.cache[i][col] != self.cache[i - 1][col]:
col -= self.items[i - 1][0]
optimalSubset.append(self.items[i - 1])
return (self.findBest(len(self.items), self.capacity), optimalSubset) |
def run_rc4(text,key):
resultado = []
for char in text:
resultado.append(rc4(char,key))
return bytearray(resultado)
def rc4(value,key):
SJ = KSA(key)
generatedByte = GenFluxo(SJ[0])
return value ^ next(generatedByte)
def KSA(key):
S = []
T = []
for i in range(256):
S.append(i)
T.append(i % key)
j = 0
for i in range(256):
j = (j + S[i] + T[i]) % 256
swap(S,i,j)
return (S,T)
def GenFluxo(S):
i = 0
j = 0
while(True):
i = (i+1) % 256
j = (j + S[i]) % 256
swap(S,i,j)
K = S[(S[i] + S[j]) % 256]
yield K
def swap(lista,index1,index2):
tmp = lista[index1]
lista[index1] = lista[index2]
lista[index1] = tmp
if __name__ == "__main__":
input_val = bytearray("encrypted text","utf-8")
print(run_rc4(input_val,4))
print(run_rc4(run_rc4(input_val,4),4).decode("utf-8"))
| def run_rc4(text, key):
resultado = []
for char in text:
resultado.append(rc4(char, key))
return bytearray(resultado)
def rc4(value, key):
sj = ksa(key)
generated_byte = gen_fluxo(SJ[0])
return value ^ next(generatedByte)
def ksa(key):
s = []
t = []
for i in range(256):
S.append(i)
T.append(i % key)
j = 0
for i in range(256):
j = (j + S[i] + T[i]) % 256
swap(S, i, j)
return (S, T)
def gen_fluxo(S):
i = 0
j = 0
while True:
i = (i + 1) % 256
j = (j + S[i]) % 256
swap(S, i, j)
k = S[(S[i] + S[j]) % 256]
yield K
def swap(lista, index1, index2):
tmp = lista[index1]
lista[index1] = lista[index2]
lista[index1] = tmp
if __name__ == '__main__':
input_val = bytearray('encrypted text', 'utf-8')
print(run_rc4(input_val, 4))
print(run_rc4(run_rc4(input_val, 4), 4).decode('utf-8')) |
expected_output = {
'session_db': {
0: {
'session_id': 48380,
'state': 'open',
'src_ip': '10.225.32.228',
'dst_ip': '10.196.32.228',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_vpn_id': 20,
'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866',
'classmap_name': 'ZBFW-seq-1-cm_',
'nat_flags': '-',
'internal_flags': 0,
'total_initiator_bytes': 2429226758,
'total_responder_bytes': 2429224221,
'application_type': '/unknown'
},
1: {
'session_id': 48089,
'state': 'open',
'src_ip': '10.225.31.116',
'dst_ip': '10.196.31.116',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_vpn_id': 20,
'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866',
'classmap_name': 'ZBFW-seq-1-cm_',
'nat_flags': '-',
'internal_flags': 0,
'total_initiator_bytes': 2431679243,
'total_responder_bytes': 2431677173,
'application_type': '/statistical-p2p'
},
2: {
'session_id': 49645,
'state': 'open',
'src_ip': '10.225.37.186',
'dst_ip': '10.196.37.186',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_vpn_id': 20,
'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866',
'classmap_name': 'ZBFW-seq-1-cm_',
'nat_flags': '-',
'internal_flags': 0,
'total_initiator_bytes': 2430723994,
'total_responder_bytes': 2430722132,
'application_type': '/unknown'
},
3: {
'session_id': 46845,
'state': 'open',
'src_ip': '10.225.26.42',
'dst_ip': '10.196.26.42',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_vpn_id': 20,
'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866',
'classmap_name': 'ZBFW-seq-1-cm_',
'nat_flags': '-',
'internal_flags': 0,
'total_initiator_bytes': 2430311067,
'total_responder_bytes': 2430308180,
'application_type': '/unknown'
},
4: {
'session_id': 44583,
'state': 'open',
'src_ip': '10.225.18.63',
'dst_ip': '10.196.18.63',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_vpn_id': 20,
'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866',
'classmap_name': 'ZBFW-seq-1-cm_',
'nat_flags': '-',
'internal_flags': 0,
'total_initiator_bytes': 2435061651,
'total_responder_bytes': 2435062756,
'application_type': '/statistical-p2p'
}
}
} | expected_output = {'session_db': {0: {'session_id': 48380, 'state': 'open', 'src_ip': '10.225.32.228', 'dst_ip': '10.196.32.228', 'src_port': 1024, 'dst_port': 1024, 'protocol': 'PROTO_L4_UDP', 'src_vrf': 3, 'dst_vrf': 3, 'src_vpn_id': 20, 'dst_vpn_id': 20, 'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866', 'classmap_name': 'ZBFW-seq-1-cm_', 'nat_flags': '-', 'internal_flags': 0, 'total_initiator_bytes': 2429226758, 'total_responder_bytes': 2429224221, 'application_type': '/unknown'}, 1: {'session_id': 48089, 'state': 'open', 'src_ip': '10.225.31.116', 'dst_ip': '10.196.31.116', 'src_port': 1024, 'dst_port': 1024, 'protocol': 'PROTO_L4_UDP', 'src_vrf': 3, 'dst_vrf': 3, 'src_vpn_id': 20, 'dst_vpn_id': 20, 'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866', 'classmap_name': 'ZBFW-seq-1-cm_', 'nat_flags': '-', 'internal_flags': 0, 'total_initiator_bytes': 2431679243, 'total_responder_bytes': 2431677173, 'application_type': '/statistical-p2p'}, 2: {'session_id': 49645, 'state': 'open', 'src_ip': '10.225.37.186', 'dst_ip': '10.196.37.186', 'src_port': 1024, 'dst_port': 1024, 'protocol': 'PROTO_L4_UDP', 'src_vrf': 3, 'dst_vrf': 3, 'src_vpn_id': 20, 'dst_vpn_id': 20, 'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866', 'classmap_name': 'ZBFW-seq-1-cm_', 'nat_flags': '-', 'internal_flags': 0, 'total_initiator_bytes': 2430723994, 'total_responder_bytes': 2430722132, 'application_type': '/unknown'}, 3: {'session_id': 46845, 'state': 'open', 'src_ip': '10.225.26.42', 'dst_ip': '10.196.26.42', 'src_port': 1024, 'dst_port': 1024, 'protocol': 'PROTO_L4_UDP', 'src_vrf': 3, 'dst_vrf': 3, 'src_vpn_id': 20, 'dst_vpn_id': 20, 'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866', 'classmap_name': 'ZBFW-seq-1-cm_', 'nat_flags': '-', 'internal_flags': 0, 'total_initiator_bytes': 2430311067, 'total_responder_bytes': 2430308180, 'application_type': '/unknown'}, 4: {'session_id': 44583, 'state': 'open', 'src_ip': '10.225.18.63', 'dst_ip': '10.196.18.63', 'src_port': 1024, 'dst_port': 1024, 'protocol': 'PROTO_L4_UDP', 'src_vrf': 3, 'dst_vrf': 3, 'src_vpn_id': 20, 'dst_vpn_id': 20, 'zp_name': 'ZP_LAN_ZONE_vpn20_LAN__968352866', 'classmap_name': 'ZBFW-seq-1-cm_', 'nat_flags': '-', 'internal_flags': 0, 'total_initiator_bytes': 2435061651, 'total_responder_bytes': 2435062756, 'application_type': '/statistical-p2p'}}} |
# family.py
def init(engine):
def son_of(son, father, mother):
engine.add_universal_fact('family', 'son_of', (son, father, mother))
son_of('art', 'art2', 'nana')
son_of('artie', 'art', 'kathleen')
son_of('ed', 'art', 'kathleen')
son_of('david', 'art', 'kathleen')
son_of('justin', 'artie', 'julie')
son_of('arthur', 'artie', 'lisa')
son_of('keith', 'ed', 'ann')
son_of('ramon', 'ed', 'ann')
son_of('cody', 'david', 'colleen')
| def init(engine):
def son_of(son, father, mother):
engine.add_universal_fact('family', 'son_of', (son, father, mother))
son_of('art', 'art2', 'nana')
son_of('artie', 'art', 'kathleen')
son_of('ed', 'art', 'kathleen')
son_of('david', 'art', 'kathleen')
son_of('justin', 'artie', 'julie')
son_of('arthur', 'artie', 'lisa')
son_of('keith', 'ed', 'ann')
son_of('ramon', 'ed', 'ann')
son_of('cody', 'david', 'colleen') |
# -*- coding: utf-8 -*-
V = int(input())
for i in range(10):
print("N[%d] = %d" % (i, V))
V *= 2
| v = int(input())
for i in range(10):
print('N[%d] = %d' % (i, V))
v *= 2 |
class Something:
def do_something(
self, x: int = 1984, y: int = 2021, z: Optional[int] = None
) -> None:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
| class Something:
def do_something(self, x: int=1984, y: int=2021, z: Optional[int]=None) -> None:
pass
__book_url__ = 'dummy'
__book_version__ = 'dummy' |
# Allow definitions for where we should pick up our assets from.
# By default if no repository is specified in say WORKSPACE then it defaults to maven_central definition.
# This behaviour is found / specified and loaded from
# "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", "maven_jar",
# To prevent us having to create our own version of this asset, we are just adding custom maven repository definitions to a central location.
WANDISCO_ASSETS = "WANDISCO:"
| wandisco_assets = 'WANDISCO:' |
class Error(Exception):
"""Raised when something failed in an unexpected and unrecoverable way"""
pass
class OperationError(Error):
"""Raised when an operation failed in an expected but unrecoverable way"""
pass
class NotifyError(Error):
"""Raised when an notify operation failed in an expected but unrecoverable way"""
pass
class DBConnectionError(OperationError):
"""Raised when a db connection error occurs"""
pass
class DBAuthenticationError(OperationError):
"""Raised when a db authentication error occurs"""
pass
class DBOperationError(OperationError):
"""Raised when a db operation error occurs"""
pass
| class Error(Exception):
"""Raised when something failed in an unexpected and unrecoverable way"""
pass
class Operationerror(Error):
"""Raised when an operation failed in an expected but unrecoverable way"""
pass
class Notifyerror(Error):
"""Raised when an notify operation failed in an expected but unrecoverable way"""
pass
class Dbconnectionerror(OperationError):
"""Raised when a db connection error occurs"""
pass
class Dbauthenticationerror(OperationError):
"""Raised when a db authentication error occurs"""
pass
class Dboperationerror(OperationError):
"""Raised when a db operation error occurs"""
pass |
class Config:
HOST = '192.168.0.23' # use 127.0.0.1 if running both client and server on the Raspberry Pi.
PORT = 2018
RELAY_LABELS = ['Exterior Stairs Light', 'Deck Pot Lights', 'Soffit Receptacle', 'Driveway Light']
| class Config:
host = '192.168.0.23'
port = 2018
relay_labels = ['Exterior Stairs Light', 'Deck Pot Lights', 'Soffit Receptacle', 'Driveway Light'] |
### model hyperparameters
state_size = [100, 128, 4] # 4 stacked frames
action_size = 7 # 7 possible actions
learning_rate = 0.00025 # alpha (aka learning rate)
### training hyperparameters
total_episodes = 50 # total episodes for training
max_steps = 5000 # max possible steps in an episode
batch_size = 64
# exploration parameters
explore_start = 1.0 # exploration probability at start
explore_stop = 0.01 # minimum exploration probability
decay_rate = 0.00001 # exponential decay rate for exploration prob
# Q learning hyperparameters
gamma = 0.9 # discounting rate
### memory
pretrain_length = batch_size # number of experiences stored in the memory when initialized
memory_size = 1000000 # number of experiences the memory can keep
### preprocessing hyperparameters
stack_size = 4
## turn this to true if you want to render the environment during training
episode_render = True | state_size = [100, 128, 4]
action_size = 7
learning_rate = 0.00025
total_episodes = 50
max_steps = 5000
batch_size = 64
explore_start = 1.0
explore_stop = 0.01
decay_rate = 1e-05
gamma = 0.9
pretrain_length = batch_size
memory_size = 1000000
stack_size = 4
episode_render = True |
#
# PySNMP MIB module DLINK-3100-DOT1X-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-DOT1X-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:48:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint")
MacAddress, = mibBuilder.importSymbols("BRIDGE-MIB", "MacAddress")
rnd, = mibBuilder.importSymbols("DLINK-3100-MIB", "rnd")
dot1xPaePortNumber, dot1xAuthSessionStatsEntry, PaeControlledPortStatus = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xPaePortNumber", "dot1xAuthSessionStatsEntry", "PaeControlledPortStatus")
VlanIndex, dot1qFdbId, PortList = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIndex", "dot1qFdbId", "PortList")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Gauge32, ObjectIdentity, ModuleIdentity, Bits, Counter64, NotificationType, Counter32, TimeTicks, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ObjectIdentity", "ModuleIdentity", "Bits", "Counter64", "NotificationType", "Counter32", "TimeTicks", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "iso")
TextualConvention, TruthValue, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString", "RowStatus")
rldot1x = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95))
rldot1x.setRevisions(('2007-01-02 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: rldot1x.setRevisionsDescriptions(('Initial revision.',))
if mibBuilder.loadTexts: rldot1x.setLastUpdated('200701020000Z')
if mibBuilder.loadTexts: rldot1x.setOrganization('Dlink, Inc. Dlink Semiconductor, Inc.')
if mibBuilder.loadTexts: rldot1x.setContactInfo('www.dlink.com')
if mibBuilder.loadTexts: rldot1x.setDescription('This private MIB module defines dot1x private MIBs.')
rldot1xMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xMibVersion.setStatus('current')
if mibBuilder.loadTexts: rldot1xMibVersion.setDescription("MIB's version, the current version is 1.")
rldot1xExtAuthSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2), )
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsTable.setDescription('A table that contains the session statistics objects for the Authenticator PAE associated with each Port. An entry appears in this table for each port that may authenticate access to itself.')
rldot1xExtAuthSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2, 1), )
dot1xAuthSessionStatsEntry.registerAugmentions(("DLINK-3100-DOT1X-MIB", "rldot1xExtAuthSessionStatsEntry"))
rldot1xExtAuthSessionStatsEntry.setIndexNames(*dot1xAuthSessionStatsEntry.getIndexNames())
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsEntry.setDescription('The session statistics information for an Authenticator PAE. This shows the current values being collected for each session that is still in progress, or the final values for the last valid session on each port where there is no session currently active.')
rlDot1xAuthSessionAuthenticMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("remoteAuthServer", 1), ("localAuthServer", 2), ("none", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDot1xAuthSessionAuthenticMethod.setStatus('current')
if mibBuilder.loadTexts: rlDot1xAuthSessionAuthenticMethod.setDescription('The authentication method used to establish the session.')
rldot1xGuestVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 3), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xGuestVlanSupported.setStatus('current')
if mibBuilder.loadTexts: rldot1xGuestVlanSupported.setDescription('indicate if guest vlan is supported.')
rldot1xGuestVlanVID = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 4), VlanIndex()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanVID.setStatus('current')
if mibBuilder.loadTexts: rldot1xGuestVlanVID.setDescription('specify the guest vlan tag , 0 for non exiting.')
rldot1xGuestVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 5), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanPorts.setStatus('current')
if mibBuilder.loadTexts: rldot1xGuestVlanPorts.setDescription('the ports that can be members in the guest vlan')
rldot1xUnAuthenticatedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanSupported.setStatus('current')
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanSupported.setDescription('indicate if unauthenticated Vlan is supported.')
rldot1xUnAuthenticatedVlanTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7), )
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanTable.setDescription('port belong to vlan in all port authenticated state except force unauthenticated table')
rldot1xUnAuthenticatedVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qFdbId"))
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanEntry.setDescription(' port belong to vlan in all port authenticated state except force unauthenticated entry')
rldot1xUnAuthenticatedVlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7, 1, 1), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanStatus.setStatus('current')
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanStatus.setDescription('The row status variable, used according to row installation and removal conventions.')
rldot1xUserBasedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xUserBasedVlanSupported.setStatus('current')
if mibBuilder.loadTexts: rldot1xUserBasedVlanSupported.setDescription('indicate if user based Vlan is supported.')
rldot1xUserBasedVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 9), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xUserBasedVlanPorts.setStatus('current')
if mibBuilder.loadTexts: rldot1xUserBasedVlanPorts.setDescription('the ports that can be members in the user based vlan')
rldot1xAuthenticationPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10), )
if mibBuilder.loadTexts: rldot1xAuthenticationPortTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthenticationPortTable.setDescription('A table of system level information for each port supported by the Port Access Entity. An entry appears in this table for each port of this system.')
rldot1xAuthenticationPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: rldot1xAuthenticationPortEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthenticationPortEntry.setDescription('The Port number and mac method')
rldot1xAuthenticationPortMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3))).clone('eapolOnly')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xAuthenticationPortMethod.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthenticationPortMethod.setDescription('The value of the mac based authenication.')
rldot1xRadiusAttrVlanIdEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdEnabled.setDescription('Defines if treat VLAN ID that received from Radius attributes in Radius-Accept message.')
rldot1xRadiusAttAclNameEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 3), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttAclNameEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xRadiusAttAclNameEnabled.setDescription('Defines if treat ACL Name that received from Radius attributes in Radius-Accept message.')
rldot1xAuthMultiStatsTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11), )
if mibBuilder.loadTexts: rldot1xAuthMultiStatsTable.setReference('9.4.2 Authenticator Statistics')
if mibBuilder.loadTexts: rldot1xAuthMultiStatsTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiStatsTable.setDescription('A table that contains the statistics objects for the Authenticator PAE associated with each Port and MAC for multisession 802.1x mode of operation. An entry appears in this table for each port and MAC that have an authentication session currently running under way for them.')
rldot1xAuthMultiStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1), ).setIndexNames((0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiStatsPortNumber"), (0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiStatsSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiStatsEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiStatsEntry.setDescription('The statistics information for an Authenticator PAE.')
rldot1xAuthMultiStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiStatsPortNumber.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiStatsPortNumber.setDescription('Port Number.')
rldot1xAuthMultiStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiStatsSourceMac.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiStatsSourceMac.setDescription('Mac of the authentication session.')
rldot1xAuthMultiEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesRx.setReference('9.4.2, EAPOL frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesRx.setDescription('The number of valid EAPOL frames of any type that have been received by this Authenticator.')
rldot1xAuthMultiEapolFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesTx.setReference('9.4.2, EAPOL frames transmitted')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesTx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesTx.setDescription('The number of EAPOL frames of any type that have been transmitted by this Authenticator.')
rldot1xAuthMultiEapolStartFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolStartFramesRx.setReference('9.4.2, EAPOL Start frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolStartFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolStartFramesRx.setDescription('The number of EAPOL Start frames that have been received by this Authenticator.')
rldot1xAuthMultiEapolLogoffFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolLogoffFramesRx.setReference('9.4.2, EAPOL Logoff frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolLogoffFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolLogoffFramesRx.setDescription('The number of EAPOL Logoff frames that have been received by this Authenticator.')
rldot1xAuthMultiEapolRespIdFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespIdFramesRx.setReference('9.4.2, EAPOL Resp/Id frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespIdFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespIdFramesRx.setDescription('The number of EAP Resp/Id frames that have been received by this Authenticator.')
rldot1xAuthMultiEapolRespFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespFramesRx.setReference('9.4.2, EAPOL Response frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespFramesRx.setDescription('The number of valid EAP Response frames (other than Resp/Id frames) that have been received by this Authenticator.')
rldot1xAuthMultiEapolReqIdFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqIdFramesTx.setReference('9.4.2, EAPOL Req/Id frames transmitted')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqIdFramesTx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqIdFramesTx.setDescription('The number of EAP Req/Id frames that have been transmitted by this Authenticator.')
rldot1xAuthMultiEapolReqFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqFramesTx.setReference('9.4.2, EAPOL Request frames transmitted')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqFramesTx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqFramesTx.setDescription('The number of EAP Request frames (other than Rq/Id frames) that have been transmitted by this Authenticator.')
rldot1xAuthMultiInvalidEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiInvalidEapolFramesRx.setReference('9.4.2, Invalid EAPOL frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiInvalidEapolFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiInvalidEapolFramesRx.setDescription('The number of EAPOL frames that have been received by this Authenticator in which the frame type is not recognized.')
rldot1xAuthMultiEapLengthErrorFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapLengthErrorFramesRx.setReference('9.4.2, EAP length error frames received')
if mibBuilder.loadTexts: rldot1xAuthMultiEapLengthErrorFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEapLengthErrorFramesRx.setDescription('The number of EAPOL frames that have been received by this Authenticator in which the Packet Body Length field is invalid.')
rldot1xAuthMultiDiagTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12), )
if mibBuilder.loadTexts: rldot1xAuthMultiDiagTable.setReference('9.4.3 Authenticator Diagnostics')
if mibBuilder.loadTexts: rldot1xAuthMultiDiagTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiDiagTable.setDescription('A table that contains the diagnostics objects for the Authenticator PAE associated with each Port and MAC. An entry appears in this table for each port and MAC that have an authentication session currently running under way for them.')
rldot1xAuthMultiDiagEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1), ).setIndexNames((0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiDiagPortNumber"), (0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiDiagSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiDiagEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiDiagEntry.setDescription('The diagnostics information for an Authenticator PAE.')
rldot1xAuthMultiDiagPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiDiagPortNumber.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiDiagPortNumber.setDescription('Port Number.')
rldot1xAuthMultiDiagSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiDiagSourceMac.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiDiagSourceMac.setDescription('Mac of the authentication session.')
rldot1xAuthMultiEntersConnecting = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEntersConnecting.setReference('9.4.2, 8.5.4.2.1')
if mibBuilder.loadTexts: rldot1xAuthMultiEntersConnecting.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEntersConnecting.setDescription('Counts the number of times that the state machine transitions to the CONNECTING state from any other state.')
rldot1xAuthMultiEntersAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEntersAuthenticating.setReference('9.4.2, 8.5.4.2.3')
if mibBuilder.loadTexts: rldot1xAuthMultiEntersAuthenticating.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiEntersAuthenticating.setDescription('Counts the number of times that the state machine transitions from CONNECTING to AUTHENTICATING, as a result of an EAP-Response/Identity message being received from the Supplicant.')
rldot1xAuthMultiAuthSuccessWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthSuccessWhileAuthenticating.setReference('9.4.2, 8.5.4.2.4')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthSuccessWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthSuccessWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to AUTHENTICATED, as a result of the Backend Authentication state machine indicating successful authentication of the Supplicant (authSuccess = TRUE).')
rldot1xAuthMultiAuthFailWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthFailWhileAuthenticating.setReference('9.4.2, 8.5.4.2.6')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthFailWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthFailWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to HELD, as a result of the Backend Authentication state machine indicating authentication failure (authFail = TRUE).')
rldot1xAuthMultiAuthReauthsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticating.setReference('9.4.2, 8.5.4.2.7')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to ABORTING, as a result of a reauthentication request (reAuthenticate = TRUE).')
rldot1xAuthMultiAuthEapStartsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setReference('9.4.2, 8.5.4.2.8')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to ABORTING, as a result of an EAPOL-Start message being received from the Supplicant.')
rldot1xAuthMultiAuthReauthsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticated.setReference('9.4.2, 8.5.4.2.10')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticated.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticated.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATED to CONNECTING, as a result of a reauthentication request (reAuthenticate = TRUE).')
rldot1xAuthMultiAuthEapStartsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setReference('9.4.2, 8.5.4.2.11')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATED to CONNECTING, as a result of an EAPOL-Start message being received from the Supplicant.')
rldot1xAuthMultiBackendResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendResponses.setReference('9.4.2, 8.5.6.2.1')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendResponses.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendResponses.setDescription('Counts the number of times that the state machine sends an initial Access-Request packet to the Authentication server (i.e., executes sendRespToServer on entry to the RESPONSE state). Indicates that the Authenticator attempted communication with the Authentication Server.')
rldot1xAuthMultiBackendAccessChallenges = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAccessChallenges.setReference('9.4.2, 8.5.6.2.2')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAccessChallenges.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAccessChallenges.setDescription('Counts the number of times that the state machine receives an initial Access-Challenge packet from the Authentication server (i.e., aReq becomes TRUE, causing exit from the RESPONSE state). Indicates that the Authentication Server has communication with the Authenticator.')
rldot1xAuthMultiBackendOtherRequestsToSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendOtherRequestsToSupplicant.setReference('9.4.2, 8.5.6.2.3')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendOtherRequestsToSupplicant.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendOtherRequestsToSupplicant.setDescription('Counts the number of times that the state machine sends an EAP-Request packet (other than an Identity, Notification, Failure or Success message) to the Supplicant (i.e., executes txReq on entry to the REQUEST state). Indicates that the Authenticator chose an EAP-method.')
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setReference('9.4.2, 8.5.6.2.4')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setDescription('Counts the number of times that the state machine receives a response from the Supplicant to an initial EAP-Request, and the response is something other than EAP-NAK (i.e., rxResp becomes TRUE, causing the state machine to transition from REQUEST to RESPONSE, and the response is not an EAP-NAK). Indicates that the Supplicant can respond to the Authenticators chosen EAP-method.')
rldot1xAuthMultiBackendAuthSuccesses = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthSuccesses.setReference('9.4.2, 8.5.6.2.5')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthSuccesses.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthSuccesses.setDescription('Counts the number of times that the state machine receives an EAP-Success message from the Authentication Server (i.e., aSuccess becomes TRUE, causing a transition from RESPONSE to SUCCESS). Indicates that the Supplicant has successfully authenticated to the Authentication Server.')
rldot1xAuthMultiSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13), )
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsTable.setReference('9.4.4')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsTable.setDescription('A table that contains the session statistics objects for the Authenticator PAE associated with each Port. An entry appears in this table for each port that may authenticate access to itself.')
rldot1xAuthMultiSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1), ).setIndexNames((0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiSessionStatsPortNumber"), (0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiSessionStatsSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsEntry.setDescription('The session statistics information for an Authenticator PAE. This shows the current values being collected for each session that is still in progress, or the final values for the last valid session on each port where there is no session currently active.')
rldot1xAuthMultiSessionStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsPortNumber.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsPortNumber.setDescription('Port Number.')
rldot1xAuthMultiSessionStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsSourceMac.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsSourceMac.setDescription('Mac of the authentication session.')
rldot1xAuthMultiSessionOctetsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsRx.setReference('9.4.4, Session Octets Received')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsRx.setDescription('The number of octets received in user data frames on this Port during the session.')
rldot1xAuthMultiSessionOctetsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsTx.setReference('9.4.4, Session Octets Transmitted')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsTx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsTx.setDescription('The number of octets transmitted in user data frames on this Port during the session.')
rldot1xAuthMultiSessionFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesRx.setReference('9.4.4, Session Frames Received')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesRx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesRx.setDescription('The number of user data frames received on this Port during the session.')
rldot1xAuthMultiSessionFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesTx.setReference('9.4.4, Session Frames Transmitted')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesTx.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesTx.setDescription('The number of user data frames transmitted on this Port during the session.')
rldot1xAuthMultiSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 7), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionId.setReference('9.4.4, Session Identifier')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionId.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionId.setDescription('A unique identifier for the session, in the form of a printable ASCII string of at least three characters.')
rldot1xAuthMultiSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 8), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionTime.setReference('9.4.4, Session Time')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionTime.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionTime.setDescription('The duration of the session in seconds.')
rldot1xAuthMultiSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 9), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionUserName.setReference('9.4.4, Session User Name')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionUserName.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionUserName.setDescription('The User-Name representing the identity of the Supplicant PAE.')
rldot1xAuthMultiSessionRadiusAttrVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrVlan.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrVlan.setDescription('VLAN ID that received from Radius attributes.')
rldot1xAuthMultiSessionRadiusAttrFilterId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 11), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrFilterId.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrFilterId.setDescription('Filter ID that received from Radius attributes.')
rldot1xAuthMultiConfigTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14), )
if mibBuilder.loadTexts: rldot1xAuthMultiConfigTable.setReference('9.4.1 Authenticator Configuration')
if mibBuilder.loadTexts: rldot1xAuthMultiConfigTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiConfigTable.setDescription('A table that contains the configuration objects for the Authenticator PAE associated with each port and MAC. An entry appears in this table for each port and MAC that may authenticate access to itself.')
rldot1xAuthMultiConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1), ).setIndexNames((0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiPortNumber"), (0, "DLINK-3100-DOT1X-MIB", "rldot1xAuthMultiSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiConfigEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiConfigEntry.setDescription('The configuration information for an Authenticator PAE.')
rldot1xAuthMultiPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiPortNumber.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiPortNumber.setDescription('Port Number.')
rldot1xAuthMultiSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSourceMac.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiSourceMac.setDescription('Mac of the authentication session.')
rldot1xAuthMultiPaeState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("initialize", 1), ("disconnected", 2), ("connecting", 3), ("authenticating", 4), ("authenticated", 5), ("aborting", 6), ("held", 7), ("forceAuth", 8), ("forceUnauth", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiPaeState.setReference('9.4.1, Authenticator PAE state')
if mibBuilder.loadTexts: rldot1xAuthMultiPaeState.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiPaeState.setDescription('The current value of the Authenticator PAE state machine.')
rldot1xAuthMultiBackendAuthState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("request", 1), ("response", 2), ("success", 3), ("fail", 4), ("timeout", 5), ("idle", 6), ("initialize", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthState.setReference('9.4.1, Backend Authentication state')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthState.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthState.setDescription('The current state of the Backend Authentication state machine.')
rldot1xAuthMultiControlledPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 5), PaeControlledPortStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiControlledPortStatus.setReference('9.4.1, AuthControlledPortStatus')
if mibBuilder.loadTexts: rldot1xAuthMultiControlledPortStatus.setStatus('current')
if mibBuilder.loadTexts: rldot1xAuthMultiControlledPortStatus.setDescription('The current value of the controlled Port status parameter for the Port.')
rldot1xBpduFilteringEnabled = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 15), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xBpduFilteringEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xBpduFilteringEnabled.setDescription('Specify that when 802.1x is globally disabled, 802.1x BPDU packets would be filtered or bridged.')
rldot1xRadiusAttributesErrorsAclReject = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 18), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttributesErrorsAclReject.setStatus('current')
if mibBuilder.loadTexts: rldot1xRadiusAttributesErrorsAclReject.setDescription('Specify ACL error handling for the Radius attributes feature.')
rldot1xGuestVlanTimeInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 180))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanTimeInterval.setStatus('current')
if mibBuilder.loadTexts: rldot1xGuestVlanTimeInterval.setDescription('indicate the guest vlan timeout interval.')
rldot1xMacAuthSuccessTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 20), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacAuthSuccessTrapEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xMacAuthSuccessTrapEnabled.setDescription('Specify if sending traps when a MAC address is successfully authenticated by the 802.1X mac-authentication access control.')
rldot1xMacAuthFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 21), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacAuthFailureTrapEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xMacAuthFailureTrapEnabled.setDescription('Specify if sending traps when MAC address was failed in authentication of the 802.1X MAC authentication access control.')
rldot1xLegacyPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22), )
if mibBuilder.loadTexts: rldot1xLegacyPortTable.setStatus('current')
if mibBuilder.loadTexts: rldot1xLegacyPortTable.setDescription('A table of system level information for each port supported by the Port Access Entity. An entry appears in this table for each port of this system.')
rldot1xLegacyPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: rldot1xLegacyPortEntry.setStatus('current')
if mibBuilder.loadTexts: rldot1xLegacyPortEntry.setDescription('The Port number and leagcy mode')
rldot1xLegacyPortModeEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xLegacyPortModeEnabled.setStatus('current')
if mibBuilder.loadTexts: rldot1xLegacyPortModeEnabled.setDescription('Indicates whether in multiple sessions mode work according to legacy devices mode or not.')
mibBuilder.exportSymbols("DLINK-3100-DOT1X-MIB", rldot1xAuthMultiEapolReqFramesTx=rldot1xAuthMultiEapolReqFramesTx, rldot1xAuthMultiAuthSuccessWhileAuthenticating=rldot1xAuthMultiAuthSuccessWhileAuthenticating, rldot1xAuthMultiSessionStatsEntry=rldot1xAuthMultiSessionStatsEntry, rldot1xUserBasedVlanPorts=rldot1xUserBasedVlanPorts, rldot1xAuthMultiSessionTime=rldot1xAuthMultiSessionTime, rldot1xAuthMultiEntersAuthenticating=rldot1xAuthMultiEntersAuthenticating, rldot1xMibVersion=rldot1xMibVersion, rldot1xAuthMultiEapLengthErrorFramesRx=rldot1xAuthMultiEapLengthErrorFramesRx, rldot1xAuthMultiStatsSourceMac=rldot1xAuthMultiStatsSourceMac, rldot1xLegacyPortTable=rldot1xLegacyPortTable, rldot1xAuthMultiControlledPortStatus=rldot1xAuthMultiControlledPortStatus, rldot1xAuthMultiBackendAuthSuccesses=rldot1xAuthMultiBackendAuthSuccesses, rldot1xAuthMultiSessionStatsPortNumber=rldot1xAuthMultiSessionStatsPortNumber, rldot1xAuthMultiEapolFramesTx=rldot1xAuthMultiEapolFramesTx, rldot1xRadiusAttributesErrorsAclReject=rldot1xRadiusAttributesErrorsAclReject, rldot1xAuthMultiStatsPortNumber=rldot1xAuthMultiStatsPortNumber, rldot1xAuthMultiEapolRespFramesRx=rldot1xAuthMultiEapolRespFramesRx, rldot1xMacAuthFailureTrapEnabled=rldot1xMacAuthFailureTrapEnabled, rldot1xGuestVlanTimeInterval=rldot1xGuestVlanTimeInterval, rldot1xUserBasedVlanSupported=rldot1xUserBasedVlanSupported, rldot1xLegacyPortModeEnabled=rldot1xLegacyPortModeEnabled, rldot1xRadiusAttrVlanIdEnabled=rldot1xRadiusAttrVlanIdEnabled, rldot1xAuthMultiSessionOctetsTx=rldot1xAuthMultiSessionOctetsTx, rldot1xGuestVlanSupported=rldot1xGuestVlanSupported, rldot1xAuthenticationPortTable=rldot1xAuthenticationPortTable, rldot1xAuthMultiSessionFramesTx=rldot1xAuthMultiSessionFramesTx, rldot1xExtAuthSessionStatsTable=rldot1xExtAuthSessionStatsTable, rldot1xAuthMultiSessionUserName=rldot1xAuthMultiSessionUserName, rldot1xAuthMultiSessionRadiusAttrFilterId=rldot1xAuthMultiSessionRadiusAttrFilterId, rldot1xAuthMultiPaeState=rldot1xAuthMultiPaeState, rldot1xAuthMultiBackendOtherRequestsToSupplicant=rldot1xAuthMultiBackendOtherRequestsToSupplicant, rldot1xAuthMultiPortNumber=rldot1xAuthMultiPortNumber, rldot1xAuthMultiInvalidEapolFramesRx=rldot1xAuthMultiInvalidEapolFramesRx, rldot1xAuthMultiAuthReauthsWhileAuthenticating=rldot1xAuthMultiAuthReauthsWhileAuthenticating, rldot1xUnAuthenticatedVlanSupported=rldot1xUnAuthenticatedVlanSupported, rldot1xAuthMultiBackendAccessChallenges=rldot1xAuthMultiBackendAccessChallenges, rldot1xAuthMultiBackendAuthState=rldot1xAuthMultiBackendAuthState, rldot1xAuthMultiDiagSourceMac=rldot1xAuthMultiDiagSourceMac, rldot1xAuthMultiEapolRespIdFramesRx=rldot1xAuthMultiEapolRespIdFramesRx, rldot1xAuthMultiSessionFramesRx=rldot1xAuthMultiSessionFramesRx, rldot1xMacAuthSuccessTrapEnabled=rldot1xMacAuthSuccessTrapEnabled, rldot1xAuthMultiEapolStartFramesRx=rldot1xAuthMultiEapolStartFramesRx, PYSNMP_MODULE_ID=rldot1x, rldot1xAuthMultiSourceMac=rldot1xAuthMultiSourceMac, rldot1xBpduFilteringEnabled=rldot1xBpduFilteringEnabled, rldot1xLegacyPortEntry=rldot1xLegacyPortEntry, rldot1xAuthMultiSessionId=rldot1xAuthMultiSessionId, rldot1xExtAuthSessionStatsEntry=rldot1xExtAuthSessionStatsEntry, rldot1xUnAuthenticatedVlanEntry=rldot1xUnAuthenticatedVlanEntry, rldot1xAuthMultiSessionOctetsRx=rldot1xAuthMultiSessionOctetsRx, rldot1xAuthMultiAuthReauthsWhileAuthenticated=rldot1xAuthMultiAuthReauthsWhileAuthenticated, rldot1xAuthMultiDiagPortNumber=rldot1xAuthMultiDiagPortNumber, rldot1xAuthMultiStatsEntry=rldot1xAuthMultiStatsEntry, rldot1xAuthMultiEapolFramesRx=rldot1xAuthMultiEapolFramesRx, rldot1xAuthMultiSessionStatsTable=rldot1xAuthMultiSessionStatsTable, rlDot1xAuthSessionAuthenticMethod=rlDot1xAuthSessionAuthenticMethod, rldot1xAuthenticationPortEntry=rldot1xAuthenticationPortEntry, rldot1xAuthMultiEapolLogoffFramesRx=rldot1xAuthMultiEapolLogoffFramesRx, rldot1xGuestVlanVID=rldot1xGuestVlanVID, rldot1xRadiusAttAclNameEnabled=rldot1xRadiusAttAclNameEnabled, rldot1xAuthMultiDiagEntry=rldot1xAuthMultiDiagEntry, rldot1xAuthMultiEntersConnecting=rldot1xAuthMultiEntersConnecting, rldot1x=rldot1x, rldot1xGuestVlanPorts=rldot1xGuestVlanPorts, rldot1xAuthMultiEapolReqIdFramesTx=rldot1xAuthMultiEapolReqIdFramesTx, rldot1xAuthMultiAuthEapStartsWhileAuthenticating=rldot1xAuthMultiAuthEapStartsWhileAuthenticating, rldot1xAuthMultiBackendNonNakResponsesFromSupplicant=rldot1xAuthMultiBackendNonNakResponsesFromSupplicant, rldot1xUnAuthenticatedVlanTable=rldot1xUnAuthenticatedVlanTable, rldot1xAuthMultiSessionRadiusAttrVlan=rldot1xAuthMultiSessionRadiusAttrVlan, rldot1xUnAuthenticatedVlanStatus=rldot1xUnAuthenticatedVlanStatus, rldot1xAuthMultiConfigEntry=rldot1xAuthMultiConfigEntry, rldot1xAuthMultiStatsTable=rldot1xAuthMultiStatsTable, rldot1xAuthMultiDiagTable=rldot1xAuthMultiDiagTable, rldot1xAuthenticationPortMethod=rldot1xAuthenticationPortMethod, rldot1xAuthMultiAuthFailWhileAuthenticating=rldot1xAuthMultiAuthFailWhileAuthenticating, rldot1xAuthMultiSessionStatsSourceMac=rldot1xAuthMultiSessionStatsSourceMac, rldot1xAuthMultiConfigTable=rldot1xAuthMultiConfigTable, rldot1xAuthMultiAuthEapStartsWhileAuthenticated=rldot1xAuthMultiAuthEapStartsWhileAuthenticated, rldot1xAuthMultiBackendResponses=rldot1xAuthMultiBackendResponses)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint')
(mac_address,) = mibBuilder.importSymbols('BRIDGE-MIB', 'MacAddress')
(rnd,) = mibBuilder.importSymbols('DLINK-3100-MIB', 'rnd')
(dot1x_pae_port_number, dot1x_auth_session_stats_entry, pae_controlled_port_status) = mibBuilder.importSymbols('IEEE8021-PAE-MIB', 'dot1xPaePortNumber', 'dot1xAuthSessionStatsEntry', 'PaeControlledPortStatus')
(vlan_index, dot1q_fdb_id, port_list) = mibBuilder.importSymbols('Q-BRIDGE-MIB', 'VlanIndex', 'dot1qFdbId', 'PortList')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(gauge32, object_identity, module_identity, bits, counter64, notification_type, counter32, time_ticks, integer32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, unsigned32, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'ObjectIdentity', 'ModuleIdentity', 'Bits', 'Counter64', 'NotificationType', 'Counter32', 'TimeTicks', 'Integer32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'Unsigned32', 'iso')
(textual_convention, truth_value, display_string, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString', 'RowStatus')
rldot1x = module_identity((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95))
rldot1x.setRevisions(('2007-01-02 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
rldot1x.setRevisionsDescriptions(('Initial revision.',))
if mibBuilder.loadTexts:
rldot1x.setLastUpdated('200701020000Z')
if mibBuilder.loadTexts:
rldot1x.setOrganization('Dlink, Inc. Dlink Semiconductor, Inc.')
if mibBuilder.loadTexts:
rldot1x.setContactInfo('www.dlink.com')
if mibBuilder.loadTexts:
rldot1x.setDescription('This private MIB module defines dot1x private MIBs.')
rldot1x_mib_version = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xMibVersion.setStatus('current')
if mibBuilder.loadTexts:
rldot1xMibVersion.setDescription("MIB's version, the current version is 1.")
rldot1x_ext_auth_session_stats_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2))
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsTable.setDescription('A table that contains the session statistics objects for the Authenticator PAE associated with each Port. An entry appears in this table for each port that may authenticate access to itself.')
rldot1x_ext_auth_session_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2, 1))
dot1xAuthSessionStatsEntry.registerAugmentions(('DLINK-3100-DOT1X-MIB', 'rldot1xExtAuthSessionStatsEntry'))
rldot1xExtAuthSessionStatsEntry.setIndexNames(*dot1xAuthSessionStatsEntry.getIndexNames())
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsEntry.setDescription('The session statistics information for an Authenticator PAE. This shows the current values being collected for each session that is still in progress, or the final values for the last valid session on each port where there is no session currently active.')
rl_dot1x_auth_session_authentic_method = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 2, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('remoteAuthServer', 1), ('localAuthServer', 2), ('none', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlDot1xAuthSessionAuthenticMethod.setStatus('current')
if mibBuilder.loadTexts:
rlDot1xAuthSessionAuthenticMethod.setDescription('The authentication method used to establish the session.')
rldot1x_guest_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 3), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xGuestVlanSupported.setStatus('current')
if mibBuilder.loadTexts:
rldot1xGuestVlanSupported.setDescription('indicate if guest vlan is supported.')
rldot1x_guest_vlan_vid = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 4), vlan_index()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanVID.setStatus('current')
if mibBuilder.loadTexts:
rldot1xGuestVlanVID.setDescription('specify the guest vlan tag , 0 for non exiting.')
rldot1x_guest_vlan_ports = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 5), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanPorts.setStatus('current')
if mibBuilder.loadTexts:
rldot1xGuestVlanPorts.setDescription('the ports that can be members in the guest vlan')
rldot1x_un_authenticated_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanSupported.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanSupported.setDescription('indicate if unauthenticated Vlan is supported.')
rldot1x_un_authenticated_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7))
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanTable.setDescription('port belong to vlan in all port authenticated state except force unauthenticated table')
rldot1x_un_authenticated_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7, 1)).setIndexNames((0, 'Q-BRIDGE-MIB', 'dot1qFdbId'))
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanEntry.setDescription(' port belong to vlan in all port authenticated state except force unauthenticated entry')
rldot1x_un_authenticated_vlan_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 7, 1, 1), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanStatus.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanStatus.setDescription('The row status variable, used according to row installation and removal conventions.')
rldot1x_user_based_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 8), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanSupported.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanSupported.setDescription('indicate if user based Vlan is supported.')
rldot1x_user_based_vlan_ports = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 9), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanPorts.setStatus('current')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanPorts.setDescription('the ports that can be members in the user based vlan')
rldot1x_authentication_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10))
if mibBuilder.loadTexts:
rldot1xAuthenticationPortTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthenticationPortTable.setDescription('A table of system level information for each port supported by the Port Access Entity. An entry appears in this table for each port of this system.')
rldot1x_authentication_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber'))
if mibBuilder.loadTexts:
rldot1xAuthenticationPortEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthenticationPortEntry.setDescription('The Port number and mac method')
rldot1x_authentication_port_method = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('eapolOnly', 1), ('macAndEapol', 2), ('macOnly', 3))).clone('eapolOnly')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xAuthenticationPortMethod.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthenticationPortMethod.setDescription('The value of the mac based authenication.')
rldot1x_radius_attr_vlan_id_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 2), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttrVlanIdEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xRadiusAttrVlanIdEnabled.setDescription('Defines if treat VLAN ID that received from Radius attributes in Radius-Accept message.')
rldot1x_radius_att_acl_name_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 10, 1, 3), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttAclNameEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xRadiusAttAclNameEnabled.setDescription('Defines if treat ACL Name that received from Radius attributes in Radius-Accept message.')
rldot1x_auth_multi_stats_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11))
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsTable.setReference('9.4.2 Authenticator Statistics')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsTable.setDescription('A table that contains the statistics objects for the Authenticator PAE associated with each Port and MAC for multisession 802.1x mode of operation. An entry appears in this table for each port and MAC that have an authentication session currently running under way for them.')
rldot1x_auth_multi_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1)).setIndexNames((0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiStatsPortNumber'), (0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiStatsSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsEntry.setDescription('The statistics information for an Authenticator PAE.')
rldot1x_auth_multi_stats_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsPortNumber.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsPortNumber.setDescription('Port Number.')
rldot1x_auth_multi_stats_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsSourceMac.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsSourceMac.setDescription('Mac of the authentication session.')
rldot1x_auth_multi_eapol_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesRx.setReference('9.4.2, EAPOL frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesRx.setDescription('The number of valid EAPOL frames of any type that have been received by this Authenticator.')
rldot1x_auth_multi_eapol_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesTx.setReference('9.4.2, EAPOL frames transmitted')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesTx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesTx.setDescription('The number of EAPOL frames of any type that have been transmitted by this Authenticator.')
rldot1x_auth_multi_eapol_start_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolStartFramesRx.setReference('9.4.2, EAPOL Start frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolStartFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolStartFramesRx.setDescription('The number of EAPOL Start frames that have been received by this Authenticator.')
rldot1x_auth_multi_eapol_logoff_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolLogoffFramesRx.setReference('9.4.2, EAPOL Logoff frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolLogoffFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolLogoffFramesRx.setDescription('The number of EAPOL Logoff frames that have been received by this Authenticator.')
rldot1x_auth_multi_eapol_resp_id_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespIdFramesRx.setReference('9.4.2, EAPOL Resp/Id frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespIdFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespIdFramesRx.setDescription('The number of EAP Resp/Id frames that have been received by this Authenticator.')
rldot1x_auth_multi_eapol_resp_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespFramesRx.setReference('9.4.2, EAPOL Response frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespFramesRx.setDescription('The number of valid EAP Response frames (other than Resp/Id frames) that have been received by this Authenticator.')
rldot1x_auth_multi_eapol_req_id_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqIdFramesTx.setReference('9.4.2, EAPOL Req/Id frames transmitted')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqIdFramesTx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqIdFramesTx.setDescription('The number of EAP Req/Id frames that have been transmitted by this Authenticator.')
rldot1x_auth_multi_eapol_req_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqFramesTx.setReference('9.4.2, EAPOL Request frames transmitted')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqFramesTx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqFramesTx.setDescription('The number of EAP Request frames (other than Rq/Id frames) that have been transmitted by this Authenticator.')
rldot1x_auth_multi_invalid_eapol_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiInvalidEapolFramesRx.setReference('9.4.2, Invalid EAPOL frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiInvalidEapolFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiInvalidEapolFramesRx.setDescription('The number of EAPOL frames that have been received by this Authenticator in which the frame type is not recognized.')
rldot1x_auth_multi_eap_length_error_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 11, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapLengthErrorFramesRx.setReference('9.4.2, EAP length error frames received')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapLengthErrorFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapLengthErrorFramesRx.setDescription('The number of EAPOL frames that have been received by this Authenticator in which the Packet Body Length field is invalid.')
rldot1x_auth_multi_diag_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12))
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagTable.setReference('9.4.3 Authenticator Diagnostics')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagTable.setDescription('A table that contains the diagnostics objects for the Authenticator PAE associated with each Port and MAC. An entry appears in this table for each port and MAC that have an authentication session currently running under way for them.')
rldot1x_auth_multi_diag_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1)).setIndexNames((0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiDiagPortNumber'), (0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiDiagSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagEntry.setDescription('The diagnostics information for an Authenticator PAE.')
rldot1x_auth_multi_diag_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagPortNumber.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagPortNumber.setDescription('Port Number.')
rldot1x_auth_multi_diag_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagSourceMac.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagSourceMac.setDescription('Mac of the authentication session.')
rldot1x_auth_multi_enters_connecting = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersConnecting.setReference('9.4.2, 8.5.4.2.1')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersConnecting.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersConnecting.setDescription('Counts the number of times that the state machine transitions to the CONNECTING state from any other state.')
rldot1x_auth_multi_enters_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersAuthenticating.setReference('9.4.2, 8.5.4.2.3')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersAuthenticating.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersAuthenticating.setDescription('Counts the number of times that the state machine transitions from CONNECTING to AUTHENTICATING, as a result of an EAP-Response/Identity message being received from the Supplicant.')
rldot1x_auth_multi_auth_success_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthSuccessWhileAuthenticating.setReference('9.4.2, 8.5.4.2.4')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthSuccessWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthSuccessWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to AUTHENTICATED, as a result of the Backend Authentication state machine indicating successful authentication of the Supplicant (authSuccess = TRUE).')
rldot1x_auth_multi_auth_fail_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthFailWhileAuthenticating.setReference('9.4.2, 8.5.4.2.6')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthFailWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthFailWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to HELD, as a result of the Backend Authentication state machine indicating authentication failure (authFail = TRUE).')
rldot1x_auth_multi_auth_reauths_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticating.setReference('9.4.2, 8.5.4.2.7')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to ABORTING, as a result of a reauthentication request (reAuthenticate = TRUE).')
rldot1x_auth_multi_auth_eap_starts_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setReference('9.4.2, 8.5.4.2.8')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATING to ABORTING, as a result of an EAPOL-Start message being received from the Supplicant.')
rldot1x_auth_multi_auth_reauths_while_authenticated = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticated.setReference('9.4.2, 8.5.4.2.10')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticated.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticated.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATED to CONNECTING, as a result of a reauthentication request (reAuthenticate = TRUE).')
rldot1x_auth_multi_auth_eap_starts_while_authenticated = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setReference('9.4.2, 8.5.4.2.11')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setDescription('Counts the number of times that the state machine transitions from AUTHENTICATED to CONNECTING, as a result of an EAPOL-Start message being received from the Supplicant.')
rldot1x_auth_multi_backend_responses = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendResponses.setReference('9.4.2, 8.5.6.2.1')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendResponses.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendResponses.setDescription('Counts the number of times that the state machine sends an initial Access-Request packet to the Authentication server (i.e., executes sendRespToServer on entry to the RESPONSE state). Indicates that the Authenticator attempted communication with the Authentication Server.')
rldot1x_auth_multi_backend_access_challenges = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAccessChallenges.setReference('9.4.2, 8.5.6.2.2')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAccessChallenges.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAccessChallenges.setDescription('Counts the number of times that the state machine receives an initial Access-Challenge packet from the Authentication server (i.e., aReq becomes TRUE, causing exit from the RESPONSE state). Indicates that the Authentication Server has communication with the Authenticator.')
rldot1x_auth_multi_backend_other_requests_to_supplicant = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendOtherRequestsToSupplicant.setReference('9.4.2, 8.5.6.2.3')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendOtherRequestsToSupplicant.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendOtherRequestsToSupplicant.setDescription('Counts the number of times that the state machine sends an EAP-Request packet (other than an Identity, Notification, Failure or Success message) to the Supplicant (i.e., executes txReq on entry to the REQUEST state). Indicates that the Authenticator chose an EAP-method.')
rldot1x_auth_multi_backend_non_nak_responses_from_supplicant = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setReference('9.4.2, 8.5.6.2.4')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setDescription('Counts the number of times that the state machine receives a response from the Supplicant to an initial EAP-Request, and the response is something other than EAP-NAK (i.e., rxResp becomes TRUE, causing the state machine to transition from REQUEST to RESPONSE, and the response is not an EAP-NAK). Indicates that the Supplicant can respond to the Authenticators chosen EAP-method.')
rldot1x_auth_multi_backend_auth_successes = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 12, 1, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthSuccesses.setReference('9.4.2, 8.5.6.2.5')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthSuccesses.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthSuccesses.setDescription('Counts the number of times that the state machine receives an EAP-Success message from the Authentication Server (i.e., aSuccess becomes TRUE, causing a transition from RESPONSE to SUCCESS). Indicates that the Supplicant has successfully authenticated to the Authentication Server.')
rldot1x_auth_multi_session_stats_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13))
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsTable.setReference('9.4.4')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsTable.setDescription('A table that contains the session statistics objects for the Authenticator PAE associated with each Port. An entry appears in this table for each port that may authenticate access to itself.')
rldot1x_auth_multi_session_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1)).setIndexNames((0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiSessionStatsPortNumber'), (0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiSessionStatsSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsEntry.setDescription('The session statistics information for an Authenticator PAE. This shows the current values being collected for each session that is still in progress, or the final values for the last valid session on each port where there is no session currently active.')
rldot1x_auth_multi_session_stats_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsPortNumber.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsPortNumber.setDescription('Port Number.')
rldot1x_auth_multi_session_stats_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsSourceMac.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsSourceMac.setDescription('Mac of the authentication session.')
rldot1x_auth_multi_session_octets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 3), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsRx.setReference('9.4.4, Session Octets Received')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsRx.setDescription('The number of octets received in user data frames on this Port during the session.')
rldot1x_auth_multi_session_octets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsTx.setReference('9.4.4, Session Octets Transmitted')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsTx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsTx.setDescription('The number of octets transmitted in user data frames on this Port during the session.')
rldot1x_auth_multi_session_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesRx.setReference('9.4.4, Session Frames Received')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesRx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesRx.setDescription('The number of user data frames received on this Port during the session.')
rldot1x_auth_multi_session_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesTx.setReference('9.4.4, Session Frames Transmitted')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesTx.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesTx.setDescription('The number of user data frames transmitted on this Port during the session.')
rldot1x_auth_multi_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 7), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionId.setReference('9.4.4, Session Identifier')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionId.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionId.setDescription('A unique identifier for the session, in the form of a printable ASCII string of at least three characters.')
rldot1x_auth_multi_session_time = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 8), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionTime.setReference('9.4.4, Session Time')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionTime.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionTime.setDescription('The duration of the session in seconds.')
rldot1x_auth_multi_session_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 9), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionUserName.setReference('9.4.4, Session User Name')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionUserName.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionUserName.setDescription('The User-Name representing the identity of the Supplicant PAE.')
rldot1x_auth_multi_session_radius_attr_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrVlan.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrVlan.setDescription('VLAN ID that received from Radius attributes.')
rldot1x_auth_multi_session_radius_attr_filter_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 13, 1, 11), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrFilterId.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrFilterId.setDescription('Filter ID that received from Radius attributes.')
rldot1x_auth_multi_config_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14))
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigTable.setReference('9.4.1 Authenticator Configuration')
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigTable.setDescription('A table that contains the configuration objects for the Authenticator PAE associated with each port and MAC. An entry appears in this table for each port and MAC that may authenticate access to itself.')
rldot1x_auth_multi_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1)).setIndexNames((0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiPortNumber'), (0, 'DLINK-3100-DOT1X-MIB', 'rldot1xAuthMultiSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigEntry.setDescription('The configuration information for an Authenticator PAE.')
rldot1x_auth_multi_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiPortNumber.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiPortNumber.setDescription('Port Number.')
rldot1x_auth_multi_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSourceMac.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiSourceMac.setDescription('Mac of the authentication session.')
rldot1x_auth_multi_pae_state = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('initialize', 1), ('disconnected', 2), ('connecting', 3), ('authenticating', 4), ('authenticated', 5), ('aborting', 6), ('held', 7), ('forceAuth', 8), ('forceUnauth', 9)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiPaeState.setReference('9.4.1, Authenticator PAE state')
if mibBuilder.loadTexts:
rldot1xAuthMultiPaeState.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiPaeState.setDescription('The current value of the Authenticator PAE state machine.')
rldot1x_auth_multi_backend_auth_state = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('request', 1), ('response', 2), ('success', 3), ('fail', 4), ('timeout', 5), ('idle', 6), ('initialize', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthState.setReference('9.4.1, Backend Authentication state')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthState.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthState.setDescription('The current state of the Backend Authentication state machine.')
rldot1x_auth_multi_controlled_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 14, 1, 5), pae_controlled_port_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiControlledPortStatus.setReference('9.4.1, AuthControlledPortStatus')
if mibBuilder.loadTexts:
rldot1xAuthMultiControlledPortStatus.setStatus('current')
if mibBuilder.loadTexts:
rldot1xAuthMultiControlledPortStatus.setDescription('The current value of the controlled Port status parameter for the Port.')
rldot1x_bpdu_filtering_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 15), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xBpduFilteringEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xBpduFilteringEnabled.setDescription('Specify that when 802.1x is globally disabled, 802.1x BPDU packets would be filtered or bridged.')
rldot1x_radius_attributes_errors_acl_reject = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 18), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttributesErrorsAclReject.setStatus('current')
if mibBuilder.loadTexts:
rldot1xRadiusAttributesErrorsAclReject.setDescription('Specify ACL error handling for the Radius attributes feature.')
rldot1x_guest_vlan_time_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 19), integer32().subtype(subtypeSpec=value_range_constraint(0, 180))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanTimeInterval.setStatus('current')
if mibBuilder.loadTexts:
rldot1xGuestVlanTimeInterval.setDescription('indicate the guest vlan timeout interval.')
rldot1x_mac_auth_success_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 20), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacAuthSuccessTrapEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xMacAuthSuccessTrapEnabled.setDescription('Specify if sending traps when a MAC address is successfully authenticated by the 802.1X mac-authentication access control.')
rldot1x_mac_auth_failure_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 21), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacAuthFailureTrapEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xMacAuthFailureTrapEnabled.setDescription('Specify if sending traps when MAC address was failed in authentication of the 802.1X MAC authentication access control.')
rldot1x_legacy_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22))
if mibBuilder.loadTexts:
rldot1xLegacyPortTable.setStatus('current')
if mibBuilder.loadTexts:
rldot1xLegacyPortTable.setDescription('A table of system level information for each port supported by the Port Access Entity. An entry appears in this table for each port of this system.')
rldot1x_legacy_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber'))
if mibBuilder.loadTexts:
rldot1xLegacyPortEntry.setStatus('current')
if mibBuilder.loadTexts:
rldot1xLegacyPortEntry.setDescription('The Port number and leagcy mode')
rldot1x_legacy_port_mode_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 94, 89, 89, 95, 22, 1, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xLegacyPortModeEnabled.setStatus('current')
if mibBuilder.loadTexts:
rldot1xLegacyPortModeEnabled.setDescription('Indicates whether in multiple sessions mode work according to legacy devices mode or not.')
mibBuilder.exportSymbols('DLINK-3100-DOT1X-MIB', rldot1xAuthMultiEapolReqFramesTx=rldot1xAuthMultiEapolReqFramesTx, rldot1xAuthMultiAuthSuccessWhileAuthenticating=rldot1xAuthMultiAuthSuccessWhileAuthenticating, rldot1xAuthMultiSessionStatsEntry=rldot1xAuthMultiSessionStatsEntry, rldot1xUserBasedVlanPorts=rldot1xUserBasedVlanPorts, rldot1xAuthMultiSessionTime=rldot1xAuthMultiSessionTime, rldot1xAuthMultiEntersAuthenticating=rldot1xAuthMultiEntersAuthenticating, rldot1xMibVersion=rldot1xMibVersion, rldot1xAuthMultiEapLengthErrorFramesRx=rldot1xAuthMultiEapLengthErrorFramesRx, rldot1xAuthMultiStatsSourceMac=rldot1xAuthMultiStatsSourceMac, rldot1xLegacyPortTable=rldot1xLegacyPortTable, rldot1xAuthMultiControlledPortStatus=rldot1xAuthMultiControlledPortStatus, rldot1xAuthMultiBackendAuthSuccesses=rldot1xAuthMultiBackendAuthSuccesses, rldot1xAuthMultiSessionStatsPortNumber=rldot1xAuthMultiSessionStatsPortNumber, rldot1xAuthMultiEapolFramesTx=rldot1xAuthMultiEapolFramesTx, rldot1xRadiusAttributesErrorsAclReject=rldot1xRadiusAttributesErrorsAclReject, rldot1xAuthMultiStatsPortNumber=rldot1xAuthMultiStatsPortNumber, rldot1xAuthMultiEapolRespFramesRx=rldot1xAuthMultiEapolRespFramesRx, rldot1xMacAuthFailureTrapEnabled=rldot1xMacAuthFailureTrapEnabled, rldot1xGuestVlanTimeInterval=rldot1xGuestVlanTimeInterval, rldot1xUserBasedVlanSupported=rldot1xUserBasedVlanSupported, rldot1xLegacyPortModeEnabled=rldot1xLegacyPortModeEnabled, rldot1xRadiusAttrVlanIdEnabled=rldot1xRadiusAttrVlanIdEnabled, rldot1xAuthMultiSessionOctetsTx=rldot1xAuthMultiSessionOctetsTx, rldot1xGuestVlanSupported=rldot1xGuestVlanSupported, rldot1xAuthenticationPortTable=rldot1xAuthenticationPortTable, rldot1xAuthMultiSessionFramesTx=rldot1xAuthMultiSessionFramesTx, rldot1xExtAuthSessionStatsTable=rldot1xExtAuthSessionStatsTable, rldot1xAuthMultiSessionUserName=rldot1xAuthMultiSessionUserName, rldot1xAuthMultiSessionRadiusAttrFilterId=rldot1xAuthMultiSessionRadiusAttrFilterId, rldot1xAuthMultiPaeState=rldot1xAuthMultiPaeState, rldot1xAuthMultiBackendOtherRequestsToSupplicant=rldot1xAuthMultiBackendOtherRequestsToSupplicant, rldot1xAuthMultiPortNumber=rldot1xAuthMultiPortNumber, rldot1xAuthMultiInvalidEapolFramesRx=rldot1xAuthMultiInvalidEapolFramesRx, rldot1xAuthMultiAuthReauthsWhileAuthenticating=rldot1xAuthMultiAuthReauthsWhileAuthenticating, rldot1xUnAuthenticatedVlanSupported=rldot1xUnAuthenticatedVlanSupported, rldot1xAuthMultiBackendAccessChallenges=rldot1xAuthMultiBackendAccessChallenges, rldot1xAuthMultiBackendAuthState=rldot1xAuthMultiBackendAuthState, rldot1xAuthMultiDiagSourceMac=rldot1xAuthMultiDiagSourceMac, rldot1xAuthMultiEapolRespIdFramesRx=rldot1xAuthMultiEapolRespIdFramesRx, rldot1xAuthMultiSessionFramesRx=rldot1xAuthMultiSessionFramesRx, rldot1xMacAuthSuccessTrapEnabled=rldot1xMacAuthSuccessTrapEnabled, rldot1xAuthMultiEapolStartFramesRx=rldot1xAuthMultiEapolStartFramesRx, PYSNMP_MODULE_ID=rldot1x, rldot1xAuthMultiSourceMac=rldot1xAuthMultiSourceMac, rldot1xBpduFilteringEnabled=rldot1xBpduFilteringEnabled, rldot1xLegacyPortEntry=rldot1xLegacyPortEntry, rldot1xAuthMultiSessionId=rldot1xAuthMultiSessionId, rldot1xExtAuthSessionStatsEntry=rldot1xExtAuthSessionStatsEntry, rldot1xUnAuthenticatedVlanEntry=rldot1xUnAuthenticatedVlanEntry, rldot1xAuthMultiSessionOctetsRx=rldot1xAuthMultiSessionOctetsRx, rldot1xAuthMultiAuthReauthsWhileAuthenticated=rldot1xAuthMultiAuthReauthsWhileAuthenticated, rldot1xAuthMultiDiagPortNumber=rldot1xAuthMultiDiagPortNumber, rldot1xAuthMultiStatsEntry=rldot1xAuthMultiStatsEntry, rldot1xAuthMultiEapolFramesRx=rldot1xAuthMultiEapolFramesRx, rldot1xAuthMultiSessionStatsTable=rldot1xAuthMultiSessionStatsTable, rlDot1xAuthSessionAuthenticMethod=rlDot1xAuthSessionAuthenticMethod, rldot1xAuthenticationPortEntry=rldot1xAuthenticationPortEntry, rldot1xAuthMultiEapolLogoffFramesRx=rldot1xAuthMultiEapolLogoffFramesRx, rldot1xGuestVlanVID=rldot1xGuestVlanVID, rldot1xRadiusAttAclNameEnabled=rldot1xRadiusAttAclNameEnabled, rldot1xAuthMultiDiagEntry=rldot1xAuthMultiDiagEntry, rldot1xAuthMultiEntersConnecting=rldot1xAuthMultiEntersConnecting, rldot1x=rldot1x, rldot1xGuestVlanPorts=rldot1xGuestVlanPorts, rldot1xAuthMultiEapolReqIdFramesTx=rldot1xAuthMultiEapolReqIdFramesTx, rldot1xAuthMultiAuthEapStartsWhileAuthenticating=rldot1xAuthMultiAuthEapStartsWhileAuthenticating, rldot1xAuthMultiBackendNonNakResponsesFromSupplicant=rldot1xAuthMultiBackendNonNakResponsesFromSupplicant, rldot1xUnAuthenticatedVlanTable=rldot1xUnAuthenticatedVlanTable, rldot1xAuthMultiSessionRadiusAttrVlan=rldot1xAuthMultiSessionRadiusAttrVlan, rldot1xUnAuthenticatedVlanStatus=rldot1xUnAuthenticatedVlanStatus, rldot1xAuthMultiConfigEntry=rldot1xAuthMultiConfigEntry, rldot1xAuthMultiStatsTable=rldot1xAuthMultiStatsTable, rldot1xAuthMultiDiagTable=rldot1xAuthMultiDiagTable, rldot1xAuthenticationPortMethod=rldot1xAuthenticationPortMethod, rldot1xAuthMultiAuthFailWhileAuthenticating=rldot1xAuthMultiAuthFailWhileAuthenticating, rldot1xAuthMultiSessionStatsSourceMac=rldot1xAuthMultiSessionStatsSourceMac, rldot1xAuthMultiConfigTable=rldot1xAuthMultiConfigTable, rldot1xAuthMultiAuthEapStartsWhileAuthenticated=rldot1xAuthMultiAuthEapStartsWhileAuthenticated, rldot1xAuthMultiBackendResponses=rldot1xAuthMultiBackendResponses) |
def is_subsequence(str1, str2):
if len(str1) == 0:
return True
if len(str2) == 0:
return False
index = 0
current = str1[index]
for letter in str2:
if letter == current:
index += 1
if len(str1) == index:
return True
current = str1[index]
return False
def main():
str1 = input().strip()
str2 = input().strip()
print(is_subsequence(str1, str2))
if __name__ == '__main__':
main()
| def is_subsequence(str1, str2):
if len(str1) == 0:
return True
if len(str2) == 0:
return False
index = 0
current = str1[index]
for letter in str2:
if letter == current:
index += 1
if len(str1) == index:
return True
current = str1[index]
return False
def main():
str1 = input().strip()
str2 = input().strip()
print(is_subsequence(str1, str2))
if __name__ == '__main__':
main() |
class InvalidMilvagoClassException(Exception):
"""Used when an invalid Milvago instance
has been passed."""
class InvalidMediaType(Exception):
"""Used when an invalid content-type
has been passed.""" | class Invalidmilvagoclassexception(Exception):
"""Used when an invalid Milvago instance
has been passed."""
class Invalidmediatype(Exception):
"""Used when an invalid content-type
has been passed.""" |
"""Rules for building Jekyll based websites.
"""
load(
"@kruemelmann_rules_jekyll//jekyll:jekyll.bzl",
_jekyll_build = "jekyll_build_rule",
)
load(
"@kruemelmann_rules_jekyll//jekyll/private:jekyll_repositories.bzl",
_jekyll_repositories = "jekyll_repositories",
)
jekyll_build = _jekyll_build
jekyll_repositories = _jekyll_repositories
| """Rules for building Jekyll based websites.
"""
load('@kruemelmann_rules_jekyll//jekyll:jekyll.bzl', _jekyll_build='jekyll_build_rule')
load('@kruemelmann_rules_jekyll//jekyll/private:jekyll_repositories.bzl', _jekyll_repositories='jekyll_repositories')
jekyll_build = _jekyll_build
jekyll_repositories = _jekyll_repositories |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 9 2019
@author: emilia_chojak
@e-mail: emilia.chojak@gmail.com
"""
seq = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
cut_motif = "GAATTC" #G*AATTC so it will be cut between G and A
cut_index = seq.find(cut_motif)+1
first_fragment = len(seq[:cut_index])
second_fragment = len(seq[cut_index:])
print(first_fragment, second_fragment) | """
Created on Mon Dec 9 2019
@author: emilia_chojak
@e-mail: emilia.chojak@gmail.com
"""
seq = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT'
cut_motif = 'GAATTC'
cut_index = seq.find(cut_motif) + 1
first_fragment = len(seq[:cut_index])
second_fragment = len(seq[cut_index:])
print(first_fragment, second_fragment) |
__author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/28/2020 10:55 PM'
class Solution:
def shortestPalindrome(self, s: str) -> str:
i, j = 0, len(s)
if_palindrome = lambda item: item == item[::-1]
while 0 < j:
if if_palindrome(s[i: j]):
break
else:
j -= 1
pre = []
if j == 0:
pre = list(s[::-1])
else:
pre = list(s[j:])[::-1]
pre.extend(list(s))
return "".join(pre)
if __name__ == '__main__':
ss = "abcd"
res = Solution().shortestPalindrome(ss)
print(res)
| __author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/28/2020 10:55 PM'
class Solution:
def shortest_palindrome(self, s: str) -> str:
(i, j) = (0, len(s))
if_palindrome = lambda item: item == item[::-1]
while 0 < j:
if if_palindrome(s[i:j]):
break
else:
j -= 1
pre = []
if j == 0:
pre = list(s[::-1])
else:
pre = list(s[j:])[::-1]
pre.extend(list(s))
return ''.join(pre)
if __name__ == '__main__':
ss = 'abcd'
res = solution().shortestPalindrome(ss)
print(res) |
# basic types
'hello' # str
True # bool
None # null
4 # int
2.5 # float
0. # ...
1j # complex
[1,2,3] # list
(1,2,3) # tuple
range(4) # range
{'a','b','c'} # set
frozenset({'a','b'}) # frozenset
{'a': 'foo', 'b': 4} # dict
b'hello' # bytes
bytearray(5) # bytearray
memoryview(bytes(5)) # memoryview
# type fns
str('Hello World') # str
int(20) # int
float(20.5) # float
complex(1j) # complex
list(('a','b','c')) # list
tuple(('a','b','c')) # tuple
range(6) # range
dict(name='John', age=36)# dict
set(('a','b','c')) # set
frozenset(('a','b','c')) # frozenset
bool(5) # bool
bytes(5) # bytes
bytearray(5) # bytearray
memoryview(bytes(5)) # memoryview
# type coercion
str(25) # '25'
int('25') # 25
float('12.34') # 12.34
if None or 0 or 0.0 or '' or [] or {} or set():
print('dead code') # not reached | """hello"""
True
None
4
2.5
0.0
1j
[1, 2, 3]
(1, 2, 3)
range(4)
{'a', 'b', 'c'}
frozenset({'a', 'b'})
{'a': 'foo', 'b': 4}
b'hello'
bytearray(5)
memoryview(bytes(5))
str('Hello World')
int(20)
float(20.5)
complex(1j)
list(('a', 'b', 'c'))
tuple(('a', 'b', 'c'))
range(6)
dict(name='John', age=36)
set(('a', 'b', 'c'))
frozenset(('a', 'b', 'c'))
bool(5)
bytes(5)
bytearray(5)
memoryview(bytes(5))
str(25)
int('25')
float('12.34')
if None or 0 or 0.0 or '' or [] or {} or set():
print('dead code') |
#
# PySNMP MIB module Brcm-adapterInfo-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Brcm-adapterInfo-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:42:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Bits, TimeTicks, MibIdentifier, Counter32, IpAddress, Unsigned32, enterprises, Gauge32, ModuleIdentity, ObjectIdentity, Integer32, iso, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "TimeTicks", "MibIdentifier", "Counter32", "IpAddress", "Unsigned32", "enterprises", "Gauge32", "ModuleIdentity", "ObjectIdentity", "Integer32", "iso", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64")
DisplayString, TextualConvention, PhysAddress = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "PhysAddress")
broadcom = MibIdentifier((1, 3, 6, 1, 4, 1, 4413))
enet = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1))
basp = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 2))
ifControllers = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 3))
baspConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 1))
baspStat = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 2))
baspTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 3))
class InetAddressType(TextualConvention, Integer32):
description = 'A value that represents a type of Internet address. unknown(0) An unknown address type. This value MUST be used if the value of the corresponding InetAddress object is a zero-length string. It may also be used to indicate an IP address that is not in one of the formats defined below. ipv4(1) An IPv4 address as defined by the InetAddressIPv4 textual convention. ipv6(2) An IPv6 address as defined by the InetAddressIPv6 textual convention. ipv4z(3) A non-global IPv4 address including a zone index as defined by the InetAddressIPv4z textual convention. ipv6z(4) A non-global IPv6 address including a zone index as defined by the InetAddressIPv6z textual convention. dns(16) A DNS domain name as defined by the InetAddressDNS textual convention. Each definition of a concrete InetAddressType value must be accompanied by a definition of a textual convention for use with that InetAddressType. To support future extensions, the InetAddressType textual convention SHOULD NOT be sub-typed in object type definitions. It MAY be sub-typed in compliance statements in order to require only a subset of these address types for a compliant implementation. Implementations must ensure that InetAddressType objects and any dependent objects (e.g., InetAddress objects) are consistent. An inconsistentValue error must be generated if an attempt to change an InetAddressType object would, for example, lead to an undefined InetAddress value. In particular, InetAddressType/InetAddress pairs must be changed together if the address type changes (e.g., from ipv6(2) to ipv4(1)).'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 16))
namedValues = NamedValues(("unknown", 0), ("ipv4", 1), ("ipv6", 2), ("ipv4z", 3), ("ipv6z", 4), ("dns", 16))
class InetAddress(TextualConvention, OctetString):
description = "Denotes a generic Internet address. An InetAddress value is always interpreted within the context of an InetAddressType value. Every usage of the InetAddress textual convention is required to specify the InetAddressType object that provides the context. It is suggested that the InetAddressType object be logically registered before the object(s) that use the InetAddress textual convention, if they appear in the same logical row. The value of an InetAddress object must always be consistent with the value of the associated InetAddressType object. Attempts to set an InetAddress object to a value inconsistent with the associated InetAddressType must fail with an inconsistentValue error. When this textual convention is used as the syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the object definition MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers; otherwise the applicable constraints MUST be stated in the appropriate conceptual row DESCRIPTION clauses, or in the surrounding documentation if there is no single DESCRIPTION clause that is appropriate."
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
class InetAddressIPv4(TextualConvention, OctetString):
description = 'Represents an IPv4 network address: Octets Contents Encoding 1-4 IPv4 address network-byte order The corresponding InetAddressType value is ipv4(1). This textual convention SHOULD NOT be used directly in object definitions, as it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with InetAddressType, as a pair.'
status = 'current'
displayHint = '1d.1d.1d.1d'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(4, 4)
fixedLength = 4
class InetAddressIPv6(TextualConvention, OctetString):
description = 'Represents an IPv6 network address: Octets Contents Encoding 1-16 IPv6 address network-byte order The corresponding InetAddressType value is ipv6(2). This textual convention SHOULD NOT be used directly in object definitions, as it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with InetAddressType, as a pair.'
status = 'current'
displayHint = '2x:2x:2x:2x:2x:2x:2x:2x'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(16, 16)
fixedLength = 16
ifNumber = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 3, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifNumber.setStatus('mandatory')
if mibBuilder.loadTexts: ifNumber.setDescription('The number of Broadcom network interfaces (regardless of their current state) present on this system.')
ifTable = MibTable((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2), )
if mibBuilder.loadTexts: ifTable.setStatus('mandatory')
if mibBuilder.loadTexts: ifTable.setDescription('A list of Broadcom network interface entries. The number of entries is given by the ifNumber.')
ifEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1), ).setIndexNames((0, "Brcm-adapterInfo-MIB", "ifIndex"))
if mibBuilder.loadTexts: ifEntry.setStatus('mandatory')
if mibBuilder.loadTexts: ifEntry.setDescription('An entry containing statistics objects of a Broadcom network interface in this system.')
ifIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifIndex.setStatus('mandatory')
if mibBuilder.loadTexts: ifIndex.setDescription("An unique value for each Broadcom interface. The value for each interface must remain constant at least from one re-initialization of the entity's network management system to the next re- initialization.")
ifName = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifName.setStatus('mandatory')
if mibBuilder.loadTexts: ifName.setDescription(' A textual string containing name of the adapter or team')
ifDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifDescr.setStatus('mandatory')
if mibBuilder.loadTexts: ifDescr.setDescription(' A textual string containing the adapter or team description')
ifNetworkAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifNetworkAddress.setStatus('mandatory')
if mibBuilder.loadTexts: ifNetworkAddress.setDescription('IP address of the adapter.')
ifSubnetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifSubnetMask.setStatus('mandatory')
if mibBuilder.loadTexts: ifSubnetMask.setDescription('IP subnet Mask of the adapter.')
ifPhysAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 6), PhysAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifPhysAddress.setStatus('mandatory')
if mibBuilder.loadTexts: ifPhysAddress.setDescription('MAC address of the adapter.')
ifPermPhysAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 7), PhysAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifPermPhysAddress.setStatus('mandatory')
if mibBuilder.loadTexts: ifPermPhysAddress.setDescription('Permanent MAC address of the adapter.')
ifLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("link-up", 1), ("link-fail", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifLinkStatus.setStatus('mandatory')
if mibBuilder.loadTexts: ifLinkStatus.setDescription(' Adapter link status, this information only applicable to the Broadcom adapter')
ifState = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("normal-mode", 1), ("diagnotic-mode", 2), ("adapter-removed", 3), ("lowpower-mode", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifState.setStatus('mandatory')
if mibBuilder.loadTexts: ifState.setDescription('The operating mode of the driver, this information only applicable to the Broadcom adapter')
ifLineSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("speed-10-Mbps", 2), ("speed-100-Mbps", 3), ("speed-1000-Mbps", 4), ("speed-2500-Mbps", 5), ("speed-10-Gbps", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifLineSpeed.setStatus('mandatory')
if mibBuilder.loadTexts: ifLineSpeed.setDescription(' The operating speed of the adapter, this information only applicable to the Broadcom adapter')
ifDuplexMode = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("half-duplex", 2), ("full-duplex", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifDuplexMode.setStatus('mandatory')
if mibBuilder.loadTexts: ifDuplexMode.setDescription(' Adapter duplex mode, this information only applicable to the Broadcom adapter')
ifMemBaseLow = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifMemBaseLow.setStatus('mandatory')
if mibBuilder.loadTexts: ifMemBaseLow.setDescription(' memory low range of the adapter, this information only applicable to the Broadcom adapter')
ifMemBaseHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 13), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifMemBaseHigh.setStatus('mandatory')
if mibBuilder.loadTexts: ifMemBaseHigh.setDescription(' memory high range of the adapter, this information only applicable to the Broadcom adapter')
ifInterrupt = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifInterrupt.setStatus('mandatory')
if mibBuilder.loadTexts: ifInterrupt.setDescription(' IRQ value for the adapter, this information only applicable to the Broadcom adapter')
ifBusNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifBusNumber.setStatus('mandatory')
if mibBuilder.loadTexts: ifBusNumber.setDescription(' PCI Bus Number where the Adapter is situated, this information only applicable to the Broadcom adapter')
ifDeviceNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifDeviceNumber.setStatus('mandatory')
if mibBuilder.loadTexts: ifDeviceNumber.setDescription(' PCI Device Number of the adapter, this information only applicable to the Broadcom adapter')
ifFunctionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifFunctionNumber.setStatus('mandatory')
if mibBuilder.loadTexts: ifFunctionNumber.setDescription(' PCI Function Number of the adapter, this information only applicable to the Broadcom adapter')
ifIpv6NetworkAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 18), InetAddressIPv6()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifIpv6NetworkAddress.setStatus('mandatory')
if mibBuilder.loadTexts: ifIpv6NetworkAddress.setDescription('IPv6 address of the adapter.')
mibBuilder.exportSymbols("Brcm-adapterInfo-MIB", InetAddressIPv4=InetAddressIPv4, baspTrap=baspTrap, ifState=ifState, ifFunctionNumber=ifFunctionNumber, ifName=ifName, ifBusNumber=ifBusNumber, ifEntry=ifEntry, ifPhysAddress=ifPhysAddress, baspStat=baspStat, ifMemBaseLow=ifMemBaseLow, ifNetworkAddress=ifNetworkAddress, ifDuplexMode=ifDuplexMode, ifLineSpeed=ifLineSpeed, ifSubnetMask=ifSubnetMask, ifNumber=ifNumber, ifControllers=ifControllers, ifIndex=ifIndex, ifDescr=ifDescr, broadcom=broadcom, ifPermPhysAddress=ifPermPhysAddress, ifInterrupt=ifInterrupt, InetAddressType=InetAddressType, baspConfig=baspConfig, ifTable=ifTable, ifLinkStatus=ifLinkStatus, basp=basp, InetAddress=InetAddress, InetAddressIPv6=InetAddressIPv6, ifIpv6NetworkAddress=ifIpv6NetworkAddress, ifMemBaseHigh=ifMemBaseHigh, ifDeviceNumber=ifDeviceNumber, enet=enet)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_size_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ValueRangeConstraint')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(bits, time_ticks, mib_identifier, counter32, ip_address, unsigned32, enterprises, gauge32, module_identity, object_identity, integer32, iso, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'TimeTicks', 'MibIdentifier', 'Counter32', 'IpAddress', 'Unsigned32', 'enterprises', 'Gauge32', 'ModuleIdentity', 'ObjectIdentity', 'Integer32', 'iso', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64')
(display_string, textual_convention, phys_address) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention', 'PhysAddress')
broadcom = mib_identifier((1, 3, 6, 1, 4, 1, 4413))
enet = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1))
basp = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 2))
if_controllers = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 3))
basp_config = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 1))
basp_stat = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 2))
basp_trap = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 2, 3))
class Inetaddresstype(TextualConvention, Integer32):
description = 'A value that represents a type of Internet address. unknown(0) An unknown address type. This value MUST be used if the value of the corresponding InetAddress object is a zero-length string. It may also be used to indicate an IP address that is not in one of the formats defined below. ipv4(1) An IPv4 address as defined by the InetAddressIPv4 textual convention. ipv6(2) An IPv6 address as defined by the InetAddressIPv6 textual convention. ipv4z(3) A non-global IPv4 address including a zone index as defined by the InetAddressIPv4z textual convention. ipv6z(4) A non-global IPv6 address including a zone index as defined by the InetAddressIPv6z textual convention. dns(16) A DNS domain name as defined by the InetAddressDNS textual convention. Each definition of a concrete InetAddressType value must be accompanied by a definition of a textual convention for use with that InetAddressType. To support future extensions, the InetAddressType textual convention SHOULD NOT be sub-typed in object type definitions. It MAY be sub-typed in compliance statements in order to require only a subset of these address types for a compliant implementation. Implementations must ensure that InetAddressType objects and any dependent objects (e.g., InetAddress objects) are consistent. An inconsistentValue error must be generated if an attempt to change an InetAddressType object would, for example, lead to an undefined InetAddress value. In particular, InetAddressType/InetAddress pairs must be changed together if the address type changes (e.g., from ipv6(2) to ipv4(1)).'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 16))
named_values = named_values(('unknown', 0), ('ipv4', 1), ('ipv6', 2), ('ipv4z', 3), ('ipv6z', 4), ('dns', 16))
class Inetaddress(TextualConvention, OctetString):
description = "Denotes a generic Internet address. An InetAddress value is always interpreted within the context of an InetAddressType value. Every usage of the InetAddress textual convention is required to specify the InetAddressType object that provides the context. It is suggested that the InetAddressType object be logically registered before the object(s) that use the InetAddress textual convention, if they appear in the same logical row. The value of an InetAddress object must always be consistent with the value of the associated InetAddressType object. Attempts to set an InetAddress object to a value inconsistent with the associated InetAddressType must fail with an inconsistentValue error. When this textual convention is used as the syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the object definition MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers; otherwise the applicable constraints MUST be stated in the appropriate conceptual row DESCRIPTION clauses, or in the surrounding documentation if there is no single DESCRIPTION clause that is appropriate."
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 255)
class Inetaddressipv4(TextualConvention, OctetString):
description = 'Represents an IPv4 network address: Octets Contents Encoding 1-4 IPv4 address network-byte order The corresponding InetAddressType value is ipv4(1). This textual convention SHOULD NOT be used directly in object definitions, as it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with InetAddressType, as a pair.'
status = 'current'
display_hint = '1d.1d.1d.1d'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(4, 4)
fixed_length = 4
class Inetaddressipv6(TextualConvention, OctetString):
description = 'Represents an IPv6 network address: Octets Contents Encoding 1-16 IPv6 address network-byte order The corresponding InetAddressType value is ipv6(2). This textual convention SHOULD NOT be used directly in object definitions, as it restricts addresses to a specific format. However, if it is used, it MAY be used either on its own or in conjunction with InetAddressType, as a pair.'
status = 'current'
display_hint = '2x:2x:2x:2x:2x:2x:2x:2x'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(16, 16)
fixed_length = 16
if_number = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 3, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
ifNumber.setDescription('The number of Broadcom network interfaces (regardless of their current state) present on this system.')
if_table = mib_table((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2))
if mibBuilder.loadTexts:
ifTable.setStatus('mandatory')
if mibBuilder.loadTexts:
ifTable.setDescription('A list of Broadcom network interface entries. The number of entries is given by the ifNumber.')
if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1)).setIndexNames((0, 'Brcm-adapterInfo-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
ifEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
ifEntry.setDescription('An entry containing statistics objects of a Broadcom network interface in this system.')
if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
ifIndex.setDescription("An unique value for each Broadcom interface. The value for each interface must remain constant at least from one re-initialization of the entity's network management system to the next re- initialization.")
if_name = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifName.setStatus('mandatory')
if mibBuilder.loadTexts:
ifName.setDescription(' A textual string containing name of the adapter or team')
if_descr = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifDescr.setStatus('mandatory')
if mibBuilder.loadTexts:
ifDescr.setDescription(' A textual string containing the adapter or team description')
if_network_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifNetworkAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
ifNetworkAddress.setDescription('IP address of the adapter.')
if_subnet_mask = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 5), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifSubnetMask.setStatus('mandatory')
if mibBuilder.loadTexts:
ifSubnetMask.setDescription('IP subnet Mask of the adapter.')
if_phys_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 6), phys_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifPhysAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
ifPhysAddress.setDescription('MAC address of the adapter.')
if_perm_phys_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 7), phys_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifPermPhysAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
ifPermPhysAddress.setDescription('Permanent MAC address of the adapter.')
if_link_status = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('link-up', 1), ('link-fail', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifLinkStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
ifLinkStatus.setDescription(' Adapter link status, this information only applicable to the Broadcom adapter')
if_state = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('normal-mode', 1), ('diagnotic-mode', 2), ('adapter-removed', 3), ('lowpower-mode', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifState.setStatus('mandatory')
if mibBuilder.loadTexts:
ifState.setDescription('The operating mode of the driver, this information only applicable to the Broadcom adapter')
if_line_speed = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unknown', 1), ('speed-10-Mbps', 2), ('speed-100-Mbps', 3), ('speed-1000-Mbps', 4), ('speed-2500-Mbps', 5), ('speed-10-Gbps', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifLineSpeed.setStatus('mandatory')
if mibBuilder.loadTexts:
ifLineSpeed.setDescription(' The operating speed of the adapter, this information only applicable to the Broadcom adapter')
if_duplex_mode = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('unknown', 1), ('half-duplex', 2), ('full-duplex', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifDuplexMode.setStatus('mandatory')
if mibBuilder.loadTexts:
ifDuplexMode.setDescription(' Adapter duplex mode, this information only applicable to the Broadcom adapter')
if_mem_base_low = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 12), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifMemBaseLow.setStatus('mandatory')
if mibBuilder.loadTexts:
ifMemBaseLow.setDescription(' memory low range of the adapter, this information only applicable to the Broadcom adapter')
if_mem_base_high = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 13), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifMemBaseHigh.setStatus('mandatory')
if mibBuilder.loadTexts:
ifMemBaseHigh.setDescription(' memory high range of the adapter, this information only applicable to the Broadcom adapter')
if_interrupt = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifInterrupt.setStatus('mandatory')
if mibBuilder.loadTexts:
ifInterrupt.setDescription(' IRQ value for the adapter, this information only applicable to the Broadcom adapter')
if_bus_number = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 15), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifBusNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
ifBusNumber.setDescription(' PCI Bus Number where the Adapter is situated, this information only applicable to the Broadcom adapter')
if_device_number = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 16), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifDeviceNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
ifDeviceNumber.setDescription(' PCI Device Number of the adapter, this information only applicable to the Broadcom adapter')
if_function_number = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 17), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifFunctionNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
ifFunctionNumber.setDescription(' PCI Function Number of the adapter, this information only applicable to the Broadcom adapter')
if_ipv6_network_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 3, 2, 1, 18), inet_address_i_pv6()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifIpv6NetworkAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
ifIpv6NetworkAddress.setDescription('IPv6 address of the adapter.')
mibBuilder.exportSymbols('Brcm-adapterInfo-MIB', InetAddressIPv4=InetAddressIPv4, baspTrap=baspTrap, ifState=ifState, ifFunctionNumber=ifFunctionNumber, ifName=ifName, ifBusNumber=ifBusNumber, ifEntry=ifEntry, ifPhysAddress=ifPhysAddress, baspStat=baspStat, ifMemBaseLow=ifMemBaseLow, ifNetworkAddress=ifNetworkAddress, ifDuplexMode=ifDuplexMode, ifLineSpeed=ifLineSpeed, ifSubnetMask=ifSubnetMask, ifNumber=ifNumber, ifControllers=ifControllers, ifIndex=ifIndex, ifDescr=ifDescr, broadcom=broadcom, ifPermPhysAddress=ifPermPhysAddress, ifInterrupt=ifInterrupt, InetAddressType=InetAddressType, baspConfig=baspConfig, ifTable=ifTable, ifLinkStatus=ifLinkStatus, basp=basp, InetAddress=InetAddress, InetAddressIPv6=InetAddressIPv6, ifIpv6NetworkAddress=ifIpv6NetworkAddress, ifMemBaseHigh=ifMemBaseHigh, ifDeviceNumber=ifDeviceNumber, enet=enet) |
#grading system
print("grading system")
s=float(input("Enter marks of the student"))
if(s>90 and s<=100):
print("grade=A")
elif(s>80 and s<=90):
print("grade=B")
elif(s>70 and s<=80):
print("grade=c")
elif(s>60 and s<=70):
print("grade=d")
elif(s>50 and s<=60):
print("grade=e")
elif(s<40):
print("grade=fail")
else:
print("invalid input") | print('grading system')
s = float(input('Enter marks of the student'))
if s > 90 and s <= 100:
print('grade=A')
elif s > 80 and s <= 90:
print('grade=B')
elif s > 70 and s <= 80:
print('grade=c')
elif s > 60 and s <= 70:
print('grade=d')
elif s > 50 and s <= 60:
print('grade=e')
elif s < 40:
print('grade=fail')
else:
print('invalid input') |
result = ""
summe = 0
while(True):
nums = input().split(" ")
M = int(nums[0])
N = int(nums[1])
if(M <= 0 or N <= 0):
break
if(M > N):
for i in range(N,M+1):
result += str(i)+" "
summe += i
else:
for i in range(M,N+1):
result += str(i)+" "
summe += i
result += "Sum="+str(summe)
print(result)
result = ""
summe = 0 | result = ''
summe = 0
while True:
nums = input().split(' ')
m = int(nums[0])
n = int(nums[1])
if M <= 0 or N <= 0:
break
if M > N:
for i in range(N, M + 1):
result += str(i) + ' '
summe += i
else:
for i in range(M, N + 1):
result += str(i) + ' '
summe += i
result += 'Sum=' + str(summe)
print(result)
result = ''
summe = 0 |
n = int(input())
x = 1
for _ in range(n, 0, -1):
print(' '*_ + '*'*x)
x=x+2
_ = _-1
| n = int(input())
x = 1
for _ in range(n, 0, -1):
print(' ' * _ + '*' * x)
x = x + 2
_ = _ - 1 |
class Cat:
def __init__(self, name) -> None:
self.name = name
def __str__(self) -> str:
return f"Meow {self.name}!"
| class Cat:
def __init__(self, name) -> None:
self.name = name
def __str__(self) -> str:
return f'Meow {self.name}!' |
RECORDS =[
{
'name': 'Cluster 1',
'number_of_nodes': 5,
'node_type': 'm5.xlarge',
'region': 'us-west-1'
},
{
'name': 'Cluster 2',
'number_of_nodes': 6,
'node_type': 'm5.large',
'region': 'eu-west-1'
},
{
'name': 'Cluster 3',
'number_of_nodes': 13,
'node_type': 'm5.24xlarge',
'region': 'us-east-3'
},
{
'name': 'Cluster 4',
'number_of_nodes': 2,
'node_type': 'm4.xlarge',
'region': 'us-west-1'
},
{
'name': 'Cluster 5',
'number_of_nodes': 4,
'node_type': 't2.large',
'region': 'ap-northeast-1'
},
]
| records = [{'name': 'Cluster 1', 'number_of_nodes': 5, 'node_type': 'm5.xlarge', 'region': 'us-west-1'}, {'name': 'Cluster 2', 'number_of_nodes': 6, 'node_type': 'm5.large', 'region': 'eu-west-1'}, {'name': 'Cluster 3', 'number_of_nodes': 13, 'node_type': 'm5.24xlarge', 'region': 'us-east-3'}, {'name': 'Cluster 4', 'number_of_nodes': 2, 'node_type': 'm4.xlarge', 'region': 'us-west-1'}, {'name': 'Cluster 5', 'number_of_nodes': 4, 'node_type': 't2.large', 'region': 'ap-northeast-1'}] |
'''
Write a Python program print every second character(Even) from a string.
'''
string=input()
final=''
for i in range(1,len(string),2):
final+=string[i]
print(final) | """
Write a Python program print every second character(Even) from a string.
"""
string = input()
final = ''
for i in range(1, len(string), 2):
final += string[i]
print(final) |
# Bubble Sort
# Find the largest element A[i], reverse A[0:i+1], making the current largest at the head of the array, then reverse the whole array to make A[i] at the bottom.
# Do the above again and again, finally we'll have the whole array sorted.
# eg:
# [3,1,4,2] (input array)
# [4,1,3,2] -> [2,3,1,4] (current maximum 4 is placed at the bottom)
# [3,2,1,4] -> [1,2,3,4] (current maximum 3 is placed at the bottom)
# [2,1,3,4] -> [1,2,3,4] (current maximum 2 is placed at the bottom)
# [1,2,3,4] -> [1,2,3,4] (current maximum 1 is placed at the bottom)
# done!
class Solution:
def pancakeSort(self, arr: List[int]) -> List[int]:
n = len(arr)
res = []
for i in range(n):
# find max from first n-i elements
cur_max = max(arr[0:n-i])
j = 0
# find the index of this max value
while arr[j] != cur_max:
j += 1
# j is the index of the max value, there are j+1 elements until the max
# reverse first j+1 elements
arr[:j+1] = reversed(arr[:j+1])
res.append(j+1)
# reverse all first n - i elements
arr[:n-i] = reversed(arr[:n-i])
res.append(n-i)
return res
# Time: O(N^2)
# Space:O(N) | class Solution:
def pancake_sort(self, arr: List[int]) -> List[int]:
n = len(arr)
res = []
for i in range(n):
cur_max = max(arr[0:n - i])
j = 0
while arr[j] != cur_max:
j += 1
arr[:j + 1] = reversed(arr[:j + 1])
res.append(j + 1)
arr[:n - i] = reversed(arr[:n - i])
res.append(n - i)
return res |
def get_truncated_str(str_: str, _max_len: int = 80) -> str:
truncated_str = str_[:_max_len]
if len(str_) > _max_len:
return truncated_str[:-5] + '[...]'
return truncated_str
| def get_truncated_str(str_: str, _max_len: int=80) -> str:
truncated_str = str_[:_max_len]
if len(str_) > _max_len:
return truncated_str[:-5] + '[...]'
return truncated_str |
au_cities = (('Wollongong', 150.902, -34.4245),
('Shellharbour', 150.87, -34.5789),
('Thirroul', 150.924, -34.3147),
('Mittagong', 150.449, -34.4509),
('Batemans Bay', 150.175, -35.7082),
('Canberra', 144.963, -37.8143),
('Melbourne', 145.963, -37.8143),
('Sydney', 151.26071, -33.887034),
('Hobart', 147.33, -42.8827),
('Adelaide', 138.6, -34.9258),
('Hillsdale', 151.231341, -33.952685),
)
stx_cities = (('Downtown Houston', -95.363151, 29.763374),
('West University Place', -95.448601, 29.713803),
('Southside Place', -95.436920, 29.705777),
('Bellaire', -95.458732, 29.705614),
('Pearland', -95.287303, 29.563568),
('Galveston', -94.797489, 29.301336),
('Sealy', -96.156952, 29.780918),
('San Antonio', -98.493183, 29.424170),
('Saint Hedwig', -98.199820, 29.414197),
)
# Data from U.S. Census ZCTA cartographic boundary file for Texas (`zt48_d00.shp`).
stx_zips = (('77002', 'POLYGON ((-95.365015 29.772327, -95.362415 29.772327, -95.360915 29.771827, -95.354615 29.771827, -95.351515 29.772527, -95.350915 29.765327, -95.351015 29.762436, -95.350115 29.760328, -95.347515 29.758528, -95.352315 29.753928, -95.356415 29.756328, -95.358215 29.754028, -95.360215 29.756328, -95.363415 29.757128, -95.364014 29.75638, -95.363415 29.753928, -95.360015 29.751828, -95.361815 29.749528, -95.362715 29.750028, -95.367516 29.744128, -95.369316 29.745128, -95.373916 29.744128, -95.380116 29.738028, -95.387916 29.727929, -95.388516 29.729629, -95.387916 29.732129, -95.382916 29.737428, -95.376616 29.742228, -95.372616 29.747228, -95.378601 29.750846, -95.378616 29.752028, -95.378616 29.754428, -95.376016 29.754528, -95.374616 29.759828, -95.373616 29.761128, -95.371916 29.763928, -95.372316 29.768727, -95.365884 29.76791, -95.366015 29.767127, -95.358715 29.765327, -95.358615 29.766327, -95.359115 29.767227, -95.360215 29.767027, -95.362783 29.768267, -95.365315 29.770527, -95.365015 29.772327))'),
('77005', 'POLYGON ((-95.447918 29.727275, -95.428017 29.728729, -95.421117 29.729029, -95.418617 29.727629, -95.418517 29.726429, -95.402117 29.726629, -95.402117 29.725729, -95.395316 29.725729, -95.391916 29.726229, -95.389716 29.725829, -95.396517 29.715429, -95.397517 29.715929, -95.400917 29.711429, -95.411417 29.715029, -95.418417 29.714729, -95.418317 29.70623, -95.440818 29.70593, -95.445018 29.70683, -95.446618 29.70763, -95.447418 29.71003, -95.447918 29.727275))'),
('77025', 'POLYGON ((-95.418317 29.70623, -95.414717 29.706129, -95.414617 29.70533, -95.418217 29.70533, -95.419817 29.69533, -95.419484 29.694196, -95.417166 29.690901, -95.414517 29.69433, -95.413317 29.69263, -95.412617 29.68973, -95.412817 29.68753, -95.414087 29.685055, -95.419165 29.685428, -95.421617 29.68513, -95.425717 29.67983, -95.425017 29.67923, -95.424517 29.67763, -95.427418 29.67763, -95.438018 29.664631, -95.436713 29.664411, -95.440118 29.662231, -95.439218 29.661031, -95.437718 29.660131, -95.435718 29.659731, -95.431818 29.660331, -95.441418 29.656631, -95.441318 29.656331, -95.441818 29.656131, -95.441718 29.659031, -95.441118 29.661031, -95.446718 29.656431, -95.446518 29.673431, -95.446918 29.69013, -95.447418 29.71003, -95.446618 29.70763, -95.445018 29.70683, -95.440818 29.70593, -95.418317 29.70623))'),
('77401', 'POLYGON ((-95.447918 29.727275, -95.447418 29.71003, -95.446918 29.69013, -95.454318 29.68893, -95.475819 29.68903, -95.475819 29.69113, -95.484419 29.69103, -95.484519 29.69903, -95.480419 29.70133, -95.480419 29.69833, -95.474119 29.69833, -95.474119 29.70453, -95.472719 29.71283, -95.468019 29.71293, -95.468219 29.720229, -95.464018 29.720229, -95.464118 29.724529, -95.463018 29.725929, -95.459818 29.726129, -95.459918 29.720329, -95.451418 29.720429, -95.451775 29.726303, -95.451318 29.727029, -95.447918 29.727275))'),
)
interstates = (('I-25', 'LINESTRING(-104.4780170766108 36.66698791870694, -104.4468522338495 36.79925409393386, -104.46212692626 36.9372149776075, -104.5126119783768 37.08163268820887, -104.5247764602161 37.29300499892048, -104.7084397427668 37.49150259925398, -104.8126599016282 37.69514285621863, -104.8452887035466 37.87613395659479, -104.7160169341003 38.05951763337799, -104.6165437927668 38.30432045855106, -104.6437227858174 38.53979986564737, -104.7596170387259 38.7322907594295, -104.8380078676822 38.89998460604341, -104.8501253693506 39.09980189213358, -104.8791648316464 39.24368776457503, -104.8635041274215 39.3785278162751, -104.8894471170052 39.5929228239605, -104.9721242843344 39.69528482419685, -105.0112104500356 39.7273080432394, -105.0010368577104 39.76677607811571, -104.981835619 39.81466504121967, -104.9858891550477 39.88806911250832, -104.9873548059578 39.98117234571016, -104.9766220487419 40.09796423450692, -104.9818565932953 40.36056530662884, -104.9912746373997 40.74904484447656)'),
)
stx_interstates = (('I-10', 'LINESTRING(924952.5 4220931.6,925065.3 4220931.6,929568.4 4221057.8)'),
)
| au_cities = (('Wollongong', 150.902, -34.4245), ('Shellharbour', 150.87, -34.5789), ('Thirroul', 150.924, -34.3147), ('Mittagong', 150.449, -34.4509), ('Batemans Bay', 150.175, -35.7082), ('Canberra', 144.963, -37.8143), ('Melbourne', 145.963, -37.8143), ('Sydney', 151.26071, -33.887034), ('Hobart', 147.33, -42.8827), ('Adelaide', 138.6, -34.9258), ('Hillsdale', 151.231341, -33.952685))
stx_cities = (('Downtown Houston', -95.363151, 29.763374), ('West University Place', -95.448601, 29.713803), ('Southside Place', -95.43692, 29.705777), ('Bellaire', -95.458732, 29.705614), ('Pearland', -95.287303, 29.563568), ('Galveston', -94.797489, 29.301336), ('Sealy', -96.156952, 29.780918), ('San Antonio', -98.493183, 29.42417), ('Saint Hedwig', -98.19982, 29.414197))
stx_zips = (('77002', 'POLYGON ((-95.365015 29.772327, -95.362415 29.772327, -95.360915 29.771827, -95.354615 29.771827, -95.351515 29.772527, -95.350915 29.765327, -95.351015 29.762436, -95.350115 29.760328, -95.347515 29.758528, -95.352315 29.753928, -95.356415 29.756328, -95.358215 29.754028, -95.360215 29.756328, -95.363415 29.757128, -95.364014 29.75638, -95.363415 29.753928, -95.360015 29.751828, -95.361815 29.749528, -95.362715 29.750028, -95.367516 29.744128, -95.369316 29.745128, -95.373916 29.744128, -95.380116 29.738028, -95.387916 29.727929, -95.388516 29.729629, -95.387916 29.732129, -95.382916 29.737428, -95.376616 29.742228, -95.372616 29.747228, -95.378601 29.750846, -95.378616 29.752028, -95.378616 29.754428, -95.376016 29.754528, -95.374616 29.759828, -95.373616 29.761128, -95.371916 29.763928, -95.372316 29.768727, -95.365884 29.76791, -95.366015 29.767127, -95.358715 29.765327, -95.358615 29.766327, -95.359115 29.767227, -95.360215 29.767027, -95.362783 29.768267, -95.365315 29.770527, -95.365015 29.772327))'), ('77005', 'POLYGON ((-95.447918 29.727275, -95.428017 29.728729, -95.421117 29.729029, -95.418617 29.727629, -95.418517 29.726429, -95.402117 29.726629, -95.402117 29.725729, -95.395316 29.725729, -95.391916 29.726229, -95.389716 29.725829, -95.396517 29.715429, -95.397517 29.715929, -95.400917 29.711429, -95.411417 29.715029, -95.418417 29.714729, -95.418317 29.70623, -95.440818 29.70593, -95.445018 29.70683, -95.446618 29.70763, -95.447418 29.71003, -95.447918 29.727275))'), ('77025', 'POLYGON ((-95.418317 29.70623, -95.414717 29.706129, -95.414617 29.70533, -95.418217 29.70533, -95.419817 29.69533, -95.419484 29.694196, -95.417166 29.690901, -95.414517 29.69433, -95.413317 29.69263, -95.412617 29.68973, -95.412817 29.68753, -95.414087 29.685055, -95.419165 29.685428, -95.421617 29.68513, -95.425717 29.67983, -95.425017 29.67923, -95.424517 29.67763, -95.427418 29.67763, -95.438018 29.664631, -95.436713 29.664411, -95.440118 29.662231, -95.439218 29.661031, -95.437718 29.660131, -95.435718 29.659731, -95.431818 29.660331, -95.441418 29.656631, -95.441318 29.656331, -95.441818 29.656131, -95.441718 29.659031, -95.441118 29.661031, -95.446718 29.656431, -95.446518 29.673431, -95.446918 29.69013, -95.447418 29.71003, -95.446618 29.70763, -95.445018 29.70683, -95.440818 29.70593, -95.418317 29.70623))'), ('77401', 'POLYGON ((-95.447918 29.727275, -95.447418 29.71003, -95.446918 29.69013, -95.454318 29.68893, -95.475819 29.68903, -95.475819 29.69113, -95.484419 29.69103, -95.484519 29.69903, -95.480419 29.70133, -95.480419 29.69833, -95.474119 29.69833, -95.474119 29.70453, -95.472719 29.71283, -95.468019 29.71293, -95.468219 29.720229, -95.464018 29.720229, -95.464118 29.724529, -95.463018 29.725929, -95.459818 29.726129, -95.459918 29.720329, -95.451418 29.720429, -95.451775 29.726303, -95.451318 29.727029, -95.447918 29.727275))'))
interstates = (('I-25', 'LINESTRING(-104.4780170766108 36.66698791870694, -104.4468522338495 36.79925409393386, -104.46212692626 36.9372149776075, -104.5126119783768 37.08163268820887, -104.5247764602161 37.29300499892048, -104.7084397427668 37.49150259925398, -104.8126599016282 37.69514285621863, -104.8452887035466 37.87613395659479, -104.7160169341003 38.05951763337799, -104.6165437927668 38.30432045855106, -104.6437227858174 38.53979986564737, -104.7596170387259 38.7322907594295, -104.8380078676822 38.89998460604341, -104.8501253693506 39.09980189213358, -104.8791648316464 39.24368776457503, -104.8635041274215 39.3785278162751, -104.8894471170052 39.5929228239605, -104.9721242843344 39.69528482419685, -105.0112104500356 39.7273080432394, -105.0010368577104 39.76677607811571, -104.981835619 39.81466504121967, -104.9858891550477 39.88806911250832, -104.9873548059578 39.98117234571016, -104.9766220487419 40.09796423450692, -104.9818565932953 40.36056530662884, -104.9912746373997 40.74904484447656)'),)
stx_interstates = (('I-10', 'LINESTRING(924952.5 4220931.6,925065.3 4220931.6,929568.4 4221057.8)'),) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"get_pandas": "01_klass.ipynb",
"avled_tverrvar": "03_sporre.ipynb",
"df": "04_proc.ipynb",
"freq": "04_proc.ipynb"}
modules = ["klass.py",
"sporre.py",
"proc.py"]
doc_url = "https://statisticsnorway.github.io/ssb_fellesfunksjoner_360//ssb_fellesfunksjoner_360/"
git_url = "https://github.com/statisticsnorway/ssb_fellesfunksjoner_360/"
def custom_doc_links(name): return None
| __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'get_pandas': '01_klass.ipynb', 'avled_tverrvar': '03_sporre.ipynb', 'df': '04_proc.ipynb', 'freq': '04_proc.ipynb'}
modules = ['klass.py', 'sporre.py', 'proc.py']
doc_url = 'https://statisticsnorway.github.io/ssb_fellesfunksjoner_360//ssb_fellesfunksjoner_360/'
git_url = 'https://github.com/statisticsnorway/ssb_fellesfunksjoner_360/'
def custom_doc_links(name):
return None |
# tb retorna valores booleanos
set_1 = {1,2,3,4,5,6,7}
set_2 = {0,3,4,5,6,7,8,9}
set_3={1,2,3,4,7,0,9}
print(set_1)
print(set_2)
print(set_3)
set_4={77,33}
print(set_4)
print(set_2.isdisjoint(set_3))
print(set_3.isdisjoint(set_1))
print(set_3.isdisjoint(set_4)) | set_1 = {1, 2, 3, 4, 5, 6, 7}
set_2 = {0, 3, 4, 5, 6, 7, 8, 9}
set_3 = {1, 2, 3, 4, 7, 0, 9}
print(set_1)
print(set_2)
print(set_3)
set_4 = {77, 33}
print(set_4)
print(set_2.isdisjoint(set_3))
print(set_3.isdisjoint(set_1))
print(set_3.isdisjoint(set_4)) |
# fail history: I tried so much because memory limit error(MLE)
# it is better to process a number than a string
T = int(input())
def solution(N):
A = 0
B = 0
if N % 2 == 0:
A, B = N//2, N//2
else:
A, B = N//2+1, (N//2)
_A = A
_B = B
len_N = len(str(N))
for i in range(len_N):
if _A % 10 == 4 or _B % 10 == 4:
A += 2*10**i
B -= 2*10**i
_A //= 10
_B //= 10
return A, B
for i in range(1, T+1):
N = int(input())
A, B = solution(N)
print(f"Case #{i}: {A} {B}") | t = int(input())
def solution(N):
a = 0
b = 0
if N % 2 == 0:
(a, b) = (N // 2, N // 2)
else:
(a, b) = (N // 2 + 1, N // 2)
_a = A
_b = B
len_n = len(str(N))
for i in range(len_N):
if _A % 10 == 4 or _B % 10 == 4:
a += 2 * 10 ** i
b -= 2 * 10 ** i
_a //= 10
_b //= 10
return (A, B)
for i in range(1, T + 1):
n = int(input())
(a, b) = solution(N)
print(f'Case #{i}: {A} {B}') |
class Solution:
def reversePrefix(self, word: str, ch: str) -> str:
if(ch in word):
return ch+word.split(ch, 1)[0][::-1]+word.split(ch, 1)[1]
else:
return word
| class Solution:
def reverse_prefix(self, word: str, ch: str) -> str:
if ch in word:
return ch + word.split(ch, 1)[0][::-1] + word.split(ch, 1)[1]
else:
return word |
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
candidates.sort()
return self.adding(candidates, 0, target, [])
def adding(self, candidates, startIndex, target, output):
if target == 0:
return [output]
if target < candidates[startIndex]:
return []
result = []
for i in range(startIndex, len(candidates)):
num = candidates[i]
result += self.adding(candidates, i, target - num, output + [num])
return result | class Solution(object):
def combination_sum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
candidates.sort()
return self.adding(candidates, 0, target, [])
def adding(self, candidates, startIndex, target, output):
if target == 0:
return [output]
if target < candidates[startIndex]:
return []
result = []
for i in range(startIndex, len(candidates)):
num = candidates[i]
result += self.adding(candidates, i, target - num, output + [num])
return result |
'''
QUESTION:
125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For the purpose of this problem, we define empty string as valid palindrome.
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: true
Example 2:
Input: "race a car"
Output: false
'''
class Solution(object):
def isPalindrome(self, s):
char_list = []
for c in s:
if c.isalnum():
char_list.append(c)
left_index = 0
right_index = len(char_list) - 1
while (left_index < right_index):
if char_list[left_index].upper() != char_list[right_index].upper():
return False
else:
left_index += 1
right_index -= 1
return True
'''
Ideas/thoughts:
make a lst with the characters adding only alphanum
check if the left and right characters are equal
''' | """
QUESTION:
125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For the purpose of this problem, we define empty string as valid palindrome.
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: true
Example 2:
Input: "race a car"
Output: false
"""
class Solution(object):
def is_palindrome(self, s):
char_list = []
for c in s:
if c.isalnum():
char_list.append(c)
left_index = 0
right_index = len(char_list) - 1
while left_index < right_index:
if char_list[left_index].upper() != char_list[right_index].upper():
return False
else:
left_index += 1
right_index -= 1
return True
'\nIdeas/thoughts:\nmake a lst with the characters adding only alphanum\ncheck if the left and right characters are equal\n\n' |
"""Top-level package for pre-dl."""
__author__ = """skylight-hm"""
__email__ = '465784936@qq.com'
__version__ = '0.1.0'
| """Top-level package for pre-dl."""
__author__ = 'skylight-hm'
__email__ = '465784936@qq.com'
__version__ = '0.1.0' |
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$May 18, 2015 22:05:20 EDT$"
| __author__ = 'John Kirkham <kirkhamj@janelia.hhmi.org>'
__date__ = '$May 18, 2015 22:05:20 EDT$' |
#!/usr/bin/env python
#
# This is the Python 'module' that contains the
# disposition criteria for Yara and jq filters the scanner framework
# will work on. Each member is the name of a
# high fidelity detection.
#
# default - Modules that are always run on a returned buffer value
# triggers - List of tuples that are configured to drive the flow of execution
# as the file itself it scanned recursively. They consist of Yara rule names
# that (if evaluated to true) may then run zero, one or more modules and optionally
# set the alert flag.
# post_processor - List of tuples that are configured to capture observations
# concerning the JSON output. These consist of jq filters that ultimately produce
# a boolean value dictating if a given condition is true. If 'true' then the
# observation is captured and the alert flag is optionally set.
default = ['META_BASIC_INFO',
'EXTRACT_EMBEDDED',
'SCAN_YARA']
# STRUCTURE: List of tuples such that...
# Types: [('string', 'list', boolean'), ...]
# Variables: [('rule name', ['module_1' , 'module_2'] , 'alert_flag'), ...]
triggers = [('ft_zip', ['EXTRACT_ZIP'], False),
('ft_exe', ['META_PE'], False),
('ft_rar', ['EXTRACT_RAR'], False),
('ft_ole_cf', ['META_OLECF', 'EXTRACT_VBA_MACRO'], False),
('ft_pdf', ['META_PDF'], False),
('misc_ooxml_core_properties', ['META_OOXML'], False),
('ft_swf', ['EXTRACT_SWF'], False),
('misc_upx_packed_binary', ['EXTRACT_UPX'], False),
('ft_rtf', ['EXTRACT_RTF_OBJ'], False),
('ft_tar', ['EXTRACT_TAR'], False),
('ft_gzip', ['EXTRACT_GZIP'], False),
('misc_pe_signature', ['META_PE_SIGNATURE'], False),
('ft_cab', ['EXTRACT_CAB'], False),
('ft_elf', ['META_ELF'], False),
('ft_java_class', ['META_JAVA_CLASS'], False),
('misc_hexascii_pe_in_html', ['EXTRACT_HEXASCII_PE'], False),
('misc_no_dosmode_header', '', False),
('ft_macho', ['META_MACHO'], False),
]
# STRUCTURE: List of tuples such that...
# Types: [('string', 'string', boolean'), ...]
# Variables: [('jq script', 'observation' , 'alert_flag'), ...]
post_processor = [('one_module.jq', 'Only one kind of module was run on for this report.', False),
('no_yara_hits.jq', 'There doesn\'t appear to be any Yara signature hits for this scan.', False),
('exe_in_zip.jq', 'An executable was found inside a ZIP file.', False),
('embedded_sfx_rar_w_exe.jq', 'An embedded file contained a self-extracting RAR that itself contained an executable payload.', False),
('many_objects.jq', 'More than 10 unique objects were observed in this file.', False),
('vt_match_found.jq', 'At least one file was found to have results in VirusTotal\'s database.', False),
('vt_match_not_found.jq', 'There were no matches found when VirusTotal was queried.', False),
('macro_gt_five_suspicious.jq', 'A macro was found with more than five suspicious traits.', False),
('vt_broadbased_detections_found.jq', 'Some AV products have detected this as a PUP threat.', False),
('vt_exploit_detections_found.jq', 'Some AV products have detected this as an exploit.', False),
('more_than_ten_yara.jq', 'More than 10 unique Yara signatures fired when processing this file!', False),
('fresh_vt_scan.jq', 'One of the VirusTotal results contains an object that was scanned less than 24 hours ago.', False),
('pe_recently_compiled.jq', 'An executable has a compile time less than a week old.', False),
]
| default = ['META_BASIC_INFO', 'EXTRACT_EMBEDDED', 'SCAN_YARA']
triggers = [('ft_zip', ['EXTRACT_ZIP'], False), ('ft_exe', ['META_PE'], False), ('ft_rar', ['EXTRACT_RAR'], False), ('ft_ole_cf', ['META_OLECF', 'EXTRACT_VBA_MACRO'], False), ('ft_pdf', ['META_PDF'], False), ('misc_ooxml_core_properties', ['META_OOXML'], False), ('ft_swf', ['EXTRACT_SWF'], False), ('misc_upx_packed_binary', ['EXTRACT_UPX'], False), ('ft_rtf', ['EXTRACT_RTF_OBJ'], False), ('ft_tar', ['EXTRACT_TAR'], False), ('ft_gzip', ['EXTRACT_GZIP'], False), ('misc_pe_signature', ['META_PE_SIGNATURE'], False), ('ft_cab', ['EXTRACT_CAB'], False), ('ft_elf', ['META_ELF'], False), ('ft_java_class', ['META_JAVA_CLASS'], False), ('misc_hexascii_pe_in_html', ['EXTRACT_HEXASCII_PE'], False), ('misc_no_dosmode_header', '', False), ('ft_macho', ['META_MACHO'], False)]
post_processor = [('one_module.jq', 'Only one kind of module was run on for this report.', False), ('no_yara_hits.jq', "There doesn't appear to be any Yara signature hits for this scan.", False), ('exe_in_zip.jq', 'An executable was found inside a ZIP file.', False), ('embedded_sfx_rar_w_exe.jq', 'An embedded file contained a self-extracting RAR that itself contained an executable payload.', False), ('many_objects.jq', 'More than 10 unique objects were observed in this file.', False), ('vt_match_found.jq', "At least one file was found to have results in VirusTotal's database.", False), ('vt_match_not_found.jq', 'There were no matches found when VirusTotal was queried.', False), ('macro_gt_five_suspicious.jq', 'A macro was found with more than five suspicious traits.', False), ('vt_broadbased_detections_found.jq', 'Some AV products have detected this as a PUP threat.', False), ('vt_exploit_detections_found.jq', 'Some AV products have detected this as an exploit.', False), ('more_than_ten_yara.jq', 'More than 10 unique Yara signatures fired when processing this file!', False), ('fresh_vt_scan.jq', 'One of the VirusTotal results contains an object that was scanned less than 24 hours ago.', False), ('pe_recently_compiled.jq', 'An executable has a compile time less than a week old.', False)] |
# authorization user not abonement
class AutopaymentMailRu(object):
def __init__(self, driver):
self.driver = driver
def enter_email(self, user_name="autopayment@mail.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
# registration user buy subscription
class PaymentnotMailRu(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name="payment.not@mail.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def reg_enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
# registration user with abonement
class PaymNotYandexRu(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name="paym.not@yandex.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def reg_enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
def enter_email(self, user_name="paym.not@yandex.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
# registration user with abonement
class VratchGlavYandexRu(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name="vratch.glav@yandex.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def reg_enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
def enter_email(self, user_name="vratch.glav@yandex.ru"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
# authorization admin user
class Admin(object):
def __init__(self, driver):
self.driver = driver
def enter_email(self, user_name):
self.driver.find_element_by_name("user[email]").clear()
self.driver.find_element_by_name("user[email]").send_keys("%s" % user_name)
def enter_password(self, password):
self.driver.find_element_by_id("user_password").clear()
self.driver.find_element_by_id("user_password").send_keys("%s" % password)
class IuUseryopmail(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name="iuuser@yopmail.com"):
self.driver.find_element_by_xpath("//div/label[1]/input").send_keys(user_name)
def reg_enter_password(self, password="123456"):
self.driver.find_element_by_xpath("//div/label[2]/input").send_keys(password)
| class Autopaymentmailru(object):
def __init__(self, driver):
self.driver = driver
def enter_email(self, user_name='autopayment@mail.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
class Paymentnotmailru(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name='payment.not@mail.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def reg_enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
class Paymnotyandexru(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name='paym.not@yandex.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def reg_enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
def enter_email(self, user_name='paym.not@yandex.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
class Vratchglavyandexru(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name='vratch.glav@yandex.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def reg_enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
def enter_email(self, user_name='vratch.glav@yandex.ru'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password)
class Admin(object):
def __init__(self, driver):
self.driver = driver
def enter_email(self, user_name):
self.driver.find_element_by_name('user[email]').clear()
self.driver.find_element_by_name('user[email]').send_keys('%s' % user_name)
def enter_password(self, password):
self.driver.find_element_by_id('user_password').clear()
self.driver.find_element_by_id('user_password').send_keys('%s' % password)
class Iuuseryopmail(object):
def __init__(self, driver):
self.driver = driver
def reg_enter_email(self, user_name='iuuser@yopmail.com'):
self.driver.find_element_by_xpath('//div/label[1]/input').send_keys(user_name)
def reg_enter_password(self, password='123456'):
self.driver.find_element_by_xpath('//div/label[2]/input').send_keys(password) |
class CalculateVarianceService:
def __init__(self, rows):
self.rows = rows
def call(self):
"""
Calculate the variance of numbers in the result column
"""
if not len(self.rows):
return 0
data = [float(row[-1]) for row in self.rows]
mean = sum(data) / len(data)
variance = sum([(d - mean) ** 2 for d in data]) / len(data)
return variance
| class Calculatevarianceservice:
def __init__(self, rows):
self.rows = rows
def call(self):
"""
Calculate the variance of numbers in the result column
"""
if not len(self.rows):
return 0
data = [float(row[-1]) for row in self.rows]
mean = sum(data) / len(data)
variance = sum([(d - mean) ** 2 for d in data]) / len(data)
return variance |
src = Split('''
port.c
portISR.c
port_aos.c
startup.c
panic.c
backtrace.c
vectors.S
os_cpu_a.S
''')
component = aos_component('andes', src)
component.add_global_includes('./include')
| src = split('\n port.c\n portISR.c\n port_aos.c\n\t\tstartup.c\n panic.c\n backtrace.c\n vectors.S\n os_cpu_a.S\n')
component = aos_component('andes', src)
component.add_global_includes('./include') |
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
def twoSum(i,j):
target2 = target - nums[i] - nums[j]
left = j+1
right = n-1
while left < right:
total = nums[left] + nums[right]
if total == target2:
result.append([nums[i], nums[j], nums[left], nums[right]])
left += 1
while left < right and nums[left] == nums[left-1]:
left += 1
elif total < target2:
left += 1
else:
right -= 1
nums.sort()
n = len(nums)
i=0
result = []
while i < n-3:
if i>0 and nums[i] == nums[i-1]:
i += 1
continue
j = i+1
while j < n-2:
if j > i+1 and nums[j] == nums[j-1]:
j+=1
continue
twoSum(i, j)
j+=1
i += 1
return result
| class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
def two_sum(i, j):
target2 = target - nums[i] - nums[j]
left = j + 1
right = n - 1
while left < right:
total = nums[left] + nums[right]
if total == target2:
result.append([nums[i], nums[j], nums[left], nums[right]])
left += 1
while left < right and nums[left] == nums[left - 1]:
left += 1
elif total < target2:
left += 1
else:
right -= 1
nums.sort()
n = len(nums)
i = 0
result = []
while i < n - 3:
if i > 0 and nums[i] == nums[i - 1]:
i += 1
continue
j = i + 1
while j < n - 2:
if j > i + 1 and nums[j] == nums[j - 1]:
j += 1
continue
two_sum(i, j)
j += 1
i += 1
return result |
class CraigslistApartmentListing:
def __init__(self):
self.properties = {
"datapid": None,
"datetime": None,
"title": None,
"housing" : None,
"ft" : None,
"ad_url" : None,
"hood" : None,
"zipcode" : None,
"bedrooms" : None,
"bathrooms" : None,
"price" : None,
"map_location" : None
}
def __setitem__(self, key, value):
self.properties[key] = value
def __getitem__(self, key):
return self.properties[key]
def __str__(self):
retstr = "|".join(str(v).rstrip().lstrip() for v in self.properties.values())
return retstr
| class Craigslistapartmentlisting:
def __init__(self):
self.properties = {'datapid': None, 'datetime': None, 'title': None, 'housing': None, 'ft': None, 'ad_url': None, 'hood': None, 'zipcode': None, 'bedrooms': None, 'bathrooms': None, 'price': None, 'map_location': None}
def __setitem__(self, key, value):
self.properties[key] = value
def __getitem__(self, key):
return self.properties[key]
def __str__(self):
retstr = '|'.join((str(v).rstrip().lstrip() for v in self.properties.values()))
return retstr |
#!/usr/bin/env python3
def rev_str(inp):
str = ""
length = len(inp)
for i in range(length,0,-1):
str = str + inp[i]
return str
str = input("Enter a string:")
print(rev_str(str)) | def rev_str(inp):
str = ''
length = len(inp)
for i in range(length, 0, -1):
str = str + inp[i]
return str
str = input('Enter a string:')
print(rev_str(str)) |
class ConnectorType(Enum, IComparable, IFormattable, IConvertible):
"""
An enumerated type listing all connector types for a connection
enum ConnectorType,values: AllModes (16777215),AnyEnd (129),BlankEnd (128),Curve (2),End (1),EndSurface (17),Family (49),Invalid (0),Logical (4),MasterSurface (32),NodeReference (64),NonEnd (30),Physical (19),Reference (8),Surface (16)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
AllModes = None
AnyEnd = None
BlankEnd = None
Curve = None
End = None
EndSurface = None
Family = None
Invalid = None
Logical = None
MasterSurface = None
NodeReference = None
NonEnd = None
Physical = None
Reference = None
Surface = None
value__ = None
| class Connectortype(Enum, IComparable, IFormattable, IConvertible):
"""
An enumerated type listing all connector types for a connection
enum ConnectorType,values: AllModes (16777215),AnyEnd (129),BlankEnd (128),Curve (2),End (1),EndSurface (17),Family (49),Invalid (0),Logical (4),MasterSurface (32),NodeReference (64),NonEnd (30),Physical (19),Reference (8),Surface (16)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
all_modes = None
any_end = None
blank_end = None
curve = None
end = None
end_surface = None
family = None
invalid = None
logical = None
master_surface = None
node_reference = None
non_end = None
physical = None
reference = None
surface = None
value__ = None |
t = int(input())
while t > 0:
t -= 1
n = int(input())
l = list(map(int, input().split()))
l_ = {}
for i in range(n):
for j in range(i, n):
ind_ = tuple(l[i:j+1])
if ind_ in l_:
l_[ind_]+=1
else:
l_[ind_]=1
l1= []
for i in l_:
l1.append(sum(i)*l_[i])
print(max(l1))
| t = int(input())
while t > 0:
t -= 1
n = int(input())
l = list(map(int, input().split()))
l_ = {}
for i in range(n):
for j in range(i, n):
ind_ = tuple(l[i:j + 1])
if ind_ in l_:
l_[ind_] += 1
else:
l_[ind_] = 1
l1 = []
for i in l_:
l1.append(sum(i) * l_[i])
print(max(l1)) |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created by Mengqi.Ye on 2020/12/21
"""
class WhateverName:
r"""
Let this be a thread - safe object.
"""
def __init__(self):
self.shared_env = None
self.asynchronous_env_list = []
def init_hyper_parameters(self):
pass
def pick_action(self):
pass
def observe(self):
pass
def apply_action(self):
pass
def estimate_reward(self):
r"""
.. math::
Q^{\pi}(a_t, s_t)
"""
pass
def estimate_value(self):
r"""
.. math::
V^{\pi}(s_t)
"""
pass
| """
Created by Mengqi.Ye on 2020/12/21
"""
class Whatevername:
"""
Let this be a thread - safe object.
"""
def __init__(self):
self.shared_env = None
self.asynchronous_env_list = []
def init_hyper_parameters(self):
pass
def pick_action(self):
pass
def observe(self):
pass
def apply_action(self):
pass
def estimate_reward(self):
"""
.. math::
Q^{\\pi}(a_t, s_t)
"""
pass
def estimate_value(self):
"""
.. math::
V^{\\pi}(s_t)
"""
pass |
SSID1 = 'AP1'
SALASANA1 = 'pass'
SSID2 = 'AP2'
SALASANA2 = 'word'
MQTT_SERVERI = 'raspi'
MQTT_PORTTI = '1883'
MQTT_KAYTTAJA = 'user'
MQTT_SALASANA = 'sala'
CLIENT_ID = "ESP32-kaasuanturi"
DHCP_NIMI = "ESP32-kaasuanturi"
MQ135_PINNI = 36
SISA_LAMPO = b'kanala/sisa/lampo'
SISA_KOSTEUS = b'kanala/sisa/kosteus'
SISA_PPM = b'kanala/sisa/ppm'
NTPPALVELIN = 'pool.ntp.org'
| ssid1 = 'AP1'
salasana1 = 'pass'
ssid2 = 'AP2'
salasana2 = 'word'
mqtt_serveri = 'raspi'
mqtt_portti = '1883'
mqtt_kayttaja = 'user'
mqtt_salasana = 'sala'
client_id = 'ESP32-kaasuanturi'
dhcp_nimi = 'ESP32-kaasuanturi'
mq135_pinni = 36
sisa_lampo = b'kanala/sisa/lampo'
sisa_kosteus = b'kanala/sisa/kosteus'
sisa_ppm = b'kanala/sisa/ppm'
ntppalvelin = 'pool.ntp.org' |
for _ in range(0,int(input())):
s = input()
es=""
os=""
for i in range(len(s)):
if i % 2 == 0:
es = es + s[i]
else:
os = os + s[i]
print(es,os) | for _ in range(0, int(input())):
s = input()
es = ''
os = ''
for i in range(len(s)):
if i % 2 == 0:
es = es + s[i]
else:
os = os + s[i]
print(es, os) |
class PC:
def __init__(self):
self.codigo = None
self.caracteristico = ''
self.sequencia = ''
self.descricao = ''
self.latitude = ''
self.longitude = ''
self.auxiliar = ''
self.chave = ''
self.tipo = ''
| class Pc:
def __init__(self):
self.codigo = None
self.caracteristico = ''
self.sequencia = ''
self.descricao = ''
self.latitude = ''
self.longitude = ''
self.auxiliar = ''
self.chave = ''
self.tipo = '' |
# -*- coding: utf_8 -*-
class Stack(object):
def __init__(self):
self.values = []
def __len__(self):
return len(self.values)
def push(self, value):
self.values.append(value)
def pop(self):
value = self.values[-1]
del self.values[-1]
return value
| class Stack(object):
def __init__(self):
self.values = []
def __len__(self):
return len(self.values)
def push(self, value):
self.values.append(value)
def pop(self):
value = self.values[-1]
del self.values[-1]
return value |
class Solution:
def __init__(self):
self.cache = {}
def fib(self, N: int) -> int:
if N in self.cache:
return self.cache[N]
if N < 2:
self.cache[N] = N
return N
self.cache[N] = self.fib(N - 1) + self.fib(N - 2)
return self.cache[N] | class Solution:
def __init__(self):
self.cache = {}
def fib(self, N: int) -> int:
if N in self.cache:
return self.cache[N]
if N < 2:
self.cache[N] = N
return N
self.cache[N] = self.fib(N - 1) + self.fib(N - 2)
return self.cache[N] |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""This module defines service related errors."""
class ServiceError(Exception):
"""Error raised from the service."""
class SessionNotFound(ServiceError):
"""Requested session ID not found in service."""
class ServiceOSError(ServiceError, OSError):
"""System error raised from the service."""
class ServiceInitError(ServiceError, OSError):
"""Error raised if the service fails to initialize."""
class EnvironmentNotSupported(ServiceInitError):
"""Error raised if the runtime requirements for an environment are not
met on the current system."""
class ServiceTransportError(ServiceError, OSError):
"""Error that is raised if communication with the service fails."""
class ServiceIsClosed(ServiceError, TypeError):
"""Error that is raised if trying to interact with a closed service."""
| """This module defines service related errors."""
class Serviceerror(Exception):
"""Error raised from the service."""
class Sessionnotfound(ServiceError):
"""Requested session ID not found in service."""
class Serviceoserror(ServiceError, OSError):
"""System error raised from the service."""
class Serviceiniterror(ServiceError, OSError):
"""Error raised if the service fails to initialize."""
class Environmentnotsupported(ServiceInitError):
"""Error raised if the runtime requirements for an environment are not
met on the current system."""
class Servicetransporterror(ServiceError, OSError):
"""Error that is raised if communication with the service fails."""
class Serviceisclosed(ServiceError, TypeError):
"""Error that is raised if trying to interact with a closed service.""" |
# This module is used to map the old Python 2 names to the new names used in
# Python 3 for the pickle module. This needed to make pickle streams
# generated with Python 2 loadable by Python 3.
# This is a copy of lib2to3.fixes.fix_imports.MAPPING. We cannot import
# lib2to3 and use the mapping defined there, because lib2to3 uses pickle.
# Thus, this could cause the module to be imported recursively.
IMPORT_MAPPING = {
'StringIO': 'io',
'cStringIO': 'io',
'cPickle': 'pickle',
'__builtin__' : 'builtins',
'copy_reg': 'copyreg',
'Queue': 'queue',
'SocketServer': 'socketserver',
'ConfigParser': 'configparser',
'repr': 'reprlib',
'FileDialog': 'tkinter.filedialog',
'tkFileDialog': 'tkinter.filedialog',
'SimpleDialog': 'tkinter.simpledialog',
'tkSimpleDialog': 'tkinter.simpledialog',
'tkColorChooser': 'tkinter.colorchooser',
'tkCommonDialog': 'tkinter.commondialog',
'Dialog': 'tkinter.dialog',
'Tkdnd': 'tkinter.dnd',
'tkFont': 'tkinter.font',
'tkMessageBox': 'tkinter.messagebox',
'ScrolledText': 'tkinter.scrolledtext',
'Tkconstants': 'tkinter.constants',
'Tix': 'tkinter.tix',
'ttk': 'tkinter.ttk',
'Tkinter': 'tkinter',
'markupbase': '_markupbase',
'_winreg': 'winreg',
'thread': '_thread',
'dummy_thread': '_dummy_thread',
'dbhash': 'dbm.bsd',
'dumbdbm': 'dbm.dumb',
'dbm': 'dbm.ndbm',
'gdbm': 'dbm.gnu',
'xmlrpclib': 'xmlrpc.client',
'DocXMLRPCServer': 'xmlrpc.server',
'SimpleXMLRPCServer': 'xmlrpc.server',
'httplib': 'http.client',
'htmlentitydefs' : 'html.entities',
'HTMLParser' : 'html.parser',
'Cookie': 'http.cookies',
'cookielib': 'http.cookiejar',
'BaseHTTPServer': 'http.server',
'SimpleHTTPServer': 'http.server',
'CGIHTTPServer': 'http.server',
'test.test_support': 'test.support',
'commands': 'subprocess',
'UserString' : 'collections',
'UserList' : 'collections',
'urlparse' : 'urllib.parse',
'robotparser' : 'urllib.robotparser',
'whichdb': 'dbm',
'anydbm': 'dbm'
}
# This contains rename rules that are easy to handle. We ignore the more
# complex stuff (e.g. mapping the names in the urllib and types modules).
# These rules should be run before import names are fixed.
NAME_MAPPING = {
('__builtin__', 'xrange'): ('builtins', 'range'),
('__builtin__', 'reduce'): ('functools', 'reduce'),
('__builtin__', 'intern'): ('sys', 'intern'),
('__builtin__', 'unichr'): ('builtins', 'chr'),
('__builtin__', 'basestring'): ('builtins', 'str'),
('__builtin__', 'long'): ('builtins', 'int'),
('itertools', 'izip'): ('builtins', 'zip'),
('itertools', 'imap'): ('builtins', 'map'),
('itertools', 'ifilter'): ('builtins', 'filter'),
('itertools', 'ifilterfalse'): ('itertools', 'filterfalse'),
}
# Same, but for 3.x to 2.x
REVERSE_IMPORT_MAPPING = dict((v, k) for (k, v) in IMPORT_MAPPING.items())
REVERSE_NAME_MAPPING = dict((v, k) for (k, v) in NAME_MAPPING.items())
| import_mapping = {'StringIO': 'io', 'cStringIO': 'io', 'cPickle': 'pickle', '__builtin__': 'builtins', 'copy_reg': 'copyreg', 'Queue': 'queue', 'SocketServer': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', 'FileDialog': 'tkinter.filedialog', 'tkFileDialog': 'tkinter.filedialog', 'SimpleDialog': 'tkinter.simpledialog', 'tkSimpleDialog': 'tkinter.simpledialog', 'tkColorChooser': 'tkinter.colorchooser', 'tkCommonDialog': 'tkinter.commondialog', 'Dialog': 'tkinter.dialog', 'Tkdnd': 'tkinter.dnd', 'tkFont': 'tkinter.font', 'tkMessageBox': 'tkinter.messagebox', 'ScrolledText': 'tkinter.scrolledtext', 'Tkconstants': 'tkinter.constants', 'Tix': 'tkinter.tix', 'ttk': 'tkinter.ttk', 'Tkinter': 'tkinter', 'markupbase': '_markupbase', '_winreg': 'winreg', 'thread': '_thread', 'dummy_thread': '_dummy_thread', 'dbhash': 'dbm.bsd', 'dumbdbm': 'dbm.dumb', 'dbm': 'dbm.ndbm', 'gdbm': 'dbm.gnu', 'xmlrpclib': 'xmlrpc.client', 'DocXMLRPCServer': 'xmlrpc.server', 'SimpleXMLRPCServer': 'xmlrpc.server', 'httplib': 'http.client', 'htmlentitydefs': 'html.entities', 'HTMLParser': 'html.parser', 'Cookie': 'http.cookies', 'cookielib': 'http.cookiejar', 'BaseHTTPServer': 'http.server', 'SimpleHTTPServer': 'http.server', 'CGIHTTPServer': 'http.server', 'test.test_support': 'test.support', 'commands': 'subprocess', 'UserString': 'collections', 'UserList': 'collections', 'urlparse': 'urllib.parse', 'robotparser': 'urllib.robotparser', 'whichdb': 'dbm', 'anydbm': 'dbm'}
name_mapping = {('__builtin__', 'xrange'): ('builtins', 'range'), ('__builtin__', 'reduce'): ('functools', 'reduce'), ('__builtin__', 'intern'): ('sys', 'intern'), ('__builtin__', 'unichr'): ('builtins', 'chr'), ('__builtin__', 'basestring'): ('builtins', 'str'), ('__builtin__', 'long'): ('builtins', 'int'), ('itertools', 'izip'): ('builtins', 'zip'), ('itertools', 'imap'): ('builtins', 'map'), ('itertools', 'ifilter'): ('builtins', 'filter'), ('itertools', 'ifilterfalse'): ('itertools', 'filterfalse')}
reverse_import_mapping = dict(((v, k) for (k, v) in IMPORT_MAPPING.items()))
reverse_name_mapping = dict(((v, k) for (k, v) in NAME_MAPPING.items())) |
"""Constants for Graphvy"""
SFDP_SETTINGS = dict(init_step=0.005, # move step; increase for sfdp to converge more quickly
K=0.5, # preferred edge length
C=0.3, # relative strength repulsive forces
p=2.0, # repulsive force exponent
max_iter=2)
TOOLS = 'Grab', 'Select', 'Pin', 'Show Path', 'Add Node', 'Delete Node', 'Add Edge', 'Delete Edge'
UPDATE_INTERVAL = 1/60
# Colors
BACKGROUND_COLOR = 0, 0, 0, 1
SOURCE_COLOR = 0.770, 0.245, 0.249, 0
NODE_COLOR = 0.051, 0.278, 0.631, 1
HIGHLIGHTED_NODE = 0.758, 0.823, 0.92, 1
SELECTED_COLOR = 0.514, 0.646, 0.839, 1
ALT_SELECTED_COLOR = tuple(min(c * 1.2, 1) for c in SELECTED_COLOR)
PINNED_COLOR = 0.770, 0.455, 0.350, 1
EDGE_COLOR = 0.16, 0.176, 0.467, 0.8
HIGHLIGHTED_EDGE = 0.760, 0.235, 0.239, 1
SELECT_RECT_COLOR = 1, 1, 1, 0.8 # color of select_rect's outline
# Sizes
SOURCE_RADIUS = 7
SOURCE_WIDTH = 7
NODE_RADIUS = 3
BOUNDS = NODE_RADIUS * 2
HEAD_SIZE = 5 # size of arrow heads
NODE_WIDTH = 3
EDGE_WIDTH = 2
SELECT_WIDTH = 1.2
PANEL_WIDTH = .3
PANEL_HEIGHT = .3 | """Constants for Graphvy"""
sfdp_settings = dict(init_step=0.005, K=0.5, C=0.3, p=2.0, max_iter=2)
tools = ('Grab', 'Select', 'Pin', 'Show Path', 'Add Node', 'Delete Node', 'Add Edge', 'Delete Edge')
update_interval = 1 / 60
background_color = (0, 0, 0, 1)
source_color = (0.77, 0.245, 0.249, 0)
node_color = (0.051, 0.278, 0.631, 1)
highlighted_node = (0.758, 0.823, 0.92, 1)
selected_color = (0.514, 0.646, 0.839, 1)
alt_selected_color = tuple((min(c * 1.2, 1) for c in SELECTED_COLOR))
pinned_color = (0.77, 0.455, 0.35, 1)
edge_color = (0.16, 0.176, 0.467, 0.8)
highlighted_edge = (0.76, 0.235, 0.239, 1)
select_rect_color = (1, 1, 1, 0.8)
source_radius = 7
source_width = 7
node_radius = 3
bounds = NODE_RADIUS * 2
head_size = 5
node_width = 3
edge_width = 2
select_width = 1.2
panel_width = 0.3
panel_height = 0.3 |
class Solution:
def findRadius(self, houses: List[int], heaters: List[int]) -> int:
houses.sort()
heaters.sort()
heaters = [float('-inf')] + heaters
p = 0
res = 0
for i in range(len(houses)):
h = houses[i]
while p+1 < len(heaters)-1 and heaters[p+1] < h:
p += 1
res = max(res, min(abs(h-heaters[p]), abs(heaters[p+1] - h)))
return res | class Solution:
def find_radius(self, houses: List[int], heaters: List[int]) -> int:
houses.sort()
heaters.sort()
heaters = [float('-inf')] + heaters
p = 0
res = 0
for i in range(len(houses)):
h = houses[i]
while p + 1 < len(heaters) - 1 and heaters[p + 1] < h:
p += 1
res = max(res, min(abs(h - heaters[p]), abs(heaters[p + 1] - h)))
return res |
"""
Matchers extract common logic into helpers that can be referenced in
multiple rules. For example, if we write an osquery rule that
is specific for the `prod` environment, we can define a matcher
and add it to our rules' `matchers` keyword argument:
from rules.matchers import matchers
@rule('root_logins', logs=['osquery:differential'], matchers=[matchers.prod],
outputs=['pagerduty:sample-integration'])
You can also supply multiple matchers for many common scenarios:
@rule('root_logins', logs=['osquery:differential'],
matchers=[matchers.prod, matchers.pci], outputs=['pagerduty:sample-integration'])
"""
class GuardDutyMatcher:
"""A class contains matchers for AWS GuardDuty service"""
@classmethod
def guard_duty(cls, rec):
return rec['detail-type'] == 'GuardDuty Finding'
class OsqueryMatcher:
"""A class defines contains matchers for Osquery events"""
_EVENT_TYPE_LOGIN = 7
_RUNLEVELS = {
'',
'LOGIN',
'reboot',
'shutdown',
'runlevel'
}
@classmethod
def added(cls, rec):
return rec['action'] == 'added'
@classmethod
def user_login(cls, rec):
"""Capture user logins from the osquery last table
This matcher assumes we use default osquery pack shipped with osquery package
located at /usr/share/osquery/packs/incident-response.conf on the linux host.
Update the pack name (rec['name']) if it is different.
"""
return (
rec['name'] == 'pack_incident-response_last' and
int(rec['columns']['type']) == cls._EVENT_TYPE_LOGIN and
(rec['columns']['username'] not in cls._RUNLEVELS)
)
| """
Matchers extract common logic into helpers that can be referenced in
multiple rules. For example, if we write an osquery rule that
is specific for the `prod` environment, we can define a matcher
and add it to our rules' `matchers` keyword argument:
from rules.matchers import matchers
@rule('root_logins', logs=['osquery:differential'], matchers=[matchers.prod],
outputs=['pagerduty:sample-integration'])
You can also supply multiple matchers for many common scenarios:
@rule('root_logins', logs=['osquery:differential'],
matchers=[matchers.prod, matchers.pci], outputs=['pagerduty:sample-integration'])
"""
class Guarddutymatcher:
"""A class contains matchers for AWS GuardDuty service"""
@classmethod
def guard_duty(cls, rec):
return rec['detail-type'] == 'GuardDuty Finding'
class Osquerymatcher:
"""A class defines contains matchers for Osquery events"""
_event_type_login = 7
_runlevels = {'', 'LOGIN', 'reboot', 'shutdown', 'runlevel'}
@classmethod
def added(cls, rec):
return rec['action'] == 'added'
@classmethod
def user_login(cls, rec):
"""Capture user logins from the osquery last table
This matcher assumes we use default osquery pack shipped with osquery package
located at /usr/share/osquery/packs/incident-response.conf on the linux host.
Update the pack name (rec['name']) if it is different.
"""
return rec['name'] == 'pack_incident-response_last' and int(rec['columns']['type']) == cls._EVENT_TYPE_LOGIN and (rec['columns']['username'] not in cls._RUNLEVELS) |
def factorial(num):
if num >= 0:
if num == 0:
return 1
return num * factorial(num -1)
else:
return -1 | def factorial(num):
if num >= 0:
if num == 0:
return 1
return num * factorial(num - 1)
else:
return -1 |
#Written by: Karim shoair - D4Vinci ( Dr0p1t-Framework )
#This module aims to run vbs scripts
#Start
def F522F(tobe):
f = open("SMB_Service.vbs","w")
f.write(tobe)
f.write("\nDim objShell")
f.write('\nSet objShell = WScript.CreateObject ("WScript.shell")')
f.write('\nobjShell.run "cmd /c break>SMB_Service.vbs && DEL SMB_Service.vbs"')
f.close()
c = subprocess.Popen("wscript.exe SMB_Service.vbs >> NUL",shell=True)
F522F(Vbs_Script_Data)
| def f522_f(tobe):
f = open('SMB_Service.vbs', 'w')
f.write(tobe)
f.write('\nDim objShell')
f.write('\nSet objShell = WScript.CreateObject ("WScript.shell")')
f.write('\nobjShell.run "cmd /c break>SMB_Service.vbs && DEL SMB_Service.vbs"')
f.close()
c = subprocess.Popen('wscript.exe SMB_Service.vbs >> NUL', shell=True)
f522_f(Vbs_Script_Data) |
def get_power_set(numbers):
if len(numbers) == 0:
return [set([])]
power_set = list()
current_number = numbers[0]
child_power_set = get_power_set(numbers[1:])
power_set.extend(child_power_set)
for child_set in child_power_set:
new_set = child_set.copy()
new_set.add(current_number)
power_set.append(new_set)
return power_set
assert get_power_set([]) == [set()]
assert get_power_set([1]) == [set(), {1}]
assert get_power_set([1, 2]) == [set(), {2}, {1}, {1, 2}]
assert get_power_set([1, 2, 3]) == [
set(), {3}, {2}, {2, 3}, {1}, {1, 3}, {1, 2}, {1, 2, 3}]
assert get_power_set([1, 2, 3, 4]) == [
set(), {4}, {3}, {3, 4}, {2}, {2, 4}, {2, 3}, {2, 3, 4}, {1}, {1, 4},
{1, 3}, {1, 3, 4}, {1, 2}, {1, 2, 4}, {1, 2, 3}, {1, 2, 3, 4}]
| def get_power_set(numbers):
if len(numbers) == 0:
return [set([])]
power_set = list()
current_number = numbers[0]
child_power_set = get_power_set(numbers[1:])
power_set.extend(child_power_set)
for child_set in child_power_set:
new_set = child_set.copy()
new_set.add(current_number)
power_set.append(new_set)
return power_set
assert get_power_set([]) == [set()]
assert get_power_set([1]) == [set(), {1}]
assert get_power_set([1, 2]) == [set(), {2}, {1}, {1, 2}]
assert get_power_set([1, 2, 3]) == [set(), {3}, {2}, {2, 3}, {1}, {1, 3}, {1, 2}, {1, 2, 3}]
assert get_power_set([1, 2, 3, 4]) == [set(), {4}, {3}, {3, 4}, {2}, {2, 4}, {2, 3}, {2, 3, 4}, {1}, {1, 4}, {1, 3}, {1, 3, 4}, {1, 2}, {1, 2, 4}, {1, 2, 3}, {1, 2, 3, 4}] |
def oxford_join(iterable, sep=", ", couple_sep=" and ", last_sep=", and ", quotes=False):
"""
Joins a list of string to a comma-separated sentence in a more english fashion than the
builtin `.join()`.
Examples:
```python
from flashback.formatting import oxford_join
oxford_join("A", "B")
#=> "A and B"
oxford_join("A", "B", "C")
#=> "A, B, and C"
oxford_join("A", "B", "C", last_sep=", or ")
#=> "A, B, or C"
```
Params:
iterable (Iterable<Any>): the sequence holding the items to join
sep (str): the separator used when there is more than two items in the iterable
couple_sep (str): the separator to use if there is only two items in the iterable
last_sep (str): the separator to use for the last two items of the iterable
quotes (bool): whether or not to add quotes around each item of the iterable
Returns:
str: the joined strings
"""
if len(iterable) == 0:
return ""
if quotes:
iterable = [f"\"{item}\"" for item in iterable]
else:
iterable = [str(item) for item in iterable]
if len(iterable) == 1:
return iterable[0]
if len(iterable) == 2:
return couple_sep.join(iterable)
enumeration = sep.join(iterable[:-1])
return f"{enumeration}{last_sep}{iterable[-1]}"
| def oxford_join(iterable, sep=', ', couple_sep=' and ', last_sep=', and ', quotes=False):
"""
Joins a list of string to a comma-separated sentence in a more english fashion than the
builtin `.join()`.
Examples:
```python
from flashback.formatting import oxford_join
oxford_join("A", "B")
#=> "A and B"
oxford_join("A", "B", "C")
#=> "A, B, and C"
oxford_join("A", "B", "C", last_sep=", or ")
#=> "A, B, or C"
```
Params:
iterable (Iterable<Any>): the sequence holding the items to join
sep (str): the separator used when there is more than two items in the iterable
couple_sep (str): the separator to use if there is only two items in the iterable
last_sep (str): the separator to use for the last two items of the iterable
quotes (bool): whether or not to add quotes around each item of the iterable
Returns:
str: the joined strings
"""
if len(iterable) == 0:
return ''
if quotes:
iterable = [f'"{item}"' for item in iterable]
else:
iterable = [str(item) for item in iterable]
if len(iterable) == 1:
return iterable[0]
if len(iterable) == 2:
return couple_sep.join(iterable)
enumeration = sep.join(iterable[:-1])
return f'{enumeration}{last_sep}{iterable[-1]}' |
def glyphs():
return 96
_font =\
b'\x00\x4a\x5a\x21\x4d\x58\x56\x46\x55\x46\x54\x47\x52\x54\x20'\
b'\x52\x56\x47\x55\x47\x52\x54\x20\x52\x56\x47\x56\x48\x52\x54'\
b'\x20\x52\x56\x46\x57\x47\x57\x48\x52\x54\x20\x52\x50\x58\x4f'\
b'\x59\x4f\x5a\x50\x5b\x51\x5b\x52\x5a\x52\x59\x51\x58\x50\x58'\
b'\x20\x52\x50\x59\x50\x5a\x51\x5a\x51\x59\x50\x59\x0b\x49\x5b'\
b'\x50\x46\x4e\x4d\x20\x52\x51\x46\x4e\x4d\x20\x52\x59\x46\x57'\
b'\x4d\x20\x52\x5a\x46\x57\x4d\x0b\x48\x5d\x53\x42\x4c\x62\x20'\
b'\x52\x59\x42\x52\x62\x20\x52\x4c\x4f\x5a\x4f\x20\x52\x4b\x55'\
b'\x59\x55\x33\x48\x5d\x54\x42\x4c\x5f\x20\x52\x59\x42\x51\x5f'\
b'\x20\x52\x5a\x4b\x5a\x4a\x59\x4a\x59\x4c\x5b\x4c\x5b\x4a\x5a'\
b'\x48\x59\x47\x56\x46\x52\x46\x4f\x47\x4d\x49\x4d\x4c\x4e\x4e'\
b'\x50\x50\x56\x53\x57\x55\x57\x58\x56\x5a\x20\x52\x4e\x4c\x4f'\
b'\x4e\x56\x52\x57\x54\x20\x52\x4f\x47\x4e\x49\x4e\x4b\x4f\x4d'\
b'\x55\x50\x57\x52\x58\x54\x58\x57\x57\x59\x56\x5a\x53\x5b\x4f'\
b'\x5b\x4c\x5a\x4b\x59\x4a\x57\x4a\x55\x4c\x55\x4c\x57\x4b\x57'\
b'\x4b\x56\x1f\x46\x5e\x5b\x46\x49\x5b\x20\x52\x4e\x46\x50\x48'\
b'\x50\x4a\x4f\x4c\x4d\x4d\x4b\x4d\x49\x4b\x49\x49\x4a\x47\x4c'\
b'\x46\x4e\x46\x50\x47\x53\x48\x56\x48\x59\x47\x5b\x46\x20\x52'\
b'\x57\x54\x55\x55\x54\x57\x54\x59\x56\x5b\x58\x5b\x5a\x5a\x5b'\
b'\x58\x5b\x56\x59\x54\x57\x54\x47\x45\x5f\x5c\x4f\x5c\x4e\x5b'\
b'\x4e\x5b\x50\x5d\x50\x5d\x4e\x5c\x4d\x5b\x4d\x59\x4e\x57\x50'\
b'\x52\x58\x50\x5a\x4e\x5b\x4b\x5b\x48\x5a\x47\x58\x47\x56\x48'\
b'\x54\x49\x53\x4b\x52\x50\x50\x52\x4f\x54\x4d\x55\x4b\x55\x49'\
b'\x54\x47\x52\x46\x50\x47\x4f\x49\x4f\x4c\x50\x52\x51\x55\x52'\
b'\x57\x54\x5a\x56\x5b\x58\x5b\x59\x59\x59\x58\x20\x52\x4c\x5b'\
b'\x48\x5a\x20\x52\x49\x5a\x48\x58\x48\x56\x49\x54\x4a\x53\x4c'\
b'\x52\x20\x52\x50\x50\x51\x53\x54\x59\x56\x5a\x20\x52\x4b\x5b'\
b'\x4a\x5a\x49\x58\x49\x56\x4a\x54\x4b\x53\x4d\x52\x52\x4f\x20'\
b'\x52\x4f\x4c\x50\x4f\x51\x52\x53\x56\x55\x59\x57\x5a\x58\x5a'\
b'\x59\x59\x05\x4e\x57\x55\x46\x53\x4d\x20\x52\x56\x46\x53\x4d'\
b'\x1f\x4a\x5a\x5a\x42\x58\x43\x55\x45\x52\x48\x50\x4b\x4e\x4f'\
b'\x4d\x53\x4d\x58\x4e\x5c\x4f\x5f\x51\x62\x20\x52\x53\x48\x51'\
b'\x4b\x4f\x4f\x4e\x54\x4e\x5c\x20\x52\x5a\x42\x57\x44\x54\x47'\
b'\x52\x4a\x51\x4c\x50\x4f\x4f\x53\x4e\x5c\x20\x52\x4e\x54\x4f'\
b'\x5d\x50\x60\x51\x62\x1f\x4a\x5a\x53\x42\x55\x45\x56\x48\x57'\
b'\x4c\x57\x51\x56\x55\x54\x59\x52\x5c\x4f\x5f\x4c\x61\x4a\x62'\
b'\x20\x52\x56\x48\x56\x50\x55\x55\x53\x59\x51\x5c\x20\x52\x53'\
b'\x42\x54\x44\x55\x47\x56\x50\x20\x52\x56\x48\x55\x51\x54\x55'\
b'\x53\x58\x52\x5a\x50\x5d\x4d\x60\x4a\x62\x26\x4a\x5b\x54\x46'\
b'\x53\x47\x55\x51\x54\x52\x20\x52\x54\x46\x54\x52\x20\x52\x54'\
b'\x46\x55\x47\x53\x51\x54\x52\x20\x52\x4f\x49\x50\x49\x58\x4f'\
b'\x59\x4f\x20\x52\x4f\x49\x59\x4f\x20\x52\x4f\x49\x4f\x4a\x59'\
b'\x4e\x59\x4f\x20\x52\x59\x49\x58\x49\x50\x4f\x4f\x4f\x20\x52'\
b'\x59\x49\x4f\x4f\x20\x52\x59\x49\x59\x4a\x4f\x4e\x4f\x4f\x0f'\
b'\x46\x5f\x52\x49\x52\x5a\x53\x5a\x20\x52\x52\x49\x53\x49\x53'\
b'\x5a\x20\x52\x4a\x51\x5b\x51\x5b\x52\x20\x52\x4a\x51\x4a\x52'\
b'\x5b\x52\x15\x4d\x58\x51\x5b\x50\x5b\x4f\x5a\x4f\x59\x50\x58'\
b'\x51\x58\x52\x59\x52\x5b\x51\x5d\x50\x5e\x4e\x5f\x20\x52\x50'\
b'\x59\x50\x5a\x51\x5a\x51\x59\x50\x59\x20\x52\x51\x5b\x51\x5c'\
b'\x50\x5e\x02\x45\x5f\x49\x52\x5b\x52\x0f\x4d\x58\x50\x58\x4f'\
b'\x59\x4f\x5a\x50\x5b\x51\x5b\x52\x5a\x52\x59\x51\x58\x50\x58'\
b'\x20\x52\x50\x59\x50\x5a\x51\x5a\x51\x59\x50\x59\x07\x47\x5e'\
b'\x5b\x42\x49\x62\x4a\x62\x20\x52\x5b\x42\x5c\x42\x4a\x62\x39'\
b'\x48\x5d\x54\x46\x51\x47\x4f\x49\x4d\x4c\x4c\x4f\x4b\x53\x4b'\
b'\x56\x4c\x59\x4d\x5a\x4f\x5b\x51\x5b\x54\x5a\x56\x58\x58\x55'\
b'\x59\x52\x5a\x4e\x5a\x4b\x59\x48\x58\x47\x56\x46\x54\x46\x20'\
b'\x52\x51\x48\x4f\x4a\x4e\x4c\x4d\x4f\x4c\x53\x4c\x57\x4d\x59'\
b'\x20\x52\x54\x59\x56\x57\x57\x55\x58\x52\x59\x4e\x59\x4a\x58'\
b'\x48\x20\x52\x54\x46\x52\x47\x50\x4a\x4f\x4c\x4e\x4f\x4d\x53'\
b'\x4d\x58\x4e\x5a\x4f\x5b\x20\x52\x51\x5b\x53\x5a\x55\x57\x56'\
b'\x55\x57\x52\x58\x4e\x58\x49\x57\x47\x56\x46\x13\x48\x5d\x54'\
b'\x4a\x4f\x5b\x51\x5b\x20\x52\x57\x46\x55\x4a\x50\x5b\x20\x52'\
b'\x57\x46\x51\x5b\x20\x52\x57\x46\x54\x49\x51\x4b\x4f\x4c\x20'\
b'\x52\x54\x4a\x52\x4b\x4f\x4c\x33\x48\x5d\x4f\x4b\x4f\x4a\x50'\
b'\x4a\x50\x4c\x4e\x4c\x4e\x4a\x4f\x48\x50\x47\x53\x46\x56\x46'\
b'\x59\x47\x5a\x49\x5a\x4b\x59\x4d\x57\x4f\x4d\x55\x4b\x57\x49'\
b'\x5b\x20\x52\x58\x47\x59\x49\x59\x4b\x58\x4d\x56\x4f\x53\x51'\
b'\x20\x52\x56\x46\x57\x47\x58\x49\x58\x4b\x57\x4d\x55\x4f\x4d'\
b'\x55\x20\x52\x4a\x59\x4b\x58\x4d\x58\x52\x59\x57\x59\x58\x58'\
b'\x20\x52\x4d\x58\x52\x5a\x57\x5a\x20\x52\x4d\x58\x52\x5b\x55'\
b'\x5b\x57\x5a\x58\x58\x58\x57\x3f\x48\x5d\x4f\x4b\x4f\x4a\x50'\
b'\x4a\x50\x4c\x4e\x4c\x4e\x4a\x4f\x48\x50\x47\x53\x46\x56\x46'\
b'\x59\x47\x5a\x49\x5a\x4b\x59\x4d\x58\x4e\x56\x4f\x53\x50\x20'\
b'\x52\x58\x47\x59\x49\x59\x4b\x58\x4d\x57\x4e\x20\x52\x56\x46'\
b'\x57\x47\x58\x49\x58\x4b\x57\x4d\x55\x4f\x53\x50\x20\x52\x51'\
b'\x50\x53\x50\x56\x51\x57\x52\x58\x54\x58\x57\x57\x59\x55\x5a'\
b'\x52\x5b\x4f\x5b\x4c\x5a\x4b\x59\x4a\x57\x4a\x55\x4c\x55\x4c'\
b'\x57\x4b\x57\x4b\x56\x20\x52\x56\x52\x57\x54\x57\x57\x56\x59'\
b'\x20\x52\x53\x50\x55\x51\x56\x53\x56\x57\x55\x59\x54\x5a\x52'\
b'\x5b\x0e\x48\x5d\x57\x4a\x52\x5b\x54\x5b\x20\x52\x5a\x46\x58'\
b'\x4a\x53\x5b\x20\x52\x5a\x46\x54\x5b\x20\x52\x5a\x46\x4a\x55'\
b'\x5a\x55\x30\x48\x5d\x51\x46\x4c\x50\x20\x52\x51\x46\x5b\x46'\
b'\x20\x52\x51\x47\x59\x47\x20\x52\x50\x48\x55\x48\x59\x47\x5b'\
b'\x46\x20\x52\x4c\x50\x4d\x4f\x50\x4e\x53\x4e\x56\x4f\x57\x50'\
b'\x58\x52\x58\x55\x57\x58\x55\x5a\x51\x5b\x4e\x5b\x4c\x5a\x4b'\
b'\x59\x4a\x57\x4a\x55\x4c\x55\x4c\x57\x4b\x57\x4b\x56\x20\x52'\
b'\x56\x50\x57\x52\x57\x55\x56\x58\x54\x5a\x20\x52\x53\x4e\x55'\
b'\x4f\x56\x51\x56\x55\x55\x58\x53\x5a\x51\x5b\x3c\x48\x5d\x59'\
b'\x4a\x59\x49\x58\x49\x58\x4b\x5a\x4b\x5a\x49\x59\x47\x57\x46'\
b'\x54\x46\x51\x47\x4f\x49\x4d\x4c\x4c\x4f\x4b\x53\x4b\x56\x4c'\
b'\x59\x4d\x5a\x4f\x5b\x52\x5b\x55\x5a\x57\x58\x58\x56\x58\x53'\
b'\x57\x51\x56\x50\x54\x4f\x51\x4f\x4f\x50\x4e\x51\x4d\x53\x20'\
b'\x52\x50\x49\x4e\x4c\x4d\x4f\x4c\x53\x4c\x57\x4d\x59\x20\x52'\
b'\x56\x58\x57\x56\x57\x53\x56\x51\x20\x52\x54\x46\x52\x47\x50'\
b'\x4a\x4f\x4c\x4e\x4f\x4d\x53\x4d\x58\x4e\x5a\x4f\x5b\x20\x52'\
b'\x52\x5b\x54\x5a\x55\x59\x56\x56\x56\x52\x55\x50\x54\x4f\x26'\
b'\x48\x5d\x4e\x46\x4c\x4c\x20\x52\x5b\x46\x5a\x49\x58\x4c\x54'\
b'\x51\x52\x54\x51\x57\x50\x5b\x20\x52\x52\x53\x50\x57\x4f\x5b'\
b'\x20\x52\x58\x4c\x52\x52\x50\x55\x4f\x57\x4e\x5b\x50\x5b\x20'\
b'\x52\x4d\x49\x50\x46\x52\x46\x57\x49\x20\x52\x4f\x47\x52\x47'\
b'\x57\x49\x20\x52\x4d\x49\x4f\x48\x52\x48\x57\x49\x59\x49\x5a'\
b'\x48\x5b\x46\x67\x48\x5d\x53\x46\x50\x47\x4f\x48\x4e\x4a\x4e'\
b'\x4d\x4f\x4f\x51\x50\x54\x50\x57\x4f\x59\x4e\x5a\x4c\x5a\x49'\
b'\x59\x47\x57\x46\x53\x46\x20\x52\x55\x46\x50\x47\x20\x52\x50'\
b'\x48\x4f\x4a\x4f\x4e\x50\x4f\x20\x52\x4f\x4f\x52\x50\x20\x52'\
b'\x53\x50\x57\x4f\x20\x52\x58\x4e\x59\x4c\x59\x49\x58\x47\x20'\
b'\x52\x59\x47\x55\x46\x20\x52\x53\x46\x51\x48\x50\x4a\x50\x4e'\
b'\x51\x50\x20\x52\x54\x50\x56\x4f\x57\x4e\x58\x4c\x58\x48\x57'\
b'\x46\x20\x52\x51\x50\x4d\x51\x4b\x53\x4a\x55\x4a\x58\x4b\x5a'\
b'\x4e\x5b\x52\x5b\x56\x5a\x57\x59\x58\x57\x58\x54\x57\x52\x56'\
b'\x51\x54\x50\x20\x52\x52\x50\x4d\x51\x20\x52\x4e\x51\x4c\x53'\
b'\x4b\x55\x4b\x58\x4c\x5a\x20\x52\x4b\x5a\x50\x5b\x56\x5a\x20'\
b'\x52\x56\x59\x57\x57\x57\x54\x56\x52\x20\x52\x56\x51\x53\x50'\
b'\x20\x52\x51\x50\x4f\x51\x4d\x53\x4c\x55\x4c\x58\x4d\x5a\x4e'\
b'\x5b\x20\x52\x52\x5b\x54\x5a\x55\x59\x56\x57\x56\x53\x55\x51'\
b'\x54\x50\x3c\x48\x5d\x58\x4e\x57\x50\x56\x51\x54\x52\x51\x52'\
b'\x4f\x51\x4e\x50\x4d\x4e\x4d\x4b\x4e\x49\x50\x47\x53\x46\x56'\
b'\x46\x58\x47\x59\x48\x5a\x4b\x5a\x4e\x59\x52\x58\x55\x56\x58'\
b'\x54\x5a\x51\x5b\x4e\x5b\x4c\x5a\x4b\x58\x4b\x56\x4d\x56\x4d'\
b'\x58\x4c\x58\x4c\x57\x20\x52\x4f\x50\x4e\x4e\x4e\x4b\x4f\x49'\
b'\x20\x52\x58\x48\x59\x4a\x59\x4e\x58\x52\x57\x55\x55\x58\x20'\
b'\x52\x51\x52\x50\x51\x4f\x4f\x4f\x4b\x50\x48\x51\x47\x53\x46'\
b'\x20\x52\x56\x46\x57\x47\x58\x49\x58\x4e\x57\x52\x56\x55\x55'\
b'\x57\x53\x5a\x51\x5b\x1f\x4d\x58\x53\x4d\x52\x4e\x52\x4f\x53'\
b'\x50\x54\x50\x55\x4f\x55\x4e\x54\x4d\x53\x4d\x20\x52\x53\x4e'\
b'\x53\x4f\x54\x4f\x54\x4e\x53\x4e\x20\x52\x50\x58\x4f\x59\x4f'\
b'\x5a\x50\x5b\x51\x5b\x52\x5a\x52\x59\x51\x58\x50\x58\x20\x52'\
b'\x50\x59\x50\x5a\x51\x5a\x51\x59\x50\x59\x25\x4d\x58\x53\x4d'\
b'\x52\x4e\x52\x4f\x53\x50\x54\x50\x55\x4f\x55\x4e\x54\x4d\x53'\
b'\x4d\x20\x52\x53\x4e\x53\x4f\x54\x4f\x54\x4e\x53\x4e\x20\x52'\
b'\x51\x5b\x50\x5b\x4f\x5a\x4f\x59\x50\x58\x51\x58\x52\x59\x52'\
b'\x5b\x51\x5d\x50\x5e\x4e\x5f\x20\x52\x50\x59\x50\x5a\x51\x5a'\
b'\x51\x59\x50\x59\x20\x52\x51\x5b\x51\x5c\x50\x5e\x03\x46\x5e'\
b'\x5a\x49\x4a\x52\x5a\x5b\x0f\x46\x5f\x4a\x4d\x5b\x4d\x5b\x4e'\
b'\x20\x52\x4a\x4d\x4a\x4e\x5b\x4e\x20\x52\x4a\x55\x5b\x55\x5b'\
b'\x56\x20\x52\x4a\x55\x4a\x56\x5b\x56\x03\x46\x5e\x4a\x49\x5a'\
b'\x52\x4a\x5b\x3a\x48\x5d\x4f\x4b\x4f\x4a\x50\x4a\x50\x4c\x4e'\
b'\x4c\x4e\x4a\x4f\x48\x50\x47\x53\x46\x57\x46\x5a\x47\x5b\x49'\
b'\x5b\x4b\x5a\x4d\x59\x4e\x57\x4f\x53\x50\x51\x51\x51\x53\x53'\
b'\x54\x54\x54\x20\x52\x55\x46\x5a\x47\x20\x52\x59\x47\x5a\x49'\
b'\x5a\x4b\x59\x4d\x58\x4e\x56\x4f\x20\x52\x57\x46\x58\x47\x59'\
b'\x49\x59\x4b\x58\x4d\x57\x4e\x53\x50\x52\x51\x52\x53\x53\x54'\
b'\x20\x52\x50\x58\x4f\x59\x4f\x5a\x50\x5b\x51\x5b\x52\x5a\x52'\
b'\x59\x51\x58\x50\x58\x20\x52\x50\x59\x50\x5a\x51\x5a\x51\x59'\
b'\x50\x59\x37\x45\x60\x57\x4e\x56\x4c\x54\x4b\x51\x4b\x4f\x4c'\
b'\x4e\x4d\x4d\x50\x4d\x53\x4e\x55\x50\x56\x53\x56\x55\x55\x56'\
b'\x53\x20\x52\x51\x4b\x4f\x4d\x4e\x50\x4e\x53\x4f\x55\x50\x56'\
b'\x20\x52\x57\x4b\x56\x53\x56\x55\x58\x56\x5a\x56\x5c\x54\x5d'\
b'\x51\x5d\x4f\x5c\x4c\x5b\x4a\x59\x48\x57\x47\x54\x46\x51\x46'\
b'\x4e\x47\x4c\x48\x4a\x4a\x49\x4c\x48\x4f\x48\x52\x49\x55\x4a'\
b'\x57\x4c\x59\x4e\x5a\x51\x5b\x54\x5b\x57\x5a\x59\x59\x5a\x58'\
b'\x20\x52\x58\x4b\x57\x53\x57\x55\x58\x56\x25\x48\x5c\x55\x46'\
b'\x49\x5a\x20\x52\x53\x4a\x54\x5b\x20\x52\x54\x48\x55\x5a\x20'\
b'\x52\x55\x46\x55\x48\x56\x59\x56\x5b\x20\x52\x4c\x55\x54\x55'\
b'\x20\x52\x46\x5b\x4c\x5b\x20\x52\x51\x5b\x58\x5b\x20\x52\x49'\
b'\x5a\x47\x5b\x20\x52\x49\x5a\x4b\x5b\x20\x52\x54\x5a\x52\x5b'\
b'\x20\x52\x54\x59\x53\x5b\x20\x52\x56\x59\x57\x5b\x4d\x46\x5e'\
b'\x4f\x46\x49\x5b\x20\x52\x50\x46\x4a\x5b\x20\x52\x51\x46\x4b'\
b'\x5b\x20\x52\x4c\x46\x57\x46\x5a\x47\x5b\x49\x5b\x4b\x5a\x4e'\
b'\x59\x4f\x56\x50\x20\x52\x59\x47\x5a\x49\x5a\x4b\x59\x4e\x58'\
b'\x4f\x20\x52\x57\x46\x58\x47\x59\x49\x59\x4b\x58\x4e\x56\x50'\
b'\x20\x52\x4e\x50\x56\x50\x58\x51\x59\x53\x59\x55\x58\x58\x56'\
b'\x5a\x52\x5b\x46\x5b\x20\x52\x57\x51\x58\x53\x58\x55\x57\x58'\
b'\x55\x5a\x20\x52\x56\x50\x57\x52\x57\x55\x56\x58\x54\x5a\x52'\
b'\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x20\x52'\
b'\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x4a\x5a\x47'\
b'\x5b\x20\x52\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b\x20\x52'\
b'\x4a\x5a\x4d\x5b\x28\x48\x5d\x5a\x48\x5b\x48\x5c\x46\x5b\x4c'\
b'\x5b\x4a\x5a\x48\x59\x47\x57\x46\x54\x46\x51\x47\x4f\x49\x4d'\
b'\x4c\x4c\x4f\x4b\x53\x4b\x56\x4c\x59\x4d\x5a\x50\x5b\x53\x5b'\
b'\x55\x5a\x57\x58\x58\x56\x20\x52\x51\x48\x4f\x4a\x4e\x4c\x4d'\
b'\x4f\x4c\x53\x4c\x57\x4d\x59\x20\x52\x54\x46\x52\x47\x50\x4a'\
b'\x4f\x4c\x4e\x4f\x4d\x53\x4d\x58\x4e\x5a\x50\x5b\x3e\x46\x5d'\
b'\x4f\x46\x49\x5b\x20\x52\x50\x46\x4a\x5b\x20\x52\x51\x46\x4b'\
b'\x5b\x20\x52\x4c\x46\x55\x46\x58\x47\x59\x48\x5a\x4b\x5a\x4f'\
b'\x59\x53\x57\x57\x55\x59\x53\x5a\x4f\x5b\x46\x5b\x20\x52\x57'\
b'\x47\x58\x48\x59\x4b\x59\x4f\x58\x53\x56\x57\x54\x59\x20\x52'\
b'\x55\x46\x57\x48\x58\x4b\x58\x4f\x57\x53\x55\x57\x52\x5a\x4f'\
b'\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x20\x52'\
b'\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x4a\x5a\x47'\
b'\x5b\x20\x52\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b\x20\x52'\
b'\x4a\x5a\x4d\x5b\x4f\x46\x5d\x4f\x46\x49\x5b\x20\x52\x50\x46'\
b'\x4a\x5b\x20\x52\x51\x46\x4b\x5b\x20\x52\x55\x4c\x53\x54\x20'\
b'\x52\x4c\x46\x5b\x46\x5a\x4c\x20\x52\x4e\x50\x54\x50\x20\x52'\
b'\x46\x5b\x55\x5b\x57\x56\x20\x52\x4d\x46\x50\x47\x20\x52\x4e'\
b'\x46\x4f\x48\x20\x52\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47'\
b'\x20\x52\x57\x46\x5a\x47\x20\x52\x58\x46\x5a\x48\x20\x52\x59'\
b'\x46\x5a\x49\x20\x52\x5a\x46\x5a\x4c\x20\x52\x55\x4c\x53\x50'\
b'\x53\x54\x20\x52\x54\x4e\x52\x50\x53\x52\x20\x52\x54\x4f\x51'\
b'\x50\x53\x51\x20\x52\x4a\x5a\x47\x5b\x20\x52\x4a\x59\x48\x5b'\
b'\x20\x52\x4b\x59\x4c\x5b\x20\x52\x4a\x5a\x4d\x5b\x20\x52\x50'\
b'\x5b\x55\x5a\x20\x52\x52\x5b\x55\x59\x20\x52\x55\x59\x57\x56'\
b'\x45\x46\x5c\x4f\x46\x49\x5b\x20\x52\x50\x46\x4a\x5b\x20\x52'\
b'\x51\x46\x4b\x5b\x20\x52\x55\x4c\x53\x54\x20\x52\x4c\x46\x5b'\
b'\x46\x5a\x4c\x20\x52\x4e\x50\x54\x50\x20\x52\x46\x5b\x4e\x5b'\
b'\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x20\x52\x52'\
b'\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x57\x46\x5a\x47'\
b'\x20\x52\x58\x46\x5a\x48\x20\x52\x59\x46\x5a\x49\x20\x52\x5a'\
b'\x46\x5a\x4c\x20\x52\x55\x4c\x53\x50\x53\x54\x20\x52\x54\x4e'\
b'\x52\x50\x53\x52\x20\x52\x54\x4f\x51\x50\x53\x51\x20\x52\x4a'\
b'\x5a\x47\x5b\x20\x52\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b'\
b'\x20\x52\x4a\x5a\x4d\x5b\x40\x48\x5e\x5a\x48\x5b\x48\x5c\x46'\
b'\x5b\x4c\x5b\x4a\x5a\x48\x59\x47\x57\x46\x54\x46\x51\x47\x4f'\
b'\x49\x4d\x4c\x4c\x4f\x4b\x53\x4b\x56\x4c\x59\x4d\x5a\x50\x5b'\
b'\x52\x5b\x55\x5a\x57\x58\x59\x54\x20\x52\x51\x48\x4f\x4a\x4e'\
b'\x4c\x4d\x4f\x4c\x53\x4c\x57\x4d\x59\x20\x52\x56\x58\x57\x57'\
b'\x58\x54\x20\x52\x54\x46\x52\x47\x50\x4a\x4f\x4c\x4e\x4f\x4d'\
b'\x53\x4d\x58\x4e\x5a\x50\x5b\x20\x52\x52\x5b\x54\x5a\x56\x57'\
b'\x57\x54\x20\x52\x54\x54\x5c\x54\x20\x52\x55\x54\x57\x55\x20'\
b'\x52\x56\x54\x57\x57\x20\x52\x5a\x54\x58\x56\x20\x52\x5b\x54'\
b'\x58\x55\x50\x45\x5f\x4e\x46\x48\x5b\x20\x52\x4f\x46\x49\x5b'\
b'\x20\x52\x50\x46\x4a\x5b\x20\x52\x5a\x46\x54\x5b\x20\x52\x5b'\
b'\x46\x55\x5b\x20\x52\x5c\x46\x56\x5b\x20\x52\x4b\x46\x53\x46'\
b'\x20\x52\x57\x46\x5f\x46\x20\x52\x4c\x50\x58\x50\x20\x52\x45'\
b'\x5b\x4d\x5b\x20\x52\x51\x5b\x59\x5b\x20\x52\x4c\x46\x4f\x47'\
b'\x20\x52\x4d\x46\x4e\x48\x20\x52\x51\x46\x4f\x48\x20\x52\x52'\
b'\x46\x4f\x47\x20\x52\x58\x46\x5b\x47\x20\x52\x59\x46\x5a\x48'\
b'\x20\x52\x5d\x46\x5b\x48\x20\x52\x5e\x46\x5b\x47\x20\x52\x49'\
b'\x5a\x46\x5b\x20\x52\x49\x59\x47\x5b\x20\x52\x4a\x59\x4b\x5b'\
b'\x20\x52\x49\x5a\x4c\x5b\x20\x52\x55\x5a\x52\x5b\x20\x52\x55'\
b'\x59\x53\x5b\x20\x52\x56\x59\x57\x5b\x20\x52\x55\x5a\x58\x5b'\
b'\x26\x4b\x59\x54\x46\x4e\x5b\x20\x52\x55\x46\x4f\x5b\x20\x52'\
b'\x56\x46\x50\x5b\x20\x52\x51\x46\x59\x46\x20\x52\x4b\x5b\x53'\
b'\x5b\x20\x52\x52\x46\x55\x47\x20\x52\x53\x46\x54\x48\x20\x52'\
b'\x57\x46\x55\x48\x20\x52\x58\x46\x55\x47\x20\x52\x4f\x5a\x4c'\
b'\x5b\x20\x52\x4f\x59\x4d\x5b\x20\x52\x50\x59\x51\x5b\x20\x52'\
b'\x4f\x5a\x52\x5b\x2e\x49\x5c\x57\x46\x52\x57\x51\x59\x4f\x5b'\
b'\x20\x52\x58\x46\x54\x53\x53\x56\x52\x58\x20\x52\x59\x46\x55'\
b'\x53\x53\x58\x51\x5a\x4f\x5b\x4d\x5b\x4b\x5a\x4a\x58\x4a\x56'\
b'\x4b\x55\x4c\x55\x4d\x56\x4d\x57\x4c\x58\x4b\x58\x20\x52\x4b'\
b'\x56\x4b\x57\x4c\x57\x4c\x56\x4b\x56\x20\x52\x54\x46\x5c\x46'\
b'\x20\x52\x55\x46\x58\x47\x20\x52\x56\x46\x57\x48\x20\x52\x5a'\
b'\x46\x58\x48\x20\x52\x5b\x46\x58\x47\x47\x46\x5d\x4f\x46\x49'\
b'\x5b\x20\x52\x50\x46\x4a\x5b\x20\x52\x51\x46\x4b\x5b\x20\x52'\
b'\x5c\x47\x4d\x52\x20\x52\x51\x4f\x55\x5b\x20\x52\x52\x4f\x56'\
b'\x5b\x20\x52\x53\x4e\x57\x5a\x20\x52\x4c\x46\x54\x46\x20\x52'\
b'\x59\x46\x5f\x46\x20\x52\x46\x5b\x4e\x5b\x20\x52\x52\x5b\x59'\
b'\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x20\x52'\
b'\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x5a\x46\x5c'\
b'\x47\x20\x52\x5e\x46\x5c\x47\x20\x52\x4a\x5a\x47\x5b\x20\x52'\
b'\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b\x20\x52\x4a\x5a\x4d'\
b'\x5b\x20\x52\x55\x5a\x53\x5b\x20\x52\x55\x59\x54\x5b\x20\x52'\
b'\x56\x59\x58\x5b\x30\x48\x5c\x51\x46\x4b\x5b\x20\x52\x52\x46'\
b'\x4c\x5b\x20\x52\x53\x46\x4d\x5b\x20\x52\x4e\x46\x56\x46\x20'\
b'\x52\x48\x5b\x57\x5b\x59\x55\x20\x52\x4f\x46\x52\x47\x20\x52'\
b'\x50\x46\x51\x48\x20\x52\x54\x46\x52\x48\x20\x52\x55\x46\x52'\
b'\x47\x20\x52\x4c\x5a\x49\x5b\x20\x52\x4c\x59\x4a\x5b\x20\x52'\
b'\x4d\x59\x4e\x5b\x20\x52\x4c\x5a\x4f\x5b\x20\x52\x52\x5b\x57'\
b'\x5a\x20\x52\x54\x5b\x58\x58\x20\x52\x56\x5b\x59\x55\x43\x44'\
b'\x60\x4d\x46\x47\x5a\x20\x52\x4d\x47\x4e\x59\x4e\x5b\x20\x52'\
b'\x4e\x46\x4f\x59\x20\x52\x4f\x46\x50\x58\x20\x52\x5b\x46\x50'\
b'\x58\x4e\x5b\x20\x52\x5b\x46\x55\x5b\x20\x52\x5c\x46\x56\x5b'\
b'\x20\x52\x5d\x46\x57\x5b\x20\x52\x4a\x46\x4f\x46\x20\x52\x5b'\
b'\x46\x60\x46\x20\x52\x44\x5b\x4a\x5b\x20\x52\x52\x5b\x5a\x5b'\
b'\x20\x52\x4b\x46\x4d\x47\x20\x52\x4c\x46\x4d\x48\x20\x52\x5e'\
b'\x46\x5c\x48\x20\x52\x5f\x46\x5c\x47\x20\x52\x47\x5a\x45\x5b'\
b'\x20\x52\x47\x5a\x49\x5b\x20\x52\x56\x5a\x53\x5b\x20\x52\x56'\
b'\x59\x54\x5b\x20\x52\x57\x59\x58\x5b\x20\x52\x56\x5a\x59\x5b'\
b'\x2a\x46\x5f\x4f\x46\x49\x5a\x20\x52\x4f\x46\x56\x5b\x20\x52'\
b'\x50\x46\x56\x58\x20\x52\x51\x46\x57\x58\x20\x52\x5c\x47\x57'\
b'\x58\x56\x5b\x20\x52\x4c\x46\x51\x46\x20\x52\x59\x46\x5f\x46'\
b'\x20\x52\x46\x5b\x4c\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e'\
b'\x46\x50\x48\x20\x52\x5a\x46\x5c\x47\x20\x52\x5e\x46\x5c\x47'\
b'\x20\x52\x49\x5a\x47\x5b\x20\x52\x49\x5a\x4b\x5b\x37\x47\x5d'\
b'\x53\x46\x50\x47\x4e\x49\x4c\x4c\x4b\x4f\x4a\x53\x4a\x56\x4b'\
b'\x59\x4c\x5a\x4e\x5b\x51\x5b\x54\x5a\x56\x58\x58\x55\x59\x52'\
b'\x5a\x4e\x5a\x4b\x59\x48\x58\x47\x56\x46\x53\x46\x20\x52\x4f'\
b'\x49\x4d\x4c\x4c\x4f\x4b\x53\x4b\x57\x4c\x59\x20\x52\x55\x58'\
b'\x57\x55\x58\x52\x59\x4e\x59\x4a\x58\x48\x20\x52\x53\x46\x51'\
b'\x47\x4f\x4a\x4e\x4c\x4d\x4f\x4c\x53\x4c\x58\x4d\x5a\x4e\x5b'\
b'\x20\x52\x51\x5b\x53\x5a\x55\x57\x56\x55\x57\x52\x58\x4e\x58'\
b'\x49\x57\x47\x56\x46\x3b\x46\x5d\x4f\x46\x49\x5b\x20\x52\x50'\
b'\x46\x4a\x5b\x20\x52\x51\x46\x4b\x5b\x20\x52\x4c\x46\x58\x46'\
b'\x5b\x47\x5c\x49\x5c\x4b\x5b\x4e\x59\x50\x55\x51\x4d\x51\x20'\
b'\x52\x5a\x47\x5b\x49\x5b\x4b\x5a\x4e\x58\x50\x20\x52\x58\x46'\
b'\x59\x47\x5a\x49\x5a\x4b\x59\x4e\x57\x50\x55\x51\x20\x52\x46'\
b'\x5b\x4e\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48'\
b'\x20\x52\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x4a'\
b'\x5a\x47\x5b\x20\x52\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b'\
b'\x20\x52\x4a\x5a\x4d\x5b\x4d\x47\x5d\x53\x46\x50\x47\x4e\x49'\
b'\x4c\x4c\x4b\x4f\x4a\x53\x4a\x56\x4b\x59\x4c\x5a\x4e\x5b\x51'\
b'\x5b\x54\x5a\x56\x58\x58\x55\x59\x52\x5a\x4e\x5a\x4b\x59\x48'\
b'\x58\x47\x56\x46\x53\x46\x20\x52\x4f\x49\x4d\x4c\x4c\x4f\x4b'\
b'\x53\x4b\x57\x4c\x59\x20\x52\x55\x58\x57\x55\x58\x52\x59\x4e'\
b'\x59\x4a\x58\x48\x20\x52\x53\x46\x51\x47\x4f\x4a\x4e\x4c\x4d'\
b'\x4f\x4c\x53\x4c\x58\x4d\x5a\x4e\x5b\x20\x52\x51\x5b\x53\x5a'\
b'\x55\x57\x56\x55\x57\x52\x58\x4e\x58\x49\x57\x47\x56\x46\x20'\
b'\x52\x4c\x58\x4d\x56\x4f\x55\x50\x55\x52\x56\x53\x58\x54\x5d'\
b'\x55\x5e\x56\x5e\x57\x5d\x20\x52\x54\x5e\x55\x5f\x56\x5f\x20'\
b'\x52\x53\x58\x53\x5f\x54\x60\x56\x60\x57\x5d\x57\x5c\x4d\x46'\
b'\x5e\x4f\x46\x49\x5b\x20\x52\x50\x46\x4a\x5b\x20\x52\x51\x46'\
b'\x4b\x5b\x20\x52\x4c\x46\x57\x46\x5a\x47\x5b\x49\x5b\x4b\x5a'\
b'\x4e\x59\x4f\x56\x50\x4e\x50\x20\x52\x59\x47\x5a\x49\x5a\x4b'\
b'\x59\x4e\x58\x4f\x20\x52\x57\x46\x58\x47\x59\x49\x59\x4b\x58'\
b'\x4e\x56\x50\x20\x52\x52\x50\x54\x51\x55\x52\x57\x58\x58\x59'\
b'\x59\x59\x5a\x58\x20\x52\x57\x59\x58\x5a\x59\x5a\x20\x52\x55'\
b'\x52\x56\x5a\x57\x5b\x59\x5b\x5a\x58\x5a\x57\x20\x52\x46\x5b'\
b'\x4e\x5b\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x20'\
b'\x52\x52\x46\x50\x48\x20\x52\x53\x46\x50\x47\x20\x52\x4a\x5a'\
b'\x47\x5b\x20\x52\x4a\x59\x48\x5b\x20\x52\x4b\x59\x4c\x5b\x20'\
b'\x52\x4a\x5a\x4d\x5b\x2b\x47\x5e\x5a\x48\x5b\x48\x5c\x46\x5b'\
b'\x4c\x5b\x4a\x5a\x48\x59\x47\x56\x46\x52\x46\x4f\x47\x4d\x49'\
b'\x4d\x4c\x4e\x4e\x50\x50\x56\x53\x57\x55\x57\x58\x56\x5a\x20'\
b'\x52\x4e\x4c\x4f\x4e\x56\x52\x57\x54\x20\x52\x4f\x47\x4e\x49'\
b'\x4e\x4b\x4f\x4d\x55\x50\x57\x52\x58\x54\x58\x57\x57\x59\x56'\
b'\x5a\x53\x5b\x4f\x5b\x4c\x5a\x4b\x59\x4a\x57\x4a\x55\x49\x5b'\
b'\x4a\x59\x4b\x59\x35\x47\x5d\x54\x46\x4e\x5b\x20\x52\x55\x46'\
b'\x4f\x5b\x20\x52\x56\x46\x50\x5b\x20\x52\x4d\x46\x4b\x4c\x20'\
b'\x52\x5d\x46\x5c\x4c\x20\x52\x4d\x46\x5d\x46\x20\x52\x4b\x5b'\
b'\x53\x5b\x20\x52\x4e\x46\x4b\x4c\x20\x52\x50\x46\x4c\x49\x20'\
b'\x52\x52\x46\x4d\x47\x20\x52\x59\x46\x5c\x47\x20\x52\x5a\x46'\
b'\x5c\x48\x20\x52\x5b\x46\x5c\x49\x20\x52\x5c\x46\x5c\x4c\x20'\
b'\x52\x4f\x5a\x4c\x5b\x20\x52\x4f\x59\x4d\x5b\x20\x52\x50\x59'\
b'\x51\x5b\x20\x52\x4f\x5a\x52\x5b\x2f\x46\x5f\x4e\x46\x4b\x51'\
b'\x4a\x55\x4a\x58\x4b\x5a\x4e\x5b\x52\x5b\x55\x5a\x57\x58\x58'\
b'\x55\x5c\x47\x20\x52\x4f\x46\x4c\x51\x4b\x55\x4b\x59\x4c\x5a'\
b'\x20\x52\x50\x46\x4d\x51\x4c\x55\x4c\x59\x4e\x5b\x20\x52\x4b'\
b'\x46\x53\x46\x20\x52\x59\x46\x5f\x46\x20\x52\x4c\x46\x4f\x47'\
b'\x20\x52\x4d\x46\x4e\x48\x20\x52\x51\x46\x4f\x48\x20\x52\x52'\
b'\x46\x4f\x47\x20\x52\x5a\x46\x5c\x47\x20\x52\x5e\x46\x5c\x47'\
b'\x22\x48\x5c\x4e\x46\x4e\x48\x4f\x59\x4f\x5b\x20\x52\x4f\x47'\
b'\x50\x58\x20\x52\x50\x46\x51\x57\x20\x52\x5b\x47\x4f\x5b\x20'\
b'\x52\x4c\x46\x53\x46\x20\x52\x58\x46\x5e\x46\x20\x52\x4d\x46'\
b'\x4e\x48\x20\x52\x51\x46\x50\x48\x20\x52\x52\x46\x4f\x47\x20'\
b'\x52\x59\x46\x5b\x47\x20\x52\x5d\x46\x5b\x47\x38\x45\x5f\x4d'\
b'\x46\x4d\x48\x4b\x59\x4b\x5b\x20\x52\x4e\x47\x4c\x58\x20\x52'\
b'\x4f\x46\x4d\x57\x20\x52\x55\x46\x4d\x57\x4b\x5b\x20\x52\x55'\
b'\x46\x55\x48\x53\x59\x53\x5b\x20\x52\x56\x47\x54\x58\x20\x52'\
b'\x57\x46\x55\x57\x20\x52\x5d\x47\x55\x57\x53\x5b\x20\x52\x4a'\
b'\x46\x52\x46\x20\x52\x55\x46\x57\x46\x20\x52\x5a\x46\x60\x46'\
b'\x20\x52\x4b\x46\x4e\x47\x20\x52\x4c\x46\x4d\x48\x20\x52\x50'\
b'\x46\x4e\x49\x20\x52\x51\x46\x4e\x47\x20\x52\x5b\x46\x5d\x47'\
b'\x20\x52\x5f\x46\x5d\x47\x35\x47\x5d\x4e\x46\x54\x5b\x20\x52'\
b'\x4f\x46\x55\x5b\x20\x52\x50\x46\x56\x5b\x20\x52\x5b\x47\x49'\
b'\x5a\x20\x52\x4c\x46\x53\x46\x20\x52\x58\x46\x5e\x46\x20\x52'\
b'\x46\x5b\x4c\x5b\x20\x52\x51\x5b\x58\x5b\x20\x52\x4d\x46\x4f'\
b'\x48\x20\x52\x51\x46\x50\x48\x20\x52\x52\x46\x50\x47\x20\x52'\
b'\x59\x46\x5b\x47\x20\x52\x5d\x46\x5b\x47\x20\x52\x49\x5a\x47'\
b'\x5b\x20\x52\x49\x5a\x4b\x5b\x20\x52\x54\x5a\x52\x5b\x20\x52'\
b'\x54\x59\x53\x5b\x20\x52\x55\x59\x57\x5b\x32\x47\x5d\x4d\x46'\
b'\x51\x50\x4e\x5b\x20\x52\x4e\x46\x52\x50\x4f\x5b\x20\x52\x4f'\
b'\x46\x53\x50\x50\x5b\x20\x52\x5c\x47\x53\x50\x20\x52\x4b\x46'\
b'\x52\x46\x20\x52\x59\x46\x5f\x46\x20\x52\x4b\x5b\x53\x5b\x20'\
b'\x52\x4c\x46\x4e\x47\x20\x52\x50\x46\x4f\x48\x20\x52\x51\x46'\
b'\x4e\x47\x20\x52\x5a\x46\x5c\x47\x20\x52\x5e\x46\x5c\x47\x20'\
b'\x52\x4f\x5a\x4c\x5b\x20\x52\x4f\x59\x4d\x5b\x20\x52\x50\x59'\
b'\x51\x5b\x20\x52\x4f\x5a\x52\x5b\x22\x47\x5d\x5a\x46\x48\x5b'\
b'\x20\x52\x5b\x46\x49\x5b\x20\x52\x5c\x46\x4a\x5b\x20\x52\x5c'\
b'\x46\x4e\x46\x4c\x4c\x20\x52\x48\x5b\x56\x5b\x58\x55\x20\x52'\
b'\x4f\x46\x4c\x4c\x20\x52\x50\x46\x4d\x49\x20\x52\x52\x46\x4e'\
b'\x47\x20\x52\x52\x5b\x56\x5a\x20\x52\x54\x5b\x57\x58\x20\x52'\
b'\x55\x5b\x58\x55\x0b\x4b\x59\x4f\x42\x4f\x62\x20\x52\x50\x42'\
b'\x50\x62\x20\x52\x4f\x42\x56\x42\x20\x52\x4f\x62\x56\x62\x02'\
b'\x4b\x59\x4b\x46\x59\x5e\x0b\x4b\x59\x54\x42\x54\x62\x20\x52'\
b'\x55\x42\x55\x62\x20\x52\x4e\x42\x55\x42\x20\x52\x4e\x62\x55'\
b'\x62\x07\x47\x5d\x4a\x54\x52\x4f\x5a\x54\x20\x52\x4a\x54\x52'\
b'\x50\x5a\x54\x02\x48\x5c\x48\x62\x5c\x62\x06\x4c\x58\x50\x46'\
b'\x55\x4c\x20\x52\x50\x46\x4f\x47\x55\x4c\x31\x47\x5d\x57\x4d'\
b'\x55\x54\x55\x58\x56\x5a\x57\x5b\x59\x5b\x5b\x59\x5c\x57\x20'\
b'\x52\x58\x4d\x56\x54\x56\x5a\x20\x52\x57\x4d\x59\x4d\x57\x54'\
b'\x56\x58\x20\x52\x55\x54\x55\x51\x54\x4e\x52\x4d\x50\x4d\x4d'\
b'\x4e\x4b\x51\x4a\x54\x4a\x56\x4b\x59\x4c\x5a\x4e\x5b\x50\x5b'\
b'\x52\x5a\x53\x59\x54\x57\x55\x54\x20\x52\x4e\x4e\x4c\x51\x4b'\
b'\x54\x4b\x57\x4c\x59\x20\x52\x50\x4d\x4e\x4f\x4d\x51\x4c\x54'\
b'\x4c\x57\x4d\x5a\x4e\x5b\x33\x49\x5c\x50\x46\x4e\x4d\x4d\x53'\
b'\x4d\x57\x4e\x59\x4f\x5a\x51\x5b\x53\x5b\x56\x5a\x58\x57\x59'\
b'\x54\x59\x52\x58\x4f\x57\x4e\x55\x4d\x53\x4d\x51\x4e\x50\x4f'\
b'\x4f\x51\x4e\x54\x20\x52\x51\x46\x4f\x4d\x4e\x51\x4e\x57\x4f'\
b'\x5a\x20\x52\x56\x59\x57\x57\x58\x54\x58\x51\x57\x4f\x20\x52'\
b'\x4d\x46\x52\x46\x50\x4d\x4e\x54\x20\x52\x53\x5b\x55\x59\x56'\
b'\x57\x57\x54\x57\x51\x56\x4e\x55\x4d\x20\x52\x4e\x46\x51\x47'\
b'\x20\x52\x4f\x46\x50\x48\x21\x49\x5b\x57\x51\x57\x50\x56\x50'\
b'\x56\x52\x58\x52\x58\x50\x57\x4e\x55\x4d\x52\x4d\x4f\x4e\x4d'\
b'\x51\x4c\x54\x4c\x56\x4d\x59\x4e\x5a\x50\x5b\x52\x5b\x55\x5a'\
b'\x57\x57\x20\x52\x4f\x4f\x4e\x51\x4d\x54\x4d\x57\x4e\x59\x20'\
b'\x52\x52\x4d\x50\x4f\x4f\x51\x4e\x54\x4e\x57\x4f\x5a\x50\x5b'\
b'\x39\x47\x5d\x59\x46\x56\x51\x55\x55\x55\x58\x56\x5a\x57\x5b'\
b'\x59\x5b\x5b\x59\x5c\x57\x20\x52\x5a\x46\x57\x51\x56\x55\x56'\
b'\x5a\x20\x52\x56\x46\x5b\x46\x57\x54\x56\x58\x20\x52\x55\x54'\
b'\x55\x51\x54\x4e\x52\x4d\x50\x4d\x4d\x4e\x4b\x51\x4a\x54\x4a'\
b'\x56\x4b\x59\x4c\x5a\x4e\x5b\x50\x5b\x52\x5a\x53\x59\x54\x57'\
b'\x55\x54\x20\x52\x4d\x4f\x4c\x51\x4b\x54\x4b\x57\x4c\x59\x20'\
b'\x52\x50\x4d\x4e\x4f\x4d\x51\x4c\x54\x4c\x57\x4d\x5a\x4e\x5b'\
b'\x20\x52\x57\x46\x5a\x47\x20\x52\x58\x46\x59\x48\x20\x49\x5b'\
b'\x4d\x56\x51\x55\x54\x54\x57\x52\x58\x50\x57\x4e\x55\x4d\x52'\
b'\x4d\x4f\x4e\x4d\x51\x4c\x54\x4c\x56\x4d\x59\x4e\x5a\x50\x5b'\
b'\x52\x5b\x55\x5a\x57\x58\x20\x52\x4f\x4f\x4e\x51\x4d\x54\x4d'\
b'\x57\x4e\x59\x20\x52\x52\x4d\x50\x4f\x4f\x51\x4e\x54\x4e\x57'\
b'\x4f\x5a\x50\x5b\x2c\x4a\x5a\x5a\x48\x5a\x47\x59\x47\x59\x49'\
b'\x5b\x49\x5b\x47\x5a\x46\x58\x46\x56\x47\x54\x49\x53\x4b\x52'\
b'\x4e\x51\x52\x4f\x5b\x4e\x5e\x4d\x60\x4b\x62\x20\x52\x54\x4a'\
b'\x53\x4d\x52\x52\x50\x5b\x4f\x5e\x20\x52\x58\x46\x56\x48\x55'\
b'\x4a\x54\x4d\x53\x52\x51\x5a\x50\x5d\x4f\x5f\x4d\x61\x4b\x62'\
b'\x49\x62\x48\x61\x48\x5f\x4a\x5f\x4a\x61\x49\x61\x49\x60\x20'\
b'\x52\x4e\x4d\x59\x4d\x38\x48\x5d\x58\x4d\x54\x5b\x53\x5e\x51'\
b'\x61\x4f\x62\x20\x52\x59\x4d\x55\x5b\x53\x5f\x20\x52\x58\x4d'\
b'\x5a\x4d\x56\x5b\x54\x5f\x52\x61\x4f\x62\x4c\x62\x4a\x61\x49'\
b'\x60\x49\x5e\x4b\x5e\x4b\x60\x4a\x60\x4a\x5f\x20\x52\x56\x54'\
b'\x56\x51\x55\x4e\x53\x4d\x51\x4d\x4e\x4e\x4c\x51\x4b\x54\x4b'\
b'\x56\x4c\x59\x4d\x5a\x4f\x5b\x51\x5b\x53\x5a\x54\x59\x55\x57'\
b'\x56\x54\x20\x52\x4e\x4f\x4d\x51\x4c\x54\x4c\x57\x4d\x59\x20'\
b'\x52\x51\x4d\x4f\x4f\x4e\x51\x4d\x54\x4d\x57\x4e\x5a\x4f\x5b'\
b'\x28\x47\x5d\x4f\x46\x49\x5b\x4b\x5b\x20\x52\x50\x46\x4a\x5b'\
b'\x20\x52\x4c\x46\x51\x46\x4b\x5b\x20\x52\x4d\x54\x4f\x50\x51'\
b'\x4e\x53\x4d\x55\x4d\x57\x4e\x58\x50\x58\x53\x56\x58\x20\x52'\
b'\x57\x4e\x57\x52\x56\x56\x56\x5a\x20\x52\x57\x50\x55\x55\x55'\
b'\x58\x56\x5a\x57\x5b\x59\x5b\x5b\x59\x5c\x57\x20\x52\x4d\x46'\
b'\x50\x47\x20\x52\x4e\x46\x4f\x48\x22\x4b\x58\x53\x46\x53\x48'\
b'\x55\x48\x55\x46\x53\x46\x20\x52\x54\x46\x54\x48\x20\x52\x53'\
b'\x47\x55\x47\x20\x52\x4c\x51\x4d\x4f\x4f\x4d\x51\x4d\x52\x4e'\
b'\x53\x50\x53\x53\x51\x58\x20\x52\x52\x4e\x52\x52\x51\x56\x51'\
b'\x5a\x20\x52\x52\x50\x50\x55\x50\x58\x51\x5a\x52\x5b\x54\x5b'\
b'\x56\x59\x57\x57\x2c\x4b\x58\x55\x46\x55\x48\x57\x48\x57\x46'\
b'\x55\x46\x20\x52\x56\x46\x56\x48\x20\x52\x55\x47\x57\x47\x20'\
b'\x52\x4d\x51\x4e\x4f\x50\x4d\x52\x4d\x53\x4e\x54\x50\x54\x53'\
b'\x52\x5a\x51\x5d\x50\x5f\x4e\x61\x4c\x62\x4a\x62\x49\x61\x49'\
b'\x5f\x4b\x5f\x4b\x61\x4a\x61\x4a\x60\x20\x52\x53\x4e\x53\x53'\
b'\x51\x5a\x50\x5d\x4f\x5f\x20\x52\x53\x50\x52\x54\x50\x5b\x4f'\
b'\x5e\x4e\x60\x4c\x62\x30\x47\x5d\x4f\x46\x49\x5b\x4b\x5b\x20'\
b'\x52\x50\x46\x4a\x5b\x20\x52\x4c\x46\x51\x46\x4b\x5b\x20\x52'\
b'\x59\x4f\x59\x4e\x58\x4e\x58\x50\x5a\x50\x5a\x4e\x59\x4d\x57'\
b'\x4d\x55\x4e\x51\x52\x4f\x53\x20\x52\x4d\x53\x4f\x53\x51\x54'\
b'\x52\x55\x54\x59\x55\x5a\x57\x5a\x20\x52\x51\x55\x53\x59\x54'\
b'\x5a\x20\x52\x4f\x53\x50\x54\x52\x5a\x53\x5b\x55\x5b\x57\x5a'\
b'\x59\x57\x20\x52\x4d\x46\x50\x47\x20\x52\x4e\x46\x4f\x48\x19'\
b'\x4c\x58\x54\x46\x51\x51\x50\x55\x50\x58\x51\x5a\x52\x5b\x54'\
b'\x5b\x56\x59\x57\x57\x20\x52\x55\x46\x52\x51\x51\x55\x51\x5a'\
b'\x20\x52\x51\x46\x56\x46\x52\x54\x51\x58\x20\x52\x52\x46\x55'\
b'\x47\x20\x52\x53\x46\x54\x48\x3c\x40\x63\x41\x51\x42\x4f\x44'\
b'\x4d\x46\x4d\x47\x4e\x48\x50\x48\x53\x46\x5b\x20\x52\x47\x4e'\
b'\x47\x53\x45\x5b\x20\x52\x47\x50\x46\x54\x44\x5b\x46\x5b\x20'\
b'\x52\x48\x53\x4a\x50\x4c\x4e\x4e\x4d\x50\x4d\x52\x4e\x53\x50'\
b'\x53\x53\x51\x5b\x20\x52\x52\x4e\x52\x53\x50\x5b\x20\x52\x52'\
b'\x50\x51\x54\x4f\x5b\x51\x5b\x20\x52\x53\x53\x55\x50\x57\x4e'\
b'\x59\x4d\x5b\x4d\x5d\x4e\x5e\x50\x5e\x53\x5c\x58\x20\x52\x5d'\
b'\x4e\x5d\x52\x5c\x56\x5c\x5a\x20\x52\x5d\x50\x5b\x55\x5b\x58'\
b'\x5c\x5a\x5d\x5b\x5f\x5b\x61\x59\x62\x57\x29\x46\x5e\x47\x51'\
b'\x48\x4f\x4a\x4d\x4c\x4d\x4d\x4e\x4e\x50\x4e\x53\x4c\x5b\x20'\
b'\x52\x4d\x4e\x4d\x53\x4b\x5b\x20\x52\x4d\x50\x4c\x54\x4a\x5b'\
b'\x4c\x5b\x20\x52\x4e\x53\x50\x50\x52\x4e\x54\x4d\x56\x4d\x58'\
b'\x4e\x59\x50\x59\x53\x57\x58\x20\x52\x58\x4e\x58\x52\x57\x56'\
b'\x57\x5a\x20\x52\x58\x50\x56\x55\x56\x58\x57\x5a\x58\x5b\x5a'\
b'\x5b\x5c\x59\x5d\x57\x2d\x48\x5c\x51\x4d\x4e\x4e\x4c\x51\x4b'\
b'\x54\x4b\x56\x4c\x59\x4d\x5a\x50\x5b\x53\x5b\x56\x5a\x58\x57'\
b'\x59\x54\x59\x52\x58\x4f\x57\x4e\x54\x4d\x51\x4d\x20\x52\x4e'\
b'\x4f\x4d\x51\x4c\x54\x4c\x57\x4d\x59\x20\x52\x56\x59\x57\x57'\
b'\x58\x54\x58\x51\x57\x4f\x20\x52\x51\x4d\x4f\x4f\x4e\x51\x4d'\
b'\x54\x4d\x57\x4e\x5a\x50\x5b\x20\x52\x53\x5b\x55\x59\x56\x57'\
b'\x57\x54\x57\x51\x56\x4e\x54\x4d\x41\x47\x5d\x48\x51\x49\x4f'\
b'\x4b\x4d\x4d\x4d\x4e\x4e\x4f\x50\x4f\x53\x4e\x57\x4b\x62\x20'\
b'\x52\x4e\x4e\x4e\x53\x4d\x57\x4a\x62\x20\x52\x4e\x50\x4d\x54'\
b'\x49\x62\x20\x52\x4f\x54\x50\x51\x51\x4f\x52\x4e\x54\x4d\x56'\
b'\x4d\x58\x4e\x59\x4f\x5a\x52\x5a\x54\x59\x57\x57\x5a\x54\x5b'\
b'\x52\x5b\x50\x5a\x4f\x57\x4f\x54\x20\x52\x58\x4f\x59\x51\x59'\
b'\x54\x58\x57\x57\x59\x20\x52\x56\x4d\x57\x4e\x58\x51\x58\x54'\
b'\x57\x57\x56\x59\x54\x5b\x20\x52\x46\x62\x4e\x62\x20\x52\x4a'\
b'\x61\x47\x62\x20\x52\x4a\x60\x48\x62\x20\x52\x4b\x60\x4c\x62'\
b'\x20\x52\x4a\x61\x4d\x62\x38\x47\x5c\x57\x4d\x51\x62\x20\x52'\
b'\x58\x4d\x52\x62\x20\x52\x57\x4d\x59\x4d\x53\x62\x20\x52\x55'\
b'\x54\x55\x51\x54\x4e\x52\x4d\x50\x4d\x4d\x4e\x4b\x51\x4a\x54'\
b'\x4a\x56\x4b\x59\x4c\x5a\x4e\x5b\x50\x5b\x52\x5a\x53\x59\x54'\
b'\x57\x55\x54\x20\x52\x4d\x4f\x4c\x51\x4b\x54\x4b\x57\x4c\x59'\
b'\x20\x52\x50\x4d\x4e\x4f\x4d\x51\x4c\x54\x4c\x57\x4d\x5a\x4e'\
b'\x5b\x20\x52\x4e\x62\x56\x62\x20\x52\x52\x61\x4f\x62\x20\x52'\
b'\x52\x60\x50\x62\x20\x52\x53\x60\x54\x62\x20\x52\x52\x61\x55'\
b'\x62\x1d\x49\x5b\x4a\x51\x4b\x4f\x4d\x4d\x4f\x4d\x50\x4e\x51'\
b'\x50\x51\x54\x4f\x5b\x20\x52\x50\x4e\x50\x54\x4e\x5b\x20\x52'\
b'\x50\x50\x4f\x54\x4d\x5b\x4f\x5b\x20\x52\x59\x4f\x59\x4e\x58'\
b'\x4e\x58\x50\x5a\x50\x5a\x4e\x59\x4d\x57\x4d\x55\x4e\x53\x50'\
b'\x51\x54\x2e\x4a\x5b\x58\x50\x58\x4f\x57\x4f\x57\x51\x59\x51'\
b'\x59\x4f\x58\x4e\x55\x4d\x52\x4d\x4f\x4e\x4e\x4f\x4e\x51\x4f'\
b'\x53\x51\x54\x54\x55\x56\x56\x57\x58\x20\x52\x4f\x4e\x4e\x51'\
b'\x20\x52\x4f\x52\x51\x53\x54\x54\x56\x55\x20\x52\x57\x56\x56'\
b'\x5a\x20\x52\x4e\x4f\x4f\x51\x51\x52\x54\x53\x56\x54\x57\x56'\
b'\x57\x58\x56\x5a\x53\x5b\x50\x5b\x4d\x5a\x4c\x59\x4c\x57\x4e'\
b'\x57\x4e\x59\x4d\x59\x4d\x58\x16\x4b\x59\x54\x46\x51\x51\x50'\
b'\x55\x50\x58\x51\x5a\x52\x5b\x54\x5b\x56\x59\x57\x57\x20\x52'\
b'\x55\x46\x52\x51\x51\x55\x51\x5a\x20\x52\x54\x46\x56\x46\x52'\
b'\x54\x51\x58\x20\x52\x4e\x4d\x58\x4d\x29\x46\x5e\x47\x51\x48'\
b'\x4f\x4a\x4d\x4c\x4d\x4d\x4e\x4e\x50\x4e\x53\x4c\x58\x20\x52'\
b'\x4d\x4e\x4d\x52\x4c\x56\x4c\x5a\x20\x52\x4d\x50\x4b\x55\x4b'\
b'\x58\x4c\x5a\x4e\x5b\x50\x5b\x52\x5a\x54\x58\x56\x55\x20\x52'\
b'\x58\x4d\x56\x55\x56\x58\x57\x5a\x58\x5b\x5a\x5b\x5c\x59\x5d'\
b'\x57\x20\x52\x59\x4d\x57\x55\x57\x5a\x20\x52\x58\x4d\x5a\x4d'\
b'\x58\x54\x57\x58\x1c\x48\x5c\x49\x51\x4a\x4f\x4c\x4d\x4e\x4d'\
b'\x4f\x4e\x50\x50\x50\x53\x4e\x58\x20\x52\x4f\x4e\x4f\x52\x4e'\
b'\x56\x4e\x5a\x20\x52\x4f\x50\x4d\x55\x4d\x58\x4e\x5a\x50\x5b'\
b'\x52\x5b\x54\x5a\x56\x58\x58\x55\x59\x51\x59\x4d\x58\x4d\x58'\
b'\x4e\x59\x50\x2f\x43\x61\x44\x51\x45\x4f\x47\x4d\x49\x4d\x4a'\
b'\x4e\x4b\x50\x4b\x53\x49\x58\x20\x52\x4a\x4e\x4a\x52\x49\x56'\
b'\x49\x5a\x20\x52\x4a\x50\x48\x55\x48\x58\x49\x5a\x4b\x5b\x4d'\
b'\x5b\x4f\x5a\x51\x58\x52\x55\x20\x52\x54\x4d\x52\x55\x52\x58'\
b'\x53\x5a\x55\x5b\x57\x5b\x59\x5a\x5b\x58\x5d\x55\x5e\x51\x5e'\
b'\x4d\x5d\x4d\x5d\x4e\x5e\x50\x20\x52\x55\x4d\x53\x55\x53\x5a'\
b'\x20\x52\x54\x4d\x56\x4d\x54\x54\x53\x58\x32\x47\x5d\x4a\x51'\
b'\x4c\x4e\x4e\x4d\x50\x4d\x52\x4e\x53\x50\x53\x52\x20\x52\x50'\
b'\x4d\x51\x4e\x51\x52\x50\x56\x4f\x58\x4d\x5a\x4b\x5b\x49\x5b'\
b'\x48\x5a\x48\x58\x4a\x58\x4a\x5a\x49\x5a\x49\x59\x20\x52\x52'\
b'\x4f\x52\x52\x51\x56\x51\x59\x20\x52\x5a\x4f\x5a\x4e\x59\x4e'\
b'\x59\x50\x5b\x50\x5b\x4e\x5a\x4d\x58\x4d\x56\x4e\x54\x50\x53'\
b'\x52\x52\x56\x52\x5a\x53\x5b\x20\x52\x50\x56\x50\x58\x51\x5a'\
b'\x53\x5b\x55\x5b\x57\x5a\x59\x57\x30\x47\x5d\x48\x51\x49\x4f'\
b'\x4b\x4d\x4d\x4d\x4e\x4e\x4f\x50\x4f\x53\x4d\x58\x20\x52\x4e'\
b'\x4e\x4e\x52\x4d\x56\x4d\x5a\x20\x52\x4e\x50\x4c\x55\x4c\x58'\
b'\x4d\x5a\x4f\x5b\x51\x5b\x53\x5a\x55\x58\x57\x54\x20\x52\x59'\
b'\x4d\x55\x5b\x54\x5e\x52\x61\x50\x62\x20\x52\x5a\x4d\x56\x5b'\
b'\x54\x5f\x20\x52\x59\x4d\x5b\x4d\x57\x5b\x55\x5f\x53\x61\x50'\
b'\x62\x4d\x62\x4b\x61\x4a\x60\x4a\x5e\x4c\x5e\x4c\x60\x4b\x60'\
b'\x4b\x5f\x26\x48\x5c\x59\x4d\x58\x4f\x56\x51\x4e\x57\x4c\x59'\
b'\x4b\x5b\x20\x52\x58\x4f\x4f\x4f\x4d\x50\x4c\x52\x20\x52\x56'\
b'\x4f\x52\x4e\x4f\x4e\x4e\x4f\x20\x52\x56\x4f\x52\x4d\x4f\x4d'\
b'\x4d\x4f\x4c\x52\x20\x52\x4c\x59\x55\x59\x57\x58\x58\x56\x20'\
b'\x52\x4e\x59\x52\x5a\x55\x5a\x56\x59\x20\x52\x4e\x59\x52\x5b'\
b'\x55\x5b\x57\x59\x58\x56\x27\x4b\x59\x54\x42\x52\x43\x51\x44'\
b'\x50\x46\x50\x48\x51\x4a\x52\x4b\x53\x4d\x53\x4f\x51\x51\x20'\
b'\x52\x52\x43\x51\x45\x51\x47\x52\x49\x53\x4a\x54\x4c\x54\x4e'\
b'\x53\x50\x4f\x52\x53\x54\x54\x56\x54\x58\x53\x5a\x52\x5b\x51'\
b'\x5d\x51\x5f\x52\x61\x20\x52\x51\x53\x53\x55\x53\x57\x52\x59'\
b'\x51\x5a\x50\x5c\x50\x5e\x51\x60\x52\x61\x54\x62\x02\x4e\x56'\
b'\x52\x42\x52\x62\x27\x4b\x59\x50\x42\x52\x43\x53\x44\x54\x46'\
b'\x54\x48\x53\x4a\x52\x4b\x51\x4d\x51\x4f\x53\x51\x20\x52\x52'\
b'\x43\x53\x45\x53\x47\x52\x49\x51\x4a\x50\x4c\x50\x4e\x51\x50'\
b'\x55\x52\x51\x54\x50\x56\x50\x58\x51\x5a\x52\x5b\x53\x5d\x53'\
b'\x5f\x52\x61\x20\x52\x53\x53\x51\x55\x51\x57\x52\x59\x53\x5a'\
b'\x54\x5c\x54\x5e\x53\x60\x52\x61\x50\x62\x17\x46\x5e\x49\x55'\
b'\x49\x53\x4a\x50\x4c\x4f\x4e\x4f\x50\x50\x54\x53\x56\x54\x58'\
b'\x54\x5a\x53\x5b\x51\x20\x52\x49\x53\x4a\x51\x4c\x50\x4e\x50'\
b'\x50\x51\x54\x54\x56\x55\x58\x55\x5a\x54\x5b\x51\x5b\x4f\x22'\
b'\x4a\x5a\x4a\x46\x4a\x5b\x4b\x5b\x4b\x46\x4c\x46\x4c\x5b\x4d'\
b'\x5b\x4d\x46\x4e\x46\x4e\x5b\x4f\x5b\x4f\x46\x50\x46\x50\x5b'\
b'\x51\x5b\x51\x46\x52\x46\x52\x5b\x53\x5b\x53\x46\x54\x46\x54'\
b'\x5b\x55\x5b\x55\x46\x56\x46\x56\x5b\x57\x5b\x57\x46\x58\x46'\
b'\x58\x5b\x59\x5b\x59\x46\x5a\x46\x5a\x5b'
_index =\
b'\x00\x00\x03\x00\x48\x00\x61\x00\x7a\x00\xe3\x00\x24\x01\xb5'\
b'\x01\xc2\x01\x03\x02\x44\x02\x93\x02\xb4\x02\xe1\x02\xe8\x02'\
b'\x09\x03\x1a\x03\x8f\x03\xb8\x03\x21\x04\xa2\x04\xc1\x04\x24'\
b'\x05\x9f\x05\xee\x05\xbf\x06\x3a\x07\x7b\x07\xc8\x07\xd1\x07'\
b'\xf2\x07\xfb\x07\x72\x08\xe3\x08\x30\x09\xcd\x09\x20\x0a\x9f'\
b'\x0a\x40\x0b\xcd\x0b\x50\x0c\xf3\x0c\x42\x0d\xa1\x0d\x32\x0e'\
b'\x95\x0e\x1e\x0f\x75\x0f\xe6\x0f\x5f\x10\xfc\x10\x99\x11\xf2'\
b'\x11\x5f\x12\xc0\x12\x07\x13\x7a\x13\xe7\x13\x4e\x14\x95\x14'\
b'\xae\x14\xb5\x14\xce\x14\xdf\x14\xe6\x14\xf5\x14\x5a\x15\xc3'\
b'\x15\x08\x16\x7d\x16\xc0\x16\x1b\x17\x8e\x17\xe1\x17\x28\x18'\
b'\x83\x18\xe6\x18\x1b\x19\x96\x19\xeb\x19\x48\x1a\xcd\x1a\x40'\
b'\x1b\x7d\x1b\xdc\x1b\x0b\x1c\x60\x1c\x9b\x1c\xfc\x1c\x63\x1d'\
b'\xc6\x1d\x15\x1e\x66\x1e\x6d\x1e\xbe\x1e\xef\x1e'
_mvfont = memoryview(_font)
def _chr_addr(ordch):
offset = 2 * (ordch - 32)
return int.from_bytes(_index[offset:offset + 2], 'little')
def get_ch(ordch):
offset = _chr_addr(ordch if 32 <= ordch <= 127 else ord('?'))
count = _font[offset]
return _mvfont[offset:offset+(count+2)*2-1]
| def glyphs():
return 96
_font = b'\x00JZ!MXVFUFTGRT RVGUGRT RVGVHRT RVFWGWHRT RPXOYOZP[Q[RZRYQXPX RPYPZQZQYPY\x0bI[PFNM RQFNM RYFWM RZFWM\x0bH]SBLb RYBRb RLOZO RKUYU3H]TBL_ RYBQ_ RZKZJYJYL[L[JZHYGVFRFOGMIMLNNPPVSWUWXVZ RNLONVRWT ROGNINKOMUPWRXTXWWYVZS[O[LZKYJWJULULWKWKV\x1fF^[FI[ RNFPHPJOLMMKMIKIIJGLFNFPGSHVHYG[F RWTUUTWTYV[X[ZZ[X[VYTWTGE_\\O\\N[N[P]P]N\\M[MYNWPRXPZN[K[HZGXGVHTISKRPPROTMUKUITGRFPGOIOLPRQURWTZV[X[YYYX RL[HZ RIZHXHVITJSLR RPPQSTYVZ RK[JZIXIVJTKSMRRO ROLPOQRSVUYWZXZYY\x05NWUFSM RVFSM\x1fJZZBXCUERHPKNOMSMXN\\O_Qb RSHQKOONTN\\ RZBWDTGRJQLPOOSN\\ RNTO]P`Qb\x1fJZSBUEVHWLWQVUTYR\\O_LaJb RVHVPUUSYQ\\ RSBTDUGVP RVHUQTUSXRZP]M`Jb&J[TFSGUQTR RTFTR RTFUGSQTR ROIPIXOYO ROIYO ROIOJYNYO RYIXIPOOO RYIOO RYIYJONOO\x0fF_RIRZSZ RRISISZ RJQ[Q[R RJQJR[R\x15MXQ[P[OZOYPXQXRYR[Q]P^N_ RPYPZQZQYPY RQ[Q\\P^\x02E_IR[R\x0fMXPXOYOZP[Q[RZRYQXPX RPYPZQZQYPY\x07G^[BIbJb R[B\\BJb9H]TFQGOIMLLOKSKVLYMZO[Q[TZVXXUYRZNZKYHXGVFTF RQHOJNLMOLSLWMY RTYVWWUXRYNYJXH RTFRGPJOLNOMSMXNZO[ RQ[SZUWVUWRXNXIWGVF\x13H]TJO[Q[ RWFUJP[ RWFQ[ RWFTIQKOL RTJRKOL3H]OKOJPJPLNLNJOHPGSFVFYGZIZKYMWOMUKWI[ RXGYIYKXMVOSQ RVFWGXIXKWMUOMU RJYKXMXRYWYXX RMXRZWZ RMXR[U[WZXXXW?H]OKOJPJPLNLNJOHPGSFVFYGZIZKYMXNVOSP RXGYIYKXMWN RVFWGXIXKWMUOSP RQPSPVQWRXTXWWYUZR[O[LZKYJWJULULWKWKV RVRWTWWVY RSPUQVSVWUYTZR[\x0eH]WJR[T[ RZFXJS[ RZFT[ RZFJUZU0H]QFLP RQF[F RQGYG RPHUHYG[F RLPMOPNSNVOWPXRXUWXUZQ[N[LZKYJWJULULWKWKV RVPWRWUVXTZ RSNUOVQVUUXSZQ[<H]YJYIXIXKZKZIYGWFTFQGOIMLLOKSKVLYMZO[R[UZWXXVXSWQVPTOQOOPNQMS RPINLMOLSLWMY RVXWVWSVQ RTFRGPJOLNOMSMXNZO[ RR[TZUYVVVRUPTO&H]NFLL R[FZIXLTQRTQWP[ RRSPWO[ RXLRRPUOWN[P[ RMIPFRFWI ROGRGWI RMIOHRHWIYIZH[FgH]SFPGOHNJNMOOQPTPWOYNZLZIYGWFSF RUFPG RPHOJONPO ROORP RSPWO RXNYLYIXG RYGUF RSFQHPJPNQP RTPVOWNXLXHWF RQPMQKSJUJXKZN[R[VZWYXWXTWRVQTP RRPMQ RNQLSKUKXLZ RKZP[VZ RVYWWWTVR RVQSP RQPOQMSLULXMZN[ RR[TZUYVWVSUQTP<H]XNWPVQTRQROQNPMNMKNIPGSFVFXGYHZKZNYRXUVXTZQ[N[LZKXKVMVMXLXLW ROPNNNKOI RXHYJYNXRWUUX RQRPQOOOKPHQGSF RVFWGXIXNWRVUUWSZQ[\x1fMXSMRNROSPTPUOUNTMSM RSNSOTOTNSN RPXOYOZP[Q[RZRYQXPX RPYPZQZQYPY%MXSMRNROSPTPUOUNTMSM RSNSOTOTNSN RQ[P[OZOYPXQXRYR[Q]P^N_ RPYPZQZQYPY RQ[Q\\P^\x03F^ZIJRZ[\x0fF_JM[M[N RJMJN[N RJU[U[V RJUJV[V\x03F^JIZRJ[:H]OKOJPJPLNLNJOHPGSFWFZG[I[KZMYNWOSPQQQSSTTT RUFZG RYGZIZKYMXNVO RWFXGYIYKXMWNSPRQRSST RPXOYOZP[Q[RZRYQXPX RPYPZQZQYPY7E`WNVLTKQKOLNMMPMSNUPVSVUUVS RQKOMNPNSOUPV RWKVSVUXVZV\\T]Q]O\\L[JYHWGTFQFNGLHJJILHOHRIUJWLYNZQ[T[WZYYZX RXKWSWUXV%H\\UFIZ RSJT[ RTHUZ RUFUHVYV[ RLUTU RF[L[ RQ[X[ RIZG[ RIZK[ RTZR[ RTYS[ RVYW[MF^OFI[ RPFJ[ RQFK[ RLFWFZG[I[KZNYOVP RYGZIZKYNXO RWFXGYIYKXNVP RNPVPXQYSYUXXVZR[F[ RWQXSXUWXUZ RVPWRWUVXTZR[ RMFPG RNFOH RRFPH RSFPG RJZG[ RJYH[ RKYL[ RJZM[(H]ZH[H\\F[L[JZHYGWFTFQGOIMLLOKSKVLYMZP[S[UZWXXV RQHOJNLMOLSLWMY RTFRGPJOLNOMSMXNZP[>F]OFI[ RPFJ[ RQFK[ RLFUFXGYHZKZOYSWWUYSZO[F[ RWGXHYKYOXSVWTY RUFWHXKXOWSUWRZO[ RMFPG RNFOH RRFPH RSFPG RJZG[ RJYH[ RKYL[ RJZM[OF]OFI[ RPFJ[ RQFK[ RULST RLF[FZL RNPTP RF[U[WV RMFPG RNFOH RRFPH RSFPG RWFZG RXFZH RYFZI RZFZL RULSPST RTNRPSR RTOQPSQ RJZG[ RJYH[ RKYL[ RJZM[ RP[UZ RR[UY RUYWVEF\\OFI[ RPFJ[ RQFK[ RULST RLF[FZL RNPTP RF[N[ RMFPG RNFOH RRFPH RSFPG RWFZG RXFZH RYFZI RZFZL RULSPST RTNRPSR RTOQPSQ RJZG[ RJYH[ RKYL[ RJZM[@H^ZH[H\\F[L[JZHYGWFTFQGOIMLLOKSKVLYMZP[R[UZWXYT RQHOJNLMOLSLWMY RVXWWXT RTFRGPJOLNOMSMXNZP[ RR[TZVWWT RTT\\T RUTWU RVTWW RZTXV R[TXUPE_NFH[ ROFI[ RPFJ[ RZFT[ R[FU[ R\\FV[ RKFSF RWF_F RLPXP RE[M[ RQ[Y[ RLFOG RMFNH RQFOH RRFOG RXF[G RYFZH R]F[H R^F[G RIZF[ RIYG[ RJYK[ RIZL[ RUZR[ RUYS[ RVYW[ RUZX[&KYTFN[ RUFO[ RVFP[ RQFYF RK[S[ RRFUG RSFTH RWFUH RXFUG ROZL[ ROYM[ RPYQ[ ROZR[.I\\WFRWQYO[ RXFTSSVRX RYFUSSXQZO[M[KZJXJVKULUMVMWLXKX RKVKWLWLVKV RTF\\F RUFXG RVFWH RZFXH R[FXGGF]OFI[ RPFJ[ RQFK[ R\\GMR RQOU[ RROV[ RSNWZ RLFTF RYF_F RF[N[ RR[Y[ RMFPG RNFOH RRFPH RSFPG RZF\\G R^F\\G RJZG[ RJYH[ RKYL[ RJZM[ RUZS[ RUYT[ RVYX[0H\\QFK[ RRFL[ RSFM[ RNFVF RH[W[YU ROFRG RPFQH RTFRH RUFRG RLZI[ RLYJ[ RMYN[ RLZO[ RR[WZ RT[XX RV[YUCD`MFGZ RMGNYN[ RNFOY ROFPX R[FPXN[ R[FU[ R\\FV[ R]FW[ RJFOF R[F`F RD[J[ RR[Z[ RKFMG RLFMH R^F\\H R_F\\G RGZE[ RGZI[ RVZS[ RVYT[ RWYX[ RVZY[*F_OFIZ ROFV[ RPFVX RQFWX R\\GWXV[ RLFQF RYF_F RF[L[ RMFPG RNFPH RZF\\G R^F\\G RIZG[ RIZK[7G]SFPGNILLKOJSJVKYLZN[Q[TZVXXUYRZNZKYHXGVFSF ROIMLLOKSKWLY RUXWUXRYNYJXH RSFQGOJNLMOLSLXMZN[ RQ[SZUWVUWRXNXIWGVF;F]OFI[ RPFJ[ RQFK[ RLFXF[G\\I\\K[NYPUQMQ RZG[I[KZNXP RXFYGZIZKYNWPUQ RF[N[ RMFPG RNFOH RRFPH RSFPG RJZG[ RJYH[ RKYL[ RJZM[MG]SFPGNILLKOJSJVKYLZN[Q[TZVXXUYRZNZKYHXGVFSF ROIMLLOKSKWLY RUXWUXRYNYJXH RSFQGOJNLMOLSLXMZN[ RQ[SZUWVUWRXNXIWGVF RLXMVOUPURVSXT]U^V^W] RT^U_V_ RSXS_T`V`W]W\\MF^OFI[ RPFJ[ RQFK[ RLFWFZG[I[KZNYOVPNP RYGZIZKYNXO RWFXGYIYKXNVP RRPTQURWXXYYYZX RWYXZYZ RURVZW[Y[ZXZW RF[N[ RMFPG RNFOH RRFPH RSFPG RJZG[ RJYH[ RKYL[ RJZM[+G^ZH[H\\F[L[JZHYGVFRFOGMIMLNNPPVSWUWXVZ RNLONVRWT ROGNINKOMUPWRXTXWWYVZS[O[LZKYJWJUI[JYKY5G]TFN[ RUFO[ RVFP[ RMFKL R]F\\L RMF]F RK[S[ RNFKL RPFLI RRFMG RYF\\G RZF\\H R[F\\I R\\F\\L ROZL[ ROYM[ RPYQ[ ROZR[/F_NFKQJUJXKZN[R[UZWXXU\\G ROFLQKUKYLZ RPFMQLULYN[ RKFSF RYF_F RLFOG RMFNH RQFOH RRFOG RZF\\G R^F\\G"H\\NFNHOYO[ ROGPX RPFQW R[GO[ RLFSF RXF^F RMFNH RQFPH RRFOG RYF[G R]F[G8E_MFMHKYK[ RNGLX ROFMW RUFMWK[ RUFUHSYS[ RVGTX RWFUW R]GUWS[ RJFRF RUFWF RZF`F RKFNG RLFMH RPFNI RQFNG R[F]G R_F]G5G]NFT[ ROFU[ RPFV[ R[GIZ RLFSF RXF^F RF[L[ RQ[X[ RMFOH RQFPH RRFPG RYF[G R]F[G RIZG[ RIZK[ RTZR[ RTYS[ RUYW[2G]MFQPN[ RNFRPO[ ROFSPP[ R\\GSP RKFRF RYF_F RK[S[ RLFNG RPFOH RQFNG RZF\\G R^F\\G ROZL[ ROYM[ RPYQ[ ROZR["G]ZFH[ R[FI[ R\\FJ[ R\\FNFLL RH[V[XU ROFLL RPFMI RRFNG RR[VZ RT[WX RU[XU\x0bKYOBOb RPBPb ROBVB RObVb\x02KYKFY^\x0bKYTBTb RUBUb RNBUB RNbUb\x07G]JTROZT RJTRPZT\x02H\\Hb\\b\x06LXPFUL RPFOGUL1G]WMUTUXVZW[Y[[Y\\W RXMVTVZ RWMYMWTVX RUTUQTNRMPMMNKQJTJVKYLZN[P[RZSYTWUT RNNLQKTKWLY RPMNOMQLTLWMZN[3I\\PFNMMSMWNYOZQ[S[VZXWYTYRXOWNUMSMQNPOOQNT RQFOMNQNWOZ RVYWWXTXQWO RMFRFPMNT RS[UYVWWTWQVNUM RNFQG ROFPH!I[WQWPVPVRXRXPWNUMRMONMQLTLVMYNZP[R[UZWW ROONQMTMWNY RRMPOOQNTNWOZP[9G]YFVQUUUXVZW[Y[[Y\\W RZFWQVUVZ RVF[FWTVX RUTUQTNRMPMMNKQJTJVKYLZN[P[RZSYTWUT RMOLQKTKWLY RPMNOMQLTLWMZN[ RWFZG RXFYH I[MVQUTTWRXPWNUMRMONMQLTLVMYNZP[R[UZWX ROONQMTMWNY RRMPOOQNTNWOZP[,JZZHZGYGYI[I[GZFXFVGTISKRNQRO[N^M`Kb RTJSMRRP[O^ RXFVHUJTMSRQZP]O_MaKbIbHaH_J_JaIaI` RNMYM8H]XMT[S^QaOb RYMU[S_ RXMZMV[T_RaObLbJaI`I^K^K`J`J_ RVTVQUNSMQMNNLQKTKVLYMZO[Q[SZTYUWVT RNOMQLTLWMY RQMOONQMTMWNZO[(G]OFI[K[ RPFJ[ RLFQFK[ RMTOPQNSMUMWNXPXSVX RWNWRVVVZ RWPUUUXVZW[Y[[Y\\W RMFPG RNFOH"KXSFSHUHUFSF RTFTH RSGUG RLQMOOMQMRNSPSSQX RRNRRQVQZ RRPPUPXQZR[T[VYWW,KXUFUHWHWFUF RVFVH RUGWG RMQNOPMRMSNTPTSRZQ]P_NaLbJbIaI_K_KaJaJ` RSNSSQZP]O_ RSPRTP[O^N`Lb0G]OFI[K[ RPFJ[ RLFQFK[ RYOYNXNXPZPZNYMWMUNQROS RMSOSQTRUTYUZWZ RQUSYTZ ROSPTRZS[U[WZYW RMFPG RNFOH\x19LXTFQQPUPXQZR[T[VYWW RUFRQQUQZ RQFVFRTQX RRFUG RSFTH<@cAQBODMFMGNHPHSF[ RGNGSE[ RGPFTD[F[ RHSJPLNNMPMRNSPSSQ[ RRNRSP[ RRPQTO[Q[ RSSUPWNYM[M]N^P^S\\X R]N]R\\V\\Z R]P[U[X\\Z][_[aYbW)F^GQHOJMLMMNNPNSL[ RMNMSK[ RMPLTJ[L[ RNSPPRNTMVMXNYPYSWX RXNXRWVWZ RXPVUVXWZX[Z[\\Y]W-H\\QMNNLQKTKVLYMZP[S[VZXWYTYRXOWNTMQM RNOMQLTLWMY RVYWWXTXQWO RQMOONQMTMWNZP[ RS[UYVWWTWQVNTMAG]HQIOKMMMNNOPOSNWKb RNNNSMWJb RNPMTIb ROTPQQORNTMVMXNYOZRZTYWWZT[R[PZOWOT RXOYQYTXWWY RVMWNXQXTWWVYT[ RFbNb RJaGb RJ`Hb RK`Lb RJaMb8G\\WMQb RXMRb RWMYMSb RUTUQTNRMPMMNKQJTJVKYLZN[P[RZSYTWUT RMOLQKTKWLY RPMNOMQLTLWMZN[ RNbVb RRaOb RR`Pb RS`Tb RRaUb\x1dI[JQKOMMOMPNQPQTO[ RPNPTN[ RPPOTM[O[ RYOYNXNXPZPZNYMWMUNSPQT.J[XPXOWOWQYQYOXNUMRMONNONQOSQTTUVVWX RONNQ RORQSTTVU RWVVZ RNOOQQRTSVTWVWXVZS[P[MZLYLWNWNYMYMX\x16KYTFQQPUPXQZR[T[VYWW RUFRQQUQZ RTFVFRTQX RNMXM)F^GQHOJMLMMNNPNSLX RMNMRLVLZ RMPKUKXLZN[P[RZTXVU RXMVUVXWZX[Z[\\Y]W RYMWUWZ RXMZMXTWX\x1cH\\IQJOLMNMONPPPSNX RONORNVNZ ROPMUMXNZP[R[TZVXXUYQYMXMXNYP/CaDQEOGMIMJNKPKSIX RJNJRIVIZ RJPHUHXIZK[M[OZQXRU RTMRURXSZU[W[YZ[X]U^Q^M]M]N^P RUMSUSZ RTMVMTTSX2G]JQLNNMPMRNSPSR RPMQNQRPVOXMZK[I[HZHXJXJZIZIY RRORRQVQY RZOZNYNYP[P[NZMXMVNTPSRRVRZS[ RPVPXQZS[U[WZYW0G]HQIOKMMMNNOPOSMX RNNNRMVMZ RNPLULXMZO[Q[SZUXWT RYMU[T^RaPb RZMV[T_ RYM[MW[U_SaPbMbKaJ`J^L^L`K`K_&H\\YMXOVQNWLYK[ RXOOOMPLR RVORNONNO RVORMOMMOLR RLYUYWXXV RNYRZUZVY RNYR[U[WYXV\'KYTBRCQDPFPHQJRKSMSOQQ RRCQEQGRISJTLTNSPORSTTVTXSZR[Q]Q_Ra RQSSUSWRYQZP\\P^Q`RaTb\x02NVRBRb\'KYPBRCSDTFTHSJRKQMQOSQ RRCSESGRIQJPLPNQPURQTPVPXQZR[S]S_Ra RSSQUQWRYSZT\\T^S`RaPb\x17F^IUISJPLONOPPTSVTXTZS[Q RISJQLPNPPQTTVUXUZT[Q[O"JZJFJ[K[KFLFL[M[MFNFN[O[OFPFP[Q[QFRFR[S[SFTFT[U[UFVFV[W[WFXFX[Y[YFZFZ['
_index = b'\x00\x00\x03\x00H\x00a\x00z\x00\xe3\x00$\x01\xb5\x01\xc2\x01\x03\x02D\x02\x93\x02\xb4\x02\xe1\x02\xe8\x02\t\x03\x1a\x03\x8f\x03\xb8\x03!\x04\xa2\x04\xc1\x04$\x05\x9f\x05\xee\x05\xbf\x06:\x07{\x07\xc8\x07\xd1\x07\xf2\x07\xfb\x07r\x08\xe3\x080\t\xcd\t \n\x9f\n@\x0b\xcd\x0bP\x0c\xf3\x0cB\r\xa1\r2\x0e\x95\x0e\x1e\x0fu\x0f\xe6\x0f_\x10\xfc\x10\x99\x11\xf2\x11_\x12\xc0\x12\x07\x13z\x13\xe7\x13N\x14\x95\x14\xae\x14\xb5\x14\xce\x14\xdf\x14\xe6\x14\xf5\x14Z\x15\xc3\x15\x08\x16}\x16\xc0\x16\x1b\x17\x8e\x17\xe1\x17(\x18\x83\x18\xe6\x18\x1b\x19\x96\x19\xeb\x19H\x1a\xcd\x1a@\x1b}\x1b\xdc\x1b\x0b\x1c`\x1c\x9b\x1c\xfc\x1cc\x1d\xc6\x1d\x15\x1ef\x1em\x1e\xbe\x1e\xef\x1e'
_mvfont = memoryview(_font)
def _chr_addr(ordch):
offset = 2 * (ordch - 32)
return int.from_bytes(_index[offset:offset + 2], 'little')
def get_ch(ordch):
offset = _chr_addr(ordch if 32 <= ordch <= 127 else ord('?'))
count = _font[offset]
return _mvfont[offset:offset + (count + 2) * 2 - 1] |
ll = [1, 2, 3, 4]
def increment(x):
return x + 1
print(map(increment, ll))
for x in map(increment, ll):
print(x)
| ll = [1, 2, 3, 4]
def increment(x):
return x + 1
print(map(increment, ll))
for x in map(increment, ll):
print(x) |
"""Seed module doc"""
__descr__ = "seeddescription"
__version__ = "seedversion"
__license__ = "seedlicense"
__author__ = u"seedauthor"
__author_email__ = "seed@email"
__copyright__ = u"seedcopyright seedauthor"
__url__ = "seedurl"
| """Seed module doc"""
__descr__ = 'seeddescription'
__version__ = 'seedversion'
__license__ = 'seedlicense'
__author__ = u'seedauthor'
__author_email__ = 'seed@email'
__copyright__ = u'seedcopyright seedauthor'
__url__ = 'seedurl' |
def add_prune_to_parser(parser):
parser.add_argument('-bp', '--batch-size-prune', default=128, type=int,
metavar='N', help='mini-batch size (default: 256)')
parser.add_argument('--prune', action='store_true', default=False,
help='Prune the network')
parser.add_argument('--pruning_ratio', type=float, default=0.2,
help='pruning ratio')
parser.add_argument('--gamma_knowledge', type=float, default=0.2,
help='factor for distillation penalty')
parser.add_argument('--taylor_file', default=None, type=str, help='File where to save the taylor computation')
parser.add_argument('--prune_test', action='store_true', default=False,
help='Prune on test set')
parser.add_argument('--no_pwl', action='store_true', default=False,
help='Do not prune pwl conv')
parser.add_argument('--taylor_abs', action='store_true', default=False,
help='Alternative taylor')
parser.add_argument('--prune_skip', action='store_true', default=False,
help='Prune skip connection in resnet')
parser.add_argument('--only_last', action='store_true', default=False,
help='IKD only on last layer of the block')
parser.add_argument('--prune_conv1', action='store_true', default=False,
help='Prune stem')
parser.add_argument('--progressive_IKD_factor', action='store_true', default=False,
help='The IKD factor increase linearily along the depth of the network')
parser.add_argument('--use_time', action='store_true', default=False,
help='Use time measurement instead of FLOPS')
| def add_prune_to_parser(parser):
parser.add_argument('-bp', '--batch-size-prune', default=128, type=int, metavar='N', help='mini-batch size (default: 256)')
parser.add_argument('--prune', action='store_true', default=False, help='Prune the network')
parser.add_argument('--pruning_ratio', type=float, default=0.2, help='pruning ratio')
parser.add_argument('--gamma_knowledge', type=float, default=0.2, help='factor for distillation penalty')
parser.add_argument('--taylor_file', default=None, type=str, help='File where to save the taylor computation')
parser.add_argument('--prune_test', action='store_true', default=False, help='Prune on test set')
parser.add_argument('--no_pwl', action='store_true', default=False, help='Do not prune pwl conv')
parser.add_argument('--taylor_abs', action='store_true', default=False, help='Alternative taylor')
parser.add_argument('--prune_skip', action='store_true', default=False, help='Prune skip connection in resnet')
parser.add_argument('--only_last', action='store_true', default=False, help='IKD only on last layer of the block')
parser.add_argument('--prune_conv1', action='store_true', default=False, help='Prune stem')
parser.add_argument('--progressive_IKD_factor', action='store_true', default=False, help='The IKD factor increase linearily along the depth of the network')
parser.add_argument('--use_time', action='store_true', default=False, help='Use time measurement instead of FLOPS') |
class Person:
def __init__(self, name):
self.name = name
def say_hi(self):
print('Hello, my name is', self.name)
p = Person('Swaroop')
p.say_hi()
# The previous 2 lines can also be written as
# Person('Swaroop').say_hi()
str = 'abcdefghijklmnopqrstuvwxyz'
s = slice(5, 20, 2)
i = s.indices(10)
print(i)
print(str[1:3])
| class Person:
def __init__(self, name):
self.name = name
def say_hi(self):
print('Hello, my name is', self.name)
p = person('Swaroop')
p.say_hi()
str = 'abcdefghijklmnopqrstuvwxyz'
s = slice(5, 20, 2)
i = s.indices(10)
print(i)
print(str[1:3]) |
"""
Lucky Numbers
Problem Description
A lucky number is a number which has exactly 2 distinct prime divisors. You are given a number A and you need to determine the count of lucky numbers between the range 1 to A (both inclusive).
Problem Constraints
1 <= A <= 5000
Input Format
The first and only argument is an integer A.
Output Format
Return an integer i.e the count of lucky numbers between 1 and A, both inclusive.
Example Input
Input 1:
A = 8
Input 2:
12
Example Output
Output 1:
1
Output 2:
3
Example Explanation
Explanation 1:
Between [1, 8] there is only 1 lucky number i.e 6.
6 has 2 distinct prime factors i.e 2 and 3.
Explanation 2:
Between [1, 12] there are 3 lucky number: 6, 10 and 12.
"""
class Solution:
# @param A : integer
# @return an integer
def solve(self, n):
spf=[i for i in range(n+1)]
prime = [True for i in range(n+1)]
def SieveOfEratosthenes(n):
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
if(spf[i]==i):
spf[i]=p
p += 1
return [p for p in range(2,n) if prime[p]==True]
primes=SieveOfEratosthenes(n)
ans=0
def is_lucky(i):
if prime[i]==True:
return False
mem=set()
mem.add(spf[i])
t=spf[i]
while(i>1):
i=i//t
if(i==1):
break
mem.add(spf[i])
#print(mem)
t=spf[i]
if(len(mem)>2):
return False
return len(mem)==2
for i in range(6,n+1):
t=is_lucky(i)
#print(i,spf[i])
#print(i,t)
if(t):
ans+=1
return ans
| """
Lucky Numbers
Problem Description
A lucky number is a number which has exactly 2 distinct prime divisors. You are given a number A and you need to determine the count of lucky numbers between the range 1 to A (both inclusive).
Problem Constraints
1 <= A <= 5000
Input Format
The first and only argument is an integer A.
Output Format
Return an integer i.e the count of lucky numbers between 1 and A, both inclusive.
Example Input
Input 1:
A = 8
Input 2:
12
Example Output
Output 1:
1
Output 2:
3
Example Explanation
Explanation 1:
Between [1, 8] there is only 1 lucky number i.e 6.
6 has 2 distinct prime factors i.e 2 and 3.
Explanation 2:
Between [1, 12] there are 3 lucky number: 6, 10 and 12.
"""
class Solution:
def solve(self, n):
spf = [i for i in range(n + 1)]
prime = [True for i in range(n + 1)]
def sieve_of_eratosthenes(n):
p = 2
while p * p <= n:
if prime[p] == True:
for i in range(p * p, n + 1, p):
prime[i] = False
if spf[i] == i:
spf[i] = p
p += 1
return [p for p in range(2, n) if prime[p] == True]
primes = sieve_of_eratosthenes(n)
ans = 0
def is_lucky(i):
if prime[i] == True:
return False
mem = set()
mem.add(spf[i])
t = spf[i]
while i > 1:
i = i // t
if i == 1:
break
mem.add(spf[i])
t = spf[i]
if len(mem) > 2:
return False
return len(mem) == 2
for i in range(6, n + 1):
t = is_lucky(i)
if t:
ans += 1
return ans |
a = 1
b = 2
def myfun():
x = 1
x
print(myfun())
| a = 1
b = 2
def myfun():
x = 1
x
print(myfun()) |
'''Custom exceptions'''
class ConstructorException(Exception):
'''Custom Constructor.io Exception'''
class HttpException(ConstructorException):
'''Custom HTTP exception'''
def __init__(self, message, status, status_text, url, headers): # pylint: disable=too-many-arguments
self.message = message
self.status = status
self.status_text = status_text
self.url = url
self.headers = headers
super().__init__(self.message)
| """Custom exceptions"""
class Constructorexception(Exception):
"""Custom Constructor.io Exception"""
class Httpexception(ConstructorException):
"""Custom HTTP exception"""
def __init__(self, message, status, status_text, url, headers):
self.message = message
self.status = status
self.status_text = status_text
self.url = url
self.headers = headers
super().__init__(self.message) |
def health_calculator(age, apples_ate, cigs_smoked):
awnser = (100 * age) + (apples_ate * 3.5) - (cigs_smoked * 2)
print(awnser)
buckys_data = [27, 70, 0]
health_calculator(buckys_data[0], buckys_data[1], buckys_data[2])
health_calculator(*buckys_data) | def health_calculator(age, apples_ate, cigs_smoked):
awnser = 100 * age + apples_ate * 3.5 - cigs_smoked * 2
print(awnser)
buckys_data = [27, 70, 0]
health_calculator(buckys_data[0], buckys_data[1], buckys_data[2])
health_calculator(*buckys_data) |
while True:
try:
x = int(input())
coe = list(map(int,input().split()))
# the following method gives TLE
#n = len(coe)
#ans = 0
# for i in range(n-1):
# ans += (coe[i]*(n-i-1)) * pow(x,n-i-2)
# for optimization, we use horner's rule
# https://en.wikipedia.org/wiki/Horner's_method
n = len(coe) -1
ans = n * coe[0]
for i in range(1,n):
ans = x*ans + (n-i)*coe[i]
print(ans)
except EOFError:
break | while True:
try:
x = int(input())
coe = list(map(int, input().split()))
n = len(coe) - 1
ans = n * coe[0]
for i in range(1, n):
ans = x * ans + (n - i) * coe[i]
print(ans)
except EOFError:
break |
x,y,n = map(int, input().split())
for i in range(1,n+1):
if not(i%x) and not(i%y):
print("FizzBuzz")
elif not(i%x):
print("Fizz")
elif not(i%y):
print("Buzz")
else:
print(i) | (x, y, n) = map(int, input().split())
for i in range(1, n + 1):
if not i % x and (not i % y):
print('FizzBuzz')
elif not i % x:
print('Fizz')
elif not i % y:
print('Buzz')
else:
print(i) |
class Solution:
def findUnsortedSubarray(self, nums: List[int]) -> int:
num2 = sorted(nums)
start = 0
end = (len(nums) - 1)
while(start <= end):
if nums[start] == num2[start]:
start += 1
elif nums[end] == num2[end]:
end -= 1
else:
break
return (end - start + 1)
| class Solution:
def find_unsorted_subarray(self, nums: List[int]) -> int:
num2 = sorted(nums)
start = 0
end = len(nums) - 1
while start <= end:
if nums[start] == num2[start]:
start += 1
elif nums[end] == num2[end]:
end -= 1
else:
break
return end - start + 1 |
primes: List[int] = []
captain: str # Note: no initial value!
class Starship:
stats: Dict[str, int] = {}
header: str
kind: int
body: Optional[List[str]]
header, kind, body = message
def f():
a: int
print(a) # raises UnboundLocalError
# Commenting out the a: int makes it a NameError.
a: int
a: str # Static type checker may or may not warn about this.
class BasicStarship:
captain: str = 'Picard' # instance variable with default
damage: int # instance variable without default
stats: ClassVar[Dict[str, int]] = {} # class variable
class Starship:
captain: str = 'Picard'
damage: int
stats: ClassVar[Dict[str, int]] = {}
def __init__(self, damage: int, captain: str = None):
self.damage = damage
if captain:
self.captain = captain # Else keep the default
def hit(self):
Starship.stats['hits'] = Starship.stats.get('hits', 0) + 1
class Cls:
pass
c = Cls()
c.x: int = 0 # Annotates c.x with int.
c.y: int # Annotates c.y with int.
d = {}
d['a']: int = 0 # Annotates d['a'] with int.
d['b']: int # Annotates d['b'] with int.
| primes: List[int] = []
captain: str
class Starship:
stats: Dict[str, int] = {}
header: str
kind: int
body: Optional[List[str]]
(header, kind, body) = message
def f():
a: int
print(a)
a: int
a: str
class Basicstarship:
captain: str = 'Picard'
damage: int
stats: ClassVar[Dict[str, int]] = {}
class Starship:
captain: str = 'Picard'
damage: int
stats: ClassVar[Dict[str, int]] = {}
def __init__(self, damage: int, captain: str=None):
self.damage = damage
if captain:
self.captain = captain
def hit(self):
Starship.stats['hits'] = Starship.stats.get('hits', 0) + 1
class Cls:
pass
c = cls()
c.x: int = 0
c.y: int
d = {}
d['a']: int = 0
d['b']: int |
"""
‘
’
“
”
«
»
…
–
—
"""
| """
‘
’
“
”
«
»
…
–
—
""" |
'''
Created on 1.12.2016
@author: Darren
''''''
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.
The update(i, val) function modifies nums by updating the element at index i to val.
Example:
Given nums = [1, 3, 5]
sumRange(0, 2) -> 9
update(1, 2)
sumRange(0, 2) -> 8
Note:
The array is only modifiable by the update function.
You may assume the number of calls to update and sumRange function is distributed evenly.
"
'''
| """
Created on 1.12.2016
@author: Darren
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.
The update(i, val) function modifies nums by updating the element at index i to val.
Example:
Given nums = [1, 3, 5]
sumRange(0, 2) -> 9
update(1, 2)
sumRange(0, 2) -> 8
Note:
The array is only modifiable by the update function.
You may assume the number of calls to update and sumRange function is distributed evenly.
"
""" |
shopping_list = ["milk", "pasta", "eggs", "spam", "bread","rice"]
item_to_find = "spam"
# use None when does not have a value
found_at = None
# last value in range is not included
# for index in range(len(shopping_list)):
# # len is length
# if shopping_list[index] == item_to_find:
# found_at = index
# break
if item_to_find in shopping_list:
found_at = shopping_list.index(item_to_find)
if found_at is not None:
print("Item found at position {}".format(found_at))
else:
print("{} not found".format(item_to_find))
| shopping_list = ['milk', 'pasta', 'eggs', 'spam', 'bread', 'rice']
item_to_find = 'spam'
found_at = None
if item_to_find in shopping_list:
found_at = shopping_list.index(item_to_find)
if found_at is not None:
print('Item found at position {}'.format(found_at))
else:
print('{} not found'.format(item_to_find)) |
key = int(input("Enter shift key: "))
# noinspection DuplicatedCode
encrypt_dict = {chr(a % 26 + 97): chr((a + key) % 26 + 97) for a in range(27)}
decrypt_dict = {v: k for k, v in encrypt_dict.items()}
to_encrypt = input("Enter text to encrypt:").lower()
crypt = ""
for i in to_encrypt:
crypt += encrypt_dict[i]
print(crypt)
to_crack = input("Enter string to be cracked: ").lower()
soln = ""
for i in to_crack:
soln += decrypt_dict[i]
print(soln)
| key = int(input('Enter shift key: '))
encrypt_dict = {chr(a % 26 + 97): chr((a + key) % 26 + 97) for a in range(27)}
decrypt_dict = {v: k for (k, v) in encrypt_dict.items()}
to_encrypt = input('Enter text to encrypt:').lower()
crypt = ''
for i in to_encrypt:
crypt += encrypt_dict[i]
print(crypt)
to_crack = input('Enter string to be cracked: ').lower()
soln = ''
for i in to_crack:
soln += decrypt_dict[i]
print(soln) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.