fog-openstack 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +20 -0
  3. data/.github/workflows/main.yml +37 -0
  4. data/.rubocop.yml +65 -66
  5. data/fog-openstack.gemspec +1 -2
  6. data/lib/fog/openstack/auth/name.rb +1 -1
  7. data/lib/fog/openstack/core.rb +1 -1
  8. data/lib/fog/openstack/orchestration/models/stacks.rb +4 -3
  9. data/lib/fog/openstack/orchestration/requests/show_stack.rb +26 -0
  10. data/lib/fog/openstack/orchestration.rb +1 -0
  11. data/lib/fog/openstack/shared_file_system.rb +2 -2
  12. data/lib/fog/openstack/version.rb +1 -1
  13. data/lib/fog/openstack/volume/v3/mock.rb +68 -0
  14. data/lib/fog/openstack/volume/v3/models/availability_zone.rb +15 -0
  15. data/lib/fog/openstack/volume/v3/models/availability_zones.rb +16 -0
  16. data/lib/fog/openstack/volume/v3/models/backup.rb +15 -0
  17. data/lib/fog/openstack/volume/v3/models/backups.rb +16 -0
  18. data/lib/fog/openstack/volume/v3/models/snapshot.rb +44 -0
  19. data/lib/fog/openstack/volume/v3/models/snapshots.rb +16 -0
  20. data/lib/fog/openstack/volume/v3/models/transfer.rb +18 -0
  21. data/lib/fog/openstack/volume/v3/models/transfers.rb +16 -0
  22. data/lib/fog/openstack/volume/v3/models/volume.rb +37 -0
  23. data/lib/fog/openstack/volume/v3/models/volume_type.rb +16 -0
  24. data/lib/fog/openstack/volume/v3/models/volume_types.rb +16 -0
  25. data/lib/fog/openstack/volume/v3/models/volumes.rb +16 -0
  26. data/lib/fog/openstack/volume/v3/real.rb +23 -0
  27. data/lib/fog/openstack/volume/v3/requests/accept_transfer.rb +2 -0
  28. data/lib/fog/openstack/volume/v3/requests/action.rb +2 -0
  29. data/lib/fog/openstack/volume/v3/requests/create_backup.rb +2 -0
  30. data/lib/fog/openstack/volume/v3/requests/create_snapshot.rb +45 -0
  31. data/lib/fog/openstack/volume/v3/requests/create_transfer.rb +2 -0
  32. data/lib/fog/openstack/volume/v3/requests/create_volume.rb +49 -0
  33. data/lib/fog/openstack/volume/v3/requests/create_volume_type.rb +2 -0
  34. data/lib/fog/openstack/volume/v3/requests/delete_backup.rb +2 -0
  35. data/lib/fog/openstack/volume/v3/requests/delete_metadata.rb +2 -0
  36. data/lib/fog/openstack/volume/v3/requests/delete_snapshot.rb +2 -0
  37. data/lib/fog/openstack/volume/v3/requests/delete_snapshot_metadata.rb +2 -0
  38. data/lib/fog/openstack/volume/v3/requests/delete_transfer.rb +2 -0
  39. data/lib/fog/openstack/volume/v3/requests/delete_volume.rb +2 -0
  40. data/lib/fog/openstack/volume/v3/requests/delete_volume_type.rb +2 -0
  41. data/lib/fog/openstack/volume/v3/requests/extend_volume.rb +2 -0
  42. data/lib/fog/openstack/volume/v3/requests/get_backup_details.rb +2 -0
  43. data/lib/fog/openstack/volume/v3/requests/get_quota.rb +2 -0
  44. data/lib/fog/openstack/volume/v3/requests/get_quota_defaults.rb +2 -0
  45. data/lib/fog/openstack/volume/v3/requests/get_quota_usage.rb +2 -0
  46. data/lib/fog/openstack/volume/v3/requests/get_snapshot_details.rb +32 -0
  47. data/lib/fog/openstack/volume/v3/requests/get_transfer_details.rb +2 -0
  48. data/lib/fog/openstack/volume/v3/requests/get_volume_details.rb +35 -0
  49. data/lib/fog/openstack/volume/v3/requests/get_volume_type_details.rb +2 -0
  50. data/lib/fog/openstack/volume/v3/requests/list_backups.rb +2 -0
  51. data/lib/fog/openstack/volume/v3/requests/list_backups_detailed.rb +2 -0
  52. data/lib/fog/openstack/volume/v3/requests/list_snapshots.rb +2 -0
  53. data/lib/fog/openstack/volume/v3/requests/list_snapshots_detailed.rb +2 -0
  54. data/lib/fog/openstack/volume/v3/requests/list_transfers.rb +2 -0
  55. data/lib/fog/openstack/volume/v3/requests/list_transfers_detailed.rb +2 -0
  56. data/lib/fog/openstack/volume/v3/requests/list_volume_types.rb +2 -0
  57. data/lib/fog/openstack/volume/v3/requests/list_volumes.rb +46 -0
  58. data/lib/fog/openstack/volume/v3/requests/list_volumes_detailed.rb +46 -0
  59. data/lib/fog/openstack/volume/v3/requests/list_zones.rb +2 -0
  60. data/lib/fog/openstack/volume/v3/requests/real.rb +11 -0
  61. data/lib/fog/openstack/volume/v3/requests/real_mock.rb +14 -0
  62. data/lib/fog/openstack/volume/v3/requests/replace_metadata.rb +2 -0
  63. data/lib/fog/openstack/volume/v3/requests/restore_backup.rb +2 -0
  64. data/lib/fog/openstack/volume/v3/requests/set_tenant.rb +2 -0
  65. data/lib/fog/openstack/volume/v3/requests/snapshot_action.rb +2 -0
  66. data/lib/fog/openstack/volume/v3/requests/update_metadata.rb +2 -0
  67. data/lib/fog/openstack/volume/v3/requests/update_quota.rb +2 -0
  68. data/lib/fog/openstack/volume/v3/requests/update_snapshot.rb +2 -0
  69. data/lib/fog/openstack/volume/v3/requests/update_snapshot_metadata.rb +2 -0
  70. data/lib/fog/openstack/volume/v3/requests/update_volume.rb +20 -0
  71. data/lib/fog/openstack/volume/v3/requests/update_volume_type.rb +2 -0
  72. data/lib/fog/openstack/volume/v3.rb +94 -0
  73. data/lib/fog/openstack/volume.rb +11 -10
  74. data/supported.md +1 -2
  75. metadata +72 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a8e252a230bee20d269d2d792ab05b8f99bae13717a9540cf2686d5fff8b5cd
