Class: OneviewSDK::API200::IDPool
- Defined in:
- lib/oneview-sdk/resource/api200/id_pool.rb
Overview
Id Pool resource implementation
Direct Known Subclasses
OneviewSDK::API300::C7000::IDPool, OneviewSDK::API300::Synergy::IDPool
Constant Summary collapse
- BASE_URI =
'/rest/id-pools'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#allocate_count(pool_type, count) ⇒ Hash
Allocates a specific amount of IDs from a pool.
-
#allocate_id_list(pool_type, *id_list) ⇒ Hash
Allocates one or more IDs from a according the amount informed.
-
#check_range_availability(pool_type, *id_list) ⇒ Hash
Checks the range availability in the ID pool.
-
#collect_ids(pool_type, *id_list) ⇒ Hash
Collects one or more IDs to be returned to a pool.
-
#create ⇒ Object
Method is not available.
-
#delete ⇒ Object
Method is not available.
-
#generate_random_range(pool_type) ⇒ Hash
Generates and returns a random range.
-
#get_pool(pool_type) ⇒ OneviewSDK::IDPool
Gets a pool along with the list of ranges present in it.
-
#validate_id_list(pool_type, *id_list) ⇒ Boolean
Validates a set of user specified IDs to reserve in the pool.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create!, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, #initialize, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
This class inherits a constructor from OneviewSDK::Resource
Instance Method Details
#allocate_count(pool_type, count) ⇒ Hash
This API cannot be used to allocate IPv4 IDs. Allocation of IPv4 IDs is allowed only at the range level allocator.
Allocates a specific amount of IDs from a pool
57 58 59 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 57 def allocate_count(pool_type, count) allocate(pool_type, count: count) end |
#allocate_id_list(pool_type, *id_list) ⇒ Hash
This API cannot be used to allocate IPv4 IDs. Allocation of IPv4 IDs is allowed only at the range level allocator.
Allocates one or more IDs from a according the amount informed
48 49 50 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 48 def allocate_id_list(pool_type, *id_list) allocate(pool_type, idList: id_list.flatten) end |
#check_range_availability(pool_type, *id_list) ⇒ Hash
Checks the range availability in the ID pool
66 67 68 69 70 71 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 66 def check_range_availability(pool_type, *id_list) ensure_client return {} if id_list.flatten.empty? response = @client.rest_get("#{BASE_URI}/#{pool_type}/checkrangeavailability?idList=#{id_list.flatten.join('&idList=')}") @client.response_handler(response) end |
#collect_ids(pool_type, *id_list) ⇒ Hash
Collects one or more IDs to be returned to a pool
78 79 80 81 82 83 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 78 def collect_ids(pool_type, *id_list) raise IncompleteResource, 'The list of IDs informed is empty.' if id_list.flatten.empty? ensure_client response = @client.rest_put("#{BASE_URI}/#{pool_type}/collector", 'body' => { 'idList' => id_list.flatten }) @client.response_handler(response) end |
#create ⇒ Object
Method is not available
22 23 24 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 22 def create(*) unavailable_method end |
#delete ⇒ Object
Method is not available
28 29 30 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 28 def delete(*) unavailable_method end |
#generate_random_range(pool_type) ⇒ Hash
This API is not applicable for the IPv4 IDs.
Generates and returns a random range
90 91 92 93 94 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 90 def generate_random_range(pool_type) ensure_client response = @client.rest_get("#{BASE_URI}/#{pool_type}/generate") @client.response_handler(response) end |
#get_pool(pool_type) ⇒ OneviewSDK::IDPool
Gets a pool along with the list of ranges present in it.
36 37 38 39 40 41 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 36 def get_pool(pool_type) ensure_client response = @client.rest_get("#{BASE_URI}/#{pool_type}") body = @client.response_handler(response) set_all(body) end |
#validate_id_list(pool_type, *id_list) ⇒ Boolean
Validates a set of user specified IDs to reserve in the pool
101 102 103 104 105 106 107 |
# File 'lib/oneview-sdk/resource/api200/id_pool.rb', line 101 def validate_id_list(pool_type, *id_list) ensure_client return {} if id_list.flatten.empty? response = @client.rest_put("#{BASE_URI}/#{pool_type}/validate", 'body' => { 'idList' => id_list.flatten }) body = @client.response_handler(response) body['valid'] end |