new_cfoundry 4.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +11 -0
  8. data/Checkfile +2 -0
  9. data/Gemfile +3 -0
  10. data/LICENSE +987 -0
  11. data/NOTICE +10 -0
  12. data/README.md +9 -0
  13. data/Rakefile +14 -0
  14. data/VERSION +1 -0
  15. data/cfoundry.gemspec +40 -0
  16. data/config/locales/en.yml +168 -0
  17. data/lib/cc_api_stub/app_usage_events.rb +11 -0
  18. data/lib/cc_api_stub/applications.rb +57 -0
  19. data/lib/cc_api_stub/domains.rb +32 -0
  20. data/lib/cc_api_stub/events.rb +11 -0
  21. data/lib/cc_api_stub/frameworks.rb +22 -0
  22. data/lib/cc_api_stub/helper.rb +148 -0
  23. data/lib/cc_api_stub/login.rb +21 -0
  24. data/lib/cc_api_stub/organization_users.rb +27 -0
  25. data/lib/cc_api_stub/organizations.rb +82 -0
  26. data/lib/cc_api_stub/routes.rb +26 -0
  27. data/lib/cc_api_stub/runtimes.rb +22 -0
  28. data/lib/cc_api_stub/service_bindings.rb +22 -0
  29. data/lib/cc_api_stub/service_instances.rb +22 -0
  30. data/lib/cc_api_stub/services.rb +21 -0
  31. data/lib/cc_api_stub/space_users.rb +27 -0
  32. data/lib/cc_api_stub/spaces.rb +58 -0
  33. data/lib/cc_api_stub/users.rb +85 -0
  34. data/lib/cc_api_stub.rb +20 -0
  35. data/lib/cfoundry/auth_token.rb +63 -0
  36. data/lib/cfoundry/baseclient.rb +216 -0
  37. data/lib/cfoundry/chatty_hash.rb +46 -0
  38. data/lib/cfoundry/client.rb +42 -0
  39. data/lib/cfoundry/concerns/login_helpers.rb +14 -0
  40. data/lib/cfoundry/concerns/proxy_options.rb +17 -0
  41. data/lib/cfoundry/errors.rb +163 -0
  42. data/lib/cfoundry/rest_client.rb +317 -0
  43. data/lib/cfoundry/test_support.rb +3 -0
  44. data/lib/cfoundry/trace_helpers.rb +64 -0
  45. data/lib/cfoundry/uaaclient.rb +160 -0
  46. data/lib/cfoundry/upload_helpers.rb +222 -0
  47. data/lib/cfoundry/v2/app.rb +303 -0
  48. data/lib/cfoundry/v2/app_event.rb +13 -0
  49. data/lib/cfoundry/v2/app_instance.rb +74 -0
  50. data/lib/cfoundry/v2/app_usage_event.rb +14 -0
  51. data/lib/cfoundry/v2/base.rb +108 -0
  52. data/lib/cfoundry/v2/client.rb +104 -0
  53. data/lib/cfoundry/v2/domain.rb +20 -0
  54. data/lib/cfoundry/v2/event.rb +17 -0
  55. data/lib/cfoundry/v2/helper.rb +11 -0
  56. data/lib/cfoundry/v2/managed_service_instance.rb +12 -0
  57. data/lib/cfoundry/v2/model.rb +211 -0
  58. data/lib/cfoundry/v2/model_magic/attribute.rb +49 -0
  59. data/lib/cfoundry/v2/model_magic/client_extensions.rb +170 -0
  60. data/lib/cfoundry/v2/model_magic/has_summary.rb +49 -0
  61. data/lib/cfoundry/v2/model_magic/query_multi_value_helper.rb +21 -0
  62. data/lib/cfoundry/v2/model_magic/query_value_helper.rb +33 -0
  63. data/lib/cfoundry/v2/model_magic/queryable_by.rb +39 -0
  64. data/lib/cfoundry/v2/model_magic/to_many.rb +138 -0
  65. data/lib/cfoundry/v2/model_magic/to_one.rb +81 -0
  66. data/lib/cfoundry/v2/model_magic.rb +134 -0
  67. data/lib/cfoundry/v2/organization.rb +44 -0
  68. data/lib/cfoundry/v2/quota_definition.rb +12 -0
  69. data/lib/cfoundry/v2/route.rb +25 -0
  70. data/lib/cfoundry/v2/service.rb +22 -0
  71. data/lib/cfoundry/v2/service_auth_token.rb +9 -0
  72. data/lib/cfoundry/v2/service_binding.rb +10 -0
  73. data/lib/cfoundry/v2/service_broker.rb +12 -0
  74. data/lib/cfoundry/v2/service_instance.rb +14 -0
  75. data/lib/cfoundry/v2/service_plan.rb +16 -0
  76. data/lib/cfoundry/v2/space.rb +30 -0
  77. data/lib/cfoundry/v2/stack.rb +10 -0
  78. data/lib/cfoundry/v2/user.rb +93 -0
  79. data/lib/cfoundry/v2/user_provided_service_instance.rb +15 -0
  80. data/lib/cfoundry/validator.rb +41 -0
  81. data/lib/cfoundry/version.rb +4 -0
  82. data/lib/cfoundry/zip.rb +56 -0
  83. data/lib/cfoundry.rb +5 -0
  84. data/release_notes/release_1_5_3.md +177 -0
  85. data/release_notes/release_2.3.1.md +14 -0
  86. data/release_notes/release_2.3.3.md +38 -0
  87. data/release_notes/release_2.3.4.md +16 -0
  88. data/release_notes/release_2.3.5.md +14 -0
  89. data/release_notes/release_2.3.6.md +14 -0
  90. data/release_notes/release_2.3.6.rc1.md +29 -0
  91. data/release_notes/release_2.3.6.rc2.md +19 -0
  92. data/release_notes/release_2.3.7.rc1.md +14 -0
  93. data/release_notes/release_2.4.0.md +41 -0
  94. data/release_notes/release_2.4.1.rc1.md +58 -0
  95. data/release_notes/release_3.0.0.md +21 -0
  96. data/release_notes/release_3.0.1.md +16 -0
  97. data/release_notes/release_3.0.2.rc1.md +19 -0
  98. data/release_notes/release_4.0.0.md +19 -0
  99. data/release_notes/release_4.0.1.md +14 -0
  100. data/release_notes/release_4.0.2.rc1.md +14 -0
  101. data/release_notes/release_4.0.2.rc2.md +11 -0
  102. data/release_notes/release_4.0.2.rc3.md +11 -0
  103. data/release_notes/release_4.0.2.rc4.md +19 -0
  104. data/release_notes/release_4.0.2.rc5.md +14 -0
  105. data/release_notes/release_4.0.3.md +19 -0
  106. data/release_notes/release_4.0.4.rc1.md +14 -0
  107. data/release_notes/release_4.0.4.rc2.md +14 -0
  108. data/release_notes/release_4.1.0.md +19 -0
  109. data/release_notes/release_4.2.0.rc.md +24 -0
  110. data/release_notes/release_4.3.0.md +22 -0
  111. data/release_notes/release_4.3.1.md +14 -0
  112. data/release_notes/release_4.3.10.md +14 -0
  113. data/release_notes/release_4.3.11.md +14 -0
  114. data/release_notes/release_4.3.12.md +14 -0
  115. data/release_notes/release_4.3.2.rc1.md +21 -0
  116. data/release_notes/release_4.3.3.md +24 -0
  117. data/release_notes/release_4.3.4.md +11 -0
  118. data/release_notes/release_4.3.4.rc1.md +24 -0
  119. data/release_notes/release_4.3.5.md +36 -0
  120. data/release_notes/release_4.3.5.rc1.md +21 -0
  121. data/release_notes/release_4.3.6.md +14 -0
  122. data/release_notes/release_4.3.7.md +50 -0
  123. data/release_notes/release_4.3.8.md +19 -0
  124. data/release_notes/release_4.3.9.md +14 -0
  125. data/release_notes/release_4.4.0.md +16 -0
  126. data/release_notes/release_4.5.1.md +11 -0
  127. data/release_notes/release_4.5.2.md +14 -0
  128. data/release_notes/release_4.5.3.md +29 -0
  129. data/release_notes/release_4.6.0.md +24 -0
  130. data/release_notes/release_4.6.1.md +14 -0
  131. data/release_notes/release_4.6.2.md +16 -0
  132. data/release_notes/release_4.6.3.rc1.md +14 -0
  133. data/release_notes/release_4.6.3.rc2.md +14 -0
  134. data/release_notes/release_4.6.3.rc3.md +17 -0
  135. data/release_notes/release_4.7.0.md +11 -0
  136. data/release_notes/release_4.7.1.md +14 -0
  137. data/release_notes/release_4.7.1.rc.1.md +14 -0
  138. data/release_notes/release_4.7.1.rc1.md +19 -0
  139. data/script/gpp +3 -0
  140. data/spec/cc_api_stub/app_usage_events_spec.rb +12 -0
  141. data/spec/cc_api_stub/applications_spec.rb +69 -0
  142. data/spec/cc_api_stub/domains_spec.rb +40 -0
  143. data/spec/cc_api_stub/events_spec.rb +12 -0
  144. data/spec/cc_api_stub/frameworks_spec.rb +19 -0
  145. data/spec/cc_api_stub/login_spec.rb +20 -0
  146. data/spec/cc_api_stub/organization_users_spec.rb +35 -0
  147. data/spec/cc_api_stub/organizations_spec.rb +118 -0
  148. data/spec/cc_api_stub/routes_spec.rb +19 -0
  149. data/spec/cc_api_stub/runtimes_spec.rb +19 -0
  150. data/spec/cc_api_stub/service_bindings_spec.rb +13 -0
  151. data/spec/cc_api_stub/service_instances_spec.rb +19 -0
  152. data/spec/cc_api_stub/services_spec.rb +11 -0
  153. data/spec/cc_api_stub/space_users_spec.rb +35 -0
  154. data/spec/cc_api_stub/spaces_spec.rb +38 -0
  155. data/spec/cc_api_stub/users_spec.rb +107 -0
  156. data/spec/cfoundry/auth_token_spec.rb +154 -0
  157. data/spec/cfoundry/baseclient_spec.rb +298 -0
  158. data/spec/cfoundry/client_spec.rb +13 -0
  159. data/spec/cfoundry/errors_spec.rb +117 -0
  160. data/spec/cfoundry/rest_client_spec.rb +349 -0
  161. data/spec/cfoundry/trace_helpers_spec.rb +91 -0
  162. data/spec/cfoundry/uaaclient_spec.rb +435 -0
  163. data/spec/cfoundry/upload_helpers_spec.rb +182 -0
  164. data/spec/cfoundry/v2/app_event_spec.rb +97 -0
  165. data/spec/cfoundry/v2/app_instance_spec.rb +31 -0
  166. data/spec/cfoundry/v2/app_spec.rb +354 -0
  167. data/spec/cfoundry/v2/app_usage_event_spec.rb +15 -0
  168. data/spec/cfoundry/v2/base_spec.rb +375 -0
  169. data/spec/cfoundry/v2/client_spec.rb +121 -0
  170. data/spec/cfoundry/v2/domain_spec.rb +63 -0
  171. data/spec/cfoundry/v2/event_spec.rb +15 -0
  172. data/spec/cfoundry/v2/managed_service_instance_spec.rb +149 -0
  173. data/spec/cfoundry/v2/model_magic/attribute_spec.rb +123 -0
  174. data/spec/cfoundry/v2/model_magic/has_summary_spec.rb +17 -0
  175. data/spec/cfoundry/v2/model_magic/to_many_spec.rb +53 -0
  176. data/spec/cfoundry/v2/model_magic/to_one_spec.rb +106 -0
  177. data/spec/cfoundry/v2/model_magic_spec.rb +43 -0
  178. data/spec/cfoundry/v2/model_spec.rb +434 -0
  179. data/spec/cfoundry/v2/organization_spec.rb +135 -0
  180. data/spec/cfoundry/v2/quota_definition_spec.rb +50 -0
  181. data/spec/cfoundry/v2/route_spec.rb +42 -0
  182. data/spec/cfoundry/v2/service_plan_spec.rb +53 -0
  183. data/spec/cfoundry/v2/service_spec.rb +58 -0
  184. data/spec/cfoundry/v2/space_spec.rb +13 -0
  185. data/spec/cfoundry/v2/user_provided_service_instance_spec.rb +57 -0
  186. data/spec/cfoundry/v2/user_spec.rb +206 -0
  187. data/spec/cfoundry/validator_spec.rb +94 -0
  188. data/spec/factories/app_events_factory.rb +7 -0
  189. data/spec/factories/app_usage_events_factory.rb +32 -0
  190. data/spec/factories/apps_factory.rb +11 -0
  191. data/spec/factories/clients_factory.rb +7 -0
  192. data/spec/factories/domains_factory.rb +10 -0
  193. data/spec/factories/events_factory.rb +50 -0
  194. data/spec/factories/organizations_factory.rb +12 -0
  195. data/spec/factories/quota_definitions_factory.rb +8 -0
  196. data/spec/factories/routes_factory.rb +10 -0
  197. data/spec/factories/service_instances_factory.rb +10 -0
  198. data/spec/factories/service_plans_factory.rb +10 -0
  199. data/spec/factories/services_factory.rb +10 -0
  200. data/spec/factories/spaces_factory.rb +10 -0
  201. data/spec/factories/user_provided_service_instances_factory.rb +10 -0
  202. data/spec/factories/users_factory.rb +10 -0
  203. data/spec/fixtures/apps/with_cfignore/.cfignore +4 -0
  204. data/spec/fixtures/apps/with_cfignore/.hidden_file +1 -0
  205. data/spec/fixtures/apps/with_cfignore/ambiguous_ignored +0 -0
  206. data/spec/fixtures/apps/with_cfignore/ignored_dir/file_in_ignored_dir.txt +1 -0
  207. data/spec/fixtures/apps/with_cfignore/ignored_file.txt +1 -0
  208. data/spec/fixtures/apps/with_cfignore/non_ignored_dir/file_in_non_ignored_dir.txt +1 -0
  209. data/spec/fixtures/apps/with_cfignore/non_ignored_dir/ignored_file.txt +1 -0
  210. data/spec/fixtures/apps/with_cfignore/non_ignored_dir/toplevel_ignored.txt +0 -0
  211. data/spec/fixtures/apps/with_cfignore/non_ignored_file.txt +1 -0
  212. data/spec/fixtures/apps/with_cfignore/toplevel_ignored.txt +0 -0
  213. data/spec/fixtures/apps/with_dotfiles/.dotfile +1 -0
  214. data/spec/fixtures/apps/with_dotfiles/xyz +1 -0
  215. data/spec/fixtures/apps/with_external_symlink/foo +1 -0
  216. data/spec/fixtures/apps/with_ignored_external_symlink/.cfignore +1 -0
  217. data/spec/fixtures/apps/with_ignored_external_symlink/foo +1 -0
  218. data/spec/fixtures/apps/with_nested_directories/foo/bar/baz/fizz +0 -0
  219. data/spec/fixtures/apps/with_nested_directories/xyz +0 -0
  220. data/spec/fixtures/empty_file +0 -0
  221. data/spec/fixtures/fake_cc_app_usage_events.json +152 -0
  222. data/spec/fixtures/fake_cc_application.json +20 -0
  223. data/spec/fixtures/fake_cc_application_summary.json +56 -0
  224. data/spec/fixtures/fake_cc_created_application.json +11 -0
  225. data/spec/fixtures/fake_cc_created_domain.json +15 -0
  226. data/spec/fixtures/fake_cc_created_organization.json +11 -0
  227. data/spec/fixtures/fake_cc_created_route.json +13 -0
  228. data/spec/fixtures/fake_cc_created_service_instance.json +11 -0
  229. data/spec/fixtures/fake_cc_created_space.json +11 -0
  230. data/spec/fixtures/fake_cc_created_user.json +11 -0
  231. data/spec/fixtures/fake_cc_domain.json +55 -0
  232. data/spec/fixtures/fake_cc_domain_spaces.json +27 -0
  233. data/spec/fixtures/fake_cc_empty_search.json +7 -0
  234. data/spec/fixtures/fake_cc_events.json +419 -0
  235. data/spec/fixtures/fake_cc_frameworks.json +20 -0
  236. data/spec/fixtures/fake_cc_managed_service_instance.json +83 -0
  237. data/spec/fixtures/fake_cc_organization.json +161 -0
  238. data/spec/fixtures/fake_cc_organization_domains.json +59 -0
  239. data/spec/fixtures/fake_cc_organization_search.json +37 -0
  240. data/spec/fixtures/fake_cc_organization_spaces.json +99 -0
  241. data/spec/fixtures/fake_cc_organization_summary.json +20 -0
  242. data/spec/fixtures/fake_cc_organization_users.json +81 -0
  243. data/spec/fixtures/fake_cc_route.json +16 -0
  244. data/spec/fixtures/fake_cc_runtimes.json +20 -0
  245. data/spec/fixtures/fake_cc_service_binding.json +22 -0
  246. data/spec/fixtures/fake_cc_service_bindings.json +24 -0
  247. data/spec/fixtures/fake_cc_service_instance.json +83 -0
  248. data/spec/fixtures/fake_cc_service_instances.json +72 -0
  249. data/spec/fixtures/fake_cc_services.json +160 -0
  250. data/spec/fixtures/fake_cc_space.json +45 -0
  251. data/spec/fixtures/fake_cc_space_apps.json +49 -0
  252. data/spec/fixtures/fake_cc_space_summary.json +84 -0
  253. data/spec/fixtures/fake_cc_spaces.json +92 -0
  254. data/spec/fixtures/fake_cc_stats.json +29 -0
  255. data/spec/fixtures/fake_cc_user.json +139 -0
  256. data/spec/fixtures/fake_cc_user_organizations.json +92 -0
  257. data/spec/fixtures/fake_cc_user_provided_service_instance.json +51 -0
  258. data/spec/fixtures/fake_cc_user_with_managers.json +85 -0
  259. data/spec/integration/client_spec.rb +38 -0
  260. data/spec/spec_helper.rb +22 -0
  261. data/spec/support/factory_girl.rb +6 -0
  262. data/spec/support/shared_examples/cc_api_stub_request_examples.rb +79 -0
  263. data/spec/support/shared_examples/client_login_examples.rb +46 -0
  264. data/spec/support/shared_examples/model_summary_examples.rb +34 -0
  265. data/spec/support/test_model_builder.rb +10 -0
  266. data/vendor/errors/README.md +4 -0
  267. data/vendor/errors/v1.yml +189 -0
  268. data/vendor/errors/v2.yml +384 -0
  269. metadata +693 -0
