Skip to content

Commit

Permalink
Merge pull request #415 from HewlettPackard/ServerCertificate
Browse files Browse the repository at this point in the history
Added api1600 support to server certificate
  • Loading branch information
VenkateshRavula committed May 26, 2020
2 parents ec5b0b2 + 0033a94 commit d38cbcb
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,7 @@ This release extends support of the SDK to OneView REST API version 1600 (OneVie
- Hypervisor Manager
- Logical Enclosure
- OS Deployment Plan
- Server Certificate
- Server Hardware
- Server Hardware Type
- Server Profile
Expand Down
10 changes: 5 additions & 5 deletions endpoints-support.md
Expand Up @@ -326,11 +326,11 @@ OneviewSDK::Datacenter.find_by(@client, width: 11000).map(&:remove)
|<sub>/rest/scopes/resources/{resource_uri}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark:| :white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/scopes/resources/{resource_uri}</sub> | PATCH | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark:| :white_check_mark: |:white_check_mark: |:white_check_mark: |
| **Server Certificate** |
|<sub>/rest/certificates/https/remote/{address}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/https/remote/{address}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers</sub> | POST | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | GET | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | PUT | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/certificates/servers/{aliasName}</sub> | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
| **Server Hardware** |
|<sub>/rest/server-hardware</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
|<sub>/rest/server-hardware</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |
Expand Down
15 changes: 8 additions & 7 deletions examples/shared_samples/server_certificate.rb
Expand Up @@ -12,10 +12,10 @@
require_relative '../_client' # Gives access to @client

# NOTE: You'll need to add the following instance variable to the _client.rb file with valid values for your environment:
# @storage_system_ip
# @hypervisor_manager_ip

# All supported APIs for Server Certificate:
# - 600, 800, 1000, 1200
# - 600, 800, 1000, 1200, 1600
# # Resources classes that you can use for Server Certificate in this example:
# server_certificate_class = OneviewSDK::API600::C7000::ServerCertificate
# server_certificate_class = OneviewSDK::API600::Synergy::ServerCertificate
Expand All @@ -25,20 +25,21 @@
# server_certificate_class = OneviewSDK::API1000::Synergy::ServerCertificate
# server_certificate_class = OneviewSDK::API1200::C7000::ServerCertificate
# server_certificate_class = OneviewSDK::API1200::Synergy::ServerCertificate
# server_certificate_class = OneviewSDK::API1600::C7000::ServerCertificate
# server_certificate_class = OneviewSDK::API1600::Synergy::ServerCertificate

# Initialize the resources
server_certificate_class = OneviewSDK.resource_named('ServerCertificate', @client.api_version)

# Gets certificates from remote IP
puts 'Fetching Certificate:-'
certificate = server_certificate_class.new(@client)
certificate.data['remoteIp'] = '172.18.13.11'
certificate.data['remoteIp'] = @hypervisor_manager_ip
puts certificate.get_certificate

# Imports the certificates
puts 'Importing the certificate:- '
item = server_certificate_class.new(@client, aliasName: @storage_system_ip)
item.data['type'] = certificate.get_certificate['type']
item = server_certificate_class.new(@client, aliasName: @hypervisor_manager_ip)
item.data['certificateDetails'] = []
item.data['certificateDetails'][0] = {
'type' => certificate.get_certificate['certificateDetails'][0]['type'],
Expand All @@ -54,9 +55,9 @@

# Retrieve the certificates as per the aliasName
puts 'Retrieving Imported Certificate:-'
item = server_certificate_class.new(@client, aliasName: @storage_system_ip)
item = server_certificate_class.new(@client, aliasName: @hypervisor_manager_ip)
puts item.data if item.retrieve!

# Deleres the certificate as per the aliasName
# Deletes the certificate as per the aliasName
puts 'Removing certificate:-'
puts 'Successfully Removed.' if item.remove
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1600/c7000/server_certificate.rb
@@ -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 '../../api1200/c7000/server_certificate'

module OneviewSDK
module API1600
module C7000
# Server certificate resource implementation for API1600 C7000
class ServerCertificate < OneviewSDK::API1200::C7000::ServerCertificate
end
end
end
end
22 changes: 22 additions & 0 deletions lib/oneview-sdk/resource/api1600/synergy/server_certificate.rb
@@ -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 '../../api1200/synergy/server_certificate'

module OneviewSDK
module API1600
module Synergy
# Server certificate resource implementation for API 1600 Synergy
class ServerCertificate < OneviewSDK::API1200::Synergy::ServerCertificate
end
end
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1000/c7000/server_certificate_spec.rb
@@ -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::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API800::C7000::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API800::C7000::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1000/synergy/server_certificate_spec.rb
@@ -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::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API800::Synergy::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API800::Synergy::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1200/c7000/server_certificate_spec.rb
@@ -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::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API1000::C7000::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API1000::C7000::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1200/synergy/server_certificate_spec.rb
@@ -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::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API1000::Synergy::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API1000::Synergy::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1600/c7000/server_certificate_spec.rb
@@ -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::API1600::C7000::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API1200::C7000::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API1200::C7000::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api1600/synergy/server_certificate_spec.rb
@@ -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::API1600::Synergy::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API1200::Synergy::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API1200::Synergy::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api800/c7000/server_certificate_spec.rb
@@ -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::API800::C7000::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API600::C7000::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API600::C7000::ServerCertificate
end
end
20 changes: 20 additions & 0 deletions spec/unit/resource/api800/synergy/server_certificate_spec.rb
@@ -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::API800::Synergy::ServerCertificate do
include_context 'shared context'

it 'inherits from OneviewSDK::API600::Synergy::ServerCertificate' do
expect(described_class).to be < OneviewSDK::API600::Synergy::ServerCertificate
end
end

0 comments on commit d38cbcb

Please sign in to comment.