fog-openstack 0.1.15 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -1
  3. data/README.md +36 -5
  4. data/docs/common/connection_params.md +45 -0
  5. data/docs/common/resources.md +11 -0
  6. data/docs/compute.md +2 -46
  7. data/docs/getting_started.md +11 -10
  8. data/docs/network.md +2 -47
  9. data/docs/orchestration.md +2 -2
  10. data/docs/planning.md +2 -47
  11. data/docs/shared_file_system.md +82 -0
  12. data/docs/storage.md +5 -51
  13. data/docs/workflow.md +4 -2
  14. data/examples/metric/basics.rb +42 -0
  15. data/examples/shared_file_system/basics.rb +68 -0
  16. data/gemfiles/Gemfile-1.9 +1 -0
  17. data/lib/fog/identity/openstack/v3/requests/list_groups.rb +1 -1
  18. data/lib/fog/image/openstack/v2/models/image.rb +60 -15
  19. data/lib/fog/image/openstack/v2/models/images.rb +1 -4
  20. data/lib/fog/metric/openstack.rb +126 -0
  21. data/lib/fog/metric/openstack/models/metric.rb +18 -0
  22. data/lib/fog/metric/openstack/models/metrics.rb +31 -0
  23. data/lib/fog/metric/openstack/models/resource.rb +16 -0
  24. data/lib/fog/metric/openstack/models/resources.rb +24 -0
  25. data/lib/fog/metric/openstack/requests/get_metric.rb +62 -0
  26. data/lib/fog/metric/openstack/requests/get_metric_measures.rb +38 -0
  27. data/lib/fog/metric/openstack/requests/get_resource.rb +37 -0
  28. data/lib/fog/metric/openstack/requests/get_resource_metric_measures.rb +46 -0
  29. data/lib/fog/metric/openstack/requests/list_metrics.rb +104 -0
  30. data/lib/fog/metric/openstack/requests/list_resources.rb +70 -0
  31. data/lib/fog/network/openstack.rb +12 -9
  32. data/lib/fog/network/openstack/models/rbac_policy.rb +0 -1
  33. data/lib/fog/network/openstack/requests/create_floating_ip.rb +1 -1
  34. data/lib/fog/network/openstack/requests/create_network.rb +3 -3
  35. data/lib/fog/openstack.rb +25 -15
  36. data/lib/fog/openstack/version.rb +1 -1
  37. data/lib/fog/orchestration/openstack/models/stack.rb +5 -1
  38. data/lib/fog/shared_file_system/openstack.rb +278 -0
  39. data/lib/fog/shared_file_system/openstack/models/network.rb +42 -0
  40. data/lib/fog/shared_file_system/openstack/models/networks.rb +28 -0
  41. data/lib/fog/shared_file_system/openstack/models/share.rb +63 -0
  42. data/lib/fog/shared_file_system/openstack/models/shares.rb +28 -0
  43. data/lib/fog/shared_file_system/openstack/models/snapshot.rb +45 -0
  44. data/lib/fog/shared_file_system/openstack/models/snapshots.rb +28 -0
  45. data/lib/fog/shared_file_system/openstack/requests/create_share.rb +49 -0
  46. data/lib/fog/shared_file_system/openstack/requests/create_share_network.rb +41 -0
  47. data/lib/fog/shared_file_system/openstack/requests/create_snapshot.rb +46 -0
  48. data/lib/fog/shared_file_system/openstack/requests/delete_share.rb +29 -0
  49. data/lib/fog/shared_file_system/openstack/requests/delete_share_network.rb +28 -0
  50. data/lib/fog/shared_file_system/openstack/requests/delete_snapshot.rb +30 -0
  51. data/lib/fog/shared_file_system/openstack/requests/get_share.rb +26 -0
  52. data/lib/fog/shared_file_system/openstack/requests/get_share_network.rb +26 -0
  53. data/lib/fog/shared_file_system/openstack/requests/get_snapshot.rb +26 -0
  54. data/lib/fog/shared_file_system/openstack/requests/list_share_networks.rb +25 -0
  55. data/lib/fog/shared_file_system/openstack/requests/list_share_networks_detail.rb +25 -0
  56. data/lib/fog/shared_file_system/openstack/requests/list_shares.rb +25 -0
  57. data/lib/fog/shared_file_system/openstack/requests/list_shares_detail.rb +25 -0
  58. data/lib/fog/shared_file_system/openstack/requests/list_snapshots.rb +25 -0
  59. data/lib/fog/shared_file_system/openstack/requests/list_snapshots_detail.rb +25 -0
  60. data/lib/fog/shared_file_system/openstack/requests/update_share.rb +39 -0
  61. data/lib/fog/shared_file_system/openstack/requests/update_share_network.rb +31 -0
  62. data/lib/fog/shared_file_system/openstack/requests/update_snapshot.rb +31 -0
  63. metadata +43 -2
