Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for config changes #pr #496

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Metrics/PerceivedComplexity:
Enabled: false

Style/GlobalVars:
AllowedVariables: [$config, $secrets, $client, $client_120, $client_300, $client_300_synergy, $config_synergy, $secrets_synergy, $config_i3s, $client_i3s_300, $client_500, $client_500_synergy, $client_i3s_500, $client_600, $client_600_synergy, $client_i3s_600, $client_800, $client_800_synergy, $client_1000, $client_1000_synergy, $client_1200, $client_1200_synergy, $client_1600, $client_1600_synergy, $client_1800, $client_1800_synergy, $client_2000, $client_2000_synergy, $client_2200, $client_2200_synergy, $client_2400, $client_2400_synergy, $client_2600, $client_2600_synergy]
AllowedVariables: [$config, $secrets, $client, $client_120, $client_300, $client_300_synergy, $config_synergy, $secrets_synergy, $config_i3s, $client_i3s_300, $client_500, $client_500_synergy, $client_i3s_500, $client_600, $client_600_synergy, $client_i3s_600, $client_800, $client_800_synergy, $client_1000, $client_1000_synergy, $client_1200, $client_1200_synergy, $client_1600, $client_1600_synergy, $client_1800, $client_1800_synergy, $client_2000, $client_2000_synergy, $client_2200, $client_2200_synergy, $client_2400, $client_2400_synergy, $client_2600, $client_2600_synergy, $client_2800, $client_2800_synergy]

Style/FrozenStringLiteralComment:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion lib/oneview-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module OneviewSDK
env_i3s = %w[I3S_URL I3S_SSL_ENABLED]
ENV_VARS = env_sdk.concat(env_i3s).freeze

SUPPORTED_API_VERSIONS = [200, 300, 500, 600, 800, 1000, 1200, 1600, 1800, 2000, 2200, 2400, 2600].freeze
SUPPORTED_API_VERSIONS = [200, 300, 500, 600, 800, 1000, 1200, 1600, 1800, 2000, 2200, 2400, 2600, 2800].freeze
DEFAULT_API_VERSION = 200
@api_version = DEFAULT_API_VERSION
@api_version_updated = false # Whether or not the API version has been set by the user
Expand Down
39 changes: 39 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# (c) Copyright 2020 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 '../../resource'

module OneviewSDK
# Module Image Streamer
module ImageStreamer
# Module API 2020
module API2020
# Get resource class that matches the type given
# @param [String] type Name of the desired class type
# @param [String] variant There is only 1 variant for this module, so this is not used.
# It exists only so that the parameters match API modules that do have multiple variants.
# @return [Class] Resource class or nil if not found
def self.resource_named(type, _variant = nil)
new_type = type.to_s.downcase.gsub(/[ -_]/, '')
constants.each do |c|
klass = const_get(c)
next unless klass.is_a?(Class) && klass < OneviewSDK::Resource
name = klass.name.split('::').last.downcase.delete('_').delete('-')
return klass if new_type =~ /^#{name}[s]?$/
end
nil
end
end
end
end

# Load all API-specific resources:
Dir[File.dirname(__FILE__) + '/api2020/*.rb'].each { |file| require file }
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/artifact_bundle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/artifact_bundle'

module OneviewSDK
module ImageStreamer
module API2020
# Artifact Bundle resource implementation for Image Streamer
class ArtifactBundle < OneviewSDK::ImageStreamer::API2010::ArtifactBundle
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/build_plan.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/build_plan'

module OneviewSDK
module ImageStreamer
module API2020
# Build Plan resource implementation for Image Streamer
class BuildPlan < OneviewSDK::ImageStreamer::API2010::BuildPlan
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/deployment_group'

module OneviewSDK
module ImageStreamer
module API2020
# Deployment Group resource implementation for Image Streamer
class DeploymentGroup < OneviewSDK::ImageStreamer::API2010::DeploymentGroup
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/deployment_plan.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/deployment_plan'

module OneviewSDK
module ImageStreamer
module API2020
# Deployment Plan resource implementation for Image Streamer
class DeploymentPlan < OneviewSDK::ImageStreamer::API2010::DeploymentPlan
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/golden_image.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/golden_image'

module OneviewSDK
module ImageStreamer
module API2020
# Golden Image resource implementation for Image Streamer
class GoldenImage < OneviewSDK::ImageStreamer::API2010::GoldenImage
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/os_volume.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/os_volume'

module OneviewSDK
module ImageStreamer
module API2020
# OS Volume resource implementation for Image Streamer
class OSVolume < OneviewSDK::ImageStreamer::API2010::OSVolume
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/image-streamer/resource/api2020/plan_script.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2020 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 '../api2010/plan_script'

module OneviewSDK
module ImageStreamer
module API2020
# Plan Script resource implementation for Image Streamer
class PlanScript < OneviewSDK::ImageStreamer::API2010::PlanScript
end
end
end
end
66 changes: 66 additions & 0 deletions lib/oneview-sdk/resource/api2800.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# (c) Copyright 2021 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 v2800
module API2800
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 "API2800 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::API2800.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 API2800 variant
def self.variant
@variant
end

# Has the API2800 variant been set by the user?
# @return [TrueClass, FalseClass]
def self.variant_updated?
@variant_updated
end

# Sets the API2800 variant
def self.variant=(variant)
raise "API2800 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 API2800 variant
def self.const_missing(const)
api2800_module = OneviewSDK::API2800.const_get(@variant.to_s)
api2800_module.const_get(const)
rescue NameError
raise NameError, "The #{const} method or resource does not exist for OneView API2800 variant #{@variant}."
end
end
end

# Load all API2800-specific resources:
Dir[File.dirname(__FILE__) + '/api2800/*.rb'].each { |file| require file }
27 changes: 27 additions & 0 deletions lib/oneview-sdk/resource/api2800/c7000.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# (c) Copyright 2021 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 API2800
# Module for API2800 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::API2800.resource_named(type, 'C7000')
end
end
end
end

# Load all API-specific resources:
Dir[File.dirname(__FILE__) + '/c7000/*.rb'].each { |file| require file }
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api2800/c7000/connection_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (c) Copyright 2021 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 '../../api2600/c7000/connection_template'

module OneviewSDK
module API2800
module C7000
# Connection template resource implementation for API2800 C7000
class ConnectionTemplate < OneviewSDK::API2600::C7000::ConnectionTemplate
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api2800/c7000/enclosure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (c) Copyright 2021 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 '../../api2600/c7000/enclosure'

module OneviewSDK
module API2800
module C7000
# Enclosure resource implementation for API2800 C7000
class Enclosure < OneviewSDK::API2600::C7000::Enclosure
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api2800/c7000/enclosure_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# (C) Copyright 2021 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 '../../api2600/c7000/enclosure_group'

module OneviewSDK
module API2800
module C7000
# Enclosure group resource implementation on API2800 C7000
class EnclosureGroup < OneviewSDK::API2600::C7000::EnclosureGroup
end
end
end
end
Loading