aws-sdk 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws/api_config/EC2-2011-12-15.yml +2791 -0
- data/lib/aws/core.rb +4 -4
- data/lib/aws/core/client.rb +1 -0
- data/lib/aws/core/client_logging.rb +9 -2
- data/lib/aws/core/lazy_error_classes.rb +1 -1
- data/lib/aws/core/response.rb +5 -0
- data/lib/aws/core/service_interface.rb +3 -2
- data/lib/aws/core/uri_escape.rb +1 -2
- data/lib/aws/ec2.rb +80 -1
- data/lib/aws/ec2/client.rb +29 -10
- data/lib/aws/ec2/client/xml.rb +51 -1
- data/lib/aws/ec2/customer_gateway.rb +90 -0
- data/lib/aws/ec2/customer_gateway_collection.rb +73 -0
- data/lib/aws/ec2/dhcp_options.rb +106 -0
- data/lib/aws/ec2/dhcp_options_collection.rb +87 -0
- data/lib/aws/ec2/filtered_collection.rb +27 -2
- data/lib/aws/ec2/image.rb +7 -4
- data/lib/aws/ec2/instance.rb +54 -2
- data/lib/aws/ec2/instance_collection.rb +5 -3
- data/lib/aws/ec2/internet_gateway.rb +122 -0
- data/lib/aws/ec2/internet_gateway/attachment.rb +78 -0
- data/lib/aws/ec2/internet_gateway_collection.rb +54 -0
- data/lib/aws/ec2/network_acl.rb +254 -0
- data/lib/aws/ec2/network_acl/association.rb +56 -0
- data/lib/aws/ec2/network_acl/entry.rb +147 -0
- data/lib/aws/ec2/network_acl_collection.rb +65 -0
- data/lib/aws/ec2/network_interface.rb +174 -0
- data/lib/aws/ec2/network_interface/attachment.rb +100 -0
- data/lib/aws/ec2/network_interface_collection.rb +103 -0
- data/lib/aws/ec2/region.rb +11 -1
- data/lib/aws/ec2/resource.rb +6 -2
- data/lib/aws/ec2/route_table.rb +204 -0
- data/lib/aws/ec2/route_table/association.rb +119 -0
- data/lib/aws/ec2/route_table/route.rb +113 -0
- data/lib/aws/ec2/route_table_collection.rb +73 -0
- data/lib/aws/ec2/security_group.rb +15 -5
- data/lib/aws/ec2/security_group_collection.rb +15 -12
- data/lib/aws/ec2/subnet.rb +161 -0
- data/lib/aws/ec2/subnet_collection.rb +115 -0
- data/lib/aws/ec2/vpc.rb +166 -0
- data/lib/aws/ec2/vpc_collection.rb +71 -0
- data/lib/aws/ec2/vpn_connection.rb +99 -0
- data/lib/aws/ec2/vpn_connection/telemetry.rb +49 -0
- data/lib/aws/ec2/vpn_connection_collection.rb +96 -0
- data/lib/aws/ec2/vpn_gateway.rb +123 -0
- data/lib/aws/ec2/vpn_gateway/attachment.rb +45 -0
- data/lib/aws/ec2/vpn_gateway_collection.rb +77 -0
- data/lib/aws/iam/login_profile.rb +4 -0
- data/lib/aws/iam/user.rb +6 -0
- data/lib/aws/record/hash_model.rb +3 -3
- data/lib/aws/simple_workflow.rb +6 -3
- data/lib/aws/simple_workflow/activity_task_collection.rb +7 -2
- data/lib/aws/simple_workflow/decision_task_collection.rb +11 -5
- data/lib/aws/simple_workflow/option_formatters.rb +7 -0
- data/lib/net/http/connection_pool.rb +19 -5
- metadata +33 -5
- data/lib/aws/api_config/EC2-2011-02-28.yml +0 -2314
@@ -0,0 +1,123 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
require 'aws/ec2/vpn_gateway/attachment'
|
15
|
+
|
16
|
+
module AWS
|
17
|
+
class EC2
|
18
|
+
|
19
|
+
class VPNGateway < Resource
|
20
|
+
|
21
|
+
include TaggedItem
|
22
|
+
|
23
|
+
def initialize vpn_gateway_id, options = {}
|
24
|
+
@vpn_gateway_id = vpn_gateway_id
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [String]
|
29
|
+
attr_reader :vpn_gateway_id
|
30
|
+
|
31
|
+
alias_method :id, :vpn_gateway_id
|
32
|
+
|
33
|
+
attribute :state, :to_sym => true
|
34
|
+
|
35
|
+
attribute :vpn_type, :static => true
|
36
|
+
|
37
|
+
attribute :attachment_set, :as => :attachments
|
38
|
+
|
39
|
+
protected :attachment_set
|
40
|
+
|
41
|
+
populates_from(:create_vpn_gateway) do |resp|
|
42
|
+
resp.vpn_gateway if resp.vpn_gateway.vpn_gateway_id == id
|
43
|
+
end
|
44
|
+
|
45
|
+
populates_from(:describe_vpn_gateways) do |resp|
|
46
|
+
resp.vpn_gateway_set.find do |gateway|
|
47
|
+
gateway.vpn_gateway_id == vpn_gateway_id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array<VPNGateway::Attachment>]
|
52
|
+
def attachments
|
53
|
+
attachment_set.map {|details| Attachment.new(self, details) }
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [VPC,nil] Returns the currently attached VPC, or nil
|
57
|
+
# if this gateway has not been attached.
|
58
|
+
def vpc
|
59
|
+
if attachment = attachments.first
|
60
|
+
attachment.vpc
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attaches this vpn gateway to the given VPC.
|
65
|
+
# @param [VPC,String] vpc A {VPC} object or a vpc id string.
|
66
|
+
# @return [Attachment]
|
67
|
+
def attach vpc
|
68
|
+
|
69
|
+
client_opts = {}
|
70
|
+
client_opts[:vpn_gateway_id] = vpn_gateway_id
|
71
|
+
client_opts[:vpc_id] = vpc_id(vpc)
|
72
|
+
|
73
|
+
resp = client.attach_vpn_gateway(client_opts)
|
74
|
+
|
75
|
+
Attachment.new(self, resp.attachment)
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# Detaches this vpn gateway from the given VPC.
|
80
|
+
# @param [VPC,String] vpc A {VPC} object or a vpc id string.
|
81
|
+
# @return [nil]
|
82
|
+
def detach vpc
|
83
|
+
client_opts = {}
|
84
|
+
client_opts[:vpn_gateway_id] = vpn_gateway_id
|
85
|
+
client_opts[:vpc_id] = vpc_id(vpc)
|
86
|
+
client.detach_vpn_gateway(client_opts)
|
87
|
+
nil
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [VPNConnectionCollection] Returns a collection
|
91
|
+
# of VPC connections for this gateway.
|
92
|
+
def vpn_connections
|
93
|
+
connections = VPNConnectionCollection.new(:config => config)
|
94
|
+
connections.filter('vpn-gateway-id', id)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Deletes this vpn gateway.
|
98
|
+
# @return [nil]
|
99
|
+
def delete
|
100
|
+
client_opts = {}
|
101
|
+
client_opts[:vpn_gateway_id] = vpn_gateway_id
|
102
|
+
client.delete_vpn_gateway(client_opts)
|
103
|
+
nil
|
104
|
+
end
|
105
|
+
|
106
|
+
# @return [Boolean] Returns true if the gateway exists.
|
107
|
+
def exists?
|
108
|
+
begin
|
109
|
+
client.describe_vpn_gateways(:vpn_gateway_ids => [id])
|
110
|
+
true
|
111
|
+
rescue Errors::InvalidVPNGatewayID::NotFound
|
112
|
+
false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
protected
|
117
|
+
def vpc_id vpc
|
118
|
+
vpc.is_a?(VPC) ? vpc.vpc_id : vpc
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class EC2
|
16
|
+
class VPNGateway < Resource
|
17
|
+
class Attachment
|
18
|
+
|
19
|
+
# @private
|
20
|
+
def initialize vpn_gateway, details
|
21
|
+
@vpn_gateway = vpn_gateway
|
22
|
+
@vpc = VPC.new(details.vpc_id, :config => vpn_gateway.config)
|
23
|
+
@state = details.state.to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [VPNGateway]
|
27
|
+
attr_reader :vpn_gateway
|
28
|
+
|
29
|
+
# @return [VPC]
|
30
|
+
attr_reader :vpc
|
31
|
+
|
32
|
+
# @return [Symbol]
|
33
|
+
attr_reader :state
|
34
|
+
|
35
|
+
# Deletes this attachment.
|
36
|
+
# @return (see VPNGateway#detach)
|
37
|
+
def delete
|
38
|
+
vpn_gateway.detach(vpc)
|
39
|
+
end
|
40
|
+
alias_method :detach, :delete
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class EC2
|
16
|
+
|
17
|
+
class VPNGatewayCollection < Collection
|
18
|
+
|
19
|
+
include TaggedCollection
|
20
|
+
include Core::Collection::Simple
|
21
|
+
|
22
|
+
# Creates a new virtual private gateway. A virtual private gateway is
|
23
|
+
# the VPC-side endpoint for your VPN connection. You can create a
|
24
|
+
# virtual private gateway before creating the VPC itself.
|
25
|
+
#
|
26
|
+
# @param [Hash] options
|
27
|
+
#
|
28
|
+
# @option options [String] :vpn_type ('ipsec.1') The type of VPN
|
29
|
+
# connection this virtual private gateway supports.
|
30
|
+
#
|
31
|
+
# @option options [AvailabilityZone,String] :availability_zone
|
32
|
+
# The Availability Zone where you want the virtual private gateway.
|
33
|
+
# AWS can select a default zone for you. This can be an
|
34
|
+
# {AvailablityZone} object or availability zone name string.
|
35
|
+
#
|
36
|
+
# @return [VPNGateway]
|
37
|
+
#
|
38
|
+
def create options = {}
|
39
|
+
|
40
|
+
client_opts = {}
|
41
|
+
client_opts[:type] = options[:vpn_type] || 'ipsec.1'
|
42
|
+
|
43
|
+
if az = options[:availability_zone]
|
44
|
+
az = az.name if az.is_a?(AvailabilityZone)
|
45
|
+
client_opts[:availability_zone] = az
|
46
|
+
end
|
47
|
+
|
48
|
+
resp = client.create_vpn_gateway(client_opts)
|
49
|
+
|
50
|
+
VPNGateway.new_from(:create_vpn_gateway, resp.vpn_gateway,
|
51
|
+
resp.vpn_gateway.vpn_gateway_id, :config => config)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param [String] vpn_gateway_id
|
56
|
+
# @return [VPNGateway]
|
57
|
+
def [] vpn_gateway_id
|
58
|
+
VPNGateway.new(vpn_gateway_id, :config => config)
|
59
|
+
end
|
60
|
+
|
61
|
+
protected
|
62
|
+
|
63
|
+
def _each_item options = {}, &block
|
64
|
+
response = filtered_request(:describe_vpn_gateways, options, &block)
|
65
|
+
response.vpn_gateway_set.each do |g|
|
66
|
+
|
67
|
+
gateway = VPNGateway.new_from(:describe_vpn_gateways, g,
|
68
|
+
g.vpn_gateway_id, :config => config)
|
69
|
+
|
70
|
+
yield(gateway)
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -27,6 +27,7 @@ module AWS
|
|
27
27
|
#
|
28
28
|
# @example Deleting the login profile for a user
|
29
29
|
# user.login_profile.delete
|
30
|
+
#
|
30
31
|
class LoginProfile < Resource
|
31
32
|
|
32
33
|
# @private
|
@@ -67,8 +68,11 @@ module AWS
|
|
67
68
|
# about making keys inactive or deleting them, see
|
68
69
|
# {User#access_keys}.
|
69
70
|
#
|
71
|
+
# @return [nil]
|
72
|
+
#
|
70
73
|
def delete
|
71
74
|
client.delete_login_profile(resource_options)
|
75
|
+
nil
|
72
76
|
end
|
73
77
|
|
74
78
|
# @return [Boolean] True if a login profile exists for the user.
|
data/lib/aws/iam/user.rb
CHANGED
@@ -111,6 +111,12 @@ module AWS
|
|
111
111
|
nil
|
112
112
|
end
|
113
113
|
|
114
|
+
# Deletes the current user, after:
|
115
|
+
# * deleting its login profile
|
116
|
+
# * removing it from all groups
|
117
|
+
# * deleting all of its access keys
|
118
|
+
# * deleting its mfa devices
|
119
|
+
# * deleting its signing certificates
|
114
120
|
def delete!
|
115
121
|
groups.clear
|
116
122
|
access_keys.clear
|
@@ -57,8 +57,7 @@ module AWS
|
|
57
57
|
# @param [Integer] write_capacity_units
|
58
58
|
# See {DynamoDB::TableCollection#create} for more information.
|
59
59
|
#
|
60
|
-
# @param [Hash] options
|
61
|
-
# {DynamoDB::TableCollection#create}.
|
60
|
+
# @param [Hash] options
|
62
61
|
#
|
63
62
|
# @option options [String] :shard_name Defaults to the class name. The
|
64
63
|
# shard name will be prefixed with {AWS::Record.table_prefix},
|
@@ -70,7 +69,8 @@ module AWS
|
|
70
69
|
|
71
70
|
table_name = dynamo_db_table_name(options[:shard_name])
|
72
71
|
|
73
|
-
create_opts = {
|
72
|
+
create_opts = {}
|
73
|
+
create_opts[:hash_key] = { :id => :string }
|
74
74
|
|
75
75
|
dynamo_db.tables.create(
|
76
76
|
table_name,
|
data/lib/aws/simple_workflow.rb
CHANGED
@@ -98,16 +98,19 @@ module AWS
|
|
98
98
|
# * request_cancel_external_workflow_execution workflow_execution, options = {}
|
99
99
|
# * start_child_workflow_execution workflow_type, options = {}
|
100
100
|
#
|
101
|
+
# This sample gets a decision task and responds based on the events
|
102
|
+
# by scheduling an activity task or completing the workflow execution.
|
103
|
+
#
|
101
104
|
# # poll for decision tasks from 'my-task-list'
|
102
|
-
# domain.decision_tasks.poll('my-task-list') do |
|
105
|
+
# domain.decision_tasks.poll('my-task-list') do |task|
|
103
106
|
#
|
104
107
|
# # invesitate new events and make decisions
|
105
|
-
#
|
108
|
+
# task.new_events.each do |event|
|
106
109
|
# case event.event_type
|
107
110
|
# when 'WorkflowExecutionStarted'
|
108
111
|
# task.schedule_activity_task 'do-something', :input => 'abc xyz'
|
109
112
|
# when 'ActivityTaskCompleted'
|
110
|
-
# task.
|
113
|
+
# task.complete_workflow_execution :result => event.attributes.result
|
111
114
|
# end
|
112
115
|
# end
|
113
116
|
#
|
@@ -30,6 +30,10 @@ module AWS
|
|
30
30
|
|
31
31
|
# Returns the number of tasks in the specified +task_list+.
|
32
32
|
#
|
33
|
+
# count = activity_tasks.count('task-list-name')
|
34
|
+
# count.truncated? #=> false
|
35
|
+
# count.to_i #=> 7
|
36
|
+
#
|
33
37
|
# @note This operation is eventually consistent. The results are best
|
34
38
|
# effort and may not exactly reflect recent updates and changes.
|
35
39
|
#
|
@@ -54,7 +58,8 @@ module AWS
|
|
54
58
|
# @option options [String] :identity (nil) Identity of the worker
|
55
59
|
# making the request, which is recorded in the ActivityTaskStarted
|
56
60
|
# event in the workflow history. This enables diagnostic tracing
|
57
|
-
# when problems arise. The
|
61
|
+
# when problems arise. The :identity defaults to the hostname and
|
62
|
+
# pid (e.g. "hostname:pid").
|
58
63
|
#
|
59
64
|
# @yieldparam [ActivityTask] activity_task Yields if a task is
|
60
65
|
# available within 60 seconds.
|
@@ -68,7 +73,7 @@ module AWS
|
|
68
73
|
client_opts = {}
|
69
74
|
client_opts[:domain] = domain.name
|
70
75
|
client_opts[:task_list] = { :name => task_list }
|
71
|
-
client_opts[:identity] = options
|
76
|
+
client_opts[:identity] = identity_opt(options)
|
72
77
|
|
73
78
|
response = client.poll_for_activity_task(client_opts)
|
74
79
|
|
@@ -24,7 +24,7 @@ module AWS
|
|
24
24
|
# To get a count of decision tasks needing attention, call {#count}
|
25
25
|
# with a task list name:
|
26
26
|
#
|
27
|
-
# domain.decision_tasks.count('my-task-list') #=> 7
|
27
|
+
# domain.decision_tasks.count('my-task-list').to_i #=> 7
|
28
28
|
#
|
29
29
|
# == Getting a single decision task
|
30
30
|
#
|
@@ -83,14 +83,19 @@ module AWS
|
|
83
83
|
|
84
84
|
# Returns the number of decision tasks in the specified +task_list+.
|
85
85
|
#
|
86
|
+
# count = decision_tasks.count('task-list-name')
|
87
|
+
# count.truncated? #=> false
|
88
|
+
# count.to_i #=> 7
|
89
|
+
#
|
86
90
|
# @note This operation is eventually consistent. The results are best
|
87
91
|
# effort and may not exactly reflect recent updates and changes.
|
88
92
|
#
|
89
93
|
# @param [String] task_list Name of the task list to count
|
90
94
|
# decision tasks for.
|
91
95
|
#
|
92
|
-
# @return [
|
93
|
-
# given
|
96
|
+
# @return [Count] Returns a {Count} object that specifies the number
|
97
|
+
# of decision tasks for the given task list. This count will
|
98
|
+
# also indiciate if the count was truncated.
|
94
99
|
#
|
95
100
|
def count task_list
|
96
101
|
options = {}
|
@@ -133,7 +138,8 @@ module AWS
|
|
133
138
|
# @option options [String] :identity The identity of the decider
|
134
139
|
# requesting a decision task. This will be recorded in the
|
135
140
|
# DecisionTaskStarted event in the workflow history.
|
136
|
-
# If +:identity+ is not passed
|
141
|
+
# If +:identity+ is not passed then the hostname and
|
142
|
+
# process id will be sent (e.g. "hostname:pid").
|
137
143
|
#
|
138
144
|
# @option options [Boolean] :reverse_event_order (false) When true,
|
139
145
|
# the history events on the decision task will enumerate in
|
@@ -155,7 +161,7 @@ module AWS
|
|
155
161
|
|
156
162
|
client_opts = {}
|
157
163
|
client_opts[:domain] = domain.name
|
158
|
-
client_opts[:identity] = options
|
164
|
+
client_opts[:identity] = identity_opt(options)
|
159
165
|
client_opts[:task_list] = { :name => task_list }
|
160
166
|
client_opts[:maximum_page_size] = options[:event_batch_size] || 1000
|
161
167
|
client_opts[:reverse_order] = options.key?(:reverse_event_order) ?
|
@@ -11,11 +11,18 @@
|
|
11
11
|
# ANY KIND, either express or implied. See the License for the specific
|
12
12
|
# language governing permissions and limitations under the License.
|
13
13
|
|
14
|
+
require 'socket'
|
15
|
+
|
14
16
|
module AWS
|
15
17
|
class SimpleWorkflow
|
16
18
|
|
17
19
|
# @private
|
18
20
|
module OptionFormatters
|
21
|
+
|
22
|
+
protected
|
23
|
+
def identity_opt options
|
24
|
+
options[:identity] || "#{Socket.gethostname}:#{Process.pid}"
|
25
|
+
end
|
19
26
|
|
20
27
|
protected
|
21
28
|
def upcase_opts options, *opt_names
|
@@ -117,24 +117,37 @@ class Net::HTTP::ConnectionPool
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def request connection, *request_args, &block
|
120
|
+
|
120
121
|
session = nil
|
121
122
|
response = nil
|
122
123
|
retried = false
|
124
|
+
|
123
125
|
begin
|
126
|
+
|
124
127
|
session = session_for(connection)
|
125
128
|
session.http_session.read_timeout = connection.read_timeout
|
126
129
|
response = session.request(*request_args, &block)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
+
|
131
|
+
rescue Exception => error
|
132
|
+
|
133
|
+
# close the http session to prevent the connection from being
|
134
|
+
# left open and risk the other side sending data
|
135
|
+
session.finish if session
|
136
|
+
|
137
|
+
# retry socket errors once on a new session
|
138
|
+
if SOCKET_ERRORS.include?(error.class) and !retried
|
130
139
|
retried = true
|
131
140
|
retry
|
132
141
|
end
|
142
|
+
|
133
143
|
raise error
|
144
|
+
|
134
145
|
else
|
135
146
|
@pool_mutex.synchronize { @pool << session }
|
136
147
|
end
|
148
|
+
|
137
149
|
response
|
150
|
+
|
138
151
|
end
|
139
152
|
|
140
153
|
# Returns the number of sessions currently in the pool, not counting those
|
@@ -143,12 +156,13 @@ class Net::HTTP::ConnectionPool
|
|
143
156
|
@pool_mutex.synchronize { @pool.size }
|
144
157
|
end
|
145
158
|
|
146
|
-
# Removes http sessions from the pool that have
|
159
|
+
# Removes stale http sessions from the pool (that have exceeded
|
160
|
+
# the idle timeout).
|
147
161
|
def clean!
|
148
162
|
@pool_mutex.synchronize { _clean }
|
149
163
|
end
|
150
164
|
|
151
|
-
#
|
165
|
+
# Closes and removes removes all sessions from the pool.
|
152
166
|
# If empty! is called while there are outstanding requests they may
|
153
167
|
# get checked back into the pool, leaving the pool in a non-empty state.
|
154
168
|
def empty!
|