fog-openstack 1.0.11 → 1.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) 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 +0 -1
  6. data/lib/fog/openstack/shared_file_system.rb +2 -2
  7. data/lib/fog/openstack/version.rb +1 -1
  8. data/lib/fog/openstack/volume/v3/mock.rb +68 -0
  9. data/lib/fog/openstack/volume/v3/models/availability_zone.rb +15 -0
  10. data/lib/fog/openstack/volume/v3/models/availability_zones.rb +16 -0
  11. data/lib/fog/openstack/volume/v3/models/backup.rb +15 -0
  12. data/lib/fog/openstack/volume/v3/models/backups.rb +16 -0
  13. data/lib/fog/openstack/volume/v3/models/snapshot.rb +44 -0
  14. data/lib/fog/openstack/volume/v3/models/snapshots.rb +16 -0
  15. data/lib/fog/openstack/volume/v3/models/transfer.rb +18 -0
  16. data/lib/fog/openstack/volume/v3/models/transfers.rb +16 -0
  17. data/lib/fog/openstack/volume/v3/models/volume.rb +37 -0
  18. data/lib/fog/openstack/volume/v3/models/volume_type.rb +16 -0
  19. data/lib/fog/openstack/volume/v3/models/volume_types.rb +16 -0
  20. data/lib/fog/openstack/volume/v3/models/volumes.rb +16 -0
  21. data/lib/fog/openstack/volume/v3/real.rb +23 -0
  22. data/lib/fog/openstack/volume/v3/requests/accept_transfer.rb +2 -0
  23. data/lib/fog/openstack/volume/v3/requests/action.rb +2 -0
  24. data/lib/fog/openstack/volume/v3/requests/create_backup.rb +2 -0
  25. data/lib/fog/openstack/volume/v3/requests/create_snapshot.rb +45 -0
  26. data/lib/fog/openstack/volume/v3/requests/create_transfer.rb +2 -0
  27. data/lib/fog/openstack/volume/v3/requests/create_volume.rb +49 -0
  28. data/lib/fog/openstack/volume/v3/requests/create_volume_type.rb +2 -0
  29. data/lib/fog/openstack/volume/v3/requests/delete_backup.rb +2 -0
  30. data/lib/fog/openstack/volume/v3/requests/delete_metadata.rb +2 -0
  31. data/lib/fog/openstack/volume/v3/requests/delete_snapshot.rb +2 -0
  32. data/lib/fog/openstack/volume/v3/requests/delete_snapshot_metadata.rb +2 -0
  33. data/lib/fog/openstack/volume/v3/requests/delete_transfer.rb +2 -0
  34. data/lib/fog/openstack/volume/v3/requests/delete_volume.rb +2 -0
  35. data/lib/fog/openstack/volume/v3/requests/delete_volume_type.rb +2 -0
  36. data/lib/fog/openstack/volume/v3/requests/extend_volume.rb +2 -0
  37. data/lib/fog/openstack/volume/v3/requests/get_backup_details.rb +2 -0
  38. data/lib/fog/openstack/volume/v3/requests/get_quota.rb +2 -0
  39. data/lib/fog/openstack/volume/v3/requests/get_quota_defaults.rb +2 -0
  40. data/lib/fog/openstack/volume/v3/requests/get_quota_usage.rb +2 -0
  41. data/lib/fog/openstack/volume/v3/requests/get_snapshot_details.rb +32 -0
  42. data/lib/fog/openstack/volume/v3/requests/get_transfer_details.rb +2 -0
  43. data/lib/fog/openstack/volume/v3/requests/get_volume_details.rb +35 -0
  44. data/lib/fog/openstack/volume/v3/requests/get_volume_type_details.rb +2 -0
  45. data/lib/fog/openstack/volume/v3/requests/list_backups.rb +2 -0
  46. data/lib/fog/openstack/volume/v3/requests/list_backups_detailed.rb +2 -0
  47. data/lib/fog/openstack/volume/v3/requests/list_snapshots.rb +2 -0
  48. data/lib/fog/openstack/volume/v3/requests/list_snapshots_detailed.rb +2 -0
  49. data/lib/fog/openstack/volume/v3/requests/list_transfers.rb +2 -0
  50. data/lib/fog/openstack/volume/v3/requests/list_transfers_detailed.rb +2 -0
  51. data/lib/fog/openstack/volume/v3/requests/list_volume_types.rb +2 -0
  52. data/lib/fog/openstack/volume/v3/requests/list_volumes.rb +46 -0
  53. data/lib/fog/openstack/volume/v3/requests/list_volumes_detailed.rb +46 -0
  54. data/lib/fog/openstack/volume/v3/requests/list_zones.rb +2 -0
  55. data/lib/fog/openstack/volume/v3/requests/real.rb +11 -0
  56. data/lib/fog/openstack/volume/v3/requests/real_mock.rb +14 -0
  57. data/lib/fog/openstack/volume/v3/requests/replace_metadata.rb +2 -0
  58. data/lib/fog/openstack/volume/v3/requests/restore_backup.rb +2 -0
  59. data/lib/fog/openstack/volume/v3/requests/set_tenant.rb +2 -0
  60. data/lib/fog/openstack/volume/v3/requests/snapshot_action.rb +2 -0
  61. data/lib/fog/openstack/volume/v3/requests/update_metadata.rb +2 -0
  62. data/lib/fog/openstack/volume/v3/requests/update_quota.rb +2 -0
  63. data/lib/fog/openstack/volume/v3/requests/update_snapshot.rb +2 -0
  64. data/lib/fog/openstack/volume/v3/requests/update_snapshot_metadata.rb +2 -0
  65. data/lib/fog/openstack/volume/v3/requests/update_volume.rb +20 -0
  66. data/lib/fog/openstack/volume/v3/requests/update_volume_type.rb +2 -0
  67. data/lib/fog/openstack/volume/v3.rb +94 -0
  68. data/lib/fog/openstack/volume.rb +11 -10
  69. data/supported.md +1 -2
  70. metadata +69 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39e11cb8441eee8bdf906b567452056bd23a813ff1bad86311b36d21290e046e
