cfoundry 0.5.1.rc2 → 0.5.1.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/lib/cc_api_stub.rb +17 -0
  2. data/lib/cc_api_stub/applications.rb +53 -0
  3. data/lib/cc_api_stub/domains.rb +16 -0
  4. data/lib/cc_api_stub/frameworks.rb +22 -0
  5. data/lib/cc_api_stub/helper.rb +131 -0
  6. data/lib/cc_api_stub/login.rb +21 -0
  7. data/lib/cc_api_stub/organization_users.rb +21 -0
  8. data/lib/cc_api_stub/organizations.rb +70 -0
  9. data/lib/cc_api_stub/routes.rb +26 -0
  10. data/lib/cc_api_stub/runtimes.rb +22 -0
  11. data/lib/cc_api_stub/service_bindings.rb +22 -0
  12. data/lib/cc_api_stub/service_instances.rb +22 -0
  13. data/lib/cc_api_stub/services.rb +25 -0
  14. data/lib/cc_api_stub/spaces.rb +49 -0
  15. data/lib/cc_api_stub/users.rb +84 -0
  16. data/lib/cfoundry/baseclient.rb +24 -0
  17. data/lib/cfoundry/errors.rb +16 -133
  18. data/lib/cfoundry/v1/app.rb +6 -2
  19. data/lib/cfoundry/v2/app.rb +16 -4
  20. data/lib/cfoundry/v2/base.rb +10 -11
  21. data/lib/cfoundry/v2/client.rb +4 -0
  22. data/lib/cfoundry/version.rb +1 -1
  23. data/spec/cc_api_stub/applications_spec.rb +69 -0
  24. data/spec/cc_api_stub/domains_spec.rb +19 -0
  25. data/spec/cc_api_stub/frameworks_spec.rb +19 -0
  26. data/spec/cc_api_stub/login_spec.rb +20 -0
  27. data/spec/cc_api_stub/organization_users_spec.rb +19 -0
  28. data/spec/cc_api_stub/organizations_spec.rb +103 -0
  29. data/spec/cc_api_stub/routes_spec.rb +19 -0
  30. data/spec/cc_api_stub/runtimes_spec.rb +19 -0
  31. data/spec/cc_api_stub/service_bindings_spec.rb +13 -0
  32. data/spec/cc_api_stub/service_instances_spec.rb +19 -0
  33. data/spec/cc_api_stub/services_spec.rb +12 -0
  34. data/spec/cc_api_stub/spaces_spec.rb +38 -0
  35. data/spec/cc_api_stub/users_spec.rb +107 -0
  36. data/spec/cfoundry/baseclient_spec.rb +42 -2
  37. data/spec/cfoundry/v2/app_spec.rb +95 -0
  38. data/spec/fixtures/fake_cc_application.json +24 -0
  39. data/spec/fixtures/fake_cc_application_summary.json +57 -0
  40. data/spec/fixtures/fake_cc_created_application.json +11 -0
  41. data/spec/fixtures/fake_cc_created_domain.json +10 -0
  42. data/spec/fixtures/fake_cc_created_organization.json +11 -0
  43. data/spec/fixtures/fake_cc_created_route.json +13 -0
  44. data/spec/fixtures/fake_cc_created_service_instance.json +11 -0
  45. data/spec/fixtures/fake_cc_created_space.json +11 -0
  46. data/spec/fixtures/fake_cc_created_user.json +11 -0
  47. data/spec/fixtures/fake_cc_empty_search.json +7 -0
  48. data/spec/fixtures/fake_cc_frameworks.json +20 -0
  49. data/spec/fixtures/fake_cc_organization.json +144 -0
  50. data/spec/fixtures/fake_cc_organization_domains.json +34 -0
  51. data/spec/fixtures/fake_cc_organization_search.json +37 -0
  52. data/spec/fixtures/fake_cc_organization_summary.json +19 -0
  53. data/spec/fixtures/fake_cc_organization_users.json +81 -0
  54. data/spec/fixtures/fake_cc_runtimes.json +20 -0
  55. data/spec/fixtures/fake_cc_service_binding.json +22 -0
  56. data/spec/fixtures/fake_cc_service_bindings.json +24 -0
  57. data/spec/fixtures/fake_cc_service_instance.json +81 -0
  58. data/spec/fixtures/fake_cc_service_instances.json +0 -0
  59. data/spec/fixtures/fake_cc_service_types.json +124 -0
  60. data/spec/fixtures/fake_cc_space.json +45 -0
  61. data/spec/fixtures/fake_cc_space_summary.json +86 -0
  62. data/spec/fixtures/fake_cc_stats.json +29 -0
  63. data/spec/fixtures/fake_cc_user.json +112 -0
  64. data/spec/fixtures/fake_cc_user_organizations.json +92 -0
  65. data/spec/fixtures/fake_cc_user_with_managers.json +85 -0
  66. data/spec/spec_helper.rb +3 -0
  67. data/spec/support/fake_helper.rb +0 -36
  68. data/spec/support/shared_examples/cc_api_stub_request_examples.rb +79 -0
  69. metadata +254 -144
