# pnap_bmc_api BmcApi - the Ruby gem for the Bare Metal Cloud API Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/bmc/v1/) This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 0.1 For more information, please visit [https://phoenixnap.com/](https://phoenixnap.com/) ## Installation ### Build a gem To build the Ruby code into a gem: ```shell gem build pnap_bmc_api.gemspec ``` Then either install the gem locally, replacing `` with the actual version: ```shell gem install ./pnap_bmc_api-.gem ``` (for development, run `gem install --dev ./pnap_bmc_api-.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). Finally add this to the Gemfile: gem 'pnap_bmc_api', '~> ' ### 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_bmc_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'BmcApi/*.gemspec' If you'd like the development version: gem 'pnap_bmc_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'BmcApi/*.gemspec', branch: 'develop' Then run `bundle install`. ### Include the Ruby code directly Include the Ruby code directly using `-I` as follows: ```shell ruby -Ilib script.rb ``` ## Getting Started Please follow the [installation](#installation) procedure and then run the following code: ```ruby # Load the gem require 'pnap_bmc_api' # Setup authorization BmcApi.configure do |config| # Configure OAuth2 access token for authorization: OAuth2 config.access_token = 'YOUR ACCESS TOKEN' end api_instance = BmcApi::QuotasApi.new begin #List quotas result = api_instance.quotas_get p result rescue BmcApi::ApiError => e puts "Exception when calling QuotasApi->quotas_get: #{e}" end ``` Authorization can also be setup by using the [`oauth`](https://github.com/oauth-xx/oauth2) library: ```ruby # Load the gem require 'pnap_bmc_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 BmcApi.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/bmc/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *BmcApi::QuotasApi* | [**quotas_get**](docs/QuotasApi.md#quotas_get) | **GET** /quotas | List quotas *BmcApi::QuotasApi* | [**quotas_quota_id_actions_request_edit_post**](docs/QuotasApi.md#quotas_quota_id_actions_request_edit_post) | **POST** /quotas/{quotaId}/actions/request-edit | Request quota limit change. *BmcApi::QuotasApi* | [**quotas_quota_id_get**](docs/QuotasApi.md#quotas_quota_id_get) | **GET** /quotas/{quotaId} | Get a quota. *BmcApi::SSHKeysApi* | [**ssh_keys_get**](docs/SSHKeysApi.md#ssh_keys_get) | **GET** /ssh-keys | List SSH Keys. *BmcApi::SSHKeysApi* | [**ssh_keys_post**](docs/SSHKeysApi.md#ssh_keys_post) | **POST** /ssh-keys | Create SSH Key. *BmcApi::SSHKeysApi* | [**ssh_keys_ssh_key_id_delete**](docs/SSHKeysApi.md#ssh_keys_ssh_key_id_delete) | **DELETE** /ssh-keys/{sshKeyId} | Delete SSH Key. *BmcApi::SSHKeysApi* | [**ssh_keys_ssh_key_id_get**](docs/SSHKeysApi.md#ssh_keys_ssh_key_id_get) | **GET** /ssh-keys/{sshKeyId} | Get SSH Key. *BmcApi::SSHKeysApi* | [**ssh_keys_ssh_key_id_put**](docs/SSHKeysApi.md#ssh_keys_ssh_key_id_put) | **PUT** /ssh-keys/{sshKeyId} | Edit SSH Key. *BmcApi::ServersApi* | [**delete_private_network**](docs/ServersApi.md#delete_private_network) | **DELETE** /servers/{serverId}/network-configuration/private-network-configuration/private-networks/{privateNetworkId} | Removes the server from private network. *BmcApi::ServersApi* | [**servers_get**](docs/ServersApi.md#servers_get) | **GET** /servers | List servers. *BmcApi::ServersApi* | [**servers_post**](docs/ServersApi.md#servers_post) | **POST** /servers | Create new server. *BmcApi::ServersApi* | [**servers_server_id_actions_deprovision_post**](docs/ServersApi.md#servers_server_id_actions_deprovision_post) | **POST** /servers/{serverId}/actions/deprovision | Deprovision a server. *BmcApi::ServersApi* | [**servers_server_id_actions_power_off_post**](docs/ServersApi.md#servers_server_id_actions_power_off_post) | **POST** /servers/{serverId}/actions/power-off | Power off server. *BmcApi::ServersApi* | [**servers_server_id_actions_power_on_post**](docs/ServersApi.md#servers_server_id_actions_power_on_post) | **POST** /servers/{serverId}/actions/power-on | Power on server. *BmcApi::ServersApi* | [**servers_server_id_actions_reboot_post**](docs/ServersApi.md#servers_server_id_actions_reboot_post) | **POST** /servers/{serverId}/actions/reboot | Reboot server. *BmcApi::ServersApi* | [**servers_server_id_actions_reserve_post**](docs/ServersApi.md#servers_server_id_actions_reserve_post) | **POST** /servers/{serverId}/actions/reserve | Reserve server. *BmcApi::ServersApi* | [**servers_server_id_actions_reset_post**](docs/ServersApi.md#servers_server_id_actions_reset_post) | **POST** /servers/{serverId}/actions/reset | Reset server. *BmcApi::ServersApi* | [**servers_server_id_actions_shutdown_post**](docs/ServersApi.md#servers_server_id_actions_shutdown_post) | **POST** /servers/{serverId}/actions/shutdown | Shutdown server. *BmcApi::ServersApi* | [**servers_server_id_delete**](docs/ServersApi.md#servers_server_id_delete) | **DELETE** /servers/{serverId} | Delete server. *BmcApi::ServersApi* | [**servers_server_id_get**](docs/ServersApi.md#servers_server_id_get) | **GET** /servers/{serverId} | Get server. *BmcApi::ServersApi* | [**servers_server_id_ip_blocks_ip_block_id_delete**](docs/ServersApi.md#servers_server_id_ip_blocks_ip_block_id_delete) | **DELETE** /servers/{serverId}/network-configuration/ip-block-configurations/ip-blocks/{ipBlockId} | Unassign IP Block from Server. *BmcApi::ServersApi* | [**servers_server_id_ip_blocks_post**](docs/ServersApi.md#servers_server_id_ip_blocks_post) | **POST** /servers/{serverId}/network-configuration/ip-block-configurations/ip-blocks | Assign IP Block to Server. *BmcApi::ServersApi* | [**servers_server_id_patch**](docs/ServersApi.md#servers_server_id_patch) | **PATCH** /servers/{serverId} | Patch a Server. *BmcApi::ServersApi* | [**servers_server_id_private_networks_patch**](docs/ServersApi.md#servers_server_id_private_networks_patch) | **PATCH** /servers/{serverId}/network-configuration/private-network-configuration/private-networks/{privateNetworkId} | Updates the server's private network's IP addresses *BmcApi::ServersApi* | [**servers_server_id_private_networks_post**](docs/ServersApi.md#servers_server_id_private_networks_post) | **POST** /servers/{serverId}/network-configuration/private-network-configuration/private-networks | Adds the server to a private network. *BmcApi::ServersApi* | [**servers_server_id_public_networks_delete**](docs/ServersApi.md#servers_server_id_public_networks_delete) | **DELETE** /servers/{serverId}/network-configuration/public-network-configuration/public-networks/{publicNetworkId} | Removes the server from the Public Network *BmcApi::ServersApi* | [**servers_server_id_public_networks_patch**](docs/ServersApi.md#servers_server_id_public_networks_patch) | **PATCH** /servers/{serverId}/network-configuration/public-network-configuration/public-networks/{publicNetworkId} | Updates the server's public network's IP addresses. *BmcApi::ServersApi* | [**servers_server_id_public_networks_post**](docs/ServersApi.md#servers_server_id_public_networks_post) | **POST** /servers/{serverId}/network-configuration/public-network-configuration/public-networks | Adds the server to a Public Network. *BmcApi::ServersApi* | [**servers_server_id_tags_put**](docs/ServersApi.md#servers_server_id_tags_put) | **PUT** /servers/{serverId}/tags | Overwrite tags assigned for Server. ## Documentation for Models - [BmcApi::ActionResult](docs/ActionResult.md) - [BmcApi::DeleteResult](docs/DeleteResult.md) - [BmcApi::DeleteSshKeyResult](docs/DeleteSshKeyResult.md) - [BmcApi::Error](docs/Error.md) - [BmcApi::IpBlocksConfiguration](docs/IpBlocksConfiguration.md) - [BmcApi::NetworkConfiguration](docs/NetworkConfiguration.md) - [BmcApi::OsConfiguration](docs/OsConfiguration.md) - [BmcApi::OsConfigurationCloudInit](docs/OsConfigurationCloudInit.md) - [BmcApi::OsConfigurationMap](docs/OsConfigurationMap.md) - [BmcApi::OsConfigurationMapEsxi](docs/OsConfigurationMapEsxi.md) - [BmcApi::OsConfigurationMapProxmox](docs/OsConfigurationMapProxmox.md) - [BmcApi::OsConfigurationNetrisController](docs/OsConfigurationNetrisController.md) - [BmcApi::OsConfigurationNetrisSoftgate](docs/OsConfigurationNetrisSoftgate.md) - [BmcApi::OsConfigurationWindows](docs/OsConfigurationWindows.md) - [BmcApi::PrivateNetworkConfiguration](docs/PrivateNetworkConfiguration.md) - [BmcApi::PublicNetworkConfiguration](docs/PublicNetworkConfiguration.md) - [BmcApi::Quota](docs/Quota.md) - [BmcApi::QuotaEditLimitRequest](docs/QuotaEditLimitRequest.md) - [BmcApi::QuotaEditLimitRequestDetails](docs/QuotaEditLimitRequestDetails.md) - [BmcApi::QuotaEditLimitRequestDetailsAllOf](docs/QuotaEditLimitRequestDetailsAllOf.md) - [BmcApi::RelinquishIpBlock](docs/RelinquishIpBlock.md) - [BmcApi::ResetResult](docs/ResetResult.md) - [BmcApi::Server](docs/Server.md) - [BmcApi::ServerCreate](docs/ServerCreate.md) - [BmcApi::ServerIpBlock](docs/ServerIpBlock.md) - [BmcApi::ServerNetworkUpdate](docs/ServerNetworkUpdate.md) - [BmcApi::ServerPatch](docs/ServerPatch.md) - [BmcApi::ServerPrivateNetwork](docs/ServerPrivateNetwork.md) - [BmcApi::ServerPublicNetwork](docs/ServerPublicNetwork.md) - [BmcApi::ServerReserve](docs/ServerReserve.md) - [BmcApi::ServerReset](docs/ServerReset.md) - [BmcApi::SshKey](docs/SshKey.md) - [BmcApi::SshKeyCreate](docs/SshKeyCreate.md) - [BmcApi::SshKeyUpdate](docs/SshKeyUpdate.md) - [BmcApi::TagAssignment](docs/TagAssignment.md) - [BmcApi::TagAssignmentRequest](docs/TagAssignmentRequest.md) ## Documentation for Authorization ### OAuth2 - **Type**: OAuth - **Flow**: application - **Authorization URL**: - **Scopes**: - bmc: Grants full access to bmc-api. - bmc.read: Grants read only access to bmc-api.