4
- data.tar.gz: aca5c5940ba619c6a95ac6ca961d0497f0f363e27bc487683b69f0051b17d2ed
3
+ metadata.gz: da9787ae70b0a9dc7fd9ba6ec0f74ebba6e484b092d0eb4d67e42c50648e3a5c
4
+ data.tar.gz: 388c37ffa743e4889c6079ae724899f91ba20285c649c5e8a24c01a356706bd2
5
5
  SHA512:
6
- metadata.gz: 178b1d9f8c71816bb0bfb0880d29ce5a05a2de5fad03a55b2a14e35e70d66217cc2b98a83e781f6c9bbd66810396d470570a191f140f631fb8b555e92de2d269
7
- data.tar.gz: 2b5a5f10dcd085c61251dac698044b5a38f7f8ed7f2b35a3e59ebd3d4d590015f1884ecbbe5fb0d35603797cd8630de3b5e6d6314e1c4d2757338c825dd1dd78
6
+ metadata.gz: 4db823a7a282570134fd638d35f8abc6e94e7b53d6b25b990022edd1ca49cba65750671155c571fb8d2a1df26b4b25b61cbfe05eb16842b9aaf4dac71843d8ce
7
+ data.tar.gz: e7fbbe4a4b69a4b44082cb6bd89f323858d9ab59a97d8ed7bd58f17b7b235212b560702ee3127a17acb1361dbfdd787501c7c326305d0077caaa312f7d3c0e66
@@ -0,0 +1,20 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+
6
+ name: Linting
7
+
8
+ on: [push]
9
+
10
+ jobs:
11
+ rubocop:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 3.0
18
+ - run: bundle install
19
+ - name: rubocop runs
20
+ run: rubocop
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run unit tests
35
+ run: bundle exec rake tests:unit
36
+ - name: Run specs tests
37
+ run: bundle exec rake tests:spec
data/.rubocop.yml CHANGED
@@ -1,41 +1,24 @@
1
+ # Opt-in new cops
2
+ AllCops:
3
+ NewCops: enable
1
4
  #
