1
1
# Brightbox Cloud module for fog (The Ruby cloud services library)
2
2
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 ) .
5
5
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
7
7
in other applications.
8
8
9
9
This includes support for the following services:
10
10
11
11
* 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
12
19
* Images
13
20
* 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
18
31
19
32
## Installation
20
33
@@ -24,22 +37,93 @@ Add this line to your application's Gemfile:
24
37
25
38
And then execute:
26
39
27
- $ bundle
40
+ $ bundle install
28
41
29
42
Or install it yourself as:
30
43
31
44
$ gem install fog-brightbox
32
45
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
+
33
74
## Usage
34
75
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
+
35
115
Please see the following references for instructions using the main ` fog ` gem
36
116
and its modules:
37
117
38
118
* https://github.com/fog/fog
39
- * http://fog.io/
40
119
* http://rubydoc.info/gems/fog/
41
120
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
43
127
44
128
As required by the main ` fog-core ` library, support for Ruby 1.9 was dropped in
45
129
` v1.0.0 ` of this gem.
@@ -52,8 +136,15 @@ As of 2024 `fog-core` is only testing for Ruby 3.0+ support.
52
136
53
137
## Contributing
54
138
139
+ Bug reports and pull requests are welcome on GitHub at
140
+ https://github.com/fog/fog-brightbox .
141
+
55
142
1 . Fork it ( https://github.com/fog/fog-brightbox/fork )
56
143
2 . Create your feature branch (` git checkout -b my-new-feature ` )
57
144
3 . Commit your changes (` git commit -am 'Add some feature' ` )
58
145
4 . Push to the branch (` git push origin my-new-feature ` )
59
146
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