Skip to content
Browse files

Merge pull request #1415 from fog/deprecate_connection_option

Deprecate connection option
  • Loading branch information...
2 parents b166bb2 + c9356ef commit 44e84f571fe47c7872dec9ec983fa822b972b66e @geemus geemus committed Jan 7, 2013
Showing with 1,173 additions and 1,108 deletions.
  1. +2 −2 lib/fog/atmos/models/storage/directories.rb
  2. +11 −11 lib/fog/atmos/models/storage/directory.rb
  3. +8 −8 lib/fog/atmos/models/storage/file.rb
  4. +3 −3 lib/fog/atmos/models/storage/files.rb
  5. +2 −2 lib/fog/aws/models/auto_scaling/activities.rb
  6. +1 −1 lib/fog/aws/models/auto_scaling/activity.rb
  7. +2 −2 lib/fog/aws/models/auto_scaling/configuration.rb
  8. +2 −2 lib/fog/aws/models/auto_scaling/configurations.rb
  9. +12 −12 lib/fog/aws/models/auto_scaling/group.rb
  10. +2 −2 lib/fog/aws/models/auto_scaling/groups.rb
  11. +5 −5 lib/fog/aws/models/auto_scaling/instance.rb
  12. +2 −2 lib/fog/aws/models/auto_scaling/instances.rb
  13. +2 −2 lib/fog/aws/models/auto_scaling/policies.rb
  14. +2 −2 lib/fog/aws/models/auto_scaling/policy.rb
  15. +7 −7 lib/fog/aws/models/beanstalk/application.rb
  16. +2 −2 lib/fog/aws/models/beanstalk/applications.rb
  17. +10 −10 lib/fog/aws/models/beanstalk/environment.rb
  18. +2 −2 lib/fog/aws/models/beanstalk/environments.rb
  19. +1 −1 lib/fog/aws/models/beanstalk/events.rb
  20. +5 −5 lib/fog/aws/models/beanstalk/template.rb
  21. +3 −3 lib/fog/aws/models/beanstalk/templates.rb
  22. +6 −6 lib/fog/aws/models/beanstalk/version.rb
  23. +2 −2 lib/fog/aws/models/beanstalk/versions.rb
  24. +4 −4 lib/fog/aws/models/cdn/distribution.rb
  25. +2 −2 lib/fog/aws/models/cdn/distributions.rb
  26. +1 −1 lib/fog/aws/models/cdn/invalidation.rb
  27. +2 −2 lib/fog/aws/models/cdn/invalidations.rb
  28. +3 −3 lib/fog/aws/models/cdn/streaming_distribution.rb
  29. +2 −2 lib/fog/aws/models/cdn/streaming_distributions.rb
  30. +2 −2 lib/fog/aws/models/cloud_watch/alarm.rb
  31. +9 −9 lib/fog/aws/models/cloud_watch/alarm_data.rb
  32. +3 −3 lib/fog/aws/models/cloud_watch/alarm_datum.rb
  33. +1 −1 lib/fog/aws/models/cloud_watch/alarm_histories.rb
  34. +5 −5 lib/fog/aws/models/cloud_watch/alarms.rb
  35. +2 −2 lib/fog/aws/models/cloud_watch/metric_statistic.rb
  36. +3 −3 lib/fog/aws/models/cloud_watch/metric_statistics.rb
  37. +3 −3 lib/fog/aws/models/cloud_watch/metrics.rb
  38. +5 −5 lib/fog/aws/models/compute/address.rb
  39. +2 −2 lib/fog/aws/models/compute/addresses.rb
  40. +3 −3 lib/fog/aws/models/compute/dhcp_option.rb
  41. +2 −2 lib/fog/aws/models/compute/dhcp_options.rb
  42. +1 −1 lib/fog/aws/models/compute/flavors.rb
  43. +2 −2 lib/fog/aws/models/compute/image.rb
  44. +5 −5 lib/fog/aws/models/compute/images.rb
  45. +4 −4 lib/fog/aws/models/compute/internet_gateway.rb
  46. +2 −2 lib/fog/aws/models/compute/internet_gateways.rb
  47. +4 −4 lib/fog/aws/models/compute/key_pair.rb
  48. +2 −2 lib/fog/aws/models/compute/key_pairs.rb
  49. +3 −3 lib/fog/aws/models/compute/network_interface.rb
  50. +2 −2 lib/fog/aws/models/compute/network_interfaces.rb
  51. +7 −7 lib/fog/aws/models/compute/security_group.rb
  52. +3 −3 lib/fog/aws/models/compute/security_groups.rb
  53. +18 −14 lib/fog/aws/models/compute/server.rb
  54. +6 −6 lib/fog/aws/models/compute/servers.rb
  55. +3 −3 lib/fog/aws/models/compute/snapshot.rb
  56. +3 −3 lib/fog/aws/models/compute/snapshots.rb
  57. +11 −8 lib/fog/aws/models/compute/spot_request.rb
  58. +11 −11 lib/fog/aws/models/compute/spot_requests.rb
  59. +3 −3 lib/fog/aws/models/compute/subnet.rb
  60. +2 −2 lib/fog/aws/models/compute/subnets.rb
  61. +2 −2 lib/fog/aws/models/compute/tag.rb
  62. +3 −3 lib/fog/aws/models/compute/tags.rb
  63. +8 −8 lib/fog/aws/models/compute/volume.rb
  64. +2 −2 lib/fog/aws/models/compute/volumes.rb
  65. +2 −2 lib/fog/aws/models/compute/vpc.rb
  66. +2 −2 lib/fog/aws/models/compute/vpcs.rb
  67. +4 −4 lib/fog/aws/models/dns/record.rb
  68. +3 −3 lib/fog/aws/models/dns/records.rb
  69. +3 −3 lib/fog/aws/models/dns/zone.rb
  70. +2 −2 lib/fog/aws/models/dns/zones.rb
  71. +2 −2 lib/fog/aws/models/elasticache/cluster.rb
  72. +2 −2 lib/fog/aws/models/elasticache/clusters.rb
  73. +2 −2 lib/fog/aws/models/elasticache/parameter_group.rb
  74. +2 −2 lib/fog/aws/models/elasticache/parameter_groups.rb
  75. +4 −4 lib/fog/aws/models/elasticache/security_group.rb
  76. +2 −2 lib/fog/aws/models/elasticache/security_groups.rb
  77. +2 −2 lib/fog/aws/models/elb/listener.rb
  78. +19 −19 lib/fog/aws/models/elb/load_balancer.rb
  79. +2 −2 lib/fog/aws/models/elb/load_balancers.rb
  80. +3 −3 lib/fog/aws/models/elb/policy.rb
  81. +7 −7 lib/fog/aws/models/glacier/archive.rb
  82. +2 −2 lib/fog/aws/models/glacier/job.rb
  83. +3 −3 lib/fog/aws/models/glacier/jobs.rb
  84. +7 −7 lib/fog/aws/models/glacier/vault.rb
  85. +2 −2 lib/fog/aws/models/glacier/vaults.rb
  86. +8 −8 lib/fog/aws/models/iam/access_key.rb
  87. +7 −7 lib/fog/aws/models/iam/access_keys.rb
  88. +10 −10 lib/fog/aws/models/iam/policies.rb
  89. +8 −8 lib/fog/aws/models/iam/policy.rb
  90. +10 −10 lib/fog/aws/models/iam/user.rb
  91. +2 −2 lib/fog/aws/models/iam/users.rb
  92. +2 −2 lib/fog/aws/models/rds/parameter.rb
  93. +10 −10 lib/fog/aws/models/rds/parameter_group.rb
  94. +3 −3 lib/fog/aws/models/rds/parameter_groups.rb
  95. +2 −2 lib/fog/aws/models/rds/parameters.rb
  96. +4 −4 lib/fog/aws/models/rds/security_group.rb
  97. +2 −2 lib/fog/aws/models/rds/security_groups.rb
  98. +10 −10 lib/fog/aws/models/rds/server.rb
  99. +3 −3 lib/fog/aws/models/rds/servers.rb
  100. +3 −3 lib/fog/aws/models/rds/snapshot.rb
  101. +3 −3 lib/fog/aws/models/rds/snapshots.rb
  102. +2 −2 lib/fog/aws/models/rds/subnet_groups.rb
  103. +2 −2 lib/fog/aws/models/storage/directories.rb
  104. +12 −12 lib/fog/aws/models/storage/directory.rb
  105. +10 −11 lib/fog/aws/models/storage/file.rb
  106. +5 −5 lib/fog/aws/models/storage/files.rb
  107. +2 −2 lib/fog/aws/models/storage/version.rb
  108. +3 −3 lib/fog/aws/models/storage/versions.rb
  109. +2 −2 lib/fog/bluebox/models/compute/flavors.rb
  110. +8 −8 lib/fog/bluebox/models/compute/image.rb
  111. +2 −2 lib/fog/bluebox/models/compute/images.rb
  112. +2 −2 lib/fog/bluebox/models/compute/locations.rb
  113. +8 −8 lib/fog/bluebox/models/compute/server.rb
  114. +2 −2 lib/fog/bluebox/models/compute/servers.rb
  115. +3 −3 lib/fog/bluebox/models/dns/record.rb
  116. +2 −2 lib/fog/bluebox/models/dns/records.rb
  117. +3 −3 lib/fog/bluebox/models/dns/zone.rb
  118. +2 −2 lib/fog/bluebox/models/dns/zones.rb
  119. +4 −6 lib/fog/brightbox/compute.rb
  120. +1 −1 lib/fog/brightbox/models/compute/account.rb
  121. +3 −3 lib/fog/brightbox/models/compute/accounts.rb
  122. +3 −3 lib/fog/brightbox/models/compute/api_client.rb
  123. +2 −2 lib/fog/brightbox/models/compute/api_clients.rb
  124. +1 −1 lib/fog/brightbox/models/compute/application.rb
  125. +3 −3 lib/fog/brightbox/models/compute/applications.rb
  126. +3 −3 lib/fog/brightbox/models/compute/cloud_ip.rb
  127. +4 −4 lib/fog/brightbox/models/compute/cloud_ips.rb
  128. +3 −3 lib/fog/brightbox/models/compute/firewall_policies.rb
  129. +4 −4 lib/fog/brightbox/models/compute/firewall_policy.rb
  130. +2 −2 lib/fog/brightbox/models/compute/firewall_rule.rb
  131. +2 −2 lib/fog/brightbox/models/compute/firewall_rules.rb
  132. +3 −3 lib/fog/brightbox/models/compute/flavors.rb
  133. +2 −2 lib/fog/brightbox/models/compute/image.rb
  134. +2 −2 lib/fog/brightbox/models/compute/images.rb
  135. +2 −2 lib/fog/brightbox/models/compute/load_balancer.rb
  136. +2 −2 lib/fog/brightbox/models/compute/load_balancers.rb
  137. +11 −12 lib/fog/brightbox/models/compute/server.rb
  138. +6 −6 lib/fog/brightbox/models/compute/server_group.rb
  139. +3 −3 lib/fog/brightbox/models/compute/server_groups.rb
  140. +3 −3 lib/fog/brightbox/models/compute/servers.rb
  141. +1 −1 lib/fog/brightbox/models/compute/user.rb
  142. +3 −3 lib/fog/brightbox/models/compute/users.rb
  143. +3 −3 lib/fog/brightbox/models/compute/zones.rb
  144. +2 −2 lib/fog/clodo/models/compute/images.rb
  145. +6 −6 lib/fog/clodo/models/compute/server.rb
  146. +2 −2 lib/fog/clodo/models/compute/servers.rb
  147. +2 −2 lib/fog/cloudstack/models/compute/flavors.rb
  148. +2 −2 lib/fog/cloudstack/models/compute/image.rb
  149. +2 −2 lib/fog/cloudstack/models/compute/images.rb
  150. +2 −2 lib/fog/cloudstack/models/compute/job.rb
  151. +2 −2 lib/fog/cloudstack/models/compute/jobs.rb
  152. +3 −3 lib/fog/cloudstack/models/compute/security_group.rb
  153. +5 −5 lib/fog/cloudstack/models/compute/security_group_rule.rb
  154. +1 −1 lib/fog/cloudstack/models/compute/security_group_rules.rb
  155. +2 −2 lib/fog/cloudstack/models/compute/security_groups.rb
  156. +11 −11 lib/fog/cloudstack/models/compute/server.rb
  157. +2 −2 lib/fog/cloudstack/models/compute/servers.rb
  158. +8 −8 lib/fog/cloudstack/models/compute/volume.rb
  159. +2 −2 lib/fog/cloudstack/models/compute/volumes.rb
  160. +1 −1 lib/fog/cloudstack/models/compute/zone.rb
  161. +2 −2 lib/fog/cloudstack/models/compute/zones.rb
  162. +1 −1 lib/fog/core/attributes.rb
  163. +15 −4 lib/fog/core/collection.rb
  164. +41 −0 lib/fog/core/deprecated_connection_accessors.rb
  165. +11 −1 lib/fog/core/model.rb
  166. +1 −1 lib/fog/core/service.rb
  167. +4 −4 lib/fog/dnsimple/models/dns/record.rb
  168. +2 −2 lib/fog/dnsimple/models/dns/records.rb
  169. +3 −3 lib/fog/dnsimple/models/dns/zone.rb
  170. +2 −2 lib/fog/dnsimple/models/dns/zones.rb
  171. +5 −5 lib/fog/dnsmadeeasy/models/dns/record.rb
  172. +2 −2 lib/fog/dnsmadeeasy/models/dns/records.rb
  173. +3 −3 lib/fog/dnsmadeeasy/models/dns/zone.rb
  174. +2 −2 lib/fog/dnsmadeeasy/models/dns/zones.rb
  175. +3 −3 lib/fog/dynect/models/dns/record.rb
  176. +2 −2 lib/fog/dynect/models/dns/records.rb
  177. +4 −4 lib/fog/dynect/models/dns/zone.rb
  178. +2 −2 lib/fog/dynect/models/dns/zones.rb
  179. +3 −3 lib/fog/ecloud/generate_collection.rb
  180. +5 −5 lib/fog/ecloud/models/compute/admin_organization.rb
  181. +1 −1 lib/fog/ecloud/models/compute/admin_organizations.rb
  182. +2 −2 lib/fog/ecloud/models/compute/api_keys.rb
  183. +3 −3 lib/fog/ecloud/models/compute/association.rb
  184. +2 −2 lib/fog/ecloud/models/compute/associations.rb
  185. +2 −2 lib/fog/ecloud/models/compute/authentication_levels.rb
  186. +7 −7 lib/fog/ecloud/models/compute/backup_internet_service.rb
  187. +3 −3 lib/fog/ecloud/models/compute/backup_internet_services.rb
  188. +2 −2 lib/fog/ecloud/models/compute/catalog.rb
  189. +2 −2 lib/fog/ecloud/models/compute/catalog_configurations.rb
  190. +1 −1 lib/fog/ecloud/models/compute/catalog_item.rb
  191. +10 −10 lib/fog/ecloud/models/compute/compute_pool.rb
  192. +2 −2 lib/fog/ecloud/models/compute/compute_pools.rb
  193. +2 −2 lib/fog/ecloud/models/compute/cpu_usage_detail_summary.rb
  194. +18 −18 lib/fog/ecloud/models/compute/environment.rb
  195. +2 −2 lib/fog/ecloud/models/compute/environments.rb
  196. +1 −1 lib/fog/ecloud/models/compute/firewall_acl.rb
  197. +2 −2 lib/fog/ecloud/models/compute/firewall_acls.rb
  198. +6 −6 lib/fog/ecloud/models/compute/group.rb
  199. +2 −2 lib/fog/ecloud/models/compute/groups.rb
  200. +2 −2 lib/fog/ecloud/models/compute/guest_processes.rb
  201. +2 −2 lib/fog/ecloud/models/compute/hardware_configurations.rb
  202. +16 −16 lib/fog/ecloud/models/compute/internet_service.rb
  203. +3 −3 lib/fog/ecloud/models/compute/internet_services.rb
  204. +2 −2 lib/fog/ecloud/models/compute/ip_addresses.rb
  205. +1 −1 lib/fog/ecloud/models/compute/layout.rb
  206. +2 −2 lib/fog/ecloud/models/compute/layouts.rb
  207. +1 −1 lib/fog/ecloud/models/compute/location.rb
  208. +2 −2 lib/fog/ecloud/models/compute/locations.rb
  209. +2 −2 lib/fog/ecloud/models/compute/login_banners.rb
  210. +2 −2 lib/fog/ecloud/models/compute/memory_usage_detail_summary.rb
  211. +4 −4 lib/fog/ecloud/models/compute/monitor.rb
  212. +2 −2 lib/fog/ecloud/models/compute/monitors.rb
  213. +4 −4 lib/fog/ecloud/models/compute/network.rb
  214. +2 −2 lib/fog/ecloud/models/compute/networks.rb
  215. +5 −5 lib/fog/ecloud/models/compute/node.rb
  216. +3 −3 lib/fog/ecloud/models/compute/nodes.rb
  217. +2 −2 lib/fog/ecloud/models/compute/operating_system_families.rb
  218. +1 −1 lib/fog/ecloud/models/compute/operating_system_family.rb
  219. +1 −1 lib/fog/ecloud/models/compute/operating_systems.rb
  220. +16 −16 lib/fog/ecloud/models/compute/organization.rb
  221. +3 −3 lib/fog/ecloud/models/compute/organizations.rb
  222. +2 −2 lib/fog/ecloud/models/compute/password_complexity_rules.rb
  223. +2 −2 lib/fog/ecloud/models/compute/physical_devices.rb
  224. +1 −1 lib/fog/ecloud/models/compute/public_ip.rb
  225. +4 −4 lib/fog/ecloud/models/compute/public_ips.rb
  226. +2 −2 lib/fog/ecloud/models/compute/rnat.rb
  227. +2 −2 lib/fog/ecloud/models/compute/rnats.rb
  228. +2 −2 lib/fog/ecloud/models/compute/roles.rb
  229. +7 −7 lib/fog/ecloud/models/compute/row.rb
  230. +4 −4 lib/fog/ecloud/models/compute/rows.rb
  231. +35 −35 lib/fog/ecloud/models/compute/server.rb
  232. +2 −2 lib/fog/ecloud/models/compute/server_configuration_options.rb
  233. +6 −6 lib/fog/ecloud/models/compute/servers.rb
  234. +2 −2 lib/fog/ecloud/models/compute/ssh_keys.rb
  235. +2 −2 lib/fog/ecloud/models/compute/storage_usage_detail_summary.rb
  236. +2 −2 lib/fog/ecloud/models/compute/support_tickets.rb
  237. +2 −2 lib/fog/ecloud/models/compute/tags.rb
  238. +3 −3 lib/fog/ecloud/models/compute/tasks.rb
  239. +2 −2 lib/fog/ecloud/models/compute/templates.rb
  240. +5 −5 lib/fog/ecloud/models/compute/trusted_network_group.rb
  241. +2 −2 lib/fog/ecloud/models/compute/trusted_network_groups.rb
  242. +2 −2 lib/fog/ecloud/models/compute/user.rb
  243. +2 −2 lib/fog/ecloud/models/compute/users.rb
  244. +7 −7 lib/fog/glesys/models/compute/ip.rb
  245. +7 −7 lib/fog/glesys/models/compute/ips.rb
  246. +6 −6 lib/fog/glesys/models/compute/server.rb
  247. +4 −4 lib/fog/glesys/models/compute/servers.rb
  248. +1 −1 lib/fog/glesys/models/compute/template.rb
  249. +2 −2 lib/fog/glesys/models/compute/templates.rb
  250. +2 −2 lib/fog/go_grid/models/compute/image.rb
  251. +2 −2 lib/fog/go_grid/models/compute/images.rb
  252. +4 −4 lib/fog/go_grid/models/compute/password.rb
  253. +3 −3 lib/fog/go_grid/models/compute/passwords.rb
  254. +3 −3 lib/fog/go_grid/models/compute/server.rb
  255. +2 −2 lib/fog/go_grid/models/compute/servers.rb
  256. +2 −2 lib/fog/google/models/storage/directories.rb
  257. +4 −4 lib/fog/google/models/storage/directory.rb
  258. +5 −5 lib/fog/google/models/storage/file.rb
  259. +4 −4 lib/fog/google/models/storage/files.rb
  260. +1 −1 lib/fog/hp.rb
  261. +4 −4 lib/fog/hp/models/compute/address.rb
  262. +2 −2 lib/fog/hp/models/compute/addresses.rb
  263. +2 −2 lib/fog/hp/models/compute/flavors.rb
  264. +2 −2 lib/fog/hp/models/compute/image.rb
  265. +2 −2 lib/fog/hp/models/compute/images.rb
  266. +3 −3 lib/fog/hp/models/compute/key_pair.rb
  267. +2 −2 lib/fog/hp/models/compute/key_pairs.rb
  268. +4 −4 lib/fog/hp/models/compute/security_group.rb
  269. +3 −3 lib/fog/hp/models/compute/security_groups.rb
  270. +13 −13 lib/fog/hp/models/compute/server.rb
  271. +2 −2 lib/fog/hp/models/compute/servers.rb
  272. +3 −3 lib/fog/hp/models/storage/directories.rb
  273. +18 −18 lib/fog/hp/models/storage/directory.rb
  274. +4 −4 lib/fog/hp/models/storage/file.rb
  275. +2 −2 lib/fog/hp/models/storage/files.rb
  276. +2 −2 lib/fog/ibm/models/compute/address.rb
  277. +2 −2 lib/fog/ibm/models/compute/addresses.rb
  278. +3 −3 lib/fog/ibm/models/compute/image.rb
  279. +2 −2 lib/fog/ibm/models/compute/images.rb
  280. +2 −2 lib/fog/ibm/models/compute/key.rb
  281. +3 −3 lib/fog/ibm/models/compute/keys.rb
  282. +2 −2 lib/fog/ibm/models/compute/locations.rb
  283. +12 −12 lib/fog/ibm/models/compute/server.rb
  284. +2 −2 lib/fog/ibm/models/compute/servers.rb
  285. +2 −2 lib/fog/ibm/models/compute/vlans.rb
  286. +1 −1 lib/fog/ibm/models/storage/offerings.rb
  287. +4 −4 lib/fog/ibm/models/storage/volume.rb
  288. +2 −2 lib/fog/ibm/models/storage/volumes.rb
  289. +2 −2 lib/fog/joyent/models/compute/flavors.rb
  290. +2 −2 lib/fog/joyent/models/compute/images.rb
  291. +1 −1 lib/fog/joyent/models/compute/key.rb
  292. +3 −3 lib/fog/joyent/models/compute/keys.rb
  293. +13 −13 lib/fog/joyent/models/compute/server.rb
  294. +3 −3 lib/fog/joyent/models/compute/servers.rb
  295. +4 −4 lib/fog/joyent/models/compute/snapshot.rb
  296. +3 −3 lib/fog/joyent/models/compute/snapshots.rb
  297. +1 −1 lib/fog/libvirt/models/compute/interface.rb
  298. +1 −1 lib/fog/libvirt/models/compute/interfaces.rb
  299. +1 −1 lib/fog/libvirt/models/compute/network.rb
  300. +1 −1 lib/fog/libvirt/models/compute/networks.rb
