pnap_network_storage_api
NetworkStorageApi - the Ruby gem for the Network Storage API
Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network.
Knowledge base articles to help you can be found
here
All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/)
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0 For more information, please visit https://phoenixnap.com/
Installation
Build a gem
To build the Ruby code into a gem:
gem build pnap_network_storage_api.gemspec
Then either install the gem locally, replacing <VERSION>
with the actual version:
gem install ./pnap_network_storage_api-<VERSION>.gem
(for development, run gem install --dev ./pnap_network_storage_api-<VERSION>.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'pnap_network_storage_api', '~> <VERSION>'
Install from Git
To install this Gem from this repository, you'll need to get Bundler by doing gem install bundler
. Add the following line in your Gemfile:
gem 'pnap_network_storage_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'NetworkStorageApi/*.gemspec'
If you'd like the development version:
gem 'pnap_network_storage_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'NetworkStorageApi/*.gemspec', branch: 'develop'
Then run bundle install
.
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
# Load the gem
require 'pnap_network_storage_api'
# Setup authorization
NetworkStorageApi.configure do |config|
# Configure OAuth2 access token for authorization: OAuth2
config.access_token = 'YOUR ACCESS TOKEN'
# Configure a proc to get access tokens in lieu of the static access_token configuration
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
end
api_instance = NetworkStorageApi::StorageNetworksApi.new
opts = {
location: 'PHX' # String | If present will filter the result by the given location.
}
begin
#List all storage networks.
result = api_instance.storage_networks_get(opts)
p result
rescue NetworkStorageApi::ApiError => e
puts "Exception when calling StorageNetworksApi->storage_networks_get: #{e}"
end
Authorization can also be setup by using the oauth
library:
# Load the gem
require 'pnap_network_storage_api'
require 'oauth2'
# Setup variables for getting a token.
client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
auth_url = 'https://auth.phoenixnap.com/auth/realms/BMC/protocol/openid-connect/token'
# Setup authorization
NetworkStorageApi.configure do |config|
# Retrieve the token using OAuth2.
client = OAuth2::Client.new(client_id, client_secret, token_url: auth_url)
token = client.client_credentials.get_token
# Configure OAuth2 access token for authorization: OAuth2
config.access_token = token.token
end
Documentation for API Endpoints
All URIs are relative to https://api.phoenixnap.com/network-storage/v1
Class | Method | HTTP request | Description |
---|---|---|---|
NetworkStorageApi::StorageNetworksApi | storage_networks_get | GET /storage-networks | List all storage networks. |
NetworkStorageApi::StorageNetworksApi | storage_networks_id_delete | DELETE /storage-networks/storageId | Delete a storage network and its volume. |
NetworkStorageApi::StorageNetworksApi | storage_networks_id_get | GET /storage-networks/storageId | Get storage network details. |
NetworkStorageApi::StorageNetworksApi | storage_networks_id_patch | PATCH /storage-networks/storageId | Update storage network details. |
NetworkStorageApi::StorageNetworksApi | storage_networks_post | POST /storage-networks | Create a storage network and volume. |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_get | GET /storage-networks/storageId/volumes | Display one or more volumes belonging to a storage network. |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_post | POST /storage-networks/storageId/volumes | Create a volume belonging to a storage network. |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_volume_id_delete | DELETE /storage-networks/storageId/volumes/volumeId | Delete a Storage Network's Volume |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_volume_id_get | GET /storage-networks/storageId/volumes/volumeId | Get a storage network's volume details. |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_volume_id_patch | PATCH /storage-networks/storageId/volumes/volumeId | Update a storage network's volume details. |
NetworkStorageApi::StorageNetworksApi | storage_networks_storage_network_id_volumes_volume_id_tags_put | PUT /storage-networks/storageId/volumes/volumeId/tags | Overwrites tags assigned for the volume. |
Documentation for Models
- NetworkStorageApi::Error
- NetworkStorageApi::NfsPermissions
- NetworkStorageApi::NfsPermissionsCreate
- NetworkStorageApi::NfsPermissionsUpdate
- NetworkStorageApi::Permissions
- NetworkStorageApi::PermissionsCreate
- NetworkStorageApi::PermissionsUpdate
- NetworkStorageApi::Status
- NetworkStorageApi::StorageNetwork
- NetworkStorageApi::StorageNetworkCreate
- NetworkStorageApi::StorageNetworkUpdate
- NetworkStorageApi::StorageNetworkVolumeCreate
- NetworkStorageApi::TagAssignment
- NetworkStorageApi::TagAssignmentRequest
- NetworkStorageApi::Volume
- NetworkStorageApi::VolumeCreate
- NetworkStorageApi::VolumeUpdate
Documentation for Authorization
Authentication schemes defined for the API:
OAuth2
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- networkstorage: Grants full access to Network Storage API.
- networkstorage.read: Grants read only access to Network Storage API.