4
- data.tar.gz: 8253a9390f575e00c9fb1464292fa2506e900e0d1b342f7a744749359d94bd78
3
+ metadata.gz: 90f32cb63d4fc6b8d35a8c3fc4462a680a095e9ab86a66c0efb6b7ed0e2d4023
4
+ data.tar.gz: 9d3d2ceac51ca9abf227456f88aafe1284e8588905cb8bfb1d4db227fe36a971
5
5
  SHA512:
6
- metadata.gz: 9d31e9d1bd4557fb215069e6065dcc450334a0bf978caf288151f4d2b074578c5feeba44a51890804f9ea8fe5974f2209f9af96e114efe24203eeac4ce827eb7
7
- data.tar.gz: 54036127d26fce6a4d9e7087216f6a36d2c3ae389ea314c988e66da885bc1531db44aedf1ee2ee39d1281063bfb23e12a62425fb3fae0161c5fa780ba27cf235
6
+ metadata.gz: 9931dbb575db4abca720def96263dc653663087d4f636de9ac82a2dccd79047b4df700868976e689bb17acd61933a0f48a3ca76322c576bea60673536283d3a7
7
+ data.tar.gz: 286571d8314b7587a816bd6e89c3b7f7a72b9c79343a9313d955ec5bb0f39740f7c9be2b4d1a0f7bb241c7aacb3b288efae7f57fcc0a2ee6f2e34da2ad03cd0c
@@ -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'
@@ -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.11'.freeze
3
+ VERSION = '1.1.0.pre'.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
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/volume/v3/models/volume'
3
+ require 'fog/openstack/volume/models/volumes'
4
+
5
+ module Fog
6
+ module OpenStack
7
+ class Volume
8
+ class V3
9
+ class Volumes < Fog::OpenStack::Collection
10
+ model Fog::OpenStack::Volume::V3::Volume
11
+ include Fog::OpenStack::Volume::Volumes
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module Fog
2
+ module OpenStack
3
+ class Volume
4
+ class V3 < Fog::OpenStack::Volume
5
+ class Real
6
+ include Fog::OpenStack::Core
7
+
8
+ def self.not_found_class
9
+ Fog::OpenStack::Volume::NotFound
10
+ end
11
+
12
+ def default_endtpoint_type
13
+ 'admin'
14
+ end
15
+
16
+ def default_service_type
17
+ %w[volumev3]
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ require 'fog/openstack/volume/requests/accept_transfer'
2
+ require 'fog/openstack/volume/v3/requests/real'
@@ -0,0 +1,2 @@
1
+ require 'fog/openstack/volume/requests/action'
2
+ require 'fog/openstack/volume/v3/requests/real'
@@ -0,0 +1,2 @@
1
+ require 'fog/openstack/volume/requests/create_backup'
2
+ require 'fog/openstack/volume/v3/requests/real'