Sorry, we could not display the entire diff because too many files (529) changed.
View
4 lib/fog/atmos/models/storage/directories.rb
@@ -14,7 +14,7 @@ class Directories < Fog::Collection
def all
directory ? ns = directory.key : ns = ''
ns = ns + '/' unless ns =~ /\/$/
- data = connection.get_namespace(ns).body[:DirectoryList]
+ data = service.get_namespace(ns).body[:DirectoryList]
data = {:DirectoryEntry => []} if data.kind_of? String
data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash
dirs = data[:DirectoryEntry].select {|de| de[:FileType] == 'directory'}
@@ -28,7 +28,7 @@ def all
def get(key, options = {})
return nil if key == '' # Root dir shouldn't be retrieved like this.
key =~ /\/$/ ? ns = key : ns = key + '/'
- res = connection.get_namespace ns
+ res = service.get_namespace ns
emc_meta = res.headers['x-emc-meta']
obj_id = emc_meta.scan(/objectid=(\w+),/).flatten[0]
new(:objectid => obj_id, :key => ns)
View
22 lib/fog/atmos/models/storage/directory.rb
@@ -12,25 +12,25 @@ class Directory < Fog::Model
def files
@files ||= begin
Fog::Storage::Atmos::Files.new(
- :directory => self,
- :connection => connection
- )
- end
+ :directory => self,
+ :service => service
+ )
+ end
end
def directories
@directories ||= begin
- Fog::Storage::Atmos::Directories.new(
- :directory => self,
- :connection => connection
- )
- end
+ Fog::Storage::Atmos::Directories.new(
+ :directory => self,
+ :service => service
+ )
+ end
end
def save
self.key = attributes[:directory].key + key if attributes[:directory]
self.key = key + '/' unless key =~ /\/$/
- res = connection.post_namespace key
+ res = service.post_namespace key
reload
end
@@ -42,7 +42,7 @@ def destroy(opts={})
d.destroy(opts)
end
end
- connection.delete_namespace key
+ service.delete_namespace key
end
View
16 lib/fog/atmos/models/storage/file.rb
@@ -29,7 +29,7 @@ def directory
end
def copy(target_directory_key, target_file_key, options={})
- target_directory = connection.directories.new(:key => target_directory_key)
+ target_directory = service.directories.new(:key => target_directory_key)
target_directory.files.create(
:key => target_file_key,
:body => body
@@ -38,7 +38,7 @@ def copy(target_directory_key, target_file_key, options={})
def destroy
requires :directory, :key
- connection.delete_namespace([directory.key, key].join('/'))
+ service.delete_namespace([directory.key, key].join('/'))
true
end
@@ -60,15 +60,15 @@ def public_url(expires = (Time.now + 5 * 365 * 24 * 60 * 60))
file = directory.files.head(key)
self.objectid = if file.present? then file.attributes['x-emc-meta'].scan(/objectid=(\w+),/).flatten[0] else nil end
if self.objectid.present?
- uri = URI::HTTP.build(:scheme => connection.ssl? ? "http" : "https" , :host => connection.host, :port => connection.port.to_i, :path => "/rest/objects/#{self.objectid}" )
+ uri = URI::HTTP.build(:scheme => service.ssl? ? "http" : "https" , :host => service.host, :port => service.port.to_i, :path => "/rest/objects/#{self.objectid}" )
sb = "GET\n"
sb += uri.path.downcase + "\n"
- sb += connection.uid + "\n"
+ sb += service.uid + "\n"
sb += String(expires.to_i())
- signature = connection.sign( sb )
- uri.query = "uid=#{CGI::escape(connection.uid)}&expires=#{expires.to_i()}&signature=#{CGI::escape(signature)}"
+ signature = service.sign( sb )
+ uri.query = "uid=#{CGI::escape(service.uid)}&expires=#{expires.to_i()}&signature=#{CGI::escape(signature)}"
uri.to_s
else
nil
@@ -83,11 +83,11 @@ def save(options = {})
options[:headers]['Content-Type'] = content_type if content_type
options[:body] = body
begin
- data = connection.post_namespace(ns, options)
+ data = service.post_namespace(ns, options)
self.objectid = data.headers['location'].split('/')[-1]
rescue => error
if error.message =~ /The resource you are trying to create already exists./
- data = connection.put_namespace(ns, options)
+ data = service.put_namespace(ns, options)
else
raise error
end
View
6 lib/fog/atmos/models/storage/files.rb
@@ -19,7 +19,7 @@ def all(options = {})
requires :directory
directory ? ns = directory.key : ns = ''
ns = ns + '/' unless ns =~ /\/$/
- data = connection.get_namespace(ns).body[:DirectoryList]
+ data = service.get_namespace(ns).body[:DirectoryList]
data = {:DirectoryEntry => []} if data.kind_of? String
data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash
files = data[:DirectoryEntry].select {|de| de[:FileType] == 'regular'}
@@ -32,7 +32,7 @@ def all(options = {})
def get(key, &block)
requires :directory
- data = connection.get_namespace(directory.key + key, :parse => false)#, &block)
+ data = service.get_namespace(directory.key + key, :parse => false)#, &block)
file_data = data.headers.merge({
:body => data.body,
:key => key
@@ -51,7 +51,7 @@ def get_url(key)
def head(key, options = {})
requires :directory
- data = connection.head_namespace(directory.key + key, :parse => false)
+ data = service.head_namespace(directory.key + key, :parse => false)
file_data = data.headers.merge({
:body => data.body,
:key => key
View
4 lib/fog/aws/models/auto_scaling/activities.rb
@@ -11,7 +11,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_scaling_activities('NextToken' => next_token).body['DescribeScalingActivitiesResult']
+ result = service.describe_scaling_activities('NextToken' => next_token).body['DescribeScalingActivitiesResult']
data += result['Activities']
next_token = result['NextToken']
break if next_token.nil?
@@ -20,7 +20,7 @@ def all
end
def get(identity)
- data = connection.describe_scaling_activities('ActivityId' => identity).body['DescribeScalingActivitiesResult']['Activities'].first
+ data = service.describe_scaling_activities('ActivityId' => identity).body['DescribeScalingActivitiesResult']['Activities'].first
new(data) unless data.nil?
end
View
2 lib/fog/aws/models/auto_scaling/activity.rb
@@ -16,7 +16,7 @@ class Activity < Fog::Model
attribute :status_message, :aliases => 'StatusMessage'
def group
- connection.groups.get(attributes['AutoScalingGroupName'])
+ service.groups.get(attributes['AutoScalingGroupName'])
end
def save
View
4 lib/fog/aws/models/auto_scaling/configuration.rb
@@ -41,7 +41,7 @@ def save
options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
options.delete_if { |key, value| value.nil? }
- connection.create_launch_configuration(image_id, instance_type, id, options) #, listeners.map{|l| l.to_params})
+ service.create_launch_configuration(image_id, instance_type, id, options) #, listeners.map{|l| l.to_params})
# reload instead of merge attributes b/c some attrs (like HealthCheck)
# may be set, but only the DNS name is returned in the create_load_balance
@@ -56,7 +56,7 @@ def reload
def destroy
requires :id
- connection.delete_launch_configuration(id)
+ service.delete_launch_configuration(id)
end
end
View
4 lib/fog/aws/models/auto_scaling/configurations.rb
@@ -16,7 +16,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_launch_configurations('NextToken' => next_token).body['DescribeLaunchConfigurationsResult']
+ result = service.describe_launch_configurations('NextToken' => next_token).body['DescribeLaunchConfigurationsResult']
data += result['LaunchConfigurations']
next_token = result['NextToken']
break if next_token.nil?
@@ -25,7 +25,7 @@ def all
end
def get(identity)
- data = connection.describe_launch_configurations('LaunchConfigurationNames' => identity).body['DescribeLaunchConfigurationsResult']['LaunchConfigurations'].first
+ data = service.describe_launch_configurations('LaunchConfigurationNames' => identity).body['DescribeLaunchConfigurationsResult']['LaunchConfigurations'].first
new(data) unless data.nil?
end
View
24 lib/fog/aws/models/auto_scaling/group.rb
@@ -45,37 +45,37 @@ def activities
data = []
next_token = nil
loop do
- result = connection.describe_scaling_activities('AutoScalingGroupName' => id, 'NextToken' => next_token).body['DescribeScalingActivitiesResult']
+ result = service.describe_scaling_activities('AutoScalingGroupName' => id, 'NextToken' => next_token).body['DescribeScalingActivitiesResult']
data += result['Activities']
next_token = result['NextToken']
break if next_token.nil?
end
Fog::AWS::AutoScaling::Activities.new({
:data => data,
- :connection => connection,
+ :service => service,
#:load_balancer => self
})
end
def configuration
requires :launch_configuration_name
- connection.configurations.get(launch_configuration_name)
+ service.configurations.get(launch_configuration_name)
end
def disable_metrics_collection(metrics = {})
requires :id
- connection.disable_metrics_collection(id, 'Metrics' => metrics)
+ service.disable_metrics_collection(id, 'Metrics' => metrics)
reload
end
def enable_metrics_collection(granularity = '1Minute', metrics = {})
requires :id
- connection.enable_metrics_collection(id, granularity, 'Metrics' => metrics)
+ service.enable_metrics_collection(id, granularity, 'Metrics' => metrics)
reload
end
def instances
- Fog::AWS::AutoScaling::Instances.new(:connection => connection).load(attributes[:instances])
+ Fog::AWS::AutoScaling::Instances.new(:service => service).load(attributes[:instances])
end
def instances_in_service
@@ -88,13 +88,13 @@ def instances_out_service
def resume_processes(processes = [])
requires :id
- connection.resume_processes(id, 'ScalingProcesses' => processes)
+ service.resume_processes(id, 'ScalingProcesses' => processes)
reload
end
def suspend_processes(processes = [])
requires :id
- connection.suspend_processes(id, 'ScalingProcesses' => processes)
+ service.suspend_processes(id, 'ScalingProcesses' => processes)
reload
end
@@ -112,7 +112,7 @@ def save
requires :max_size
requires :min_size
- connection.create_auto_scaling_group(id, availability_zones, launch_configuration_name, max_size, min_size, options)
+ service.create_auto_scaling_group(id, availability_zones, launch_configuration_name, max_size, min_size, options)
reload
end
@@ -126,13 +126,13 @@ def destroy(options = { :force => false })
opts = {}
opts.merge!({'ForceDelete' => true}) if options[:force]
-
- connection.delete_auto_scaling_group(id, opts)
+
+ service.delete_auto_scaling_group(id, opts)
end
def update
requires :id
- connection.update_auto_scaling_group(id, options)
+ service.update_auto_scaling_group(id, options)
reload
end
View
4 lib/fog/aws/models/auto_scaling/groups.rb
@@ -16,7 +16,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_auto_scaling_groups('NextToken' => next_token).body['DescribeAutoScalingGroupsResult']
+ result = service.describe_auto_scaling_groups('NextToken' => next_token).body['DescribeAutoScalingGroupsResult']
data += result['AutoScalingGroups']
next_token = result['NextToken']
break if next_token.nil?
@@ -25,7 +25,7 @@ def all
end
def get(identity)
- data = connection.describe_auto_scaling_groups('AutoScalingGroupNames' => identity).body['DescribeAutoScalingGroupsResult']['AutoScalingGroups'].first
+ data = service.describe_auto_scaling_groups('AutoScalingGroupNames' => identity).body['DescribeAutoScalingGroupsResult']['AutoScalingGroups'].first
new(data) unless data.nil?
end
View
10 lib/fog/aws/models/auto_scaling/instance.rb
@@ -17,22 +17,22 @@ def initialize(attributes={})
end
def group
- connection.groups.get(attributes['AutoScalingGroupName'])
+ service.groups.get(attributes['AutoScalingGroupName'])
end
def configuration
- connection.configurations.get(attributes['LaunchConfigurationName'])
+ service.configurations.get(attributes['LaunchConfigurationName'])
end
def set_health(health_status, options)
requires :id
- connection.set_instance_health(health_status, id, options)
+ service.set_instance_health(health_status, id, options)
reload
end
def terminate(should_decrement_desired_capacity)
requires :id
- connection.terminate_instance_in_auto_scaling_group(id, should_decrement_desired_capacity)
+ service.terminate_instance_in_auto_scaling_group(id, should_decrement_desired_capacity)
reload
end
@@ -51,7 +51,7 @@ def reload
#def destroy
# requires :id
- # connection.delete_auto_scaling_group(id)
+ # service.delete_auto_scaling_group(id)
#end
end
View
4 lib/fog/aws/models/auto_scaling/instances.rb
@@ -11,7 +11,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_auto_scaling_instances('NextToken' => next_token).body['DescribeAutoScalingInstancesResult']
+ result = service.describe_auto_scaling_instances('NextToken' => next_token).body['DescribeAutoScalingInstancesResult']
data += result['AutoScalingInstances']
next_token = result['NextToken']
break if next_token.nil?
@@ -20,7 +20,7 @@ def all
end
def get(identity)
- data = connection.describe_auto_scaling_instances('InstanceIds' => identity).body['DescribeAutoScalingInstancesResult']['AutoScalingInstances'].first
+ data = service.describe_auto_scaling_instances('InstanceIds' => identity).body['DescribeAutoScalingInstancesResult']['AutoScalingInstances'].first
new(data) unless data.nil?
end
View
4 lib/fog/aws/models/auto_scaling/policies.rb
@@ -15,7 +15,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_policies('NextToken' => next_token).body['DescribePoliciesResult']
+ result = service.describe_policies('NextToken' => next_token).body['DescribePoliciesResult']
data += result['ScalingPolicies']
next_token = result['NextToken']
break if next_token.nil?
@@ -24,7 +24,7 @@ def all
end
def get(identity, auto_scaling_group = nil)
- data = connection.describe_policies('PolicyNames' => identity, 'AutoScalingGroupName' => auto_scaling_group).body['DescribePoliciesResult']['ScalingPolicies'].first
+ data = service.describe_policies('PolicyNames' => identity, 'AutoScalingGroupName' => auto_scaling_group).body['DescribePoliciesResult']['ScalingPolicies'].first
new(data) unless data.nil?
end
end
View
4 lib/fog/aws/models/auto_scaling/policy.rb
@@ -31,14 +31,14 @@ def save
options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
options.delete_if { |key, value| value.nil? }
- connection.put_scaling_policy(adjustment_type, auto_scaling_group_name, id, scaling_adjustment, options)
+ service.put_scaling_policy(adjustment_type, auto_scaling_group_name, id, scaling_adjustment, options)
reload
end
def destroy
requires :id
requires :auto_scaling_group_name
- connection.delete_policy(auto_scaling_group_name, id)
+ service.delete_policy(auto_scaling_group_name, id)
end
end
end
View
14 lib/fog/aws/models/beanstalk/application.rb
@@ -18,27 +18,27 @@ def initialize(attributes={})
def environments
requires :name
- connection.environments.all({'ApplicationName' => name})
+ service.environments.all({'ApplicationName' => name})
end
def events
requires :name
- connection.events.all({'ApplicationName' => name})
+ service.events.all({'ApplicationName' => name})
end
def templates
requires :name
- connection.templates.all({'ApplicationName' => name})
+ service.templates.all({'ApplicationName' => name})
end
def versions
requires :name
- connection.versions.all({'ApplicationName' => name})
+ service.versions.all({'ApplicationName' => name})
end
def destroy
requires :name
- connection.delete_application(name)
+ service.delete_application(name)
true
end
@@ -50,7 +50,7 @@ def save
}
options['Description'] = description unless description.nil?
- data = connection.create_application(options).body['CreateApplicationResult']['Application']
+ data = service.create_application(options).body['CreateApplicationResult']['Application']
merge_attributes(data)
true
end
@@ -59,4 +59,4 @@ def save
end
end
-end
+end
View
4 lib/fog/aws/models/beanstalk/applications.rb
@@ -9,12 +9,12 @@ class Applications < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Application
def all(application_names=[])
- data = connection.describe_applications(application_names).body['DescribeApplicationsResult']['Applications']
+ data = service.describe_applications(application_names).body['DescribeApplicationsResult']['Applications']
load(data) # data is an array of attribute hashes
end
def get(application_name)
- if data = connection.describe_applications([application_name]).body['DescribeApplicationsResult']['Applications'].first
+ if data = service.describe_applications([application_name]).body['DescribeApplicationsResult']['Applications'].first
new(data)
end
end
View
20 lib/fog/aws/models/beanstalk/environment.rb
@@ -40,7 +40,7 @@ def terminated?
# Returns the current live resources for this environment
def live_resources
requires :id
- data = connection.describe_environment_resources({'EnvironmentId' => id}).body['DescribeEnvironmentResourcesResult']['EnvironmentResources']
+ data = service.describe_environment_resources({'EnvironmentId' => id}).body['DescribeEnvironmentResourcesResult']['EnvironmentResources']
data.delete('EnvironmentName') # Delete the environment name from the result, only return actual resources
data
end
@@ -54,26 +54,26 @@ def load_balancer(elb_connection = Fog::AWS[:elb])
# Return events related to this version
def events
requires :id
- connection.events.all({'EnvironmentId' => id})
+ service.events.all({'EnvironmentId' => id})
end
# Restarts the app servers in this environment
def restart_app_server
requires :id
- connection.restart_app_server({'EnvironmentId' => id})
+ service.restart_app_server({'EnvironmentId' => id})
reload
end
# Rebuilds the environment
def rebuild
requires :id
- connection.rebuild_environment({'EnvironmentId' => id})
+ service.rebuild_environment({'EnvironmentId' => id})
reload
end
def swap_cnames(source)
requires :name
- connection.swap_environment_cnames({
+ service.swap_environment_cnames({
'SourceEnvironmentName' => source.name,
'DestinationEnvironmentName' => name
})
@@ -84,7 +84,7 @@ def swap_cnames(source)
# Return the version object for this environment
def version
requires :application_name, :version_label
- connection.versions.get(application_name, version_label)
+ service.versions.get(application_name, version_label)
end
# Update the running version of this environment
@@ -102,7 +102,7 @@ def version=(new_version)
raise "Version label not specified."
end
- data = connection.update_environment({
+ data = service.update_environment({
'EnvironmentId' => id,
'VersionLabel' => new_version_label
}).body['UpdateEnvironmentResult']
@@ -112,7 +112,7 @@ def version=(new_version)
def destroy
requires :id
- connection.terminate_environment({'EnvironmentId' => id})
+ service.terminate_environment({'EnvironmentId' => id})
true
end
@@ -133,7 +133,7 @@ def save
}
options.delete_if {|key, value| value.nil?}
- data = connection.create_environment(options).body['CreateEnvironmentResult']
+ data = service.create_environment(options).body['CreateEnvironmentResult']
merge_attributes(data)
true
end
@@ -142,4 +142,4 @@ def save
end
end
-end
+end
View
4 lib/fog/aws/models/beanstalk/environments.rb
@@ -9,7 +9,7 @@ class Environments < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Environment
def all(options={})
- data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments']
+ data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments']
load(data) # data is an array of attribute hashes
end
@@ -18,7 +18,7 @@ def all(options={})
def get(environment_name)
options = { 'EnvironmentNames' => [environment_name] }
- if data = connection.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
+ if data = service.describe_environments(options).body['DescribeEnvironmentsResult']['Environments'].first
new(data)
end
end
View
2 lib/fog/aws/models/beanstalk/events.rb
@@ -9,7 +9,7 @@ class Events < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Event
def all(options={})
- data = connection.describe_events(options).body['DescribeEventsResult']['Events']
+ data = service.describe_events(options).body['DescribeEventsResult']['Events']
load(data) # data is an array of attribute hashes
end
View
10 lib/fog/aws/models/beanstalk/template.rb
@@ -24,7 +24,7 @@ def initialize(attributes={})
# Returns an array of options that may be set on this template
def options
requires :name, :application_name
- data = connection.describe_configuration_options({
+ data = service.describe_configuration_options({
'ApplicationName' => application_name,
'TemplateName' => name
})
@@ -33,7 +33,7 @@ def options
def destroy
requires :name, :application_name
- connection.delete_configuration_template(application_name, name)
+ service.delete_configuration_template(application_name, name)
true
end
@@ -51,7 +51,7 @@ def save
}
options.delete_if {|key, value| value.nil?}
- data = connection.create_configuration_template(options).body['CreateConfigurationTemplateResult']
+ data = service.create_configuration_template(options).body['CreateConfigurationTemplateResult']
merge_attributes(data)
true
end
@@ -67,12 +67,12 @@ def modify(new_attributes)
}
options.delete_if {|key, value| value.nil?}
- data = connection.update_configuration_template(options).body['UpdateConfigurationTemplateResult']
+ data = service.update_configuration_template(options).body['UpdateConfigurationTemplateResult']
merge_attributes(data)
true
end
end
end
end
-end
+end
View
6 lib/fog/aws/models/beanstalk/templates.rb
@@ -21,15 +21,15 @@ def all(options={})
# Initialize with empty array
data = []
- applications = connection.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
+ applications = service.describe_applications(application_filter).body['DescribeApplicationsResult']['Applications']
applications.each { |application|
application['ConfigurationTemplates'].each { |template_name|
begin
options = {
'ApplicationName' => application['ApplicationName'],
'TemplateName' => template_name
}
- settings = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
+ settings = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if settings.length == 1
# Add to data
data << settings.first
@@ -54,7 +54,7 @@ def get(application_name, template_name)
# There is no describe call for templates, so we must use describe_configuration_settings. Unfortunately,
# it throws an exception if template name doesn't exist, which is inconsistent, catch and return nil
begin
- data = connection.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
+ data = service.describe_configuration_settings(options).body['DescribeConfigurationSettingsResult']['ConfigurationSettings']
if data.length == 1
result = new(data.first)
end
View
12 lib/fog/aws/models/beanstalk/version.rb
@@ -20,7 +20,7 @@ def initialize(attributes={})
# Return events related to this version
def events
requires :label, :application_name
- connection.events.all({
+ service.events.all({
'ApplicationName' => application_name,
'VersionLabel' => label
})
@@ -29,15 +29,15 @@ def events
# Returns environments running this version
def environments
requires :label, :application_name
- connection.environments.all({
+ service.environments.all({
'ApplicationName' => application_name,
'VersionLabel' => label
})
end
def destroy(delete_source_bundle = nil)
requires :label, :application_name
- connection.delete_application_version(application_name, label, delete_source_bundle)
+ service.delete_application_version(application_name, label, delete_source_bundle)
true
end
@@ -53,7 +53,7 @@ def save
}
options.delete_if {|key, value| value.nil?}
- data = connection.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion']
+ data = service.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data)
true
end
@@ -69,11 +69,11 @@ def update
}
options.delete_if {|key, value| value.nil?}
- data = connection.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']
+ data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']
merge_attributes(data)
end
end
end
end
-end
+end
View
4 lib/fog/aws/models/beanstalk/versions.rb
@@ -9,12 +9,12 @@ class Versions < Fog::Collection
model Fog::AWS::ElasticBeanstalk::Version
def all(options={})
- data = connection.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions']
+ data = service.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions']
load(data) # data is an array of attribute hashes
end
def get(application_name, version_label)
- if data = connection.describe_application_versions({
+ if data = service.describe_application_versions({
'ApplicationName' => application_name,
'VersionLabels' => [version_label]
}).body['DescribeApplicationVersionsResult']['ApplicationVersions']
View
8 lib/fog/aws/models/cdn/distribution.rb
@@ -37,7 +37,7 @@ def invalidations
@invalidations ||= begin
Fog::CDN::AWS::Invalidations.new(
:distribution => self,
- :connection => connection
+ :service => service
)
end
end
@@ -54,15 +54,15 @@ def save
private
def delete_distribution(identity, etag)
- connection.delete_distribution(identity, etag)
+ service.delete_distribution(identity, etag)
end
def put_distribution_config(identity, etag, options)
- connection.put_distribution_config(identity, etag, options)
+ service.put_distribution_config(identity, etag, options)
end
def post_distribution(options = {})
- connection.post_distribution(options)
+ service.post_distribution(options)
end
def attributes_to_options
View
4 lib/fog/aws/models/cdn/distributions.rb
@@ -16,11 +16,11 @@ class Distributions < Fog::Collection
attribute :is_truncated, :aliases => 'IsTruncated'
def get_distribution(dist_id)
- connection.get_distribution(dist_id)
+ service.get_distribution(dist_id)
end
def list_distributions(options = {})
- connection.get_distribution_list(options)
+ service.get_distribution_list(options)
end
alias :each_distribution_this_page :each
View
2 lib/fog/aws/models/cdn/invalidation.rb
@@ -30,7 +30,7 @@ def ready?
def save
requires :paths, :caller_reference
raise "Submitted invalidation cannot be submitted again" if persisted?
- response = connection.post_invalidation(distribution.identity, paths, caller_reference)
+ response = service.post_invalidation(distribution.identity, paths, caller_reference)
merge_attributes(invalidation_to_attributes(response.body))
true
end
View
4 lib/fog/aws/models/cdn/invalidations.rb
@@ -21,7 +21,7 @@ def all(options = {})
options[:max_items] ||= max_items
options.delete_if {|key, value| value.nil?}
- data = connection.get_invalidation_list(distribution.identity, options).body
+ data = service.get_invalidation_list(distribution.identity, options).body
merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextMarker', 'Marker'].include?(key)})
@@ -31,7 +31,7 @@ def all(options = {})
def get(invalidation_id)
requires :distribution
- data = connection.get_invalidation(distribution.identity, invalidation_id).body
+ data = service.get_invalidation(distribution.identity, invalidation_id).body
if data
invalidation = new(data)
View
6 lib/fog/aws/models/cdn/streaming_distribution.rb
@@ -41,15 +41,15 @@ def save
private
def delete_distribution(identity, etag)
- connection.delete_streaming_distribution(identity, etag)
+ service.delete_streaming_distribution(identity, etag)
end
def put_distribution_config(identity, etag, options)
- connection.put_streaming_distribution_config(identity, etag, options)
+ service.put_streaming_distribution_config(identity, etag, options)
end
def post_distribution(options = {})
- connection.post_streaming_distribution(options)
+ service.post_streaming_distribution(options)
end
def attributes_to_options
View
4 lib/fog/aws/models/cdn/streaming_distributions.rb
@@ -16,11 +16,11 @@ class StreamingDistributions < Fog::Collection
attribute :is_truncated, :aliases => 'IsTruncated'
def get_distribution(dist_id)
- connection.get_streaming_distribution(dist_id)
+ service.get_streaming_distribution(dist_id)
end
def list_distributions(options = {})
- connection.get_streaming_distribution_list(options)
+ service.get_streaming_distribution_list(options)
end
alias :each_distribution_this_page :each
View
4 lib/fog/aws/models/cloud_watch/alarm.rb
@@ -46,13 +46,13 @@ def save
options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
options.delete_if { |key, value| value.nil? }
- connection.put_metric_alarm(options)
+ service.put_metric_alarm(options)
reload
end
def destroy
requires :id
- connection.delete_alarms(id)
+ service.delete_alarms(id)
end
end
end
View
18 lib/fog/aws/models/cloud_watch/alarm_data.rb
@@ -6,33 +6,33 @@ module AWS
class CloudWatch
class AlarmData < Fog::Collection
model Fog::AWS::CloudWatch::AlarmDatum
-
+
def all(conditions={})
- data = connection.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms']
+ data = service.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms']
load(data) # data is an array of attribute hashes
end
-
+
def get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil)
list_opts = {'Namespace' => namespace, 'MetricName' => metric_name}
if dimensions
dimensions_array = dimensions.collect do |name, value|
{'Name' => name, 'Value' => value}
end
- list_opts.merge!('Dimensions' => dimensions_array)
+ list_opts.merge!('Dimensions' => dimensions_array)
end
if period
- list_opts.merge!('Period' => period)
+ list_opts.merge!('Period' => period)
end
if statistic
- list_opts.merge!('Statistic' => statistic)
+ list_opts.merge!('Statistic' => statistic)
end
if unit
- list_opts.merge!('Unit' => unit)
+ list_opts.merge!('Unit' => unit)
end
- data = connection.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms']
+ data = service.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms']
load(data)
end
-
+
end
end
end
View
6 lib/fog/aws/models/cloud_watch/alarm_datum.rb
@@ -16,7 +16,7 @@ class AlarmDatum < Fog::Model
attribute :comparison_operator, :aliases => 'ComparisonOperator'
attribute :state_reason, :aliases => 'StateReason'
attribute :action_enabled, :aliases => 'ActionsEnabled'
- attribute :period, :aliases => 'Period'
+ attribute :period, :aliases => 'Period'
attribute :evaluation_periods, :aliases => 'EvaluationPeriods'
attribute :threshold, :aliases => 'Threshold'
attribute :alarm_actions, :aliases => 'AlarmActions'
@@ -40,7 +40,7 @@ def save
'AlarmName' => alarm_name,
'ComparisonOperator' => comparison_operator,
'EvaluationPeriods' => evaluation_periods,
- 'MetricName' => metric_name,
+ 'MetricName' => metric_name,
'Namespace' => namespace,
'Period' => period,
'Statistic' => statistic,
@@ -57,7 +57,7 @@ def save
alarm_definition.merge!('OKActions' => ok_actions) if ok_actions
alarm_definition.merge!('Unit' => unit) if unit
- connection.put_metric_alarm(alarm_definition)
+ service.put_metric_alarm(alarm_definition)
true
end
end
View
2 lib/fog/aws/models/cloud_watch/alarm_histories.rb
@@ -8,7 +8,7 @@ class AlarmHistories < Fog::Collection
model Fog::AWS::CloudWatch::AlarmHistory
def all(conditions={})
- data = connection.describe_alarm_history(conditions).body['DescribeAlarmHistoryResult']['AlarmHistoryItems']
+ data = service.describe_alarm_history(conditions).body['DescribeAlarmHistoryResult']['AlarmHistoryItems']
load(data) # data is an array of attribute hashes
end
View
10 lib/fog/aws/models/cloud_watch/alarms.rb
@@ -12,7 +12,7 @@ def all
data = []
next_token = nil
loop do
- result = connection.describe_alarms('NextToken' => next_token).body['DescribeAlarmsResult']
+ result = service.describe_alarms('NextToken' => next_token).body['DescribeAlarmsResult']
data += result['MetricAlarms']
next_token = result['NextToken']
break if next_token.nil?
@@ -21,23 +21,23 @@ def all
end
def get(identity)
- data = connection.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first
+ data = service.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first
new(data) unless data.nil?
end
#alarm_names is an array of alarm names
def delete(alarm_names)
- connection.delete_alarms(alarm_names)
+ service.delete_alarms(alarm_names)
true
end
def disable(alarm_names)
- connection.disable_alarm_actions(alarm_names)
+ service.disable_alarm_actions(alarm_names)
true
end
def enable(alarm_names)
- connection.enable_alarm_actions(alarm_names)
+ service.enable_alarm_actions(alarm_names)
true
end
View
4 lib/fog/aws/models/cloud_watch/metric_statistic.rb
@@ -17,7 +17,7 @@ class MetricStatistic < Fog::Model
attribute :namespace, :aliases => 'Namespace'
attribute :dimensions, :aliases => 'Dimensions'
attribute :value
-
+
def save
requires :metric_name
requires :namespace
@@ -36,7 +36,7 @@ def save
'SampleCount' => sample_count
})
end
- connection.put_metric_data(namespace, [put_opts])
+ service.put_metric_data(namespace, [put_opts])
true
end
end
View
6 lib/fog/aws/models/cloud_watch/metric_statistics.rb
@@ -6,17 +6,17 @@ module AWS
class CloudWatch
class MetricStatistics < Fog::Collection
model Fog::AWS::CloudWatch::MetricStatistic
-
+
def all(conditions)
metricName = conditions['MetricName']
namespace = conditions['Namespace']
dimensions = conditions['Dimensions']
get_metric_opts = {"StartTime" => (Time.now-3600).iso8601, "EndTime" => Time.now.iso8601, "Period" => 300}.merge(conditions)
- data = connection.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints']
+ data = service.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints']
data.collect! { |datum| datum.merge('MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => dimensions) }
load(data) # data is an array of attribute hashes
end
-
+
end
end
end
View
6 lib/fog/aws/models/cloud_watch/metrics.rb
@@ -11,7 +11,7 @@ class Metrics < Fog::Collection
model Fog::AWS::CloudWatch::Metric
def all(conditions={})
- result = connection.list_metrics(conditions).body['ListMetricsResult']
+ result = service.list_metrics(conditions).body['ListMetricsResult']
merge_attributes("NextToken" => result["NextToken"])
load(result['Metrics']) # an array of attribute hashes
end
@@ -28,7 +28,7 @@ def each
subset = subset.all("NextToken" => next_token)
subset.each_metric_this_page {|m| yield m }
end
-
+
self
end
end
@@ -41,7 +41,7 @@ def get(namespace, metric_name, dimensions=nil)
end
# list_opts.merge!('Dimensions' => dimensions_array)
end
- if data = connection.list_metrics(list_opts).body['ListMetricsResult']['Metrics'].first
+ if data = service.list_metrics(list_opts).body['ListMetricsResult']['Metrics'].first
new(data)
end
end
View
10 lib/fog/aws/models/compute/address.rb
@@ -22,7 +22,7 @@ def initialize(attributes = {})
def destroy
requires :public_ip
- connection.release_address(allocation_id || public_ip)
+ service.release_address(allocation_id || public_ip)
true
end
@@ -35,12 +35,12 @@ def server=(new_server)
end
def server
- connection.servers.get(server_id)
+ service.servers.get(server_id)
end
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
- data = connection.allocate_address(domain).body
+ data = service.allocate_address(domain).body
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
if @server
@@ -57,15 +57,15 @@ def associate(new_server)
else
@server = nil
self.server_id = new_server.id
- connection.associate_address(server_id, public_ip, network_interface_id, allocation_id)
+ service.associate_address(server_id, public_ip, network_interface_id, allocation_id)
end
end
def disassociate
@server = nil
self.server_id = nil
if persisted?
- connection.disassociate_address(public_ip)
+ service.disassociate_address(public_ip)
end
end
View
4 lib/fog/aws/models/compute/addresses.rb
@@ -60,7 +60,7 @@ def all(filters = filters)
filters = {'public-ip' => [*filters]}
end
self.filters = filters
- data = connection.describe_addresses(filters).body
+ data = service.describe_addresses(filters).body
load(
data['addressesSet'].map do |address|
address.reject {|key, value| value.nil? || value.empty? }
@@ -81,7 +81,7 @@ def all(filters = filters)
def get(public_ip)
if public_ip
- self.class.new(:connection => connection).all('public-ip' => public_ip).first
+ self.class.new(:service => service).all('public-ip' => public_ip).first
end
end
View
6 lib/fog/aws/models/compute/dhcp_option.rb
@@ -24,7 +24,7 @@ def initialize(attributes={})
#
def associate(vpc_id)
requires :id
- connection.attach_dhcp_option(id, vpc_id)
+ service.attach_dhcp_option(id, vpc_id)
#reload
end
@@ -39,7 +39,7 @@ def associate(vpc_id)
def destroy
requires :id
- connection.delete_dhcp_options(id)
+ service.delete_dhcp_options(id)
true
end
@@ -55,7 +55,7 @@ def destroy
def save
requires :dhcp_configuration_set
- data = connection.create_dhcp_options(dhcp_configuration_set).body['dhcpOptionsSet'].first
+ data = service.create_dhcp_options(dhcp_configuration_set).body['dhcpOptionsSet'].first
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true
View
4 lib/fog/aws/models/compute/dhcp_options.rb
@@ -59,7 +59,7 @@ def all(filters = filters)
filters = {'dhcp-options-id' => [*filters]}
end
self.filters = filters
- data = connection.describe_dhcp_options(filters).body
+ data = service.describe_dhcp_options(filters).body
load(data['dhcpOptionsSet'])
end
@@ -80,7 +80,7 @@ def all(filters = filters)
def get(dhcp_options_id)
if dhcp_options_id
- self.class.new(:connection => connection).all('dhcp-options-id' => dhcp_options_id).first
+ self.class.new(:service => service).all('dhcp-options-id' => dhcp_options_id).first
end
end
View
2 lib/fog/aws/models/compute/flavors.rb
@@ -177,7 +177,7 @@ def all
#
def get(flavor_id)
- self.class.new(:connection => connection).all.detect {|flavor| flavor.id == flavor_id}
+ self.class.new(:service => service).all.detect {|flavor| flavor.id == flavor_id}
end
end
View
4 lib/fog/aws/models/compute/image.rb
@@ -27,11 +27,11 @@ class Image < Fog::Model
attribute :name
def deregister(delete_snapshot = false)
- connection.deregister_image(id)
+ service.deregister_image(id)
if(delete_snapshot && root_device_type == "ebs")
block_device = block_device_mapping.detect {|block_device| block_device['deviceName'] == root_device_name}