Skip to content

Commit fe11224

Browse files
committed
Update README.md with examples and links
1 parent 8548c46 commit fe11224

File tree

1 file changed

+101
-10
lines changed

1 file changed

+101
-10
lines changed

README.md

+101-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
# Brightbox Cloud module for fog (The Ruby cloud services library)
22

3-
This gem is a module for the `fog` gem that allows you to manage resources in
4-
the Brightbox Cloud.
3+
This gem is a module for the [`fog`](https://github.com/fog/fog) gem that allows
4+
you to manage resources in the [Brightbox Cloud](https://brightbox.com).
55

6-
It is included by the main `fog` metagem but can used as an independent library
6+
It is included by the main `fog` meta-gem but can used as an independent library
77
in other applications.
88

99
This includes support for the following services:
1010

1111
* Compute
12+
* Accounts
13+
* Api Clients
14+
* Applications (User Credentials)
15+
* Cloud IPs
16+
* Cloud SQL (Database Server)
17+
* Database Snapshots
18+
* Firewall Policies and Rules
1219
* Images
1320
* Load Balancers
14-
* SQL Cloud instances
15-
16-
Currently all services are grouped within `compute` but will be moved to their
17-
own sections when standardisation of fog progresses.
21+
* Servers
22+
* Server Groups
23+
* Server Types (Flavors)
24+
* Users
25+
* User Collaborations
26+
* Volumes
27+
* Zones
28+
* Storage (Orbit via Switch compatibility)
29+
* Directories
30+
* Files
1831

1932
## Installation
2033

@@ -24,22 +37,93 @@ Add this line to your application's Gemfile:
2437

2538
And then execute:
2639

27-
$ bundle
40+
$ bundle install
2841

2942
Or install it yourself as:
3043

3144
$ gem install fog-brightbox
3245

46+
## Configuration
47+
48+
This code can use `fog`'s credentials or can be configured by passing in the
49+
details to the [Fog::Brightbox::Config](lib/fog/brightbox/config.rb).
50+
51+
### Using `fog`
52+
53+
Assuming credentials are setup as expected by fog, the configuration can be used
54+
as such:
55+
56+
```ruby
57+
@config = Fog::Brightbox::Config.new(Fog.credentials)
58+
```
59+
60+
### Using options Hash
61+
62+
Alternatively credentials can be set using a Hash of options:
63+
64+
```ruby
65+
@config = Fog::Brightbox::Config.new(
66+
brightbox_client_id: "cli-12345",
67+
brightbox_secret: "<demo-value>"
68+
)
69+
```
70+
71+
See [Fog::Brightbox::Config's documentation](lib/fog/brightbox/config.rb) for
72+
all possible settings.
73+
3374
## Usage
3475

76+
Here is a basic example of usage:
77+
78+
```ruby
79+
require "fog/brightbox"
80+
81+
# Passing either a configuration object or Hash of options are supported
82+
@service = Fog::Brightbox::Compute.new(
83+
brightbox_client_id: "acc-12345",
84+
brightbox_secret: "<demo-value>"
85+
)
86+
87+
# Request all servers using the class method
88+
servers = @service.servers.all
89+
servers.each do |server|
90+
puts server.id
91+
end
92+
```
93+
94+
An alternative using a configuration object instead:
95+
96+
```ruby
97+
require "fog/brightbox"
98+
99+
@config = Fog::Brightbox::Config.new(
100+
brightbox_client_id: "acc-12345",
101+
brightbox_secret: "<demo-value>"
102+
)
103+
@service = Fog::Brightbox::Compute.new(@config)
104+
# Use service as normal
105+
```
106+
107+
The main advantages of using a configuration option is that it can be set from
108+
the main `Fog.credentials` which could be configured for numerous service
109+
providers.
110+
111+
`Fog::Brightbox::Config` also wraps around credentials itself so will manage
112+
OAuth access and refresh tokens. This can be disabled with the
113+
`brightbox_token_management: false` setting.
114+
35115
Please see the following references for instructions using the main `fog` gem
36116
and its modules:
37117

38118
* https://github.com/fog/fog
39-
* http://fog.io/
40119
* http://rubydoc.info/gems/fog/
41120

42-
### Ruby version support
121+
## Brightbox CLI
122+
123+
It may be that our [Brightbox CLI](https://github.com/brightbox/brightbox-cli)
124+
(based on this library) is suitable for you than using the library directly.
125+
126+
## Ruby version support
43127

44128
As required by the main `fog-core` library, support for Ruby 1.9 was dropped in
45129
`v1.0.0` of this gem.
@@ -52,8 +136,15 @@ As of 2024 `fog-core` is only testing for Ruby 3.0+ support.
52136

53137
## Contributing
54138

139+
Bug reports and pull requests are welcome on GitHub at
140+
https://github.com/fog/fog-brightbox.
141+
55142
1. Fork it ( https://github.com/fog/fog-brightbox/fork )
56143
2. Create your feature branch (`git checkout -b my-new-feature`)
57144
3. Commit your changes (`git commit -am 'Add some feature'`)
58145
4. Push to the branch (`git push origin my-new-feature`)
59146
5. Create new Pull Request
147+
148+
## License
149+
150+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).

0 commit comments

Comments
 (0)