2
5
  # Overrides
3
6
  #
4
- AbcSize:
5
- Severity: refactor
6
- AlignHash:
7
+ Layout/HashAlignment:
7
8
  EnforcedHashRocketStyle: table
8
9
  EnforcedColonStyle: table
9
- BlockNesting:
10
- Severity: refactor
11
- ClassLength:
12
- Max: 150
13
- Severity: refactor
14
- ClassCheck:
15
- EnforcedStyle: kind_of?
16
- CollectionMethods:
17
- PreferredMethods:
18
- find: detect
19
- find_all: select
20
- map: collect
21
- reduce: inject
22
- CyclomaticComplexity:
23
- Severity: refactor
24
- Debugger:
25
- Enabled: true
26
- FormatString:
27
- EnforcedStyle: percent
28
- HashSyntax:
29
- EnforcedStyle: hash_rockets
30
- LineLength:
10
+ Layout/LineLength:
31
11
  Max: 120
32
12
  Severity: refactor
33
- MethodLength:
34
- Max: 25
13
+ Layout/SpaceInsideHashLiteralBraces:
14
+ EnforcedStyle: no_space
15
+ Lint/Debugger:
16
+ Enabled: true
17
+ Metrics/AbcSize:
35
18
  Severity: refactor
36
19
  # Exclude test methods from BlockLength.
37
20
  Metrics/BlockLength:
38
- ExcludedMethods:
21
+ IgnoredMethods:
39
22
  - after
40
23
  - before
41
24
  - context
@@ -44,72 +27,88 @@ Metrics/BlockLength:
44
27
  - model_tests
45
28
  - namespace
46
29
  - draw
47
- ParameterLists:
30
+ Metrics/BlockNesting:
31
+ Severity: refactor
32
+ Metrics/ClassLength:
33
+ Max: 150
34
+ Severity: refactor
35
+ Metrics/CyclomaticComplexity:
36
+ Severity: refactor
37
+ Metrics/MethodLength:
38
+ Max: 25
39
+ Severity: refactor
40
+ Metrics/ParameterLists:
48
41
  Severity: refactor
49
- PerceivedComplexity:
42
+ Metrics/PerceivedComplexity:
50
43
  Severity: refactor
51
- RedundantReturn:
44
+ Style/ClassCheck:
45
+ EnforcedStyle: kind_of?
46
+ Style/CollectionMethods:
47
+ PreferredMethods:
48
+ find: detect
49
+ find_all: select
50
+ map: collect
51
+ reduce: inject
52
+ Style/FormatString:
53
+ EnforcedStyle: percent
54
+ Style/HashSyntax:
55
+ EnforcedStyle: hash_rockets
56
+ Style/RedundantReturn:
52
57
  AllowMultipleReturnValues: true
53
- SignalException:
54
- EnforcedStyle: only_raise
55
- SingleLineMethods:
56
- AllowIfMethodIsEmpty: false
57
- SpaceInsideHashLiteralBraces:
58
- EnforcedStyle: no_space
59
58
  Style/RegexpLiteral:
60
59
  EnforcedStyle: slashes
61
60
  AllowInnerSlashes: true
62
- TrivialAccessors:
61
+ Style/SignalException:
62
+ EnforcedStyle: only_raise
63
+ Style/SingleLineMethods:
64
+ AllowIfMethodIsEmpty: false
65
+ Style/TrivialAccessors:
63
66
  AllowPredicates: true
64
67
  #
65
68
  # Enabled/Disabled
66
69
  #
