ELBv2: add new valid attributes to modify_load_balancer_attributes (#7240)
This commit is contained in:
		
							parent
							
								
									987fb7d7c1
								
							
						
					
					
						commit
						1c3c4953cf
					
				| @ -576,6 +576,9 @@ class FakeLoadBalancer(CloudFormationModel): | |||||||
|         "access_logs.s3.enabled", |         "access_logs.s3.enabled", | ||||||
|         "access_logs.s3.bucket", |         "access_logs.s3.bucket", | ||||||
|         "access_logs.s3.prefix", |         "access_logs.s3.prefix", | ||||||
|  |         "connection_logs.s3.bucket", | ||||||
|  |         "connection_logs.s3.enabled", | ||||||
|  |         "connection_logs.s3.prefix", | ||||||
|         "deletion_protection.enabled", |         "deletion_protection.enabled", | ||||||
|         "idle_timeout.timeout_seconds", |         "idle_timeout.timeout_seconds", | ||||||
|         "ipv6.deny_all_igw_traffic", |         "ipv6.deny_all_igw_traffic", | ||||||
|  | |||||||
| @ -1578,40 +1578,6 @@ DESCRIBE_ATTRIBUTES_TEMPLATE = """<DescribeLoadBalancerAttributesResponse  xmlns | |||||||
| </DescribeLoadBalancerAttributesResponse> | </DescribeLoadBalancerAttributesResponse> | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| MODIFY_ATTRIBUTES_TEMPLATE = """<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/"> |  | ||||||
|   <ModifyLoadBalancerAttributesResult> |  | ||||||
|   <LoadBalancerName>{{ load_balancer.name }}</LoadBalancerName> |  | ||||||
|     <LoadBalancerAttributes> |  | ||||||
|       <AccessLog> |  | ||||||
|         <Enabled>{{ attributes.access_log.enabled }}</Enabled> |  | ||||||
|         {% if attributes.access_log.enabled %} |  | ||||||
|         <S3BucketName>{{ attributes.access_log.s3_bucket_name }}</S3BucketName> |  | ||||||
|         <S3BucketPrefix>{{ attributes.access_log.s3_bucket_prefix }}</S3BucketPrefix> |  | ||||||
|         <EmitInterval>{{ attributes.access_log.emit_interval }}</EmitInterval> |  | ||||||
|         {% endif %} |  | ||||||
|       </AccessLog> |  | ||||||
|       <ConnectionSettings> |  | ||||||
|         <IdleTimeout>{{ attributes.connecting_settings.idle_timeout }}</IdleTimeout> |  | ||||||
|       </ConnectionSettings> |  | ||||||
|       <CrossZoneLoadBalancing> |  | ||||||
|         <Enabled>{{ attributes.cross_zone_load_balancing.enabled }}</Enabled> |  | ||||||
|       </CrossZoneLoadBalancing> |  | ||||||
|       <ConnectionDraining> |  | ||||||
|         {% if attributes.connection_draining.enabled %} |  | ||||||
|         <Enabled>true</Enabled> |  | ||||||
|         <Timeout>{{ attributes.connection_draining.timeout }}</Timeout> |  | ||||||
|         {% else %} |  | ||||||
|         <Enabled>false</Enabled> |  | ||||||
|         {% endif %} |  | ||||||
|       </ConnectionDraining> |  | ||||||
|     </LoadBalancerAttributes> |  | ||||||
|   </ModifyLoadBalancerAttributesResult> |  | ||||||
|   <ResponseMetadata> |  | ||||||
|     <RequestId>{{ request_id }}</RequestId> |  | ||||||
|   </ResponseMetadata> |  | ||||||
| </ModifyLoadBalancerAttributesResponse> |  | ||||||
| """ |  | ||||||
| 
 |  | ||||||
| CREATE_LOAD_BALANCER_POLICY_TEMPLATE = """<CreateLoadBalancerPolicyResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/"> | CREATE_LOAD_BALANCER_POLICY_TEMPLATE = """<CreateLoadBalancerPolicyResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/"> | ||||||
|   <CreateLoadBalancerPolicyResult/> |   <CreateLoadBalancerPolicyResult/> | ||||||
|   <ResponseMetadata> |   <ResponseMetadata> | ||||||
|  | |||||||
| @ -1291,6 +1291,28 @@ def test_modify_load_balancer_attributes_routing_http_drop_invalid_header_fields | |||||||
|     assert routing_http_drop_invalid_header_fields_enabled["Value"] == "false" |     assert routing_http_drop_invalid_header_fields_enabled["Value"] == "false" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @mock_elbv2 | ||||||
|  | @mock_ec2 | ||||||
|  | def test_modify_load_balancer_attributes_connection_logs_s3(): | ||||||
|  |     response, _, _, _, _, client = create_load_balancer() | ||||||
|  |     arn = response["LoadBalancers"][0]["LoadBalancerArn"] | ||||||
|  | 
 | ||||||
|  |     client.modify_load_balancer_attributes( | ||||||
|  |         LoadBalancerArn=arn, | ||||||
|  |         Attributes=[ | ||||||
|  |             {"Key": "connection_logs.s3.enabled", "Value": "true"}, | ||||||
|  |             {"Key": "connection_logs.s3.bucket", "Value": "s3bucket"}, | ||||||
|  |             {"Key": "connection_logs.s3.prefix", "Value": "test_prefix"}, | ||||||
|  |         ], | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     response = client.describe_load_balancer_attributes(LoadBalancerArn=arn) | ||||||
|  |     attrs = client.describe_load_balancer_attributes(LoadBalancerArn=arn)["Attributes"] | ||||||
|  |     assert {"Key": "connection_logs.s3.enabled", "Value": "true"} in attrs | ||||||
|  |     assert {"Key": "connection_logs.s3.bucket", "Value": "s3bucket"} in attrs | ||||||
|  |     assert {"Key": "connection_logs.s3.prefix", "Value": "test_prefix"} in attrs | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @mock_elbv2 | @mock_elbv2 | ||||||
| @mock_ec2 | @mock_ec2 | ||||||
| @mock_acm | @mock_acm | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user