fog-aws 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/aws/dns.rb +14 -1
  3. data/lib/fog/aws/iam.rb +9 -0
  4. data/lib/fog/aws/models/compute/flavors.rb +50 -0
  5. data/lib/fog/aws/models/dns/records.rb +14 -20
  6. data/lib/fog/aws/models/dns/zones.rb +1 -1
  7. data/lib/fog/aws/models/storage/file.rb +28 -3
  8. data/lib/fog/aws/models/storage/files.rb +5 -0
  9. data/lib/fog/aws/parsers/.DS_Store +0 -0
  10. data/lib/fog/aws/parsers/iam/list_managed_policies.rb +29 -0
  11. data/lib/fog/aws/parsers/iam/policy_parser.rb +57 -0
  12. data/lib/fog/aws/parsers/iam/single_policy.rb +27 -0
  13. data/lib/fog/aws/rds.rb +3 -1
  14. data/lib/fog/aws/requests/.DS_Store +0 -0
  15. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +67 -62
  16. data/lib/fog/aws/requests/compute/delete_security_group.rb +42 -28
  17. data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +20 -20
  18. data/lib/fog/aws/requests/dns/create_hosted_zone.rb +1 -3
  19. data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +5 -7
  20. data/lib/fog/aws/requests/dns/get_change.rb +11 -16
  21. data/lib/fog/aws/requests/dns/get_hosted_zone.rb +1 -3
  22. data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +7 -12
  23. data/lib/fog/aws/requests/dynamodb/scan.rb +2 -1
  24. data/lib/fog/aws/requests/iam/attach_group_policy.rb +32 -0
  25. data/lib/fog/aws/requests/iam/attach_role_policy.rb +32 -0
  26. data/lib/fog/aws/requests/iam/attach_user_policy.rb +32 -0
  27. data/lib/fog/aws/requests/iam/create_policy.rb +47 -0
  28. data/lib/fog/aws/requests/iam/delete_policy.rb +30 -0
  29. data/lib/fog/aws/requests/iam/detach_group_policy.rb +32 -0
  30. data/lib/fog/aws/requests/iam/detach_role_policy.rb +32 -0
  31. data/lib/fog/aws/requests/iam/detach_user_policy.rb +32 -0
  32. data/lib/fog/aws/requests/iam/list_policies.rb +47 -0
  33. data/lib/fog/aws/requests/storage/head_object_url.rb +40 -0
  34. data/lib/fog/aws/storage.rb +1 -0
  35. data/lib/fog/aws/version.rb +1 -1
  36. data/tests/models/compute/security_group_tests.rb +11 -1
  37. data/tests/models/storage/file_tests.rb +29 -0
  38. data/tests/requests/compute/security_group_tests.rb +9 -0
  39. data/tests/requests/dns/dns_tests.rb +29 -42
  40. data/tests/requests/iam/managed_policy_tests.rb +91 -0
  41. data/tests/requests/storage/object_tests.rb +6 -0
  42. metadata +18 -2
