Merge "Add api ratelimit options"
This commit is contained in:
@@ -119,6 +119,26 @@
|
|||||||
# (optional) CA certificate file to use to verify connecting clients
|
# (optional) CA certificate file to use to verify connecting clients
|
||||||
# Defaults to false, not set
|
# Defaults to false, not set
|
||||||
#
|
#
|
||||||
|
# [*http_get_rate*]
|
||||||
|
# (optional) Default rate limit of GET request.
|
||||||
|
# Defaults to 200.
|
||||||
|
#
|
||||||
|
# [*http_post_rate*]
|
||||||
|
# (optional) Default rate limit of POST request.
|
||||||
|
# Defaults to 200.
|
||||||
|
#
|
||||||
|
# [*http_put_rate*]
|
||||||
|
# (optional) Default rate limit of PUT request.
|
||||||
|
# Defaults to 200.
|
||||||
|
#
|
||||||
|
# [*http_delete_rate*]
|
||||||
|
# (optional) Default rate limit of DELETE request.
|
||||||
|
# Defaults to 200.
|
||||||
|
#
|
||||||
|
# [*http_mgmt_post_rate*]
|
||||||
|
# (optional) Default rate limit of mgmt post request.
|
||||||
|
# Defaults to 200.
|
||||||
|
#
|
||||||
class trove::api(
|
class trove::api(
|
||||||
$keystone_password,
|
$keystone_password,
|
||||||
$verbose = false,
|
$verbose = false,
|
||||||
@@ -142,6 +162,11 @@ class trove::api(
|
|||||||
$cert_file = false,
|
$cert_file = false,
|
||||||
$key_file = false,
|
$key_file = false,
|
||||||
$ca_file = false,
|
$ca_file = false,
|
||||||
|
$http_get_rate = 200,
|
||||||
|
$http_post_rate = 200,
|
||||||
|
$http_put_rate = 200,
|
||||||
|
$http_delete_rate = 200,
|
||||||
|
$http_mgmt_post_rate = 200,
|
||||||
$manage_service = true,
|
$manage_service = true,
|
||||||
$ensure_package = 'present',
|
$ensure_package = 'present',
|
||||||
) inherits trove {
|
) inherits trove {
|
||||||
@@ -272,6 +297,15 @@ class trove::api(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# rate limits
|
||||||
|
trove_config {
|
||||||
|
'DEFAULT/http_get_rate': value => $http_get_rate;
|
||||||
|
'DEFAULT/http_post_rate': value => $http_post_rate;
|
||||||
|
'DEFAULT/http_put_rate': value => $http_put_rate;
|
||||||
|
'DEFAULT/http_delete_rate': value => $http_delete_rate;
|
||||||
|
'DEFAULT/http_mgmt_post_rate': value => $http_mgmt_post_rate;
|
||||||
|
}
|
||||||
|
|
||||||
resources { 'trove_config':
|
resources { 'trove_config':
|
||||||
purge => $purge_config,
|
purge => $purge_config,
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,32 @@ describe 'trove::api' do
|
|||||||
is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store')
|
is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store')
|
||||||
is_expected.to contain_trove_config('DEFAULT/heat_service_type').with_value('orchestration')
|
is_expected.to contain_trove_config('DEFAULT/heat_service_type').with_value('orchestration')
|
||||||
is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network')
|
is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('200')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('200')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('200')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('200')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('200')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
context 'with overridden rate limit parameters' do
|
||||||
|
before :each do
|
||||||
|
params.merge!(
|
||||||
|
:http_get_rate => '1000',
|
||||||
|
:http_post_rate => '1000',
|
||||||
|
:http_put_rate => '1000',
|
||||||
|
:http_delete_rate => '1000',
|
||||||
|
:http_mgmt_post_rate => '2000',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'contains overrided rate limit values' do
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('1000')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('1000')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('1000')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('1000')
|
||||||
|
is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('2000')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when using a single RabbitMQ server' do
|
context 'when using a single RabbitMQ server' do
|
||||||
|
Reference in New Issue
Block a user