@@ -0,0 +1,12 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class QuotaDefinition < Model
5
+ attribute :name, :string
6
+ attribute :non_basic_services_allowed, :boolean
7
+ attribute :total_services, :integer
8
+ attribute :memory_limit, :integer
9
+
10
+ queryable_by :name
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class Route < Model
5
+ attribute :host, :string
6
+ validates_format_of :host, :with => /\A[a-z]+([a-z0-9\-]*[a-z0-9]+)?\Z/i
7
+ validates_length_of :host, :maximum => 63
8
+ validates_presence_of :domain
9
+ validates_presence_of :space
10
+ to_one :domain
11
+ to_one :space
12
+
13
+ queryable_by :host, :domain_guid
14
+
15
+ def name
16
+ "#{host}.#{domain.name}"
17
+ end
18
+
19
+ private
20
+
21
+ def attribute_for_error(error)
22
+ error.is_a?(CFoundry::RouteHostTaken) ? :host : :base
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class Service < Model
5
+ attribute :label, String
6
+ attribute :provider, String
7
+ attribute :unique_id, String
8
+ attribute :url, :url
9
+ attribute :description, String
10
+ attribute :version, String
11
+ attribute :info_url, :url
12
+ attribute :acls, { "users" => [String], "wildcards" => [String] },
13
+ :default => nil
14
+ attribute :timeout, Integer, :default => nil
15
+ attribute :active, :boolean, :default => false
16
+ attribute :extra, String
17
+ attribute :tags, [String]
18
+ to_many :service_plans
19
+
20
+ queryable_by :service_plan_guid
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class ServiceAuthToken < Model
5
+ attribute :label, :string
6
+ attribute :provider, :string
7
+ attribute :token, :string
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class ServiceBinding < Model
5
+ to_one :app
6
+ to_one :service_instance
7
+
8
+ queryable_by :app_guid, :service_instance_guid
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class ServiceBroker < Model
5
+ attribute :name, :string
6
+ attribute :broker_url, :string
7
+ attribute :auth_username, :string
8
+ attribute :auth_password, :string
9
+
10
+ queryable_by :name
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class ServiceInstance < Model
5
+ attribute :name, :string
6
+ attribute :dashboard_url, :string
7
+ to_one :space
8
+ to_many :service_bindings
9
+
10
+ scoped_to_space
11
+
12
+ queryable_by :name, :space_guid, :service_plan_guid, :service_binding_guid, :gateway_name
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class ServicePlan < Model
5
+ attribute :name, :string
6
+ attribute :description, :string
7
+ attribute :unique_id, String
8
+ attribute :free, :boolean, :default => false
9
+ attribute :extra, :string
10
+ attribute :public, :boolean
11
+ to_one :service
12
+ to_many :service_instances
13
+
14
+ queryable_by :service_guid, :service_instance_guid
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ require "cfoundry/v2/model"
2
+ require "cfoundry/v2/helper"
3
+
4
+ module CFoundry::V2
5
+ class Space < Model
6
+ extend Helper
7
+
8
+ attribute :name, :string
9
+ to_one :organization
10
+ to_many :developers, :as => :user
11
+ to_many :managers, :as => :user
12
+ to_many :auditors, :as => :user
13
+ to_many :apps
14
+ to_many :domains
15
+ to_many :service_instances
16
+ to_many :services
17
+
18
+ to_many_support :developers
19
+ to_many_support :managers
20
+ to_many_support :auditors
21
+ to_many_support :apps
22
+ to_many_support :domains
23
+ to_many_support :service_instances
24
+ to_many_support :services
25
+
26
+ scoped_to_organization
27
+
28
+ queryable_by :name, :organization_guid, :developer_guid, :app_guid
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+
2
+ require "cfoundry/v2/model"
3
+
4
+ module CFoundry::V2
5
+ class Stack < Model
6
+ attribute :name, :string
7
+
8
+ queryable_by :name
9
+ end
10
+ end
@@ -0,0 +1,93 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry
4
+ module V2
5
+ class User < Model
6
+ to_many :spaces
7
+ to_many :organizations
8
+ to_many :managed_organizations, :as => :organization
9
+ to_many :billing_managed_organizations, :as => :organization
10
+ to_many :audited_organizations, :as => :organization
11
+ to_many :managed_spaces, :as => :space
12
+ to_many :audited_spaces, :as => :space
13
+ attribute :admin, :boolean
14
+ to_one :default_space, :as => :space
15
+
16
+ attribute :guid, :string # guid is explicitly set for users
17
+
18
+ queryable_by :space_guid, :organization_guid, :managed_organization_guid,
19
+ :billing_managed_organization_guid, :audited_organization_guid,
20
+ :managed_space_guid, :audited_space_guid
21
+
22
+ def guid
23
+ @guid
24
+ end
25
+
26
+ alias set_guid_attribute guid=
27
+
28
+ def guid=(x)
29
+ @guid = x
30
+ set_guid_attribute(x)
31
+ end
32
+
33
+ alias :admin? :admin
34
+
35
+ def change_password!(new, old)
36
+ @client.base.uaa.change_password(@guid, new, old)
37
+ end
38
+
39
+ # optional metadata from UAA
40
+ attr_accessor :emails, :name
41
+
42
+ def email
43
+ # if the email collection is nil or empty? collect from UAA
44
+ get_meta_from_uaa if @emails.nil?
45
+
46
+ return unless @emails && @emails.first
47
+ @emails.first[:value]
48
+ end
49
+
50
+ def given_name
51
+ get_meta_from_uaa if @name.nil?
52
+
53
+ return unless @name && @name[:givenName] != email
54
+ @name[:givenName]
55
+ end
56
+
57
+ def family_name
58
+ get_meta_from_uaa if @name.nil?
59
+
60
+ return unless @name && @name[:familyName] != email
61
+ @name[:familyName]
62
+ end
63
+
64
+ def full_name
65
+ if @name && @name[:fullName]
66
+ @name[:fullName]
67
+ elsif given_name && family_name
68
+ "#{given_name} #{family_name}"
69
+ end
70
+ end
71
+
72
+ def delete! (options = {})
73
+ super(options)
74
+ @client.base.uaa.delete_user(guid)
75
+ true
76
+ end
77
+
78
+ private
79
+
80
+ def get_meta_from_uaa
81
+ user = @client.base.uaa.user(guid)
82
+ return if user.nil?
83
+ return if not user[:error].nil?
84
+
85
+ @emails = user[:emails]
86
+ @name ||= {}
87
+ @name[:familyName] = user[:name][:familyname]
88
+ @name[:givenName] = user[:name][:givenname]
89
+ end
90
+
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,15 @@
1
+ require "cfoundry/v2/service_instance"
2
+
3
+ module CFoundry::V2
4
+ class UserProvidedServiceInstance < ServiceInstance
5
+ attribute :credentials, :hash
6
+
7
+ def self.object_name
8
+ 'service_instance'
9
+ end
10
+
11
+ def create_endpoint_name
12
+ 'user_provided_service_instances'
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,41 @@
1
+ module CFoundry
2
+ module Validator
3
+ class << self
4
+ def value_matches?(val, type)
5
+ return true if val.nil?
6
+
7
+ case type
8
+ when Class
9
+ val.is_a?(type)
10
+ when Regexp
11
+ val.is_a?(String) && !!(val =~ type)
12
+ when :url
13
+ value_matches?(val, URI::regexp(%w(http https)))
14
+ when :https_url
15
+ value_matches?(val, URI::regexp("https"))
16
+ when :boolean
17
+ val.is_a?(TrueClass) || val.is_a?(FalseClass)
18
+ when Array
19
+ val.all? do |x|
20
+ value_matches?(x, type.first)
21
+ end
22
+ when Hash
23
+ val.is_a?(Hash) &&
24
+ type.all? { |name, subtype|
25
+ val.key?(name) && value_matches?(val[name], subtype)
26
+ }
27
+ when nil
28
+ true
29
+ else
30
+ val.is_a?(Object.const_get(type.to_s.capitalize))
31
+ end
32
+ end
33
+
34
+ def validate_type(val, type)
35
+ unless value_matches?(val, type)
36
+ raise CFoundry::Mismatch.new(type, val)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,4 @@
1
+ module CFoundry # :nodoc:
2
+ # CFoundry library version number.
3
+ VERSION = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).freeze
4
+ end
@@ -0,0 +1,56 @@
1
+ require "zip/zipfilesystem"
2
+
3
+ module CFoundry
4
+ # Generic Zpi API. Uses rubyzip underneath, but may be changed in the future
5
+ # to use system zip command if necessary.
6
+ module Zip
7
+ # Directory entries to exclude from packing.
8
+ PACK_EXCLUSION_GLOBS = %w(.. . *~ #*# *.log)
9
+
10
+ module_function
11
+
12
+ # Get the entries in the zip file. Returns an array of the entire
13
+ # contents, recursively (not just top-level).
14
+ def entry_lines(file)
15
+ entries = []
16
+ ::Zip::ZipFile.foreach(file) do |zentry|
17
+ entries << zentry
18
+ end
19
+ entries
20
+ end
21
+
22
+ # Unpack a zip +file+ to directory +dest+.
23
+ def unpack(file, dest)
24
+ ::Zip::ZipFile.foreach(file) do |zentry|
25
+ epath = "#{dest}/#{zentry}"
26
+ dirname = File.dirname(epath)
27
+ FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
28
+ zentry.extract(epath) unless File.exists?(epath)
29
+ end
30
+ end
31
+
32
+ # Determine what files in +dir+ to pack.
33
+ def files_to_pack(dir)
34
+ Dir.glob("#{dir}/**/*", File::FNM_DOTMATCH).select do |f|
35
+ File.exists?(f) &&
36
+ PACK_EXCLUSION_GLOBS.none? do |e|
37
+ File.fnmatch(e, File.basename(f))
38
+ end
39
+ end
40
+ end
41
+
42
+ # Package directory +dir+ as file +zipfile+.
43
+ def pack(dir, zipfile)
44
+ files = files_to_pack(dir)
45
+ return false if files.empty?
46
+
47
+ ::Zip::ZipFile.open(zipfile, true) do |zf|
48
+ files.each do |f|
49
+ zf.add(f.sub("#{dir}/",''), f)
50
+ end
51
+ end
52
+
53
+ true
54
+ end
55
+ end
56
+ end
data/lib/cfoundry.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "cfoundry/version"
2
+ require "active_model"
3
+ require "cfoundry/client"
4
+
5
+ I18n.load_path += Dir["config/locales/*.yml"]
@@ -0,0 +1,177 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [6af0341d0b10af63efca6e7a9b806abfb037e6ad](git@github.com:cloudfoundry/cfoundry/commit/6af0341d0b10af63efca6e7a9b806abfb037e6ad)
8
+ * Bump to 1.5.3
9
+ * Andreas Maier & Ryan Spore, pair+amaier+ryan@pivotallabs.com
10
+
11
+
12
+ * SHA: [c3d8d7c7075f5c958f33ea3979dba0206a25fa9b](git@github.com:cloudfoundry/cfoundry/commit/c3d8d7c7075f5c958f33ea3979dba0206a25fa9b)
13
+ * Add dashboard url to app summary json stub
14
+
15
+ [#49312147](http://www.pivotaltracker.com/story/49312147)
16
+ * Andreas Maier & Ryan Spore, pair+amaier+ryan@pivotallabs.com
17
+
18
+
19
+ * SHA: [3d315622e4b6bc72aa1ee28197093f666af65bd3](git@github.com:cloudfoundry/cfoundry/commit/3d315622e4b6bc72aa1ee28197093f666af65bd3)
20
+ * Bump to 1.5.2
21
+ * Andreas Maier & Ryan Spore, pair+amaier+ryan@pivotallabs.com
22
+
23
+
24
+ * SHA: [cc6ed2168708e0c92b1bbe2266387bad436ea9d0](git@github.com:cloudfoundry/cfoundry/commit/cc6ed2168708e0c92b1bbe2266387bad436ea9d0)
25
+ * Add dashboard url to space summary json stub
26
+
27
+ [#49312147](http://www.pivotaltracker.com/story/49312147)
28
+ * Andreas Maier & Ryan Spore, pair+amaier+ryan@pivotallabs.com
29
+
30
+
31
+ * SHA: [20d4c1be26f74b6e0441bd45dede535e07760fb7](git@github.com:cloudfoundry/cfoundry/commit/20d4c1be26f74b6e0441bd45dede535e07760fb7)
32
+ * Bump to 1.5.1
33
+ * Andreas Maier & Dennis Schmidt, pair+amaier+dschmidt@pivotallabs.com
34
+
35
+
36
+ * SHA: [1ea770ad09aaa22bd6ed836dfc79cc44b7047371](git@github.com:cloudfoundry/cfoundry/commit/1ea770ad09aaa22bd6ed836dfc79cc44b7047371)
37
+ * Add params to delete method for models
38
+ * Andreas Maier & Dennis Schmidt, pair+amaier+dschmidt@pivotallabs.com
39
+
40
+
41
+ * SHA: [3555b21e4f1e3619f9c33d2ec39a88f5a52aa55b](git@github.com:cloudfoundry/cfoundry/commit/3555b21e4f1e3619f9c33d2ec39a88f5a52aa55b)
42
+ * Bump to 1.5.0
43
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
44
+
45
+
46
+ * SHA: [b27511b7f858c6fec40d80724bdfb7d0c07f0f50](git@github.com:cloudfoundry/cfoundry/commit/b27511b7f858c6fec40d80724bdfb7d0c07f0f50)
47
+ * Added create_model to 'to_many' associations
48
+
49
+ [#50538083](http://www.pivotaltracker.com/story/50538083)
50
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
51
+
52
+
53
+ * SHA: [498d398f555e20c40facb27d168313460b06acd1](git@github.com:cloudfoundry/cfoundry/commit/498d398f555e20c40facb27d168313460b06acd1)
54
+ * Split model magic spec [#50538083](http://www.pivotaltracker.com/story/50538083)
55
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
56
+
57
+
58
+ * SHA: [2e961b18894eb4ef7d3ec6f028e4a3a044ed3536](git@github.com:cloudfoundry/cfoundry/commit/2e961b18894eb4ef7d3ec6f028e4a3a044ed3536)
59
+ * Split ModelMagic into components
60
+
61
+ [#50538083](http://www.pivotaltracker.com/story/50538083)
62
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
63
+
64
+
65
+ * SHA: [e00106c963079201c557089c8637418356c7f1c3](git@github.com:cloudfoundry/cfoundry/commit/e00106c963079201c557089c8637418356c7f1c3)
66
+ * add comments to ModelMagic to improve scanning readability
67
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
68
+
69
+
70
+ * SHA: [16073582fe2dd32a70c1b0dff28436cef27489ab](git@github.com:cloudfoundry/cfoundry/commit/16073582fe2dd32a70c1b0dff28436cef27489ab)
71
+ * Bump to 1.4.0
72
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
73
+
74
+
75
+ * SHA: [f6d1864a73c2fabf5cec6adcd2fe321f326c442a](git@github.com:cloudfoundry/cfoundry/commit/f6d1864a73c2fabf5cec6adcd2fe321f326c442a)
76
+ * add a create_MODELNAME to model magic
77
+
78
+ creates related models from to_one associations
79
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
80
+
81
+
82
+ * SHA: [b0d830d8ae9b8370fdd55751c50b0b7c09f5433a](git@github.com:cloudfoundry/cfoundry/commit/b0d830d8ae9b8370fdd55751c50b0b7c09f5433a)
83
+ * to_one assignment now always returns RHS
84
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
85
+
86
+
87
+ * SHA: [9eb9fd501c0daabc7ddd2343eb927b9dd732602c](git@github.com:cloudfoundry/cfoundry/commit/9eb9fd501c0daabc7ddd2343eb927b9dd732602c)
88
+ * refactor model magic test structure
89
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
90
+
91
+
92
+ * SHA: [48b2b86ecd615f2bc3817a64c24553c48413cd63](git@github.com:cloudfoundry/cfoundry/commit/48b2b86ecd615f2bc3817a64c24553c48413cd63)
93
+ * use active support to camelcase class names in model magic
94
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
95
+
96
+
97
+ * SHA: [e968fdbe81b8e71b6cef2c697a4bbf2266ec1d8f](git@github.com:cloudfoundry/cfoundry/commit/e968fdbe81b8e71b6cef2c697a4bbf2266ec1d8f)
98
+ * change default ruby version to 1.9.3
99
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
100
+
101
+
102
+ * SHA: [a036c6864d96cdc466a09ba03735dd058c5fa2d8](git@github.com:cloudfoundry/cfoundry/commit/a036c6864d96cdc466a09ba03735dd058c5fa2d8)
103
+ * update homepage
104
+ * Dennis Schmidt & Ryan Spore, pair+dschmidt+ryan@pivotallabs.com
105
+
106
+
107
+ * SHA: [02cecf7b85006b762f0e545d4c4176c7abec493c](git@github.com:cloudfoundry/cfoundry/commit/02cecf7b85006b762f0e545d4c4176c7abec493c)
108
+ * Bump to 1.3.0
109
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
110
+
111
+
112
+ * SHA: [472958a273d3e296c79216ecf70646d539bc0e73](git@github.com:cloudfoundry/cfoundry/commit/472958a273d3e296c79216ecf70646d539bc0e73)
113
+ * deleting an app is now always recursive
114
+
115
+ [Finishes #48687083](http://www.pivotaltracker.com/story/48687083)
116
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
117
+
118
+
119
+ * SHA: [667fb54ab7979244f247b58c8c39f035a92c56cd](git@github.com:cloudfoundry/cfoundry/commit/667fb54ab7979244f247b58c8c39f035a92c56cd)
120
+ * fake helpers: support for lookup by guid
121
+
122
+ e.g.:
123
+
124
+ app = fake :app, :guid => "x"
125
+ client = fake_client :apps => [app]
126
+ client.app("x") == app
127
+ * Alex Suraci and Tony Hansmann, pair+alex+thansmann@pivotallabs.com
128
+
129
+
130
+ * SHA: [0984d526dd42b961784447047ad123c9a4e0cfa6](git@github.com:cloudfoundry/cfoundry/commit/0984d526dd42b961784447047ad123c9a4e0cfa6)
131
+ * Bump to 1.2.0
132
+ * Kyriacos Souroullas & Will Read, pair+k+will@pivotallabs.com
133
+
134
+
135
+ * SHA: [85b034156ce27693c9217ec42cfae1b73a80e37b](git@github.com:cloudfoundry/cfoundry/commit/85b034156ce27693c9217ec42cfae1b73a80e37b)
136
+ * Bump to 1.1.0.rc4
137
+ * Kyriacos Souroullas, Ryan Spore & Will Read, pair+k+ryan+will@pivotallabs.com
138
+
139
+
140
+ * SHA: [8c7f787bbd2b322b3f077beb4a3c29c6d50248c7](git@github.com:cloudfoundry/cfoundry/commit/8c7f787bbd2b322b3f077beb4a3c29c6d50248c7)
141
+ * Validate presence of space. Forward values to CC unless object is persisted
142
+ * Kyriacos Souroullas, Ryan Spore & Will Read, pair+k+ryan+will@pivotallabs.com
143
+
144
+
145
+ * SHA: [c63e8b811c7c29e480aad1926c671c98926f05a3](git@github.com:cloudfoundry/cfoundry/commit/c63e8b811c7c29e480aad1926c671c98926f05a3)
146
+ * Bump to 1.1.0.rc3
147
+ * Nicole Sullivan & Will Read, pair+nsullivan+will@pivotallabs.com
148
+
149
+
150
+ * SHA: [9321d5aff68c1a06928c3ba729840e9646855eaf](git@github.com:cloudfoundry/cfoundry/commit/9321d5aff68c1a06928c3ba729840e9646855eaf)
151
+ * Bump to 1.1.0.rc2
152
+ * Andreas Maier & Dennis Schmidt, pair+amaier+dschmidt@pivotallabs.com
153
+
154
+
155
+ * SHA: [f3e4850dc7542863365ff90152952aeff38818f4](git@github.com:cloudfoundry/cfoundry/commit/f3e4850dc7542863365ff90152952aeff38818f4)
156
+ * Add support for dashboard_url for service instances
157
+ * Nicole Sullivan & Will Read, pair+nsullivan+will@pivotallabs.com
158
+
159
+
160
+ * SHA: [b65721d06ef82aead628878bd2921d80f88f0a59](git@github.com:cloudfoundry/cfoundry/commit/b65721d06ef82aead628878bd2921d80f88f0a59)
161
+ * Add to_param
162
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
163
+
164
+
165
+ * SHA: [bd151b2aacb382c7ed6c2b40cadd68661cc5f6f5](git@github.com:cloudfoundry/cfoundry/commit/bd151b2aacb382c7ed6c2b40cadd68661cc5f6f5)
166
+ * [#49684499](http://www.pivotaltracker.com/story/49684499) update json_pure and multi_json gems
167
+ * Andreas Maier & Dennis Schmidt, pair+amaier+dschmidt@pivotallabs.com
168
+
169
+
170
+ * SHA: [0aa80b27e39604dbf6af4166159f208eb1de847d](git@github.com:cloudfoundry/cfoundry/commit/0aa80b27e39604dbf6af4166159f208eb1de847d)
171
+ * when not persisted, don't fetch values from CC
172
+ * Kyriacos Souroullas & Ryan Spore, pair+k+ryan@pivotallabs.com
173
+
174
+
175
+ ------
176
+
177
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,14 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [03227a6aafda336215d668ab00392425f6e40683](git@github.com:cloudfoundry/cfou/commit/03227a6aafda336215d668ab00392425f6e40683)
8
+ * use correct association name in to_one
9
+ * Joseph Palermo and Ryan Spore, pair+joseph+ryan@pivotallabs.com
10
+
11
+
12
+ ------
13
+
14
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,38 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [d5e70049400a530809bbcc9f4c41a5ab9d83d025](git@github.com:cloudfoundry/cfou/commit/d5e70049400a530809bbcc9f4c41a5ab9d83d025)
8
+ * [#52099539](http://www.pivotaltracker.com/story/52099539) Enable billing on organization-id-1
9
+ * Andreas Maier and Joseph Palermo, pair+amaier+joseph@pivotallabs.com
10
+
11
+
12
+ * SHA: [dc69bb118b053959649b70f395d0868e7f4bd9dd](git@github.com:cloudfoundry/cfou/commit/dc69bb118b053959649b70f395d0868e7f4bd9dd)
13
+ * MODELs(:query => query), MODEL_by_ATTR, and MODELs_by_ATTR filter by appropriate query params
14
+ * Corbin Halliwill & David Sabeti, pair+challi+dsabeti@pivotallabs.com
15
+
16
+
17
+ * SHA: [038a4277da8cb485c9bde9df14bcc644ccb3d210](git@github.com:cloudfoundry/cfou/commit/038a4277da8cb485c9bde9df14bcc644ccb3d210)
18
+ * Merge pull request #4 from youngm/master
19
+
20
+ Support ssl/https in BaseClient.stream_url()
21
+ * ry4n1m3, ry4n1m3@gmail.com
22
+
23
+
24
+ * SHA: [4df19c89309e967626ff2dd242d304662bf02ed2](git@github.com:cloudfoundry/cfou/commit/4df19c89309e967626ff2dd242d304662bf02ed2)
25
+ * fix gem release rake task
26
+
27
+ include updated version when committing version bump
28
+ * Ryan Spore and Stephen Levine, pair+ryan+slevine@pivotallabs.com
29
+
30
+
31
+ * SHA: [a293d670942cb9f64fb950faabb0a99af72563a1](git@github.com:cloudfoundry/cfou/commit/a293d670942cb9f64fb950faabb0a99af72563a1)
32
+ * Support for ssl in Baseclient.stream_url
33
+ * Mike Youngstrom, youngm@gmail.com
34
+
35
+
36
+ ------
37
+
38
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,16 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [362e412f3a111d254ced392e5905ef77a323ddba](git@github.com:cloudfoundry/cfou/commit/362e412f3a111d254ced392e5905ef77a323ddba)
8
+ * Revert "MODELs(:query => query), MODEL_by_ATTR, and MODELs_by_ATTR filter by appropriate query params"
9
+
10
+ This reverts commit dc69bb118b053959649b70f395d0868e7f4bd9dd.
11
+ * Joseph Palermo and Will Read, pair+joseph+will@pivotallabs.com
12
+
13
+
14
+ ------
15
+
16
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,14 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [790f1bf317bad591988288d4a074b0fbb7f9d001](git@github.com:cloudfoundry/cfou/commit/790f1bf317bad591988288d4a074b0fbb7f9d001)
8
+ * User delete returns true if successful
9
+ * Joseph Palermo and Will Read, pair+joseph+will@pivotallabs.com
10
+
11
+
12
+ ------
13
+
14
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,14 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: [4d12c037de649c98e7c2d58f927e77c0927d85c4](git@github.com:cloudfoundry/cfou/commit/4d12c037de649c98e7c2d58f927e77c0927d85c4)
8
+ * Add deprecation warning to CFoundry::Client.new
9
+ * David Sabeti and Ryan Spore, pair+dsabeti+ryan@pivotallabs.com
10
+
11
+
12
+ ------
13
+
14
+ _Release Notes generated with [Anchorman](http://github.com/infews/anchorman)_