@@ -0,0 +1,45 @@
1
+ {
2
+ "metadata": {
3
+ "guid": "space-id-1",
4
+ "url": "/v2/spaces/space-id-1",
5
+ "created_at": "2012-10-25 14:10:45 -0700",
6
+ "updated_at": null
7
+ },
8
+ "entity": {
9
+ "name": "space-name-1",
10
+ "organization_guid": "organization-id-1",
11
+ "domains_url": "/v2/spaces/space-id-1/domains",
12
+ "domains": [
13
+ {
14
+ "metadata": {
15
+ "guid": "domain-id-1",
16
+ "url": "/v2/domains/domain-id-1",
17
+ "created_at": "2012-10-25 14:08:38 -0700",
18
+ "updated_at": null
19
+ },
20
+ "entity": {
21
+ "name": "vcap.me",
22
+ "owning_organization_guid": null
23
+ }
24
+ }
25
+ ],
26
+ "organization_url": "/v2/organizations/organization-id-1",
27
+ "organization": {
28
+ "metadata": {
29
+ "guid": "organization-id-1",
30
+ "url": "/v2/organizations/organization-id-1",
31
+ "created_at": "2012-10-25 14:10:41 -0700",
32
+ "updated_at": null
33
+ },
34
+ "entity": {
35
+ "name": "organization-name-1",
36
+ "spaces_url": "/v2/organizations/organization-id-1/spaces",
37
+ "domains_url": "/v2/organizations/organization-id-1/domains",
38
+ "users_url": "/v2/organizations/organization-id-1/users",
39
+ "managers_url": "/v2/organizations/organization-id-1/managers",
40
+ "billing_managers_url": "/v2/organizations/organization-id-1/billing_managers",
41
+ "auditors_url": "/v2/organizations/organization-id-1/auditors"
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "guid":"space-id-1",
3
+ "name":"space-name-1",
4
+ "apps":[
5
+ {
6
+ "guid":"application-id-1",
7
+ "name":"application-name-1",
8
+ "routes":[
9
+ { "guid": "aa14f148-3d82-4db3-982e-fe0fd00582f4", "host": "app", "domain": { "name": "cloudfoundry.com"}}
10
+ ],
11
+ "urls":[
12
+ "app.cloudfoundry.com"
13
+ ],
14
+ "state":"STARTED",
15
+ "memory":128,
16
+ "instances":1,
17
+ "running_instances":1,
18
+ "service_count":1,
19
+ "framework_name":"framework-name-1",
20
+ "runtime_name":"runtime-name-1",
21
+ "space_guid":"space-id-1",
22
+ "framework_guid":"framework-id-1",
23
+ "runtime_guid":"runtime-id-1",
24
+ "environment_json":{},
25
+ "file_descriptors":256,
26
+ "disk_quota":256
27
+ },
28
+ {
29
+ "guid":"application-id-2",
30
+ "name":"application-name-2",
31
+ "routes":[
32
+ { "guid": "a14c5666-5354-49a7-8da8-2c29eaaaac18", "host": "app2-1", "domain": { "name": "cloudfoundry.com"}},
33
+ { "guid": "7c183670-2e4b-4dd1-b2b5-d7ada5d470fb", "host": "app2-2", "domain": { "name": "cloudfoundry.com"}}
34
+ ],
35
+ "urls":[
36
+ "app2-1.cloudfoundry.com",
37
+ "app2-2.cloudfoundry.com"
38
+ ],
39
+ "state":"STOPPED",
40
+ "memory":256,
41
+ "instances":2,
42
+ "running_instances":0,
43
+ "service_count":2,
44
+ "framework_name":"framework-name-2",
45
+ "runtime_name":"runtime-name-2",
46
+ "space_guid":"space-id-1",
47
+ "framework_guid":"framework-id-2",
48
+ "runtime_guid":"runtime-id-2",
49
+ "environment_json":{},
50
+ "file_descriptors":256,
51
+ "disk_quota":256
52
+ }
53
+ ],
54
+ "services":[
55
+ {
56
+ "guid":"service-id-1",
57
+ "name":"service-name-1",
58
+ "bound_app_count":1,
59
+ "service_plan": {
60
+ "guid":"service-plan-id-1",
61
+ "name":"300",
62
+ "service":{
63
+ "guid":"paid-postgresql-id-1",
64
+ "provider":"core",
65
+ "label":"postgresql",
66
+ "version":"9.0"
67
+ }
68
+ }
69
+ },
70
+ {
71
+ "guid":"service-id-2",
72
+ "name":"service-name-2",
73
+ "bound_app_count":2,
74
+ "service_plan": {
75
+ "guid":"service-plan-id-2",
76
+ "name":"100",
77
+ "service":{
78
+ "guid":"development-mongolab-mongodb-id-1",
79
+ "provider":"mongolab",
80
+ "label":"mongolab-mongodb",
81
+ "version":"1.0"
82
+ }
83
+ }
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "instance-id-1": {
3
+ "state": "DOWN",
4
+ "since": 1346959370
5
+ },
6
+ "instance-the-second": {
7
+ "state": "RUNNING",
8
+ "since": 1346959370,
9
+ "stats": {
10
+ "uptime": 604800.0000,
11
+ "port": 49249,
12
+ "fds_quota": 256,
13
+ "mem_quota": 134217728,
14
+ "uris": [
15
+ "tiny-java.p01.rbconsvcs.com"
16
+ ],
17
+ "name": "tiny-java",
18
+ "cores": 4,
19
+ "usage": {
20
+ "disk": 6373376,
21
+ "mem": 67039232,
22
+ "time": "2012-09-06 22:29:28 +0000",
23
+ "cpu": 0.5
24
+ },
25
+ "disk_quota": 268435456,
26
+ "host": "172.20.182.198"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "metadata": {
3
+ "guid": "user-id-1",
4
+ "url": "/v2/users/user-id-1",
5
+ "created_at": "2012-08-13 12:48:41 -0700",
6
+ "updated_at": "2012-08-13 12:55:10 -0700"
7
+ },
8
+ "entity": {
9
+ "organizations": [{
10
+ "metadata": {
11
+ "guid": "organization-id-1",
12
+ "url": "/v2/organizations/organization-id-1"
13
+ },
14
+ "entity": {
15
+ "name": "organization-name-1",
16
+ "spaces": [
17
+ {
18
+ "metadata": {
19
+ "guid": "space-id-1",
20
+ "url": "/v2/spaces/space-id-1"
21
+ },
22
+ "entity": {
23
+ "name": "space-name-1"
24
+ }
25
+ },
26
+ {
27
+ "metadata": {
28
+ "guid": "space-id-2",
29
+ "url": "/v2/spaces/space-id-2"
30
+ },
31
+ "entity": {
32
+ "name": "space-name-2"
33
+ }
34
+ },
35
+ {
36
+ "metadata": {
37
+ "guid": "space-id-3",
38
+ "url": "/v2/spaces/space-id-3"
39
+ },
40
+ "entity": {
41
+ "name": "space-name-3"
42
+ }
43
+ }
44
+ ],
45
+ "managers": [{
46
+ "metadata": {
47
+ "guid": "user-id-1",
48
+ "url": "/v2/users/user-id-1"
49
+ },
50
+ "entity": {}
51
+ }]
52
+ }
53
+ },
54
+ {
55
+ "metadata": {
56
+ "guid": "organization-id-2",
57
+ "url": "/v2/organizations/organization-id-2"
58
+ },
59
+ "entity": {
60
+ "name": "organization-name-2",
61
+ "spaces": [
62
+ {
63
+ "metadata": {
64
+ "guid": "space2-id-1",
65
+ "url": "/v2/spaces/space2-id-1"
66
+ },
67
+ "entity": {
68
+ "name": "space2-name-1"
69
+ }
70
+ },
71
+ {
72
+ "metadata": {
73
+ "guid": "space2-id-2",
74
+ "url": "/v2/spaces/space2-id-2"
75
+ },
76
+ "entity": {
77
+ "name": "space2-name-2"
78
+ }
79
+ },
80
+ {
81
+ "metadata": {
82
+ "guid": "space2-id-3",
83
+ "url": "/v2/spaces/space2-id-3"
84
+ },
85
+ "entity": {
86
+ "name": "space2-name-3"
87
+ }
88
+ }
89
+ ],
90
+ "managers": [{
91
+ "metadata": {
92
+ "guid": "user-id-1",
93
+ "url": "/v2/users/user-id-1"
94
+ },
95
+ "entity": {}
96
+ }]
97
+ }
98
+ }],
99
+
100
+ "managed_organizations": [],
101
+ "billing_managed_organizations": [{
102
+ "metadata": {
103
+ "guid": "created-organization-id-1"
104
+ }
105
+ }],
106
+ "audited_organizations": [],
107
+
108
+ "spaces": [],
109
+ "managed_spaces": [],
110
+ "audited_spaces": []
111
+ }
112
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "total_results": 3,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "organization-id-1",
10
+ "url": "/v2/organizations/organization-id-1"
11
+ },
12
+ "entity": {
13
+ "name": "organization-name-1",
14
+ "spaces": [{
15
+ "metadata": {
16
+ "guid": "space-id-1",
17
+ "url": "/v2/users/space-id-1"
18
+ },
19
+ "entity": {
20
+ "name": "space-name-1"
21
+ }
22
+ }],
23
+ "managers": [{
24
+ "metadata": {
25
+ "guid": "user-id-1",
26
+ "url": "/v2/users/user-id-1"
27
+ },
28
+ "entity": {
29
+ "admin": false,
30
+ "active": false,
31
+ "default_space_guid": "space-id-1"
32
+ }
33
+ }]
34
+ }
35
+ },
36
+ {
37
+ "metadata": {
38
+ "guid": "two-managers-organization-id-1",
39
+ "url": "/v2/organizations/two-managers-organization-id-1"
40
+ },
41
+ "entity": {
42
+ "name": "two-managers-organization-name-1",
43
+ "managers": [
44
+ {
45
+ "metadata": {
46
+ "guid": "user-id-1",
47
+ "url": "/v2/users/user-id-1"
48
+ },
49
+ "entity": {
50
+ "admin": false,
51
+ "active": false,
52
+ "default_space_guid": "two-managers-space-id-1"
53
+ }
54
+ },
55
+ {
56
+ "metadata": {
57
+ "guid": "other-user-id-1",
58
+ "url": "/v2/users/other-user-id-1",
59
+ "created_at": "2012-10-24 12:14:54 -0700",
60
+ "updated_at": "2012-10-24 12:16:11 -0700"
61
+ },
62
+ "entity": {
63
+ "admin": false,
64
+ "active": false,
65
+ "default_space_guid": "two-managers-space-id-1"
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ },
71
+ {
72
+ "metadata": {
73
+ "guid": "other-organization-id-1",
74
+ "url": "/v2/organizations/other-organization-id-1"
75
+ },
76
+ "entity": {
77
+ "name": "other-organization-name-1",
78
+ "managers": [{
79
+ "metadata": {
80
+ "guid": "other-user-id-1",
81
+ "url": "/v2/users/other-user-id-1"
82
+ },
83
+ "entity": {
84
+ "admin": false,
85
+ "active": false,
86
+ "default_space_guid": "other-space-id-1"
87
+ }
88
+ }]
89
+ }
90
+ }
91
+ ]
92
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "metadata":{
3
+ "guid":"user-id-1",
4
+ "url":"/v2/users/user-id-1",
5
+ "created_at":"2012-08-13 12:48:41 -0700",
6
+ "updated_at":"2012-08-13 12:55:10 -0700"
7
+ },
8
+ "entity":{
9
+ "organizations":[
10
+ {
11
+ "metadata":{
12
+ "guid":"organization-id-1",
13
+ "url":"/v2/organizations/organization-id-1"
14
+ },
15
+ "entity":{
16
+ "name":"organization-name-1",
17
+ "spaces":[{
18
+ "metadata":{
19
+ "guid":"space-id-1",
20
+ "url":"/v2/users/space-id-1"
21
+ },
22
+ "entity":{
23
+ "name":"space-name-1"
24
+ }
25
+ }],
26
+ "managers":[{
27
+ "metadata":{
28
+ "guid":"user-id-1",
29
+ "url":"/v2/users/user-id-1"
30
+ },
31
+ "entity":{}
32
+ }]
33
+ }
34
+ },
35
+ {
36
+ "metadata":{
37
+ "guid":"organization-two-managers-id-1",
38
+ "url":"/v2/organizations/organization-two-managers-id-1"
39
+ },
40
+ "entity":{
41
+ "name":"organization-two-managers-name-1",
42
+ "managers":[{
43
+ "metadata":{
44
+ "guid":"user-id-1",
45
+ "url":"/v2/users/user-id-1"
46
+ },
47
+ "entity":{}
48
+ }, {
49
+ "metadata":{
50
+ "guid":"other-user-id-1",
51
+ "url":"/v2/users/other-user-id-1",
52
+ "created_at":"2012-10-24 12:14:54 -0700",
53
+ "updated_at":"2012-10-24 12:16:11 -0700"
54
+ },
55
+ "entity":{}
56
+ }]
57
+ }
58
+ },
59
+ {
60
+ "metadata":{
61
+ "guid":"organization-other-managers-id-1",
62
+ "url":"/v2/organizations/organization-other-managers-id-1"
63
+ },
64
+ "entity":{
65
+ "name":"organization-other-managers-name-1",
66
+ "managers":[{
67
+ "metadata":{
68
+ "guid":"other-user-id-1",
69
+ "url":"/v2/users/other-user-id-1"
70
+ },
71
+ "entity":{}
72
+ }]
73
+ }
74
+ }
75
+ ],
76
+
77
+ "managed_organizations":[],
78
+ "billing_managed_organizations":[],
79
+ "audited_organizations":[],
80
+
81
+ "spaces":[],
82
+ "managed_spaces":[],
83
+ "audited_spaces":[]
84
+ }
85
+ }