knife-google 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +155 -66
  3. data/knife-google.gemspec +2 -1
  4. data/lib/chef/knife/google_base.rb +1 -1
  5. data/lib/chef/knife/google_disk_create.rb +17 -9
  6. data/lib/chef/knife/google_disk_delete.rb +2 -2
  7. data/lib/chef/knife/google_disk_list.rb +8 -8
  8. data/lib/chef/knife/google_project_list.rb +178 -0
  9. data/lib/chef/knife/google_region_list.rb +125 -0
  10. data/lib/chef/knife/google_server_create.rb +174 -46
  11. data/lib/chef/knife/google_server_delete.rb +9 -13
  12. data/lib/chef/knife/google_server_list.rb +5 -6
  13. data/lib/chef/knife/google_zone_list.rb +22 -28
  14. data/lib/google/compute.rb +2 -1
  15. data/lib/google/compute/client.rb +12 -7
  16. data/lib/google/compute/creatable_resource_collection.rb +12 -1
  17. data/lib/google/compute/disk.rb +0 -2
  18. data/lib/google/compute/image.rb +1 -2
  19. data/lib/google/compute/project.rb +2 -2
  20. data/lib/google/compute/{kernel.rb → region.rb} +12 -1
  21. data/lib/google/compute/region_operation.rb +62 -0
  22. data/lib/google/compute/server.rb +3 -2
  23. data/lib/google/compute/server/attached_disk.rb +3 -3
  24. data/lib/google/compute/zone.rb +6 -4
  25. data/lib/google/compute/zone_operation.rb +11 -9
  26. data/lib/knife-google/version.rb +1 -1
  27. data/spec/chef/knife/google_base_spec.rb +4 -4
  28. data/spec/chef/knife/google_disk_create_spec.rb +8 -7
  29. data/spec/chef/knife/google_disk_delete_spec.rb +15 -16
  30. data/spec/chef/knife/google_disk_list_spec.rb +6 -6
  31. data/spec/chef/knife/google_region_list_spec.rb +32 -0
  32. data/spec/chef/knife/google_server_create_spec.rb +78 -44
  33. data/spec/chef/knife/google_server_delete_spec.rb +37 -37
  34. data/spec/chef/knife/google_server_list_spec.rb +8 -7
  35. data/spec/chef/knife/google_setup_spec.rb +1 -2
  36. data/spec/chef/knife/google_zone_list_spec.rb +4 -4
  37. data/spec/data/{compute-v1beta15.json → compute-v1.json} +700 -246
  38. data/spec/data/disk.json +3 -4
  39. data/spec/data/firewall.json +2 -2
  40. data/spec/data/global_operation.json +3 -3
  41. data/spec/data/image.json +2 -2
  42. data/spec/data/machine_type.json +1 -1
  43. data/spec/data/network.json +1 -1
  44. data/spec/data/project.json +1 -1
  45. data/spec/data/region.json +23 -0
  46. data/spec/data/serial_port_output.json +1 -1
  47. data/spec/data/server.json +7 -7
  48. data/spec/data/snapshot.json +2 -2
  49. data/spec/data/zone.json +7 -15
  50. data/spec/data/zone_operation.json +3 -3
  51. data/spec/google/compute/disk_spec.rb +32 -32
  52. data/spec/google/compute/firewall_spec.rb +37 -37
  53. data/spec/google/compute/global_operation_spec.rb +9 -9
  54. data/spec/google/compute/image_spec.rb +17 -17
  55. data/spec/google/compute/machine_type_spec.rb +7 -7
  56. data/spec/google/compute/network_spec.rb +14 -14
  57. data/spec/google/compute/project_spec.rb +17 -17
  58. data/spec/google/compute/region_spec.rb +51 -0
  59. data/spec/google/compute/server_spec.rb +35 -42
  60. data/spec/google/compute/snapshot_spec.rb +11 -11
  61. data/spec/google/compute/zone_operation_spec.rb +9 -9
  62. data/spec/google/compute/zone_spec.rb +7 -7
  63. data/spec/spec_helper.rb +1 -0
  64. data/spec/support/mocks.rb +10 -10
  65. data/spec/support/resource_examples.rb +7 -7
  66. data/spec/support/spec_google_base.rb +4 -0
  67. metadata +14 -26
  68. data/spec/data/kernel.json +0 -15
  69. data/spec/google/compute/kernel_spec.rb +0 -49
@@ -1,15 +0,0 @@
1
- {
2
- "kind":"compute#kernel",
3
- "id":"12941177846308850718",
4
- "creationTimestamp":"2012-07-16 14:42:16 -0700",
5
- "selfLink":"https://www.googleapis.com/compute/v1beta15/projects/mock-project/global/kernels/mock-kernel",
6
- "name":"mock-kernel",
7
- "description":"Mock description",
8
- "deprecated":{
9
- "state":"",
10
- "replacement":"",
11
- "deprecated":"",
12
- "obsolete":"",
13
- "deleted":""
14
- }
15
- }
@@ -1,49 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- require 'spec_helper'
15
-
16
- describe Google::Compute::Kernel do
17
-
18
- before(:each) do
19
- @mock_api_client=mock(Google::APIClient, :authorization= =>{}, :auto_refresh_token= =>{})
20
- @mock_api_client.stub!(:discovered_api).and_return(mock_compute)
21
- Google::APIClient.stub!(:new).and_return(@mock_api_client)
22
- end
23
-
24
- let(:client) do
25
- Google::Compute::Client.from_json(mock_data_file(Google::Compute::Client))
26
- end
27
-
28
- it_should_behave_like Google::Compute::Resource
29
-
30
- it '#get should return an individual kernel' do
31
- @mock_api_client.should_receive(:execute).
32
- with(:api_method=>mock_compute.kernels.get,
33
- :parameters=>{'kernel'=>'mock-kernel', :project=>'mock-project'},:body_object=>nil).
34
- and_return(mock_response(Google::Compute::Kernel))
35
-
36
- kernel = client.kernels.get('mock-kernel')
37
- kernel.should be_a_kind_of Google::Compute::Kernel
38
- kernel.name.should eq('mock-kernel')
39
- end
40
-
41
- it '#list should return an array of kernels' do
42
- @mock_api_client.should_receive(:execute).
43
- with(:api_method=>mock_compute.kernels.list,
44
- :parameters=>{ :project=>'mock-project'},:body_object=>nil).
45
- and_return(mock_response(Google::Compute::Kernel, true))
46
- kernels = client.kernels.list
47
- kernels.all?{|kernel| kernel.is_a?(Google::Compute::Kernel)}.should be_true
48
- end
49
- end