fog-kubevirt 0.3.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/lib/fog/bin/kubevirt.rb +2 -2
  4. data/lib/fog/kubevirt.rb +1 -4
  5. data/lib/fog/{compute/kubevirt.rb → kubevirt/compute/compute.rb} +35 -184
  6. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/node.rb +3 -3
  7. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/nodes.rb +4 -4
  8. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/template.rb +2 -2
  9. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/templates.rb +4 -4
  10. data/lib/fog/kubevirt/compute/models/vm.rb +71 -0
  11. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/vminstance.rb +4 -13
  12. data/lib/fog/{compute/kubevirt → kubevirt/compute}/models/vminstances.rb +4 -4
  13. data/lib/fog/kubevirt/compute/models/vms.rb +137 -0
  14. data/lib/fog/kubevirt/compute/models/volume.rb +9 -0
  15. data/lib/fog/kubevirt/compute/models/volumes.rb +12 -0
  16. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_pvc.rb +2 -2
  17. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_vm.rb +2 -3
  18. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/create_vminstance.rb +2 -2
  19. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/delete_vm.rb +3 -3
  20. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/delete_vminstance.rb +5 -5
  21. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_node.rb +2 -2
  22. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_template.rb +2 -2
  23. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_vm.rb +3 -3
  24. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/get_vminstance.rb +6 -6
  25. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_nodes.rb +2 -2
  26. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_templates.rb +2 -2
  27. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_vminstances.rb +2 -2
  28. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/list_vms.rb +6 -6
  29. data/lib/fog/{compute/kubevirt → kubevirt/compute}/requests/update_vm.rb +2 -2
  30. data/lib/fog/kubevirt/version.rb +1 -1
  31. metadata +39 -133
  32. data/lib/fog/compute/kubevirt/models/networkattachmentdef.rb +0 -25
  33. data/lib/fog/compute/kubevirt/models/networkattachmentdefs.rb +0 -59
  34. data/lib/fog/compute/kubevirt/models/persistentvolume.rb +0 -82
  35. data/lib/fog/compute/kubevirt/models/persistentvolumes.rb +0 -73
  36. data/lib/fog/compute/kubevirt/models/pvc.rb +0 -59
  37. data/lib/fog/compute/kubevirt/models/pvcs.rb +0 -76
  38. data/lib/fog/compute/kubevirt/models/server.rb +0 -44
  39. data/lib/fog/compute/kubevirt/models/servers.rb +0 -32
  40. data/lib/fog/compute/kubevirt/models/service.rb +0 -36
  41. data/lib/fog/compute/kubevirt/models/services.rb +0 -83
  42. data/lib/fog/compute/kubevirt/models/storageclass.rb +0 -33
  43. data/lib/fog/compute/kubevirt/models/storageclasses.rb +0 -61
  44. data/lib/fog/compute/kubevirt/models/vm.rb +0 -17
  45. data/lib/fog/compute/kubevirt/models/vm_base.rb +0 -86
  46. data/lib/fog/compute/kubevirt/models/vm_data.rb +0 -162
  47. data/lib/fog/compute/kubevirt/models/vms.rb +0 -206
  48. data/lib/fog/compute/kubevirt/models/volume.rb +0 -57
  49. data/lib/fog/compute/kubevirt/models/volumes.rb +0 -18
  50. data/lib/fog/compute/kubevirt/requests/create_networkattachmentdef.rb +0 -37
  51. data/lib/fog/compute/kubevirt/requests/create_persistentvolume.rb +0 -19
  52. data/lib/fog/compute/kubevirt/requests/create_service.rb +0 -18
  53. data/lib/fog/compute/kubevirt/requests/create_storageclass.rb +0 -18
  54. data/lib/fog/compute/kubevirt/requests/delete_networkattachmentdef.rb +0 -16
  55. data/lib/fog/compute/kubevirt/requests/delete_persistentvolume.rb +0 -16
  56. data/lib/fog/compute/kubevirt/requests/delete_pvc.rb +0 -16
  57. data/lib/fog/compute/kubevirt/requests/delete_service.rb +0 -16
  58. data/lib/fog/compute/kubevirt/requests/delete_storageclass.rb +0 -16
  59. data/lib/fog/compute/kubevirt/requests/get_networkattachmentdef.rb +0 -19
  60. data/lib/fog/compute/kubevirt/requests/get_persistentvolume.rb +0 -16
  61. data/lib/fog/compute/kubevirt/requests/get_pvc.rb +0 -16
  62. data/lib/fog/compute/kubevirt/requests/get_server.rb +0 -32
  63. data/lib/fog/compute/kubevirt/requests/get_service.rb +0 -16
  64. data/lib/fog/compute/kubevirt/requests/get_storageclass.rb +0 -16
  65. data/lib/fog/compute/kubevirt/requests/list_networkattachmentdefs.rb +0 -21
  66. data/lib/fog/compute/kubevirt/requests/list_persistentvolumes.rb +0 -22
  67. data/lib/fog/compute/kubevirt/requests/list_pvcs.rb +0 -22
  68. data/lib/fog/compute/kubevirt/requests/list_servers.rb +0 -25
  69. data/lib/fog/compute/kubevirt/requests/list_services.rb +0 -22
  70. data/lib/fog/compute/kubevirt/requests/list_storageclasses.rb +0 -22
  71. data/lib/fog/compute/kubevirt/requests/list_volumes.rb +0 -30
  72. data/spec/compute_v1alpha2_spec.rb +0 -30
  73. data/spec/create_vm_spec.rb +0 -101
  74. data/spec/fixtures/kubevirt/networkattachmentdefinition/networkattachmentdefinitions_crud.yml +0 -320
  75. data/spec/fixtures/kubevirt/persistentvolume/persistent_volumes_crud.yml +0 -316
  76. data/spec/fixtures/kubevirt/pvc/pvcs_crud.yml +0 -362
  77. data/spec/fixtures/kubevirt/service/services_crud.yml +0 -316
  78. data/spec/fixtures/kubevirt/storageclass/storageclasses_crud.yml +0 -400
  79. data/spec/fixtures/kubevirt/vm/vm_create_multi.yml +0 -459
  80. data/spec/fixtures/kubevirt/vm/vm_create_single.yml +0 -362
  81. data/spec/network_attachment_definition_v1alpha2_spec.rb +0 -28
  82. data/spec/persistent_volumes_v1alpha2_spec.rb +0 -45
  83. data/spec/pvcs_v1alpha2_spec.rb +0 -59
  84. data/spec/shared_context.rb +0 -54
  85. data/spec/spec_helper.rb +0 -10
  86. data/spec/storage_classes_v1_spec.rb +0 -46