67
- ClassAndModuleChildren:
68
- Enabled: false
69
- DefEndAlignment:
70
+ Layout/DefEndAlignment:
70
71
  AutoCorrect: true
71
- Documentation:
72
+ Layout/EndAlignment:
73
+ AutoCorrect: true
74
+ Layout/ExtraSpacing:
75
+ AutoCorrect: false # https://github.com/bbatsov/rubocop/issues/2280 <= Now closed, we should remove this
76
+ Layout/SpaceBeforeFirstArg:
72
77
  Enabled: false
73
- Encoding:
78
+ Style/ClassAndModuleChildren:
74
79
  Enabled: false
75
- EndAlignment:
76
- AutoCorrect: true
77
- ExtraSpacing:
78
- AutoCorrect: false # https://github.com/bbatsov/rubocop/issues/2280
79
- FindEach:
80
+ Style/Documentation:
81
+ Enabled: false
82
+ Style/Encoding:
80
83
  Enabled: false
81
- GuardClause:
84
+ Style/GuardClause:
82
85
  Enabled: false
83
- IfUnlessModifier:
86
+ Style/IfUnlessModifier:
84
87
  Enabled: false
85
- NumericLiterals:
88
+ Style/NumericLiterals:
86
89
  AutoCorrect: false
87
90
  MinDigits: 7
88
- ParallelAssignment:
91
+ Style/ParallelAssignment:
89
92
  Enabled: false
90
- PerlBackrefs:
93
+ Style/PerlBackrefs:
91
94
  Enabled: false
92
- ReadWriteAttribute:
95
+ Style/RescueModifier:
93
96
  AutoCorrect: false
94
- RescueModifier:
95
- AutoCorrect: false
96
- SingleLineBlockParams:
97
- Enabled: false
98
- SpaceBeforeFirstArg:
97
+ Style/SingleLineBlockParams:
99
98
  Enabled: false
100
- SpecialGlobalVars:
99
+ Style/SpecialGlobalVars:
101
100
  AutoCorrect: false
102
101
  Style/FrozenStringLiteralComment:
103
102
  Enabled: false
104
- StringLiterals:
103
+ Style/StringLiterals:
105
104
  Enabled: false
106
- StringLiteralsInInterpolation:
105
+ Style/StringLiteralsInInterpolation:
107
106
  Enabled: false
108
- TrailingCommaInArrayLiteral:
107
+ Style/TrailingCommaInArrayLiteral:
109
108
  Enabled: false
110
- TrailingCommaInHashLiteral:
109
+ Style/TrailingCommaInHashLiteral:
111
110
  Enabled: false
112
- WhileUntilModifier:
111
+ Style/WhileUntilModifier:
113
112
  Enabled: false
114
- WordArray:
113
+ Style/WordArray:
115
114
  AutoCorrect: false
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'fog-core', '~> 2.1'
25
25
  spec.add_dependency 'fog-json', '>= 1.0'
26
- spec.add_dependency 'ipaddress', '>= 0.8'
27
26
 
28
27
  spec.add_development_dependency 'bundler'
29
28
  spec.add_development_dependency 'coveralls'
@@ -31,7 +30,7 @@ Gem::Specification.new do |spec|
31
30
  spec.add_development_dependency "mime-types-data"
32
31
  spec.add_development_dependency 'minitest'
33
32
  spec.add_development_dependency 'pry-byebug'
34
- spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rake', '>= 12.3.3'
35
34
  spec.add_development_dependency 'rubocop'
36
35
  spec.add_development_dependency 'shindo', '~> 0.3'
37
36
  spec.add_development_dependency 'vcr'
@@ -30,7 +30,7 @@ module Fog
30
30
  end
31
31
 
32
32
  def to_h(var)
33
- {var => send(var)}
33
+ {var => send(var).to_s}
34
34
  end
35
35
  end
36
36
 
@@ -54,7 +54,7 @@ module Fog
54
54
 
55
55
  response = @connection.request(
56
56
  params.merge(
57
- :headers => headers(params.delete(:headers)),
57
+ :headers => headers(params[:headers]),
58
58
  :path => "#{@path}/#{params[:path]}"
59
59
  )
60
60
  )
