Skip to content

Commit

Permalink
Merge 508132d into d38cbcb
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkateshRavula committed May 26, 2020
2 parents d38cbcb + 508132d commit 479ef74
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@ This release extends support of the SDK to OneView REST API version 1600 (OneVie
- Ethernet Network
- FC Network
- FCOE Network
- Hypervisor Cluster Profile
- Hypervisor Manager
- Logical Enclosure
- OS Deployment Plan
Expand Down
12 changes: 6 additions & 6 deletions endpoints-support.md
Expand Up @@ -120,12 +120,12 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|<sub>/rest/hypervisor-managers/{id}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-managers/{id}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Hypervisor Cluster Profiles** |
|<sub>/rest/hypervisor-cluster-profiles</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}/compliance-preview</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}/compliance-preview</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/hypervisor-cluster-profiles/{id}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **ID Pools** |
|<sub>/rest/id-pools/{poolType}</sub> | GET | :white_check_mark: | :white_check_mark: |
|<sub>/rest/id-pools/{poolType}</sub> | PUT | :white_check_mark: | :white_check_mark: |
Expand Down
9 changes: 8 additions & 1 deletion examples/shared_samples/hypervisor_cluster_profile.rb
Expand Up @@ -21,6 +21,8 @@
# - API1000 for Synergy
# - API1200 for C7000
# - API1200 for Synergy
# - API1600 for C7000
# - API1600 for Synergy

# Resources that can be created according to parameters:
# api_version = 800 & variant = C7000 to OneviewSDK::API800::C7000::HypervisorClusterProfile
Expand All @@ -29,6 +31,8 @@
# api_version = 1000 & variant = Synergy to OneviewSDK::API1000::Synergy::HypervisorClusterProfile
# api_version = 1200 & variant = C7000 to OneviewSDK::API1200::C7000::HypervisorClusterProfile
# api_version = 1200 & variant = Synergy to OneviewSDK::API1200::Synergy::HypervisorClusterProfile
# api_version = 1600 & variant = C7000 to OneviewSDK::API1600::C7000::HypervisorClusterProfile
# api_version = 1600 & variant = Synergy to OneviewSDK::API1600::Synergy::HypervisorClusterProfile

# Resource Class used in this sample
hypervisor_cluster_profile_class = OneviewSDK.resource_named('HypervisorClusterProfile', @client.api_version)
Expand Down Expand Up @@ -75,5 +79,8 @@
puts "\nCompliance preview details are :\n#{cp}\n"

# Deletes the created hypervisor cluster profile
hcp.delete
# Delete method accepts 2 arguments - soft_delete(boolean) and force(boolean) which are optional till API1200
# soft_delete has become mandatory argument in API1600 and force is still optional
# The default values for the arguments is "false"
hcp.delete(true, true)
puts "\nSuccesfully deleted the cluster profile"
@@ -0,0 +1,36 @@
# (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 '../../api1200/c7000/hypervisor_cluster_profile'

module OneviewSDK
module API1600
module C7000
# Hypervisor cluster profile resource implementation for API1600 C7000
class HypervisorClusterProfile < OneviewSDK::API1200::C7000::HypervisorClusterProfile

# softDelete is mandatory argument in API1600
def delete(soft_delete = false, force = false)
ensure_client && ensure_uri
uri = @data['uri']
uri += if force == true
"?softDelete=#{soft_delete}" + "&force=#{force}"
else
"?softDelete=#{soft_delete}"
end
response = @client.rest_delete(uri, DEFAULT_REQUEST_HEADER, @api_version)
@client.response_handler(response)
true
end
end
end
end
end
@@ -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 '../../api1600/c7000/hypervisor_cluster_profile'

module OneviewSDK
module API1600
module Synergy
# Hypervisor cluster profile resource implementation for API1600 Synergy
class HypervisorClusterProfile < OneviewSDK::API1600::C7000::HypervisorClusterProfile
end
end
end
end
@@ -0,0 +1,20 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1000::C7000::HypervisorClusterProfile do
include_context 'shared context'

it 'inherits from OneviewSDK::API800::C7000::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API800::C7000::HypervisorClusterProfile
end
end
@@ -0,0 +1,20 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1000::Synergy::HypervisorClusterProfile do
include_context 'shared context'

it 'inherits from OneviewSDK::API800::Synergy::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API800::Synergy::HypervisorClusterProfile
end
end
@@ -0,0 +1,20 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1200::C7000::HypervisorClusterProfile do
include_context 'shared context'

it 'inherits from OneviewSDK::API1000::C7000::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API1000::C7000::HypervisorClusterProfile
end
end
@@ -0,0 +1,20 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1200::Synergy::HypervisorClusterProfile do
include_context 'shared context'

it 'inherits from OneviewSDK::API1000::Synergy::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API1000::Synergy::HypervisorClusterProfile
end
end
@@ -0,0 +1,36 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1600::C7000::HypervisorClusterProfile do
include_context 'shared context'

it 'inherits from OneviewSDK::API1200::C7000::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API1200::C7000::HypervisorClusterProfile
end

describe '#delete' do
it 'passes no extra arguments' do
allow_any_instance_of(OneviewSDK::Client).to receive(:response_handler).and_return(true)
item = described_class.new(@client_1600, uri: '/rest/fake')
expect(@client_1600).to receive(:rest_api).with(:delete, '/rest/fake?softDelete=false', {}, 1600)
item.delete
end

it 'passes extra arguments' do
allow_any_instance_of(OneviewSDK::Client).to receive(:response_handler).and_return(true)
item = described_class.new(@client_1600, uri: '/rest/fake')
expect(@client_1600).to receive(:rest_api).with(:delete, '/rest/fake?softDelete=true&force=true', {}, 1600)
item.delete(true, true)
end
end
end
@@ -0,0 +1,21 @@
# (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 'spec_helper'

RSpec.describe OneviewSDK::API1600::Synergy::HypervisorClusterProfile do
include_context 'shared context'

# it inherit latest changes from API1600 C7000 lib file
it 'inherits from OneviewSDK::API1600::C7000::HypervisorClusterProfile' do
expect(described_class).to be < OneviewSDK::API1600::C7000::HypervisorClusterProfile
end
end

0 comments on commit 479ef74

Please sign in to comment.