Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added server profile template resource file for api800
- Loading branch information
Showing
9 changed files
with
225 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
module OneviewSDK | ||
# Module for API v800 | ||
module API800 | ||
SUPPORTED_VARIANTS = %w[C7000 Synergy].freeze | ||
DEFAULT_VARIANT = 'C7000'.freeze | ||
@variant = DEFAULT_VARIANT | ||
@variant_updated = false # Whether or not the API variant has been set by the user | ||
|
||
# Get resource class that matches the type given | ||
# @param [String] type Name of the desired class type | ||
# @param [String] variant Variant (C7000 or Synergy) | ||
# @return [Class] Resource class or nil if not found | ||
def self.resource_named(type, variant = @variant) | ||
raise "API800 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s) | ||
new_type = type.to_s.downcase.gsub(/[ -_]/, '') | ||
api_module = OneviewSDK::API800.const_get(variant) | ||
api_module.constants.each do |c| | ||
klass = api_module.const_get(c) | ||
next unless klass.is_a?(Class) | ||
name = klass.name.split('::').last.downcase.delete('_').delete('-') | ||
return klass if new_type =~ /^#{name}[s]?$/ | ||
end | ||
nil | ||
end | ||
|
||
# Get the current API800 variant | ||
def self.variant | ||
@variant | ||
end | ||
|
||
# Has the API800 variant been set by the user? | ||
# @return [TrueClass, FalseClass] | ||
def self.variant_updated? | ||
@variant_updated | ||
end | ||
|
||
# Sets the API800 variant | ||
def self.variant=(variant) | ||
raise "API800 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant) | ||
@variant_updated = true | ||
@variant = variant | ||
end | ||
|
||
# Helps redirect resources to the correct API800 variant | ||
def self.const_missing(const) | ||
api800_module = OneviewSDK::API800.const_get(@variant.to_s) | ||
api800_module.const_get(const) | ||
rescue NameError | ||
raise NameError, "The #{const} method or resource does not exist for OneView API800 variant #{@variant}." | ||
end | ||
end | ||
end | ||
|
||
# Load all API800-specific resources: | ||
Dir[File.dirname(__FILE__) + '/api800/*.rb'].each { |file| require file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
module OneviewSDK | ||
module API800 | ||
# Module for API800 C7000 | ||
module C7000 | ||
# Get resource class that matches the type given | ||
# @param [String] type Name of the desired class type | ||
# @return [Class] Resource class or nil if not found | ||
def self.resource_named(type) | ||
OneviewSDK::API800.resource_named(type, 'C7000') | ||
end | ||
end | ||
end | ||
end | ||
|
||
# Load all API-specific resources: | ||
Dir[File.dirname(__FILE__) + '/c7000/*.rb'].each { |file| require file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
require_relative '../../api300/c7000/server_profile' | ||
|
||
module OneviewSDK | ||
module API800 | ||
module C7000 | ||
# Server Profile resource implementation on API800 C7000 | ||
class ServerProfile < OneviewSDK::API600::C7000::ServerProfile | ||
end | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
lib/oneview-sdk/resource/api800/c7000/server_profile_template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# You may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
require_relative '../../api600/c7000/server_profile_template' | ||
|
||
module OneviewSDK | ||
module API800 | ||
module C7000 | ||
# Server Profile Template resource implementation on API800 C7000 | ||
class ServerProfileTemplate < OneviewSDK::API600::C7000::ServerProfileTemplate | ||
|
||
# Create a resource object, associate it with a client, and set its properties. | ||
# @param [OneviewSDK::Client] client The client object for the OneView appliance | ||
# @param [Hash] params The options for this resource (key-value pairs) | ||
# @param [Integer] api_ver The api version to use when interracting with this resource. | ||
def initialize(client, params = {}, api_ver = nil) | ||
@data ||= {} | ||
# Default values | ||
@data['type'] ||= 'ServerProfileTemplateV5' | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
module OneviewSDK | ||
module API800 | ||
# Module for API800 Synergy | ||
module Synergy | ||
# Get resource class that matches the type given | ||
# @param [String] type Name of the desired class type | ||
# @return [Class] Resource class or nil if not found | ||
def self.resource_named(type) | ||
OneviewSDK::API800.resource_named(type, 'Synergy') | ||
end | ||
end | ||
end | ||
end | ||
|
||
# Load all API-specific resources: | ||
Dir[File.dirname(__FILE__) + '/synergy/*.rb'].each { |file| require file } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
require_relative '../../api300/synergy/server_profile' | ||
require_relative '../c7000/server_profile' | ||
|
||
module OneviewSDK | ||
module API800 | ||
module Synergy | ||
# Server profile resource implementation for API800 Synergy | ||
class ServerProfile < OneviewSDK::API600::C7000::ServerProfile | ||
extend OneviewSDK::API300::Synergy::SASLogicalJBODHelper | ||
include OneviewSDK::API300::Synergy::ServerProfileHelper | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/oneview-sdk/resource/api800/synergy/server_profile_template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# You may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
require_relative '../c7000/server_profile_template' | ||
|
||
module OneviewSDK | ||
module API800 | ||
module Synergy | ||
# Server Profile Template resource implementation for API800 Synergy | ||
class ServerProfileTemplate < OneviewSDK::API800::C7000::ServerProfileTemplate | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters