oneview-sdk 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -8
- data/README.md +41 -11
- data/Rakefile +47 -0
- data/lib/oneview-sdk.rb +6 -1
- data/lib/oneview-sdk/cli.rb +21 -6
- data/lib/oneview-sdk/client.rb +23 -7
- data/lib/oneview-sdk/image-streamer/client.rb +96 -0
- data/lib/oneview-sdk/image-streamer/resource/api300/artifacts_bundle.rb +26 -0
- data/lib/oneview-sdk/image-streamer/resource/api300/build_plan.rb +26 -0
- data/lib/oneview-sdk/image-streamer/resource/api300/deployment_plan.rb +26 -0
- data/lib/oneview-sdk/image-streamer/resource/api300/golden_image.rb +26 -0
- data/lib/oneview-sdk/{resource/api300/synergy/logical_switch_group.rb → image-streamer/resource/api300/os_volume.rb} +17 -13
- data/lib/oneview-sdk/image-streamer/resource/api300/plan_script.rb +42 -0
- data/lib/oneview-sdk/image-streamer/resource/api300/resource.rb +21 -0
- data/lib/oneview-sdk/image-streamer/resource/api_300.rb +39 -0
- data/lib/oneview-sdk/image_streamer.rb +68 -0
- data/lib/oneview-sdk/resource.rb +13 -1
- data/lib/oneview-sdk/resource/api200/connection_template.rb +2 -2
- data/lib/oneview-sdk/resource/api200/datacenter.rb +2 -2
- data/lib/oneview-sdk/resource/api200/enclosure.rb +2 -2
- data/lib/oneview-sdk/resource/api200/enclosure_group.rb +6 -0
- data/lib/oneview-sdk/resource/api200/fabric.rb +4 -4
- data/lib/oneview-sdk/resource/api200/firmware_driver.rb +2 -2
- data/lib/oneview-sdk/resource/api200/interconnect.rb +3 -3
- data/lib/oneview-sdk/resource/api200/logical_downlink.rb +3 -3
- data/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb +8 -8
- data/lib/oneview-sdk/resource/api200/logical_switch.rb +2 -4
- data/lib/oneview-sdk/resource/api200/managed_san.rb +3 -3
- data/lib/oneview-sdk/resource/api200/power_device.rb +2 -2
- data/lib/oneview-sdk/resource/api200/rack.rb +2 -2
- data/lib/oneview-sdk/resource/api200/san_manager.rb +2 -2
- data/lib/oneview-sdk/resource/api200/server_hardware.rb +2 -2
- data/lib/oneview-sdk/resource/api200/server_hardware_type.rb +2 -2
- data/lib/oneview-sdk/resource/api200/storage_pool.rb +3 -3
- data/lib/oneview-sdk/resource/api200/storage_system.rb +2 -2
- data/lib/oneview-sdk/resource/api200/switch.rb +4 -4
- data/lib/oneview-sdk/resource/api200/unmanaged_device.rb +2 -2
- data/lib/oneview-sdk/resource/api200/user.rb +79 -0
- data/lib/oneview-sdk/resource/api200/volume_attachment.rb +3 -3
- data/lib/oneview-sdk/resource/api200/volume_snapshot.rb +2 -2
- data/lib/oneview-sdk/resource/api300.rb +2 -2
- data/lib/oneview-sdk/resource/api300/c7000/enclosure.rb +3 -15
- data/lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb +54 -1
- data/lib/oneview-sdk/resource/api300/c7000/logical_downlink.rb +2 -2
- data/lib/oneview-sdk/resource/api300/c7000/logical_switch.rb +4 -0
- data/lib/oneview-sdk/resource/api300/c7000/managed_san.rb +1 -1
- data/lib/oneview-sdk/resource/api300/c7000/scope.rb +142 -0
- data/lib/oneview-sdk/resource/api300/c7000/server_hardware.rb +3 -17
- data/lib/oneview-sdk/resource/api300/c7000/user.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/drive_enclosure.rb +3 -3
- data/lib/oneview-sdk/resource/api300/synergy/enclosure.rb +4 -31
- data/lib/oneview-sdk/resource/api300/synergy/enclosure_group.rb +3 -6
- data/lib/oneview-sdk/resource/api300/synergy/logical_downlink.rb +2 -2
- data/lib/oneview-sdk/resource/api300/synergy/logical_enclosure.rb +1 -1
- data/lib/oneview-sdk/resource/api300/synergy/logical_interconnect_group.rb +24 -23
- data/lib/oneview-sdk/resource/api300/synergy/logical_switch.rb +2 -0
- data/lib/oneview-sdk/resource/api300/synergy/sas_interconnect.rb +3 -3
- data/lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect.rb +2 -2
- data/lib/oneview-sdk/resource/api300/synergy/scope.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/user.rb +22 -0
- data/lib/oneview-sdk/rest.rb +7 -2
- data/lib/oneview-sdk/version.rb +2 -2
- data/oneview-sdk.gemspec +1 -0
- metadata +32 -4
@@ -0,0 +1,26 @@
|
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# You may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# Artifacts Bundle resource implementation for Image Streamer
|
18
|
+
# @note This resource is unimplemented/unfinished at this point, so use at your own risk.
|
19
|
+
# This resource is subject to change drastically in the near future without a major version
|
20
|
+
# bump, which may break your code.
|
21
|
+
class ArtifactsBundle < Resource
|
22
|
+
BASE_URI = '/rest/artifact-bundles'.freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# You may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# Build Plan resource implementation for Image Streamer
|
18
|
+
# @note This resource is unimplemented/unfinished at this point, so use at your own risk.
|
19
|
+
# This resource is subject to change drastically in the near future without a major version
|
20
|
+
# bump, which may break your code.
|
21
|
+
class BuildPlan < Resource
|
22
|
+
BASE_URI = '/rest/build-plans'.freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# You may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# Deployment Plan resource implementation for Image Streamer
|
18
|
+
# @note This resource is unimplemented/unfinished at this point, so use at your own risk.
|
19
|
+
# This resource is subject to change drastically in the near future without a major version
|
20
|
+
# bump, which may break your code.
|
21
|
+
class DeploymentPlan < Resource
|
22
|
+
BASE_URI = '/rest/deployment-plans'.freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# You may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# Golden Image resource implementation for Image Streamer
|
18
|
+
# @note This resource is unimplemented/unfinished at this point, so use at your own risk.
|
19
|
+
# This resource is subject to change drastically in the near future without a major version
|
20
|
+
# bump, which may break your code.
|
21
|
+
class GoldenImage < Resource
|
22
|
+
BASE_URI = '/rest/golden-images'.freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# (C) Copyright
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# You may not use this file except in compliance with the License.
|
@@ -9,35 +9,39 @@
|
|
9
9
|
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
10
|
# language governing permissions and limitations under the License.
|
11
11
|
|
12
|
-
require_relative '
|
12
|
+
require_relative 'resource'
|
13
13
|
|
14
14
|
module OneviewSDK
|
15
|
-
module
|
16
|
-
module
|
17
|
-
#
|
18
|
-
class
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# OS Volume resource implementation for Image Streamer
|
18
|
+
class OSVolume < Resource
|
19
|
+
BASE_URI = '/rest/os-volumes'.freeze
|
20
|
+
|
19
21
|
# Method is not available
|
20
22
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
21
|
-
def create
|
23
|
+
def create(*)
|
22
24
|
unavailable_method
|
23
25
|
end
|
24
26
|
|
25
27
|
# Method is not available
|
26
28
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
27
|
-
def update
|
29
|
+
def update(*)
|
28
30
|
unavailable_method
|
29
31
|
end
|
30
32
|
|
31
33
|
# Method is not available
|
32
34
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
33
|
-
def delete
|
35
|
+
def delete(*)
|
34
36
|
unavailable_method
|
35
37
|
end
|
36
38
|
|
37
|
-
#
|
38
|
-
# @
|
39
|
-
def
|
40
|
-
|
39
|
+
# Get the details of the archived OS volume with the specified attribute.
|
40
|
+
# @return [Hash] The details of the archived OS volume with the specified attribute
|
41
|
+
def get_details_archive
|
42
|
+
ensure_client && ensure_uri
|
43
|
+
response = @client.rest_get("#{BASE_URI}/archive/#{data['uri'].split('/').last}")
|
44
|
+
@client.response_handler(response)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# You may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
# Plan Script resource implementation for Image Streamer
|
18
|
+
class PlanScript < Resource
|
19
|
+
BASE_URI = '/rest/plan-scripts'.freeze
|
20
|
+
|
21
|
+
# Create a resource object, associate it with a client, and set its properties.
|
22
|
+
# @param [OneviewSDK::ImageStreamer::Client] client The client object for the Image Streamer appliance
|
23
|
+
# @param [Hash] params The options for this resource (key-value pairs)
|
24
|
+
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
25
|
+
def initialize(client, params = {}, api_ver = nil)
|
26
|
+
super
|
27
|
+
# Default values:
|
28
|
+
@data['type'] ||= 'PlanScript'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Retrieves the modified contents of the selected Plan Script as per the selected attributes.
|
32
|
+
# @return [Hash] The script differences of the selected Plan Script.
|
33
|
+
def retrieve_differences
|
34
|
+
ensure_client && ensure_uri
|
35
|
+
path = "#{BASE_URI}/differences/#{@data['uri'].split('/').last}"
|
36
|
+
response = @client.rest_post(path, { 'Content-Type' => 'none' }, @api_version)
|
37
|
+
@client.response_handler(response)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative '../../../resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
module ImageStreamer
|
16
|
+
module API300
|
17
|
+
class Resource < OneviewSDK::Resource
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative '../../resource'
|
13
|
+
|
14
|
+
module OneviewSDK
|
15
|
+
# Module Image Streamer
|
16
|
+
module ImageStreamer
|
17
|
+
# Module API 300
|
18
|
+
module API300
|
19
|
+
# Get resource class that matches the type given
|
20
|
+
# @param [String] type Name of the desired class type
|
21
|
+
# @param [String] variant There is only 1 variant for this module, so this is not used.
|
22
|
+
# It exists only so that the parameters match API modules that do have multiple variants.
|
23
|
+
# @return [Class] Resource class or nil if not found
|
24
|
+
def self.resource_named(type, _variant = nil)
|
25
|
+
new_type = type.to_s.downcase.gsub(/[ -_]/, '')
|
26
|
+
constants.each do |c|
|
27
|
+
klass = const_get(c)
|
28
|
+
next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
|
29
|
+
name = klass.name.split('::').last.downcase.delete('_').delete('-')
|
30
|
+
return klass if new_type =~ /^#{name}[s]?$/
|
31
|
+
end
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Load all API-specific resources:
|
39
|
+
Dir[File.dirname(__FILE__) + '/api300/*.rb'].each { |file| require file }
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'version'
|
13
|
+
require_relative 'exceptions'
|
14
|
+
require_relative 'image-streamer/client'
|
15
|
+
require_relative 'resource'
|
16
|
+
Dir[File.dirname(__FILE__) + '/image-streamer/resource/*.rb'].each { |file| require file }
|
17
|
+
|
18
|
+
# Module for interacting with the HPE OneView API
|
19
|
+
module OneviewSDK
|
20
|
+
# Module for interacting with the Image Streamer
|
21
|
+
module ImageStreamer
|
22
|
+
SUPPORTED_API_VERSIONS = [300].freeze
|
23
|
+
DEFAULT_API_VERSION = 300
|
24
|
+
@api_version = DEFAULT_API_VERSION
|
25
|
+
@api_version_updated = false # Whether or not the API version has been set by the user
|
26
|
+
|
27
|
+
# Get the current API version
|
28
|
+
def self.api_version
|
29
|
+
@api_version
|
30
|
+
end
|
31
|
+
|
32
|
+
# Set the default API version
|
33
|
+
def self.api_version=(version)
|
34
|
+
version = version.to_i rescue version
|
35
|
+
raise "API version #{version} is not supported!" unless SUPPORTED_API_VERSIONS.include?(version)
|
36
|
+
raise "The module for API version #{@api_version} is undefined" unless constants.include?("API#{@api_version}".to_sym)
|
37
|
+
@api_version_updated = true
|
38
|
+
@api_version = version
|
39
|
+
end
|
40
|
+
|
41
|
+
# Has the API version been set by the user?
|
42
|
+
# @return [TrueClass, FalseClass]
|
43
|
+
def self.api_version_updated?
|
44
|
+
@api_version_updated
|
45
|
+
end
|
46
|
+
|
47
|
+
# Helps redirect resources to the correct API module for Image Streamer
|
48
|
+
def self.const_missing(const)
|
49
|
+
api_module = OneviewSDK::ImageStreamer.const_get("API#{@api_version}")
|
50
|
+
api_module.const_get(const)
|
51
|
+
rescue NameError
|
52
|
+
raise NameError, "The #{const} method or resource does not exist for Image Streamer API version #{@api_version}."
|
53
|
+
end
|
54
|
+
|
55
|
+
# Get resource class that matches the type given
|
56
|
+
# @param [String] type Name of the desired class type
|
57
|
+
# @param [Fixnum] api_ver API module version to fetch resource from
|
58
|
+
# @param [String] variant API module variant to fetch resource from
|
59
|
+
# @return [Class] Resource class or nil if not found
|
60
|
+
def self.resource_named(type, api_ver = @api_version, variant = nil)
|
61
|
+
unless SUPPORTED_API_VERSIONS.include?(api_ver)
|
62
|
+
raise UnsupportedVersion, "API version #{api_ver} is not supported! Try one of: #{SUPPORTED_API_VERSIONS}"
|
63
|
+
end
|
64
|
+
api_module = OneviewSDK::ImageStreamer.const_get("API#{api_ver}")
|
65
|
+
variant ? api_module.resource_named(type, variant) : api_module.resource_named(type)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/oneview-sdk/resource.rb
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
# language governing permissions and limitations under the License.
|
11
11
|
|
12
12
|
require_relative 'client'
|
13
|
+
require_relative 'image-streamer/client'
|
13
14
|
|
14
15
|
# OneviewSDK Resources
|
15
16
|
module OneviewSDK
|
@@ -30,7 +31,7 @@ module OneviewSDK
|
|
30
31
|
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
31
32
|
# Defaults to the client.api_version if it exists, or the OneviewSDK::Client::DEFAULT_API_VERSION.
|
32
33
|
def initialize(client, params = {}, api_ver = nil)
|
33
|
-
raise InvalidClient, 'Must specify a valid client' unless client.is_a?(OneviewSDK::Client)
|
34
|
+
raise InvalidClient, 'Must specify a valid client' unless client.is_a?(OneviewSDK::Client) || client.is_a?(OneviewSDK::ImageStreamer::Client)
|
34
35
|
@client = client
|
35
36
|
@logger = @client.logger
|
36
37
|
@api_version = api_ver || @client.api_version
|
@@ -322,6 +323,17 @@ module OneviewSDK
|
|
322
323
|
true
|
323
324
|
end
|
324
325
|
|
326
|
+
# Gets all the URIs for the specified resources
|
327
|
+
# @param [Array<OneviewSDK::Resource>] resources The list of resources
|
328
|
+
# @return [Array<String>] List of uris
|
329
|
+
# @raise IncompleteResource if 'uri' is not set for each resource.
|
330
|
+
def ensure_and_get_uris(resources)
|
331
|
+
resources.map do |resource|
|
332
|
+
resource.ensure_uri
|
333
|
+
resource['uri']
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
325
337
|
# Fail for methods that are not available for one resource
|
326
338
|
def unavailable_method
|
327
339
|
raise MethodUnavailable, "The method ##{caller[0][/`.*'/][1..-2]} is unavailable for this resource"
|
@@ -30,13 +30,13 @@ module OneviewSDK
|
|
30
30
|
|
31
31
|
# Method is not available
|
32
32
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
33
|
-
def create
|
33
|
+
def create(*)
|
34
34
|
unavailable_method
|
35
35
|
end
|
36
36
|
|
37
37
|
# Method is not available
|
38
38
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
39
|
-
def delete
|
39
|
+
def delete(*)
|
40
40
|
unavailable_method
|
41
41
|
end
|
42
42
|
|
@@ -40,13 +40,13 @@ module OneviewSDK
|
|
40
40
|
|
41
41
|
# Method is not available
|
42
42
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
43
|
-
def create
|
43
|
+
def create(*)
|
44
44
|
unavailable_method
|
45
45
|
end
|
46
46
|
|
47
47
|
# Method is not available
|
48
48
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
49
|
-
def delete
|
49
|
+
def delete(*)
|
50
50
|
unavailable_method
|
51
51
|
end
|
52
52
|
|
@@ -37,13 +37,13 @@ module OneviewSDK
|
|
37
37
|
|
38
38
|
# Method is not available
|
39
39
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
40
|
-
def create
|
40
|
+
def create(*)
|
41
41
|
unavailable_method
|
42
42
|
end
|
43
43
|
|
44
44
|
# Method is not available
|
45
45
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
46
|
-
def delete
|
46
|
+
def delete(*)
|
47
47
|
unavailable_method
|
48
48
|
end
|
49
49
|
|
@@ -49,16 +49,21 @@ module OneviewSDK
|
|
49
49
|
|
50
50
|
# Adds the logical interconnect group
|
51
51
|
# @param [OneviewSDK::LogicalInterconnectGroup] lig Logical Interconnect Group
|
52
|
+
# @raise [OneviewSDK::NotFound] if the LIG uri is not set and cannot be retrieved
|
53
|
+
# @return [OneviewSDK::EnclosureGroup] self
|
52
54
|
def add_logical_interconnect_group(lig)
|
53
55
|
lig.retrieve! unless lig['uri']
|
56
|
+
raise(NotFound, "The logical interconnect group #{lig['name']} was not found.") unless lig['uri']
|
54
57
|
lig['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
|
55
58
|
entry['logicalLocation']['locationEntries'].each do |location|
|
56
59
|
add_lig_to_bay(location['relativeValue'], lig) if location['type'] == 'Bay' && entry['permittedInterconnectTypeUri']
|
57
60
|
end
|
58
61
|
end
|
62
|
+
self
|
59
63
|
end
|
60
64
|
|
61
65
|
# Creates the interconnect bay mapping
|
66
|
+
# @return [OneviewSDK::EnclosureGroup] self
|
62
67
|
def create_interconnect_bay_mapping
|
63
68
|
@data['interconnectBayMappings'] = []
|
64
69
|
1.upto(@data['interconnectBayMappingCount']) do |bay_number|
|
@@ -68,6 +73,7 @@ module OneviewSDK
|
|
68
73
|
}
|
69
74
|
@data['interconnectBayMappings'] << entry
|
70
75
|
end
|
76
|
+
self
|
71
77
|
end
|
72
78
|
|
73
79
|
private
|