fog-k5 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +241 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/.travis.yml +33 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fog-k5.gemspec +33 -0
- data/lib/fog/k5/shared.rb +67 -0
- data/lib/fog/k5/version.rb +5 -0
- data/lib/fog/k5.rb +16 -0
- data/lib/fog/storage/k5/mock.rb +11 -0
- data/lib/fog/storage/k5/models/directories.rb +9 -0
- data/lib/fog/storage/k5/models/directory.rb +16 -0
- data/lib/fog/storage/k5/models/file.rb +44 -0
- data/lib/fog/storage/k5/models/files.rb +16 -0
- data/lib/fog/storage/k5/real.rb +36 -0
- data/lib/fog/storage/k5/requests/delete_object.rb +20 -0
- data/lib/fog/storage/k5/requests/get_object.rb +20 -0
- data/lib/fog/storage/k5/requests/list_containers.rb +20 -0
- data/lib/fog/storage/k5/requests/list_objects.rb +20 -0
- data/lib/fog/storage/k5/requests/put_object.rb +23 -0
- data/lib/fog/storage/k5/utils.rb +25 -0
- data/lib/fog/storage/k5.rb +36 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 562aeb44d028e89bfd957bb910f802989999522eef6f5bb8e16474a6bd66288a
|
4
|
+
data.tar.gz: 1ebcbff8f5cfeca5756394f427c20e26cf5aea7badbfe10791133fc15cae28dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d018e604eedb4a95344c9d0e0eee000332e76dd779b62e04a522964198aeb835f6cbe6f6a62536228584e445d799e18eb563e169bdd00c5b1d96691ad130406
|
7
|
+
data.tar.gz: 3d08bcc5153e74b4f0e717d1d563573a66b2ad5f8b5532e2421e5377cfe8d6041953c3500dde187fbcbe0507c001c812a5d36155ddda03d655b16c554252c956
|
data/.gitignore
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
|
2
|
+
# Created by https://www.gitignore.io/api/ruby,sublimetext,vim,visualstudiocode,jetbrains+all,linux,osx,windows
|
3
|
+
|
4
|
+
### JetBrains+all ###
|
5
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
6
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
7
|
+
|
8
|
+
# User-specific stuff:
|
9
|
+
.idea/**/workspace.xml
|
10
|
+
.idea/**/tasks.xml
|
11
|
+
.idea/dictionaries
|
12
|
+
|
13
|
+
# Sensitive or high-churn files:
|
14
|
+
.idea/**/dataSources/
|
15
|
+
.idea/**/dataSources.ids
|
16
|
+
.idea/**/dataSources.xml
|
17
|
+
.idea/**/dataSources.local.xml
|
18
|
+
.idea/**/sqlDataSources.xml
|
19
|
+
.idea/**/dynamic.xml
|
20
|
+
.idea/**/uiDesigner.xml
|
21
|
+
|
22
|
+
# Gradle:
|
23
|
+
.idea/**/gradle.xml
|
24
|
+
.idea/**/libraries
|
25
|
+
|
26
|
+
# CMake
|
27
|
+
cmake-build-debug/
|
28
|
+
|
29
|
+
# Mongo Explorer plugin:
|
30
|
+
.idea/**/mongoSettings.xml
|
31
|
+
|
32
|
+
## File-based project format:
|
33
|
+
*.iws
|
34
|
+
|
35
|
+
## Plugin-specific files:
|
36
|
+
|
37
|
+
# IntelliJ
|
38
|
+
/out/
|
39
|
+
|
40
|
+
# mpeltonen/sbt-idea plugin
|
41
|
+
.idea_modules/
|
42
|
+
|
43
|
+
# JIRA plugin
|
44
|
+
atlassian-ide-plugin.xml
|
45
|
+
|
46
|
+
# Cursive Clojure plugin
|
47
|
+
.idea/replstate.xml
|
48
|
+
|
49
|
+
# Ruby plugin and RubyMine
|
50
|
+
/.rakeTasks
|
51
|
+
|
52
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
53
|
+
com_crashlytics_export_strings.xml
|
54
|
+
crashlytics.properties
|
55
|
+
crashlytics-build.properties
|
56
|
+
fabric.properties
|
57
|
+
|
58
|
+
### JetBrains+all Patch ###
|
59
|
+
# Ignores the whole .idea folder and all .iml files
|
60
|
+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
61
|
+
|
62
|
+
.idea/
|
63
|
+
|
64
|
+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
65
|
+
|
66
|
+
*.iml
|
67
|
+
modules.xml
|
68
|
+
.idea/misc.xml
|
69
|
+
*.ipr
|
70
|
+
|
71
|
+
### Linux ###
|
72
|
+
*~
|
73
|
+
|
74
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
75
|
+
.fuse_hidden*
|
76
|
+
|
77
|
+
# KDE directory preferences
|
78
|
+
.directory
|
79
|
+
|
80
|
+
# Linux trash folder which might appear on any partition or disk
|
81
|
+
.Trash-*
|
82
|
+
|
83
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
84
|
+
.nfs*
|
85
|
+
|
86
|
+
### OSX ###
|
87
|
+
*.DS_Store
|
88
|
+
.AppleDouble
|
89
|
+
.LSOverride
|
90
|
+
|
91
|
+
# Icon must end with two \r
|
92
|
+
Icon
|
93
|
+
|
94
|
+
# Thumbnails
|
95
|
+
._*
|
96
|
+
|
97
|
+
# Files that might appear in the root of a volume
|
98
|
+
.DocumentRevisions-V100
|
99
|
+
.fseventsd
|
100
|
+
.Spotlight-V100
|
101
|
+
.TemporaryItems
|
102
|
+
.Trashes
|
103
|
+
.VolumeIcon.icns
|
104
|
+
.com.apple.timemachine.donotpresent
|
105
|
+
|
106
|
+
# Directories potentially created on remote AFP share
|
107
|
+
.AppleDB
|
108
|
+
.AppleDesktop
|
109
|
+
Network Trash Folder
|
110
|
+
Temporary Items
|
111
|
+
.apdisk
|
112
|
+
|
113
|
+
### Ruby ###
|
114
|
+
*.gem
|
115
|
+
*.rbc
|
116
|
+
/.config
|
117
|
+
/coverage/
|
118
|
+
/InstalledFiles
|
119
|
+
/pkg/
|
120
|
+
/spec/reports/
|
121
|
+
/spec/examples.txt
|
122
|
+
/test/tmp/
|
123
|
+
/test/version_tmp/
|
124
|
+
/tmp/
|
125
|
+
|
126
|
+
# Used by dotenv library to load environment variables.
|
127
|
+
# .env
|
128
|
+
|
129
|
+
## Specific to RubyMotion:
|
130
|
+
.dat*
|
131
|
+
.repl_history
|
132
|
+
build/
|
133
|
+
*.bridgesupport
|
134
|
+
build-iPhoneOS/
|
135
|
+
build-iPhoneSimulator/
|
136
|
+
|
137
|
+
## Specific to RubyMotion (use of CocoaPods):
|
138
|
+
#
|
139
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
140
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
141
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
142
|
+
#
|
143
|
+
# vendor/Pods/
|
144
|
+
|
145
|
+
## Documentation cache and generated files:
|
146
|
+
/.yardoc/
|
147
|
+
/_yardoc/
|
148
|
+
/doc/
|
149
|
+
/rdoc/
|
150
|
+
|
151
|
+
## Environment normalization:
|
152
|
+
/.bundle/
|
153
|
+
/vendor/bundle
|
154
|
+
/lib/bundler/man/
|
155
|
+
|
156
|
+
# for a library or gem, you might want to ignore these files since the code is
|
157
|
+
# intended to run in multiple environments; otherwise, check them in:
|
158
|
+
# Gemfile.lock
|
159
|
+
# .ruby-version
|
160
|
+
# .ruby-gemset
|
161
|
+
|
162
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
163
|
+
.rvmrc
|
164
|
+
|
165
|
+
### SublimeText ###
|
166
|
+
# cache files for sublime text
|
167
|
+
*.tmlanguage.cache
|
168
|
+
*.tmPreferences.cache
|
169
|
+
*.stTheme.cache
|
170
|
+
|
171
|
+
# workspace files are user-specific
|
172
|
+
*.sublime-workspace
|
173
|
+
|
174
|
+
# project files should be checked into the repository, unless a significant
|
175
|
+
# proportion of contributors will probably not be using SublimeText
|
176
|
+
# *.sublime-project
|
177
|
+
|
178
|
+
# sftp configuration file
|
179
|
+
sftp-config.json
|
180
|
+
|
181
|
+
# Package control specific files
|
182
|
+
Package Control.last-run
|
183
|
+
Package Control.ca-list
|
184
|
+
Package Control.ca-bundle
|
185
|
+
Package Control.system-ca-bundle
|
186
|
+
Package Control.cache/
|
187
|
+
Package Control.ca-certs/
|
188
|
+
Package Control.merged-ca-bundle
|
189
|
+
Package Control.user-ca-bundle
|
190
|
+
oscrypto-ca-bundle.crt
|
191
|
+
bh_unicode_properties.cache
|
192
|
+
|
193
|
+
# Sublime-github package stores a github token in this file
|
194
|
+
# https://packagecontrol.io/packages/sublime-github
|
195
|
+
GitHub.sublime-settings
|
196
|
+
|
197
|
+
### Vim ###
|
198
|
+
# swap
|
199
|
+
.sw[a-p]
|
200
|
+
.*.sw[a-p]
|
201
|
+
# session
|
202
|
+
Session.vim
|
203
|
+
# temporary
|
204
|
+
.netrwhist
|
205
|
+
# auto-generated tag files
|
206
|
+
tags
|
207
|
+
|
208
|
+
### VisualStudioCode ###
|
209
|
+
.vscode/*
|
210
|
+
!.vscode/settings.json
|
211
|
+
!.vscode/tasks.json
|
212
|
+
!.vscode/launch.json
|
213
|
+
!.vscode/extensions.json
|
214
|
+
.history
|
215
|
+
|
216
|
+
### Windows ###
|
217
|
+
# Windows thumbnail cache files
|
218
|
+
Thumbs.db
|
219
|
+
ehthumbs.db
|
220
|
+
ehthumbs_vista.db
|
221
|
+
|
222
|
+
# Folder config file
|
223
|
+
Desktop.ini
|
224
|
+
|
225
|
+
# Recycle Bin used on file shares
|
226
|
+
$RECYCLE.BIN/
|
227
|
+
|
228
|
+
# Windows Installer files
|
229
|
+
*.cab
|
230
|
+
*.msi
|
231
|
+
*.msm
|
232
|
+
*.msp
|
233
|
+
|
234
|
+
# Windows shortcuts
|
235
|
+
*.lnk
|
236
|
+
|
237
|
+
|
238
|
+
# End of https://www.gitignore.io/api/ruby,sublimetext,vim,visualstudiocode,jetbrains+all,linux,osx,windows
|
239
|
+
Gemfile.lock
|
240
|
+
.ruby-version
|
241
|
+
.ruby-gemset
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
AllCops:
|
2
|
+
DefaultFormatter: fuubar
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
ExtraDetails: true
|
6
|
+
|
7
|
+
#################### Style #################################
|
8
|
+
|
9
|
+
Style/Documentation:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/TrailingCommaInArguments:
|
13
|
+
EnforcedStyleForMultiline: comma
|
14
|
+
|
15
|
+
Style/TrailingCommaInArrayLiteral:
|
16
|
+
EnforcedStyleForMultiline: comma
|
17
|
+
|
18
|
+
Style/TrailingCommaInHashLiteral:
|
19
|
+
EnforcedStyleForMultiline: comma
|
data/.travis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID
|
4
|
+
|
5
|
+
language: ruby
|
6
|
+
cache:
|
7
|
+
directories:
|
8
|
+
- bundle
|
9
|
+
|
10
|
+
rvm:
|
11
|
+
- 2.3.7
|
12
|
+
- 2.4.4
|
13
|
+
- 2.5.1
|
14
|
+
- ruby-head
|
15
|
+
|
16
|
+
before_install:
|
17
|
+
- gem update bundler
|
18
|
+
|
19
|
+
before_script:
|
20
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
21
|
+
- chmod +x ./cc-test-reporter
|
22
|
+
- ./cc-test-reporter before-build
|
23
|
+
|
24
|
+
script:
|
25
|
+
- bundle exec rake spec
|
26
|
+
|
27
|
+
after_script:
|
28
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
29
|
+
|
30
|
+
matrix:
|
31
|
+
allow_failures:
|
32
|
+
- rvm: ruby-head
|
33
|
+
fast_finish: true
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at legend.of.blooper@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 blooper05
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Fog::K5
|
2
|
+
|
3
|
+
[![Build Status](https://img.shields.io/travis/blooper05/fog-k5.svg?longCache=true&style=flat)](https://travis-ci.com/blooper05/fog-k5)
|
4
|
+
[![Dependency Status](https://img.shields.io/gemnasium/blooper05/fog-k5.svg?longCache=true&style=flat)](https://gemnasium.com/blooper05/fog-k5)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/maintainability/blooper05/fog-k5.svg?longCache=true&style=flat)](https://codeclimate.com/github/blooper05/fog-k5)
|
6
|
+
[![Coverage](https://img.shields.io/codeclimate/c/blooper05/fog-k5.svg?longCache=true&style=flat)](https://codeclimate.com/github/blooper05/fog-k5)
|
7
|
+
[![Gem Version](https://img.shields.io/gem/v/fog-k5.svg?longCache=true&style=flat)](https://rubygems.org/gems/fog-k5)
|
8
|
+
[![License](https://img.shields.io/github/license/blooper05/fog-k5.svg?longCache=true&style=flat)](https://github.com/blooper05/fog-k5/blob/master/LICENSE)
|
9
|
+
|
10
|
+
Module for the 'fog' gem to support FUJITSU Cloud Service K5.
|
11
|
+
|
12
|
+
**fog-k5 is in an early development phase, mean that many features of K5 were not supported yet.**
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'fog-k5'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install fog-k5
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
TODO: Write usage instructions here
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
|
+
|
38
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/blooper05/fog-k5. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
47
|
+
|
48
|
+
## Code of Conduct
|
49
|
+
|
50
|
+
Everyone interacting in the Fog::K5 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/blooper05/fog-k5/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'fog/k5'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/fog-k5.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fog/k5/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'fog-k5'
|
8
|
+
spec.version = Fog::K5::VERSION
|
9
|
+
spec.authors = ['blooper05']
|
10
|
+
spec.email = ['legend.of.blooper@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = "Module for the 'fog' gem to support FUJITSU Cloud Service K5."
|
13
|
+
spec.description = 'This library can be used as a module for `fog` or as standalone provider to use the FUJITSU Cloud Service K5 in applications.'
|
14
|
+
spec.homepage = 'https://github.com/blooper05/fog-k5'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_dependency 'fog-core'
|
25
|
+
spec.add_dependency 'fog-json'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'simplecov', '~> 0.13'
|
31
|
+
|
32
|
+
spec.add_development_dependency 'rubocop'
|
33
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Fog
|
2
|
+
module K5
|
3
|
+
module Shared
|
4
|
+
K5_URL_SCHEME = 'https'.freeze
|
5
|
+
K5_URL_SUFFIX = 'cloud.global.fujitsu.com'.freeze
|
6
|
+
|
7
|
+
def build_url(url_type:)
|
8
|
+
region = Fog.credentials[:k5_region]
|
9
|
+
"#{K5_URL_SCHEME}://#{url_type}.#{region}.#{K5_URL_SUFFIX}/"
|
10
|
+
end
|
11
|
+
|
12
|
+
def refresh_auth_token_if_expired
|
13
|
+
refresh_auth_token if auth_token_expired?
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def auth_token_expired?
|
19
|
+
!Fog.credentials[:k5_auth_token_expires_at] ||
|
20
|
+
Fog.credentials[:k5_auth_token_expires_at] - 300 < Fog::Time.now
|
21
|
+
end
|
22
|
+
|
23
|
+
def refresh_auth_token
|
24
|
+
connection = Excon.new(build_url(url_type: 'identity'))
|
25
|
+
response = connection.post(auth_request_params)
|
26
|
+
|
27
|
+
Fog.credentials[:k5_auth_token] = response.headers['X-Subject-Token']
|
28
|
+
Fog.credentials[:k5_auth_token_expires_at] = Fog::Time.parse(
|
29
|
+
Fog::JSON.decode(response.body)['token']['expires_at'],
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def auth_request_params
|
34
|
+
{
|
35
|
+
path: 'v3/auth/tokens',
|
36
|
+
idempotent: true,
|
37
|
+
expects: 201,
|
38
|
+
body: auth_request_body,
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def auth_request_body
|
43
|
+
Fog::JSON.encode(
|
44
|
+
auth: {
|
45
|
+
identity: {
|
46
|
+
methods: %w[password],
|
47
|
+
password: {
|
48
|
+
user: {
|
49
|
+
domain: {
|
50
|
+
name: Fog.credentials[:k5_domain_name],
|
51
|
+
},
|
52
|
+
name: Fog.credentials[:k5_user_name],
|
53
|
+
password: Fog.credentials[:k5_user_password],
|
54
|
+
},
|
55
|
+
},
|
56
|
+
},
|
57
|
+
scope: {
|
58
|
+
project: {
|
59
|
+
id: Fog.credentials[:k5_project_id],
|
60
|
+
},
|
61
|
+
},
|
62
|
+
},
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/fog/k5.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fog/core'
|
2
|
+
require 'fog/json'
|
3
|
+
require 'fog/k5/version'
|
4
|
+
|
5
|
+
module Fog
|
6
|
+
module K5
|
7
|
+
autoload :Shared, File.expand_path('k5/shared', __dir__)
|
8
|
+
|
9
|
+
extend Fog::Provider
|
10
|
+
service(:storage, :Storage)
|
11
|
+
end
|
12
|
+
|
13
|
+
module Storage
|
14
|
+
autoload :K5, File.expand_path('storage/k5', __dir__)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class File < Fog::Model
|
5
|
+
include Fog::K5::Shared
|
6
|
+
|
7
|
+
identity :key
|
8
|
+
|
9
|
+
attribute :body
|
10
|
+
attribute :content_length, type: :integer
|
11
|
+
attribute :content_type
|
12
|
+
attribute :directory
|
13
|
+
|
14
|
+
def destroy
|
15
|
+
requires :directory, :key
|
16
|
+
service.delete_object(directory.key, key)
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def public_url
|
21
|
+
requires :directory, :key
|
22
|
+
|
23
|
+
project_id = Fog.credentials[:k5_project_id]
|
24
|
+
version = K5_STORAGE_URL_VERSION
|
25
|
+
url = build_url(url_type: K5_STORAGE_URL_TYPE)
|
26
|
+
container = directory.key
|
27
|
+
|
28
|
+
"#{url}/#{version}/AUTH_#{project_id}/#{container}/#{key}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def save
|
32
|
+
requires :body, :directory, :key
|
33
|
+
|
34
|
+
service.put_object(directory.key, key, body)
|
35
|
+
|
36
|
+
self.content_length = Fog::Storage.get_body_size(body)
|
37
|
+
self.content_type ||= Fog::Storage.get_cotent_type(body)
|
38
|
+
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Files < Fog::Collection
|
5
|
+
model Fog::Storage::K5::File
|
6
|
+
|
7
|
+
attribute :directory
|
8
|
+
|
9
|
+
def new(attributes = {})
|
10
|
+
requires :directory
|
11
|
+
super({ directory: directory }.merge(attributes))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
include Utils
|
6
|
+
include Fog::K5::Shared
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
Fog.credentials[:k5_region] = options[:k5_region]
|
10
|
+
Fog.credentials[:k5_project_id] = options[:k5_project_id]
|
11
|
+
Fog.credentials[:k5_domain_name] = options[:k5_domain_name]
|
12
|
+
Fog.credentials[:k5_user_name] = options[:k5_user_name]
|
13
|
+
Fog.credentials[:k5_user_password] = options[:k5_user_password]
|
14
|
+
|
15
|
+
refresh_auth_token_if_expired
|
16
|
+
|
17
|
+
url = build_url(url_type: K5_STORAGE_URL_TYPE)
|
18
|
+
@connection = Fog::Core::Connection.new(url, false, params)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def params
|
24
|
+
token = Fog.credentials[:k5_auth_token]
|
25
|
+
project_id = Fog.credentials[:k5_project_id]
|
26
|
+
version = K5_STORAGE_URL_VERSION
|
27
|
+
{
|
28
|
+
headers: { 'X-Auth-Token' => token },
|
29
|
+
path_prefix: "#{version}/AUTH_#{project_id}",
|
30
|
+
query: { format: :json },
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
def delete_object(container, object, _options = {})
|
6
|
+
request(
|
7
|
+
method: :DELETE,
|
8
|
+
path: "#{container}/#{object}",
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def delete_object(_container, _object, _options = {})
|
15
|
+
Fog::Mock.not_implemented
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
def get_object(container, object, _options = {})
|
6
|
+
request(
|
7
|
+
method: :GET,
|
8
|
+
path: "#{container}/#{object}",
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def get_object(_container, _object, _options = {})
|
15
|
+
Fog::Mock.not_implemented
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
def list_containers(_options = {})
|
6
|
+
request(
|
7
|
+
method: :GET,
|
8
|
+
path: '/',
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def list_containers(_options = {})
|
15
|
+
Fog::Mock.not_implemented
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
def list_objects(container, _options = {})
|
6
|
+
request(
|
7
|
+
method: :GET,
|
8
|
+
path: container,
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
def list_objects(_container, _options = {})
|
15
|
+
Fog::Mock.not_implemented
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
class Real
|
5
|
+
def put_object(container, object, data, _options = {})
|
6
|
+
data = Fog::Storage.parse_data(data)
|
7
|
+
params = {
|
8
|
+
method: :PUT,
|
9
|
+
path: "#{container}/#{object}",
|
10
|
+
}
|
11
|
+
|
12
|
+
request(params.merge(data))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
def put_object(_container, _object, _data, _options = {})
|
18
|
+
Fog::Mock.not_implemented
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5
|
4
|
+
module Utils
|
5
|
+
def request(params)
|
6
|
+
parse(@connection.request(params))
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def parse(response)
|
12
|
+
return response if response.body.empty?
|
13
|
+
return response unless json?(response)
|
14
|
+
|
15
|
+
response.body = Fog::JSON.decode(response.body)
|
16
|
+
response
|
17
|
+
end
|
18
|
+
|
19
|
+
def json?(response)
|
20
|
+
response.headers['Content-Type'].include?('application/json')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class K5 < Fog::Service
|
4
|
+
autoload :Mock, File.expand_path('k5/mock', __dir__)
|
5
|
+
autoload :Real, File.expand_path('k5/real', __dir__)
|
6
|
+
autoload :Utils, File.expand_path('k5/utils', __dir__)
|
7
|
+
|
8
|
+
requires :k5_region,
|
9
|
+
:k5_project_id,
|
10
|
+
:k5_domain_name,
|
11
|
+
:k5_user_name,
|
12
|
+
:k5_user_password
|
13
|
+
|
14
|
+
recognizes :k5_auth_token,
|
15
|
+
:k5_auth_token_expires_at
|
16
|
+
|
17
|
+
K5_STORAGE_URL_TYPE = 'objectstorage'.freeze
|
18
|
+
K5_STORAGE_URL_VERSION = 'v1'.freeze
|
19
|
+
|
20
|
+
model_path 'fog/storage/k5/models'
|
21
|
+
|
22
|
+
collection :directories
|
23
|
+
model :directory
|
24
|
+
|
25
|
+
collection :files
|
26
|
+
model :file
|
27
|
+
|
28
|
+
request_path 'fog/storage/k5/requests'
|
29
|
+
request :delete_object
|
30
|
+
request :get_object
|
31
|
+
request :list_containers
|
32
|
+
request :list_objects
|
33
|
+
request :put_object
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fog-k5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- blooper05
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fog-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fog-json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.13'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.13'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: This library can be used as a module for `fog` or as standalone provider
|
112
|
+
to use the FUJITSU Cloud Service K5 in applications.
|
113
|
+
email:
|
114
|
+
- legend.of.blooper@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- ".travis.yml"
|
123
|
+
- CODE_OF_CONDUCT.md
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- bin/console
|
129
|
+
- bin/setup
|
130
|
+
- fog-k5.gemspec
|
131
|
+
- lib/fog/k5.rb
|
132
|
+
- lib/fog/k5/shared.rb
|
133
|
+
- lib/fog/k5/version.rb
|
134
|
+
- lib/fog/storage/k5.rb
|
135
|
+
- lib/fog/storage/k5/mock.rb
|
136
|
+
- lib/fog/storage/k5/models/directories.rb
|
137
|
+
- lib/fog/storage/k5/models/directory.rb
|
138
|
+
- lib/fog/storage/k5/models/file.rb
|
139
|
+
- lib/fog/storage/k5/models/files.rb
|
140
|
+
- lib/fog/storage/k5/real.rb
|
141
|
+
- lib/fog/storage/k5/requests/delete_object.rb
|
142
|
+
- lib/fog/storage/k5/requests/get_object.rb
|
143
|
+
- lib/fog/storage/k5/requests/list_containers.rb
|
144
|
+
- lib/fog/storage/k5/requests/list_objects.rb
|
145
|
+
- lib/fog/storage/k5/requests/put_object.rb
|
146
|
+
- lib/fog/storage/k5/utils.rb
|
147
|
+
homepage: https://github.com/blooper05/fog-k5
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.7.6
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: Module for the 'fog' gem to support FUJITSU Cloud Service K5.
|
171
|
+
test_files: []
|