@@ -0,0 +1,91 @@
1
+ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
2
+
3
+ pending if Fog.mocking?
4
+ Fog::AWS[:iam].create_group('fog_policy_test_group')
5
+ Fog::AWS[:iam].create_user('fog_policy_test_user')
6
+ Fog::AWS[:iam].create_role('fog_policy_test_role', Fog::AWS::IAM::EC2_ASSUME_ROLE_POLICY)
7
+
8
+ tests('success') do
9
+ @policy = {'Version' => '2012-10-17', "Statement" => [{"Effect" => "Deny", "Action" => "*", "Resource" => "*"}]}
10
+ @policy_format = {
11
+ 'Arn' => String,
12
+ 'AttachmentCount' => Integer,
13
+ 'Description' => String,
14
+ 'DefaultVersionId' => String,
15
+ 'IsAttachable' => Fog::Boolean,
16
+ 'Path' => String,
17
+ 'PolicyId' => String,
18
+ 'PolicyName' => String,
19
+ 'CreateDate' => Time,
20
+ 'UpdateDate' => Time
21
+ }
22
+
23
+ create_policy_format = {
24
+ 'RequestId' => String,
25
+ 'Policy' => @policy_format
26
+ }
27
+
28
+ list_policies_format = {
29
+ 'RequestId' => String,
30
+ 'Policies' => [@policy_format],
31
+ 'Marker' => String,
32
+ 'IsTruncated' => Fog::Boolean
33
+ }
34
+
35
+ tests("#create_policy('fog_policy')").formats(create_policy_format) do
36
+ body = Fog::AWS[:iam].create_policy('fog_policy', @policy, '/fog/').body
37
+ puts body.inspect
38
+ @policy_arn = body['Policy']['Arn']
39
+ body
40
+ end
41
+
42
+ tests("#list_policies()").formats(list_policies_format) do
43
+ body = Fog::AWS[:iam].list_policies('PathPrefix' => '/fog/').body
44
+ tests('length 1').returns(1) do
45
+ body['Policies'].length
46
+ end
47
+ body
48
+ end
49
+
50
+
51
+ tests("#attach_user_policy()").formats(AWS::IAM::Formats::BASIC) do
52
+ Fog::AWS[:iam].attach_user_policy('fog_policy_test_user', @policy_arn).body
53
+ end
54
+
55
+ tests("#detach_user_policy()").formats(AWS::IAM::Formats::BASIC) do
56
+ Fog::AWS[:iam].detach_user_policy('fog_policy_test_user', @policy_arn).body
57
+ end
58
+
59
+
60
+ tests("#attach_group_policy()").formats(AWS::IAM::Formats::BASIC) do
61
+ Fog::AWS[:iam].attach_group_policy('fog_policy_test_group', @policy_arn).body
62
+ end
63
+
64
+ tests("#detach_group_policy()").formats(AWS::IAM::Formats::BASIC) do
65
+ Fog::AWS[:iam].detach_group_policy('fog_policy_test_group', @policy_arn).body
66
+ end
67
+
68
+ tests("#attach_role_policy()").formats(AWS::IAM::Formats::BASIC) do
69
+ Fog::AWS[:iam].attach_role_policy('fog_policy_test_role', @policy_arn).body
70
+ end
71
+
72
+ tests("#detach_role_policy()").formats(AWS::IAM::Formats::BASIC) do
73
+ Fog::AWS[:iam].detach_role_policy('fog_policy_test_role', @policy_arn).body
74
+ end
75
+
76
+ tests("#delete_policy()").formats(AWS::IAM::Formats::BASIC) do
77
+ Fog::AWS[:iam].delete_policy(@policy_arn).body
78
+ end
79
+
80
+ end
81
+
82
+ tests('failure') do
83
+ test('failing conditions')
84
+ end
85
+
86
+ Fog::AWS[:iam].delete_group('fog_policy_test_group')
87
+ Fog::AWS[:iam].delete_user('fog_policy_test_user')
88
+ Fog::AWS[:iam].delete_role('fog_policy_test_role')
89
+
90
+
91
+ end
@@ -118,6 +118,12 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
118
118
  (object_url =~ /http:\/\/#{Regexp.quote(@directory.identity)}\.s3\.amazonaws\.com\/fog_object/) != nil
119
119
  end
120
120
 
121
+ tests("#head_object_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do
122
+ object_url = Fog::Storage[:aws].head_object_url(@directory.identity, 'fog_object', (Time.now + 60))
123
+ puts object_url
124
+ (object_url =~ /https:\/\/#{Regexp.quote(@directory.identity)}\.s3\.amazonaws\.com\/fog_object/) != nil
125
+ end
126
+
121
127
  tests("delete_multiple_objects('#{@directory.identity}', ['fog_object', 'fog_other_object'])").formats(@multiple_delete_format) do
122
128
  Fog::Storage[:aws].delete_multiple_objects(@directory.identity, ['fog_object', 'fog_other_object']).body
123
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-03 00:00:00.000000000 Z
12
+ date: 2015-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -285,6 +285,7 @@ files:
285
285
  - lib/fog/aws/models/storage/files.rb
286
286
  - lib/fog/aws/models/storage/version.rb
287
287
  - lib/fog/aws/models/storage/versions.rb
288
+ - lib/fog/aws/parsers/.DS_Store
288
289
  - lib/fog/aws/parsers/auto_scaling/basic.rb
289
290
  - lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb
290
291
  - lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb
@@ -494,6 +495,7 @@ files:
494
495
  - lib/fog/aws/parsers/iam/list_groups.rb
495
496
  - lib/fog/aws/parsers/iam/list_groups_for_user.rb
496
497
  - lib/fog/aws/parsers/iam/list_instance_profiles.rb
498
+ - lib/fog/aws/parsers/iam/list_managed_policies.rb
497
499
  - lib/fog/aws/parsers/iam/list_mfa_devices.rb
498
500
  - lib/fog/aws/parsers/iam/list_policies.rb
499
501
  - lib/fog/aws/parsers/iam/list_roles.rb
@@ -501,7 +503,9 @@ files:
501
503
  - lib/fog/aws/parsers/iam/list_signing_certificates.rb
502
504
  - lib/fog/aws/parsers/iam/list_users.rb
503
505
  - lib/fog/aws/parsers/iam/login_profile.rb
506
+ - lib/fog/aws/parsers/iam/policy_parser.rb
504
507
  - lib/fog/aws/parsers/iam/role_parser.rb
508
+ - lib/fog/aws/parsers/iam/single_policy.rb
505
509
  - lib/fog/aws/parsers/iam/single_role.rb
506
510
  - lib/fog/aws/parsers/iam/update_group.rb
507
511
  - lib/fog/aws/parsers/iam/update_user.rb
@@ -630,6 +634,7 @@ files:
630
634
  - lib/fog/aws/rds.rb
631
635
  - lib/fog/aws/redshift.rb
632
636
  - lib/fog/aws/region_methods.rb
637
+ - lib/fog/aws/requests/.DS_Store
633
638
  - lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb
634
639
  - lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb
635
640
  - lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb
@@ -950,11 +955,15 @@ files:
950
955
  - lib/fog/aws/requests/glacier/upload_part.rb
951
956
  - lib/fog/aws/requests/iam/add_role_to_instance_profile.rb
952
957
  - lib/fog/aws/requests/iam/add_user_to_group.rb
958
+ - lib/fog/aws/requests/iam/attach_group_policy.rb
959
+ - lib/fog/aws/requests/iam/attach_role_policy.rb
960
+ - lib/fog/aws/requests/iam/attach_user_policy.rb
953
961
  - lib/fog/aws/requests/iam/create_access_key.rb
954
962
  - lib/fog/aws/requests/iam/create_account_alias.rb
955
963
  - lib/fog/aws/requests/iam/create_group.rb
956
964
  - lib/fog/aws/requests/iam/create_instance_profile.rb
957
965
  - lib/fog/aws/requests/iam/create_login_profile.rb
966
+ - lib/fog/aws/requests/iam/create_policy.rb
958
967
  - lib/fog/aws/requests/iam/create_role.rb
959
968
  - lib/fog/aws/requests/iam/create_user.rb
960
969
  - lib/fog/aws/requests/iam/delete_access_key.rb
@@ -964,12 +973,16 @@ files:
964
973
  - lib/fog/aws/requests/iam/delete_group_policy.rb
965
974
  - lib/fog/aws/requests/iam/delete_instance_profile.rb
966
975
  - lib/fog/aws/requests/iam/delete_login_profile.rb
976
+ - lib/fog/aws/requests/iam/delete_policy.rb
967
977
  - lib/fog/aws/requests/iam/delete_role.rb
968
978
  - lib/fog/aws/requests/iam/delete_role_policy.rb
969
979
  - lib/fog/aws/requests/iam/delete_server_certificate.rb
970
980
  - lib/fog/aws/requests/iam/delete_signing_certificate.rb
971
981
  - lib/fog/aws/requests/iam/delete_user.rb
972
982
  - lib/fog/aws/requests/iam/delete_user_policy.rb
983
+ - lib/fog/aws/requests/iam/detach_group_policy.rb
984
+ - lib/fog/aws/requests/iam/detach_role_policy.rb
985
+ - lib/fog/aws/requests/iam/detach_user_policy.rb
973
986
  - lib/fog/aws/requests/iam/get_account_password_policy.rb
974
987
  - lib/fog/aws/requests/iam/get_account_summary.rb
975
988
  - lib/fog/aws/requests/iam/get_group.rb
@@ -989,6 +1002,7 @@ files:
989
1002
  - lib/fog/aws/requests/iam/list_instance_profiles.rb
990
1003
  - lib/fog/aws/requests/iam/list_instance_profiles_for_role.rb
991
1004
  - lib/fog/aws/requests/iam/list_mfa_devices.rb
1005
+ - lib/fog/aws/requests/iam/list_policies.rb
992
1006
  - lib/fog/aws/requests/iam/list_role_policies.rb
993
1007
  - lib/fog/aws/requests/iam/list_roles.rb
994
1008
  - lib/fog/aws/requests/iam/list_server_certificates.rb
@@ -1155,6 +1169,7 @@ files:
1155
1169
  - lib/fog/aws/requests/storage/get_service.rb
1156
1170
  - lib/fog/aws/requests/storage/head_bucket.rb
1157
1171
  - lib/fog/aws/requests/storage/head_object.rb
1172
+ - lib/fog/aws/requests/storage/head_object_url.rb
1158
1173
  - lib/fog/aws/requests/storage/initiate_multipart_upload.rb
1159
1174
  - lib/fog/aws/requests/storage/list_multipart_uploads.rb
1160
1175
  - lib/fog/aws/requests/storage/list_parts.rb
@@ -1361,6 +1376,7 @@ files:
1361
1376
  - tests/requests/iam/group_tests.rb
1362
1377
  - tests/requests/iam/helper.rb
1363
1378
  - tests/requests/iam/login_profile_tests.rb
1379
+ - tests/requests/iam/managed_policy_tests.rb
1364
1380
  - tests/requests/iam/mfa_tests.rb
1365
1381
  - tests/requests/iam/role_tests.rb
1366
1382
  - tests/requests/iam/server_certificate_tests.rb