@@ -20,10 +20,11 @@ module Fog
20
20
  load_response(data, 'stacks')
21
21
  end
22
22
 
23
- # Deprecated
24
23
  def find_by_id(id)
25
- Fog::Logger.deprecation("#find_by_id(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
26
- find { |stack| stack.id == id }
24
+ data = service.show_stack(id).body['stack']
25
+ new(data)
26
+ rescue Fog::OpenStack::Orchestration::NotFound
27
+ nil
27
28
  end
28
29
 
29
30
  def get(arg1, arg2 = nil)
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module OpenStack
3
+ class Orchestration
4
+ class Real
5
+ def show_stack(id)
6
+ request(
7
+ :method => 'GET',
8
+ :path => "stacks/#{id}",
9
+ :expects => 200
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def show_stack(_id)
16
+ stack = data[:stack].values
17
+
18
+ Excon::Response.new(
19
+ :body => {'stack' => stack},
20
+ :status => 200
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -47,6 +47,7 @@ module Fog
47
47
  request :show_resource_metadata
48
48
  request :show_resource_schema
49
49
  request :show_resource_template
50
+ request :show_stack
50
51
  request :show_stack_details
51
52
  request :update_stack
52
53
  request :patch_stack
@@ -81,7 +81,7 @@ module Fog
81
81
  # availability zones
82
82
  request :list_availability_zones
83
83
 
84
- # rubocop:disable LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
84
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
85
85
  class Mock
86
86
  def self.data
87
87
  @data ||= Hash.new do |hash, key|
@@ -342,7 +342,7 @@ module Fog
342
342
  :openstack_management_url => @openstack_management_url}
343
343
  end
344
344
  end
345
- # rubocop:enable LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
345
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Metrics/ClassLength, Metrics/AbcSize
346
346
 
347
347
  class Real
348
348
  include Fog::OpenStack::Core
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module OpenStack
3
- VERSION = '1.0.10'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,68 @@
1
+ module Fog
2
+ module OpenStack
3
+ class Volume
4
+ class V3 < Fog::OpenStack::Volume
5
+ class Mock
6
+ def self.data
7
+ @data ||= Hash.new do |hash, key|
8
+ hash[key] = {
9
+ :users => {},
10
+ :tenants => {},
11
+ :quota => {
12
+ 'gigabytes' => 1000,
13
+ 'volumes' => 10,
14
+ 'snapshots' => 10
15
+ }
16
+ }
17
+ end
18
+ end
19
+
20
+ def self.reset
21
+ @data = nil
22
+ end
23
+
24
+ def initialize(options = {})
25
+ @openstack_username = options[:openstack_username]
26
+ @openstack_tenant = options[:openstack_tenant]
27
+ @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
28
+
29
+ @auth_token = Fog::Mock.random_base64(64)
30
+ @auth_token_expiration = (Time.now.utc + 86400).iso8601
31
+
32
+ management_url = URI.parse(options[:openstack_auth_url])
33
+ management_url.port = 8776
34
+ management_url.path = '/v1'
35
+ @openstack_management_url = management_url.to_s
36
+
37
+ @data ||= {:users => {}}
38
+ unless @data[:users].find { |u| u['name'] == options[:openstack_username] }
39
+ id = Fog::Mock.random_numbers(6).to_s
40
+ @data[:users][id] = {
41
+ 'id' => id,
42
+ 'name' => options[:openstack_username],
43
+ 'email' => "#{options[:openstack_username]}@mock.com",
44
+ 'tenantId' => Fog::Mock.random_numbers(6).to_s,
45
+ 'enabled' => true
46
+ }
47
+ end
48
+ end
49
+
50
+ def data
51
+ self.class.data[@openstack_username]
52
+ end
53
+
54
+ def reset_data
55
+ self.class.data.delete(@openstack_username)
56
+ end
57
+
58
+ def credentials
59
+ {:provider => 'openstack',
60
+ :openstack_auth_url => @openstack_auth_uri.to_s,
61
+ :openstack_auth_token => @auth_token,
62
+ :openstack_management_url => @openstack_management_url}
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,15 @@
1
+ require 'fog/openstack/volume/models/availability_zone'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class AvailabilityZone < Fog::OpenStack::Volume::AvailabilityZone
8
+ identity :zoneName
9
+
10
+ attribute :zoneState
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/availability_zone'
3
+ require 'fog/openstack/volume/models/availability_zones'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class AvailabilityZones < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::AvailabilityZone
11
+ include Fog::OpenStack::Volume::AvailabilityZones
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ require 'fog/openstack/volume/models/backup'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class Backup < Fog::OpenStack::Volume::Backup
8
+ identity :id
9
+
10
+ superclass.attributes.each { |attrib| attribute attrib }
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/backup'
3
+ require 'fog/openstack/volume/models/backups'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class Backups < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::Backup
11
+ include Fog::OpenStack::Volume::Backups
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,44 @@
1
+ require 'fog/openstack/volume/models/snapshot'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class Snapshot < Fog::OpenStack::Volume::Snapshot
8
+ identity :id
9
+
10
+ attribute :name
11
+ attribute :status
12
+ attribute :description
13
+ attribute :metadata
14
+ attribute :force
15
+ attribute :size
16
+
17
+ def save
18
+ requires :name
19
+ data = if id.nil?
20
+ service.create_snapshot(attributes[:volume_id], name, description, force)
21
+ else
22
+ service.update_snapshot(id, attributes.reject { |k, _v| k == :id })
23
+ end
24
+ merge_attributes(data.body['snapshot'])
25
+ true
26
+ end
27
+
28
+ def create
29
+ requires :name
30
+
31
+ # volume_id, name, description, force=false
32
+ response = service.create_snapshot(attributes[:volume_id],
33
+ attributes[:name],
34
+ attributes[:description],
35
+ attributes[:force])
36
+ merge_attributes(response.body['snapshot'])
37
+
38
+ self
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/snapshot'
3
+ require 'fog/openstack/volume/models/snapshots'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class Snapshots < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::Snapshot
11
+ include Fog::OpenStack::Volume::Snapshots
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ require 'fog/openstack/volume/models/transfer'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class Transfer < Fog::OpenStack::Volume::Transfer
8
+ identity :id
9
+
10
+ attribute :auth_key, :aliases => 'authKey'
11
+ attribute :created_at, :aliases => 'createdAt'
12
+ attribute :name
13
+ attribute :volume_id, :aliases => 'volumeId'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/transfer'
3
+ require 'fog/openstack/volume/models/transfers'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class Transfers < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::Transfer
11
+ include Fog::OpenStack::Volume::Transfers
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,37 @@
1
+ require 'fog/openstack/volume/models/volume'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class Volume < Fog::OpenStack::Volume::Volume
8
+ identity :id
9
+
10
+ superclass.attributes.each { |attrib| attribute attrib }
11
+ attribute :name
12
+ attribute :description
13
+ attribute :tenant_id, :aliases => 'os-vol-tenant-attr:tenant_id'
14
+
15
+ def save
16
+ requires :name, :size
17
+ data = if id.nil?
18
+ service.create_volume(name, description, size, attributes)
19
+ else
20
+ service.update_volume(id, attributes.select { |key| %i(name description metadata).include?(key) })
21
+ end
22
+ merge_attributes(data.body['volume'])
23
+ true
24
+ end
25
+
26
+ def update(attr = nil)
27
+ requires :id
28
+ merge_attributes(
29
+ service.update_volume(id, attr || attributes).body['volume']
30
+ )
31
+ self
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/volume/models/volume_type'
2
+
3
+ module Fog
4
+ module OpenStack
5
+ class Volume
6
+ class V3
7
+ class VolumeType < Fog::OpenStack::Volume::VolumeType
8
+ identity :id
9
+
10
+ attribute :name
11
+ attribute :volume_backend_name
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/volume_type'
3
+ require 'fog/openstack/volume/models/volume_types'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class VolumeTypes < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::VolumeType
11
+ include Fog::OpenStack::Volume::VolumeTypes
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end