@@ -1,8 +1,8 @@
1
1
  require 'recursive_open_struct'
2
2
 
3
3
  module Fog
4
- module Compute
5
- class Kubevirt
4
+ module Kubevirt
5
+ class Compute
6
6
  class Real
7
7
  def list_templates(_filters = {})
8
8
  temps = openshift_client.get_templates(namespace: @namespace)
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Kubevirt
2
+ module Kubevirt
3
+ class Compute
4
4
  class Real
5
5
  def list_vminstances(_filters = {})
6
6
  vminstances = kubevirt_client.get_virtual_machine_instances(namespace: @namespace)
@@ -1,8 +1,8 @@
1
1
  require 'recursive_open_struct'
2
2
 
3
3
  module Fog
4
- module Compute
5
- class Kubevirt
4
+ module Kubevirt
5
+ class Compute
6
6
  class Real
7
7
  def list_vms(_filters = {})
8
8
  vms = kubevirt_client.get_virtual_machines(namespace: @namespace)
@@ -30,16 +30,16 @@ module Fog
30
30
  template: {
31
31
  spec: { domain: { cpu: { cores: 4 },
32
32
  devices: { disks: [{ disk: { dev: 'vda' },
33
- name: 'containerDisk',
34
- volumeName: 'containervolume' },
33
+ name: 'registrydisk',
34
+ volumeName: 'registryvolume' },
35
35
  { disk: { dev: 'vdb' },
36
36
  name: 'cloudinitdisk',
37
37
  volumeName: 'cloudinitvolume' }] },
38
38
  machine: { type: 'q35' },
39
39
  resources: { requests: { memory: '512Mi' } } },
40
40
  volumes: [
41
- { name: 'containervolume',
42
- containerDisk: { image: 'kubevirt/fedora-cloud-registry-disk-demo:latest' }
41
+ { name: 'registryvolume',
42
+ registryDisk: { image: 'kubevirt/fedora-cloud-registry-disk-demo:latest' }
43
43
  },
44
44
  { cloudInitNoCloud: { userDataBase64: 'I2Nsb3VkLWNvbmZpZwpwYXNzd29yZDogYXRvbWljCnNzaF9wd2F1dGg6IFRydWUKY2hwYXNzd2Q6IHsgZXhwaXJlOiBGYWxzZSB9Cg==' },
45
45
  name: 'cloudinitvolume' }]
@@ -1,6 +1,6 @@
1
1
  module Fog
2
- module Compute
3
- class Kubevirt
2
+ module Kubevirt
3
+ class Compute
4
4
  class Real
5
5
  def update_vm(update)
6
6
  kubevirt_client.update_virtual_machine(update)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Kubevirt
3
- VERSION = '0.3.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,33 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-kubevirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kliczewski
8
8
  - Moti Asayag
9
9
  - Paulo Ribeiro
10
- - Adam Grare
10
+ - Gilles Dubreuil
11
11
  - Wesley Beary
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2019-04-02 00:00:00.000000000 Z
15
+ date: 2018-10-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: minitest
18
+ name: bundler
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - "~>"
22
22
  - !ruby/object:Gem::Version
23
- version: '0'
23
+ version: '1.3'
24
24
  type: :development
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ">="
28
+ - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '0'
30
+ version: '1.3'
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rake
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -70,68 +70,40 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
- - !ruby/object:Gem::Dependency
74
- name: vcr
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: '0'
80
- type: :development
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: '0'
87
- - !ruby/object:Gem::Dependency
88
- name: webmock
89
- requirement: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- type: :development
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: '0'
101
73
  - !ruby/object:Gem::Dependency
102
74
  name: fog-core
103
75
  requirement: !ruby/object:Gem::Requirement
104
76
  requirements:
105
77
  - - "~>"
106
78
  - !ruby/object:Gem::Version
107
- version: '1.45'
79
+ version: '2.1'
108
80
  type: :runtime
109
81
  prerelease: false
110
82
  version_requirements: !ruby/object:Gem::Requirement
111
83
  requirements:
112
84
  - - "~>"
113
85
  - !ruby/object:Gem::Version
114
- version: '1.45'
86
+ version: '2.1'
115
87
  - !ruby/object:Gem::Dependency
116
88
  name: kubeclient
117
89
  requirement: !ruby/object:Gem::Requirement
118
90
  requirements:
119
91
  - - "~>"
120
92
  - !ruby/object:Gem::Version
121
- version: 4.1.2
93
+ version: 2.5.2
122
94
  type: :runtime
123
95
  prerelease: false
124
96
  version_requirements: !ruby/object:Gem::Requirement
125
97
  requirements:
126
98
  - - "~>"
127
99
  - !ruby/object:Gem::Version
128
- version: 4.1.2
100
+ version: 2.5.2
129
101
  description: This library can be used as a module for `fog`.
130
102
  email:
131
103
  - piotr.kliczewski@gmail.com
132
104
  - masayag@redhat.com
133
105
  - plribeiro3000@gmail.com
134
- - agrare@redhat.com
106
+ - gilles@redhat.com
135
107
  - geemus@gmail.com
136
108
  executables: []
137
109
  extensions: []
@@ -140,84 +112,33 @@ files:
140
112
  - LICENSE.txt
141
113
  - README.md
142
114
  - lib/fog/bin/kubevirt.rb
143
- - lib/fog/compute/kubevirt.rb
144
- - lib/fog/compute/kubevirt/models/networkattachmentdef.rb
145
- - lib/fog/compute/kubevirt/models/networkattachmentdefs.rb
146
- - lib/fog/compute/kubevirt/models/node.rb
147
- - lib/fog/compute/kubevirt/models/nodes.rb
148
- - lib/fog/compute/kubevirt/models/persistentvolume.rb
149
- - lib/fog/compute/kubevirt/models/persistentvolumes.rb
150
- - lib/fog/compute/kubevirt/models/pvc.rb
151
- - lib/fog/compute/kubevirt/models/pvcs.rb
152
- - lib/fog/compute/kubevirt/models/server.rb
153
- - lib/fog/compute/kubevirt/models/servers.rb
154
- - lib/fog/compute/kubevirt/models/service.rb
155
- - lib/fog/compute/kubevirt/models/services.rb
156
- - lib/fog/compute/kubevirt/models/storageclass.rb
157
- - lib/fog/compute/kubevirt/models/storageclasses.rb
158
- - lib/fog/compute/kubevirt/models/template.rb
159
- - lib/fog/compute/kubevirt/models/templates.rb
160
- - lib/fog/compute/kubevirt/models/vm.rb
161
- - lib/fog/compute/kubevirt/models/vm_base.rb
162
- - lib/fog/compute/kubevirt/models/vm_data.rb
163
- - lib/fog/compute/kubevirt/models/vminstance.rb
164
- - lib/fog/compute/kubevirt/models/vminstances.rb
165
- - lib/fog/compute/kubevirt/models/vms.rb
166
- - lib/fog/compute/kubevirt/models/volume.rb
167
- - lib/fog/compute/kubevirt/models/volumes.rb
168
- - lib/fog/compute/kubevirt/requests/create_networkattachmentdef.rb
169
- - lib/fog/compute/kubevirt/requests/create_persistentvolume.rb
170
- - lib/fog/compute/kubevirt/requests/create_pvc.rb
171
- - lib/fog/compute/kubevirt/requests/create_service.rb
172
- - lib/fog/compute/kubevirt/requests/create_storageclass.rb
173
- - lib/fog/compute/kubevirt/requests/create_vm.rb
174
- - lib/fog/compute/kubevirt/requests/create_vminstance.rb
175
- - lib/fog/compute/kubevirt/requests/delete_networkattachmentdef.rb
176
- - lib/fog/compute/kubevirt/requests/delete_persistentvolume.rb
177
- - lib/fog/compute/kubevirt/requests/delete_pvc.rb
178
- - lib/fog/compute/kubevirt/requests/delete_service.rb
179
- - lib/fog/compute/kubevirt/requests/delete_storageclass.rb
180
- - lib/fog/compute/kubevirt/requests/delete_vm.rb
181
- - lib/fog/compute/kubevirt/requests/delete_vminstance.rb
182
- - lib/fog/compute/kubevirt/requests/get_networkattachmentdef.rb
183
- - lib/fog/compute/kubevirt/requests/get_node.rb
184
- - lib/fog/compute/kubevirt/requests/get_persistentvolume.rb
185
- - lib/fog/compute/kubevirt/requests/get_pvc.rb
186
- - lib/fog/compute/kubevirt/requests/get_server.rb
187
- - lib/fog/compute/kubevirt/requests/get_service.rb
188
- - lib/fog/compute/kubevirt/requests/get_storageclass.rb
189
- - lib/fog/compute/kubevirt/requests/get_template.rb
190
- - lib/fog/compute/kubevirt/requests/get_vm.rb
191
- - lib/fog/compute/kubevirt/requests/get_vminstance.rb
192
- - lib/fog/compute/kubevirt/requests/list_networkattachmentdefs.rb
193
- - lib/fog/compute/kubevirt/requests/list_nodes.rb
194
- - lib/fog/compute/kubevirt/requests/list_persistentvolumes.rb
195
- - lib/fog/compute/kubevirt/requests/list_pvcs.rb
196
- - lib/fog/compute/kubevirt/requests/list_servers.rb
197
- - lib/fog/compute/kubevirt/requests/list_services.rb
198
- - lib/fog/compute/kubevirt/requests/list_storageclasses.rb
199
- - lib/fog/compute/kubevirt/requests/list_templates.rb
200
- - lib/fog/compute/kubevirt/requests/list_vminstances.rb
201
- - lib/fog/compute/kubevirt/requests/list_vms.rb
202
- - lib/fog/compute/kubevirt/requests/list_volumes.rb
203
- - lib/fog/compute/kubevirt/requests/update_vm.rb
204
115
  - lib/fog/kubevirt.rb
116
+ - lib/fog/kubevirt/compute/compute.rb
117
+ - lib/fog/kubevirt/compute/models/node.rb
118
+ - lib/fog/kubevirt/compute/models/nodes.rb
119
+ - lib/fog/kubevirt/compute/models/template.rb
120
+ - lib/fog/kubevirt/compute/models/templates.rb
121
+ - lib/fog/kubevirt/compute/models/vm.rb
122
+ - lib/fog/kubevirt/compute/models/vminstance.rb
123
+ - lib/fog/kubevirt/compute/models/vminstances.rb
124
+ - lib/fog/kubevirt/compute/models/vms.rb
125
+ - lib/fog/kubevirt/compute/models/volume.rb
126
+ - lib/fog/kubevirt/compute/models/volumes.rb
127
+ - lib/fog/kubevirt/compute/requests/create_pvc.rb
128
+ - lib/fog/kubevirt/compute/requests/create_vm.rb
129
+ - lib/fog/kubevirt/compute/requests/create_vminstance.rb
130
+ - lib/fog/kubevirt/compute/requests/delete_vm.rb
131
+ - lib/fog/kubevirt/compute/requests/delete_vminstance.rb
132
+ - lib/fog/kubevirt/compute/requests/get_node.rb
133
+ - lib/fog/kubevirt/compute/requests/get_template.rb
134
+ - lib/fog/kubevirt/compute/requests/get_vm.rb
135
+ - lib/fog/kubevirt/compute/requests/get_vminstance.rb
136
+ - lib/fog/kubevirt/compute/requests/list_nodes.rb
137
+ - lib/fog/kubevirt/compute/requests/list_templates.rb
138
+ - lib/fog/kubevirt/compute/requests/list_vminstances.rb
139
+ - lib/fog/kubevirt/compute/requests/list_vms.rb
140
+ - lib/fog/kubevirt/compute/requests/update_vm.rb
205
141
  - lib/fog/kubevirt/version.rb
206
- - spec/compute_v1alpha2_spec.rb
207
- - spec/create_vm_spec.rb
208
- - spec/fixtures/kubevirt/networkattachmentdefinition/networkattachmentdefinitions_crud.yml
209
- - spec/fixtures/kubevirt/persistentvolume/persistent_volumes_crud.yml
210
- - spec/fixtures/kubevirt/pvc/pvcs_crud.yml
211
- - spec/fixtures/kubevirt/service/services_crud.yml
212
- - spec/fixtures/kubevirt/storageclass/storageclasses_crud.yml
213
- - spec/fixtures/kubevirt/vm/vm_create_multi.yml
214
- - spec/fixtures/kubevirt/vm/vm_create_single.yml
215
- - spec/network_attachment_definition_v1alpha2_spec.rb
216
- - spec/persistent_volumes_v1alpha2_spec.rb
217
- - spec/pvcs_v1alpha2_spec.rb
218
- - spec/shared_context.rb
219
- - spec/spec_helper.rb
220
- - spec/storage_classes_v1_spec.rb
221
142
  homepage: https://github.com/pkliczewski/fog-kubevirt
222
143
  licenses:
223
144
  - Apache-2.0
@@ -242,19 +163,4 @@ rubygems_version: 2.6.14
242
163
  signing_key:
243
164
  specification_version: 4
244
165
  summary: Module for the 'fog' gem to support Kubevirt.
245
- test_files:
246
- - spec/compute_v1alpha2_spec.rb
247
- - spec/create_vm_spec.rb
248
- - spec/fixtures/kubevirt/networkattachmentdefinition/networkattachmentdefinitions_crud.yml
249
- - spec/fixtures/kubevirt/persistentvolume/persistent_volumes_crud.yml
250
- - spec/fixtures/kubevirt/pvc/pvcs_crud.yml
251
- - spec/fixtures/kubevirt/service/services_crud.yml
252
- - spec/fixtures/kubevirt/storageclass/storageclasses_crud.yml
253
- - spec/fixtures/kubevirt/vm/vm_create_multi.yml
254
- - spec/fixtures/kubevirt/vm/vm_create_single.yml
255
- - spec/network_attachment_definition_v1alpha2_spec.rb
256
- - spec/persistent_volumes_v1alpha2_spec.rb
257
- - spec/pvcs_v1alpha2_spec.rb
258
- - spec/shared_context.rb
259
- - spec/spec_helper.rb
260
- - spec/storage_classes_v1_spec.rb
166
+ test_files: []
@@ -1,25 +0,0 @@
1
- module Fog
2
- module Compute
3
- class Kubevirt
4
- class Networkattachmentdef < Fog::Model
5
- identity :name
6
-
7
- attribute :namespace, :aliases => 'metadata_namespace'
8
- attribute :resource_version, :aliases => 'metadata_resource_version'
9
- attribute :uid, :aliases => 'metadata_uid'
10
- attribute :config, :aliases => 'spec_config'
11
-
12
- def self.parse(object)
13
- metadata = object[:metadata]
14
- {
15
- :namespace => metadata[:namespace],
16
- :name => metadata[:name],
17
- :resource_version => metadata[:resourceVersion],
18
- :uid => metadata[:uid],
19
- :config => object[:spec][:config]
20
- }
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,59 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/compute/kubevirt/models/networkattachmentdef'
3
-
4
- module Fog
5
- module Compute
6
- class Kubevirt
7
- class Networkattachmentdefs < Fog::Collection
8
- attr_reader :kind, :resource_version
9
-
10
- model Fog::Compute::Kubevirt::Networkattachmentdef
11
-
12
- def all(filters = {})
13
- networkattachmentdefs = service.list_networkattachmentdefs(filters)
14
- @kind = networkattachmentdefs.kind
15
- @resource_version = networkattachmentdefs.resource_version
16
- load networkattachmentdefs
17
- end
18
-
19
- def get(name)
20
- new service.get_networkattachmentdef(name)
21
- end
22
-
23
- # Creates network attachment definition using provided parameters:
24
- # name[String] - name of the network attachment
25
- # config[String] - the configuration of the attachment, i.e.:
26
- # '{ :cniVersion => "0.3.1", :type => "ovs", :bridge => "red" }'
27
- #
28
- # @param args[Hash] contains attachment definition
29
- def create(args = {})
30
- name = args[:name]
31
- config = args[:config]
32
-
33
- net_att_def = {
34
- :metadata => {
35
- :name => name,
36
- :namespace => service.namespace
37
- },
38
- :spec => {
39
- :config => config
40
- }
41
- }
42
-
43
- service.create_networkattachmentdef(net_att_def)
44
- end
45
-
46
- def delete(name)
47
- begin
48
- net_att_def = get(name)
49
- rescue ::Fog::Kubevirt::Errors::ClientError
50
- # the network attachment definition doesn't exist
51
- net_att_def = nil
52
- end
53
-
54
- service.delete_networkattachmentdef(name, service.namespace) unless net_att_def.nil?
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,82 +0,0 @@
1
- module Fog
2
- module Compute
3
- class Kubevirt
4
- class Persistentvolume < Fog::Model
5
- identity :name
6
-
7
- attribute :resource_version, :aliases => 'metadata_resource_version'
8
- attribute :uid, :aliases => 'metadata_uid'
9
- attribute :annotations, :aliases => 'metadata_annotations'
10
- attribute :labels, :aliases => 'metadata_labels'
11
- attribute :access_modes, :aliases => 'spec_access_modes'
12
- attribute :mount_options, :aliases => 'spec_mount_options'
13
- attribute :reclaim_policy, :aliases => 'spec_reclaim_policy'
14
- attribute :storage_class, :aliases => 'spec_storage_class'
15
- attribute :capacity, :aliases => 'spec_capacity'
16
- attribute :claim_ref, :aliases => 'spec_claim_ref'
17
- attribute :type, :aliases => 'spec_type'
18
- attribute :config, :aliases => 'spec_config'
19
- attribute :phase, :aliases => 'status_phase'
20
- attribute :reason, :aliases => 'status_reason'
21
- attribute :message, :aliases => 'status_message'
22
-
23
- def self.parse(object)
24
- metadata = object[:metadata]
25
- spec = object[:spec]
26
- status = object[:status]
27
- type = detect_type(spec)
28
-
29
- {
30
- :name => metadata[:name],
31
- :resource_version => metadata[:resourceVersion],
32
- :uid => metadata[:uid],
33
- :annotations => metadata[:annotations],
34
- :labels => metadata[:labels],
35
- :access_modes => spec[:accessModes],
36
- :mount_options => spec[:mountOptions],
37
- :reclaim_policy => spec[:persistentVolumeReclaimPolicy],
38
- :storage_class => spec[:storageClassName],
39
- :capacity => spec.dig(:capacity, :storage),
40
- :claim_ref => spec[:claimRef],
41
- :type => type,
42
- :config => spec[type&.to_sym],
43
- :phase => status[:phase],
44
- :reason => status[:reason],
45
- :message => status[:message]
46
- }
47
- end
48
-
49
- def self.detect_type(spec)
50
- type = ''
51
- type = 'awsElasticBlockStore' if spec.keys.include?(:awsElasticBlockStore)
52
- type = 'azureDisk' if spec.keys.include?(:azureDisk)
53
- type = 'azureFile' if spec.keys.include?(:azureFile)
54
- type = 'cephfs' if spec.keys.include?(:cephfs)
55
- type = 'configMap' if spec.keys.include?(:configMap)
56
- type = 'csi' if spec.keys.include?(:csi)
57
- type = 'downwardAPI' if spec.keys.include?(:downwardAPI)
58
- type = 'emptyDir' if spec.keys.include?(:emptyDir)
59
- type = 'fc' if spec.keys.include?(:fc)
60
- type = 'flexVolume' if spec.keys.include?(:flexVolume)
61
- type = 'flocker' if spec.keys.include?(:flocker)
62
- type = 'gcePersistentDisk' if spec.keys.include?(:gcePersistentDisk)
63
- type = 'glusterfs' if spec.keys.include?(:glusterfs)
64
- type = 'hostPath' if spec.keys.include?(:hostPath)
65
- type = 'iscsi' if spec.keys.include?(:iscsi)
66
- type = 'local' if spec.keys.include?(:local)
67
- type = 'nfs' if spec.keys.include?(:nfs)
68
- type = 'persistentVolumeClaim' if spec.keys.include?(:persistentVolumeClaim)
69
- type = 'projected' if spec.keys.include?(:projected)
70
- type = 'portworxVolume' if spec.keys.include?(:portworxVolume)
71
- type = 'quobyte' if spec.keys.include?(:quobyte)
72
- type = 'rbd' if spec.keys.include?(:rbd)
73
- type = 'scaleIO' if spec.keys.include?(:scaleIO)
74
- type = 'secret' if spec.keys.include?(:secret)
75
- type = 'storageos' if spec.keys.include?(:storageos)
76
- type = 'vsphereVolume' if spec.keys.include?(:vsphereVolume)
77
- type
78
- end
79
- end
80
- end
81
- end
82
- end