mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #1653 from rackspace/server_doc20
[Rackspace] Updating Getting Started Docs
This commit is contained in:
commit
8116689537
2 changed files with 49 additions and 34 deletions
|
@ -1,7 +1,8 @@
|
|||
#Next Generation Cloud Servers™ (compute_v2)
|
||||
|
||||
This document explains how to get started using Next Generation Cloud Servers™ with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
||||
This document explains how to get started using Next Generation Cloud Servers with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
||||
|
||||
**Note**: Fog also provides an interface to First Gen Cloud Servers™ (compute). The compute interface is deprecated and should only be used if you need to interact with our first generation cloud. Fog determines the appropriate interface based on the `:version` parameter. See [Create Service](#create-service) section for more information.
|
||||
|
||||
## Starting irb console
|
||||
Start by executing the following command:
|
||||
|
@ -20,44 +21,55 @@ If using Ruby 1.9.x execute:
|
|||
require 'fog'
|
||||
|
||||
## Create Service
|
||||
Next, create a connection to the Next Gen Cloud Servers™:
|
||||
|
||||
Next, create a connection to the Next Gen Cloud Servers:
|
||||
|
||||
Using a US based account:
|
||||
|
||||
service = Fog::Compute.new({
|
||||
:provider => 'Rackspace', # Rackspace Fog provider
|
||||
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
||||
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
||||
:version => :v2, # Use Next Gen Cloud Servers
|
||||
:rackspace_endpoint => Fog::Compute::RackspaceV2::DFW_ENDPOINT, # Optional
|
||||
:connection_options => {} # Optional
|
||||
:version => :v2, # Use Next Gen Cloud Servers
|
||||
:rackspace_region => :ord # Defaults to :dfw
|
||||
:connection_options => {} # Optional
|
||||
})
|
||||
|
||||
Using a UK based account:
|
||||
|
||||
service = Fog::Compute.new({
|
||||
:provider => 'Rackspace', # Rackspace Fog provider
|
||||
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
||||
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
||||
:version => :v2, # Use Next Gen Cloud Servers
|
||||
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT
|
||||
:rackspace_region => :lon
|
||||
:connection_options => {} # Optional
|
||||
})
|
||||
|
||||
To learn more about obtaining cloud credentials refer to the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
||||
|
||||
By default `Fog::Compute` will connect to the DFW region. You can specify alternative regions using the key `:rackspace_endpoint ` with one of the following values:
|
||||
By default `Fog::Compute` will authenticate against the US authentication endpoint and connect to the DFW region. You can specify alternative authentication endpoints using the key `:rackspace_auth_url`. Please refer to [Alternate Authentication Endpoints](http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html) for a list of alternative Rackspace authentication endpoints.
|
||||
**Note**: A`Fog::Compute` instance is needed for the desired region.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Value</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fog::Compute::RackspaceV2::DFW_ENDPOINT</td>
|
||||
<td>Dallas Region</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fog::Compute::RackspaceV2::ORD_ENDPOINT</td>
|
||||
<td>Chicago Region</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fog::Compute::RackspaceV2::LON_ENDPOINT</td>
|
||||
<td>London Region</tr>
|
||||
</table>
|
||||
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for Cloud Servers can be found by executing the following:
|
||||
|
||||
identity_service = Fog::Identity({
|
||||
:provider => 'Rackspace', # Rackspace Fog provider
|
||||
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
||||
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
||||
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT # Not specified for US Cloud
|
||||
})
|
||||
|
||||
identity_service.service_catalog.display_service_regions :cloudServersOpenStack
|
||||
|
||||
Rackspace Private Cloud installations can skip specifying a region and directly specify their custom service endpoints using the key `:rackspace_compute_url`.
|
||||
|
||||
**Note**: A`Fog::Compute` instance is needed for the desired region.
|
||||
|
||||
### Optional Connection Parameters
|
||||
|
||||
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using `:connection_options`.
|
||||
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -98,7 +110,7 @@ Fog supports passing additional connection parameters to its underlying HTTP lib
|
|||
Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface.
|
||||
|
||||
### Request Layer
|
||||
The request abstraction maps directly to the [Next Gen Cloud Servers™ API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html). It provides the most efficient interface to the Rackspace Open Cloud.
|
||||
The request abstraction maps directly to the [Next Gen Cloud Servers API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html). It provides the most efficient interface to the Rackspace Open Cloud.
|
||||
|
||||
To see a list of requests supported by the service:
|
||||
|
||||
|
@ -468,12 +480,12 @@ The `create` method also supports the following key values:
|
|||
<tr>
|
||||
<td>:personality</td>
|
||||
<td>File path and contents. Refer to Next Gen Server API documentation - <a href="http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Personality-d1e2543.html">Server Personality</a>. </td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Update Server
|
||||
|
||||
Next Gen Cloud Servers™ support updating the following attributes `name`, `access_ipv4_address`, and `access_ipv6_address`.
|
||||
Next Gen Cloud Servers support updating the following attributes `name`, `access_ipv4_address`, and `access_ipv6_address`.
|
||||
|
||||
To update these attributes:
|
||||
|
||||
|
@ -646,7 +658,7 @@ To detach a volume:
|
|||
server.attachments.first.detach
|
||||
|
||||
## Examples
|
||||
Example code using Next Gen Cloud Servers™ can be found [here](https://github.com/fog/fog/tree/master/lib/fog/rackspace/examples).
|
||||
Example code using Next Gen Cloud Servers can be found [here](https://github.com/fog/fog/tree/master/lib/fog/rackspace/examples).
|
||||
|
||||
## Additional Resources
|
||||
* [fog.io](http://fog.io/)
|
||||
|
@ -654,7 +666,7 @@ Example code using Next Gen Cloud Servers™ can be found [here](https://github.
|
|||
* [Fog Github repo](https://github.com/fog/fog)
|
||||
* [Fog Github Issues](https://github.com/fog/fog/issues)
|
||||
* [Excon Github repo](https://github.com/geemus/excon)
|
||||
* [Next Gen Cloud Servers™ API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html)
|
||||
* [Next Gen Cloud Servers API](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html)
|
||||
|
||||
## Support and Feedback
|
||||
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
||||
|
|
|
@ -59,6 +59,7 @@ Alternative regions are specified using the key `:rackspace_region `. A list of
|
|||
|
||||
identity_service.service_catalog.display_service_regions :cloudFiles
|
||||
|
||||
Rackspace Private Cloud installations can skip specifying a region and directly specify their custom service endpoints using the keys `:rackspace_storage_url` and `:rackspace_cdn_url`.
|
||||
|
||||
**Note**: A`Fog::Storage` instance is needed for the desired region.
|
||||
|
||||
|
@ -93,14 +94,14 @@ The Storage service supports the following additional parameters:
|
|||
</tr>
|
||||
<tr>
|
||||
<td>:chunk_size</td>
|
||||
<td>The chunk size in bytes to use for block transfers. By default, Fog uses 1 MB chunks.</td>
|
||||
<td>The chunk size in bytes used for block transfers. By default, Fog uses 1 MB chunks.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
### Optional Connection Parameters
|
||||
|
||||
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using `:connection_options`.
|
||||
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -176,7 +177,7 @@ To view the status of the response:
|
|||
|
||||
**Note**: Fog is aware of the valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.
|
||||
|
||||
To view response body:
|
||||
To view response headers:
|
||||
|
||||
response.headers
|
||||
|
||||
|
@ -322,6 +323,8 @@ To list files in a directory:
|
|||
|
||||
directory.files
|
||||
|
||||
**Note**: File contents is not downloaded until `body` attribute is called.
|
||||
|
||||
## Upload Files
|
||||
|
||||
To upload a file into a directory:
|
||||
|
@ -369,7 +372,7 @@ The most efficient way to download files from a private or public directory is a
|
|||
end
|
||||
end
|
||||
|
||||
This will download and save the file in 1 MB chunks. The chunk size can be changed by passing the parameter :chunk_size into the :connection_options hash in the service constructor.
|
||||
This will download and save the file in 1 MB chunks. The chunk size can be changed by passing the parameter `:chunk_size` into the `:connection_options` hash in the service constructor.
|
||||
|
||||
**Note**: The `body` attribute of file will be empty if a file has been downloaded using this method.
|
||||
|
||||
|
@ -388,7 +391,7 @@ The simplest is with the default container URL. This can be accessed as follows:
|
|||
|
||||
file.public_url
|
||||
|
||||
For a more user-friendly URL, you can create a `CNAME` DNS record pointing to the URL generated by the `public_url` method. Then set the`CNAME` on the `Directory` object using the attribute `cdn_cname`. Note, that the `cdn_cname` attribute does not persist and will need to be specified every time a directory object is retrieved.
|
||||
For a more user-friendly URL, you can create a CNAME DNS record pointing to the URL generated by the `public_url` method. Then set the CNAME on the `Directory` object using the attribute `cdn_cname`. Note, that the `cdn_cname` attribute does not persist and will need to be specified every time a directory object is retrieved.
|
||||
|
||||
To access the file using SSL, you need to specify the option `:rackspace_cdn_ssl => true` when creating `Fog::Storage` service. This will cause the `public_url` method to return the SSL-secured URL.
|
||||
|
||||
|
|
Loading…
Reference in a new issue