@@ -0,0 +1,18 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Metric
5
+ class OpenStack
6
+ class Metric < Fog::OpenStack::Model
7
+ identity :id
8
+
9
+ attribute :name
10
+ attribute :resource_id
11
+ attribute :unit
12
+ attribute :created_by_project_id
13
+ attribute :created_by_user_id
14
+ attribute :definition
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/metric/openstack/models/metric'
3
+
4
+ module Fog
5
+ module Metric
6
+ class OpenStack
7
+ class Metrics < Fog::OpenStack::Collection
8
+
9
+ model Fog::Metric::OpenStack::Metric
10
+
11
+ def all(options = {})
12
+ load_response(service.list_metrics(options))
13
+ end
14
+
15
+ def find_by_id(metric_id)
16
+ resource = service.get_metric(metric_id).body
17
+ new(resource)
18
+ rescue Fog::Metric::OpenStack::NotFound
19
+ nil
20
+ end
21
+
22
+ def find_measures_by_id(metric_id, options = {})
23
+ resource = service.get_metric_measures(metric_id, options).body
24
+ new(resource)
25
+ rescue Fog::Metric::OpenStack::NotFound
26
+ nil
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Metric
5
+ class OpenStack
6
+ class Resource < Fog::OpenStack::Model
7
+ identity :id
8
+
9
+ attribute :original_resource_id
10
+ attribute :project_id
11
+ attribute :user_id
12
+ attribute :metrics
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/metric/openstack/models/resource'
3
+
4
+ module Fog
5
+ module Metric
6
+ class OpenStack
7
+ class Resources < Fog::OpenStack::Collection
8
+
9
+ model Fog::Metric::OpenStack::Resource
10
+
11
+ def all(options = {})
12
+ load_response(service.list_resources(options))
13
+ end
14
+
15
+ def find_by_id(resource_id)
16
+ resource = service.get_resource(resource_id).body
17
+ new(resource)
18
+ rescue Fog::Metric::OpenStack::NotFound
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,62 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def get_metric(metric_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => "metric/#{metric_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_metric(_metric_id)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "archive_policy" => {
20
+ "aggregation_methods" => [
21
+ "95pct",
22
+ "median",
23
+ "max",
24
+ "count",
25
+ "std",
26
+ "sum",
27
+ "min",
28
+ "mean"
29
+ ],
30
+ "back_window" => 0,
31
+ "definition" => [
32
+ {
33
+ "granularity" => "0:00:01",
34
+ "points" => 3600,
35
+ "timespan" => "1:00:00"
36
+ },
37
+ {
38
+ "granularity" => "0:01:00",
39
+ "points" => 10080,
40
+ "timespan" => "7 days, 0:00:00"
41
+ },
42
+ {
43
+ "granularity" => "1:00:00",
44
+ "points" => 8760,
45
+ "timespan" => "365 days, 0:00:00"
46
+ }
47
+ ],
48
+ "name" => "high"
49
+ },
50
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
51
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
52
+ "id" => "8bbb5f02-b654-4861-b19e-d372fcdca124",
53
+ "name" => nil,
54
+ "resource" => nil,
55
+ "unit" => nil
56
+ }
57
+ response
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,38 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def get_metric_measures(metric_id, options = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => "metric/#{metric_id}/measures",
10
+ :query => options,
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def get_metric_measures(_metric_id, _options = {})
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = [
20
+ {
21
+ "timestamp" => "2014-10-06T14:33:57",
22
+ "value" => 43.1
23
+ },
24
+ {
25
+ "timestamp" => "2014-10-06T14:34:12",
26
+ "value" => 12
27
+ },
28
+ {
29
+ "timestamp" => "2014-10-06T14:34:20",
30
+ "value" => 2
31
+ }
32
+ ]
33
+ response
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def get_resource(resource_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => "resource/generic/#{resource_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_resource(_resource_id)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
20
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
21
+ "ended_at" => nil,
22
+ "id" => "75c44741-cc60-4033-804e-2d3098c7d2e9",
23
+ "metrics" => {},
24
+ "original_resource_id" => "75C44741-CC60-4033-804E-2D3098C7D2E9",
25
+ "project_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
26
+ "revision_end" => nil,
27
+ "revision_start" => "2016-11-08T11:23:45.989977+00:00",
28
+ "started_at" => "2016-11-08T11:23:45.989960+00:00",
29
+ "type" => "generic",
30
+ "user_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
31
+ }
32
+ response
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def get_resource_metric_measures(resource_id, metric_name, options = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => "resource/generic/#{resource_id}/metric/#{metric_name}/measures",
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def get_resource_metric_measures(_resource_id, _metric_name, _options = {})
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = [
20
+ [
21
+ "2014-10-06T14:00:00+00:00",
22
+ 3600.0,
23
+ 24.7
24
+ ],
25
+ [
26
+ "2014-10-06T14:34:00+00:00",
27
+ 60.0,
28
+ 15.5
29
+ ],
30
+ [
31
+ "2014-10-06T14:34:12+00:00",
32
+ 1.0,
33
+ 6.0
34
+ ],
35
+ [
36
+ "2014-10-06T14:34:20+00:00",
37
+ 1.0,
38
+ 25.0
39
+ ]
40
+ ]
41
+ response
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,104 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def list_metrics(options = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'metric',
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_metrics(_options = {})
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = [
20
+ {
21
+ "archive_policy" => {
22
+ "aggregation_methods" => [
23
+ "95pct",
24
+ "median",
25
+ "max",
26
+ "count",
27
+ "std",
28
+ "sum",
29
+ "min",
30
+ "mean"
31
+ ],
32
+ "back_window" => 0,
33
+ "definition" => [
34
+ {
35
+ "granularity" => "0:00:01",
36
+ "points" => 3600,
37
+ "timespan" => "1:00:00"
38
+ },
39
+ {
40
+ "granularity" => "0:01:00",
41
+ "points" => 10080,
42
+ "timespan" => "7 days, 0:00:00"
43
+ },
44
+ {
45
+ "granularity" => "1:00:00",
46
+ "points" => 8760,
47
+ "timespan" => "365 days, 0:00:00"
48
+ }
49
+ ],
50
+ "name" => "high"
51
+ },
52
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
53
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
54
+ "id" => "8bbb5f02-b654-4861-b19e-d372fcdca124",
55
+ "name" => nil,
56
+ "resource_id" => nil,
57
+ "unit" => nil
58
+ },
59
+ {
60
+ "archive_policy" => {
61
+ "aggregation_methods" => [
62
+ "95pct",
63
+ "median",
64
+ "max",
65
+ "count",
66
+ "std",
67
+ "sum",
68
+ "min",
69
+ "mean"
70
+ ],
71
+ "back_window" => 0,
72
+ "definition" => [
73
+ {
74
+ "granularity" => "0:05:00",
75
+ "points" => 12,
76
+ "timespan" => "1:00:00"
77
+ },
78
+ {
79
+ "granularity" => "1:00:00",
80
+ "points" => 24,
81
+ "timespan" => "1 day, 0:00:00"
82
+ },
83
+ {
84
+ "granularity" => "1 day, 0:00:00",
85
+ "points" => 30,
86
+ "timespan" => "30 days, 0:00:00"
87
+ }
88
+ ],
89
+ "name" => "low"
90
+ },
91
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
92
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
93
+ "id" => "af3446dc-e20f-4ecf-aaaa-1240c05ff19b",
94
+ "name" => nil,
95
+ "resource_id" => nil,
96
+ "unit" => nil
97
+ }
98
+ ]
99
+ response
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,70 @@
1
+ module Fog
2
+ module Metric
3
+ class OpenStack
4
+ class Real
5
+ def list_resources(options = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'resource/generic',
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_resources(_options = {})
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = [
20
+ {
21
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
22
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
23
+ "ended_at" => nil,
24
+ "id" => "75c44741-cc60-4033-804e-2d3098c7d2e9",
25
+ "metrics" => {},
26
+ "original_resource_id" => "75C44741-CC60-4033-804E-2D3098C7D2E9",
27
+ "project_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
28
+ "revision_end" => nil,
29
+ "revision_start" => "2016-11-08T11:23:45.989977+00:00",
30
+ "started_at" => "2016-11-08T11:23:45.989960+00:00",
31
+ "type" => "generic",
32
+ "user_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
33
+ },
34
+ {
35
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
36
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
37
+ "ended_at" => nil,
38
+ "id" => "ab68da77-fa82-4e67-aba9-270c5a98cbcb",
39
+ "metrics" => {
40
+ "temperature" => "ed51c966-8890-4f4e-96c4-f0a753dbad42"
41
+ },
42
+ "original_resource_id" => "AB68DA77-FA82-4E67-ABA9-270C5A98CBCB",
43
+ "project_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
44
+ "revision_end" => nil,
45
+ "revision_start" => "2016-11-08T11:23:46.177259+00:00",
46
+ "started_at" => "2016-11-08T11:23:46.177236+00:00",
47
+ "type" => "generic",
48
+ "user_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
49
+ },
50
+ {
51
+ "created_by_project_id" => "384a902b-6856-424c-9d30-6b5325ac20a5",
52
+ "created_by_user_id" => "d040def9-fd68-45f0-a19f-253014f397c3",
53
+ "ended_at" => "2014-01-04T10:00:12+00:00",
54
+ "id" => "6868da77-fa82-4e67-aba9-270c5ae8cbca",
55
+ "metrics" => {},
56
+ "original_resource_id" => "6868DA77-FA82-4E67-ABA9-270C5AE8CBCA",
57
+ "project_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
58
+ "revision_end" => nil,
59
+ "revision_start" => "2016-11-08T11:23:46.781604+00:00",
60
+ "started_at" => "2014-01-02T23:23:34+00:00",
61
+ "type" => "instance",
62
+ "user_id" => "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
63
+ }
64
+ ]
65
+ response
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end