fog 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Rakefile +90 -1
- data/bin/fog +5 -1
- data/changelog.txt +156 -0
- data/docs/_layouts/default.html +1 -0
- data/docs/about/press.markdown +4 -0
- data/docs/compute/index.markdown +4 -0
- data/docs/storage/index.markdown +4 -0
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/iam.rb +7 -6
- data/lib/fog/aws/models/rds/server.rb +27 -23
- data/lib/fog/aws/parsers/iam/get_group.rb +2 -2
- data/lib/fog/aws/requests/iam/update_server_certificate.rb +37 -0
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/dynect.rb +30 -0
- data/lib/fog/bin/rackspace.rb +4 -0
- data/lib/fog/cdn.rb +4 -0
- data/lib/fog/cdn/aws.rb +6 -0
- data/lib/fog/cdn/parsers/aws/get_invalidation_list.rb +43 -0
- data/lib/fog/cdn/parsers/aws/get_streaming_distribution_list.rb +59 -0
- data/lib/fog/cdn/parsers/aws/streaming_distribution.rb +59 -0
- data/lib/fog/cdn/requests/aws/delete_streaming_distribution.rb +28 -0
- data/lib/fog/cdn/requests/aws/get_invalidation_list.rb +42 -0
- data/lib/fog/cdn/requests/aws/get_streaming_distribution.rb +50 -0
- data/lib/fog/cdn/requests/aws/get_streaming_distribution_list.rb +59 -0
- data/lib/fog/cdn/requests/aws/post_streaming_distribution.rb +78 -0
- data/lib/fog/cdn/requests/aws/put_streaming_distribution_config.rb +83 -0
- data/lib/fog/compute.rb +6 -2
- data/lib/fog/compute/aws.rb +12 -1
- data/lib/fog/compute/brightbox.rb +22 -12
- data/lib/fog/compute/models/aws/image.rb +5 -0
- data/lib/fog/compute/models/aws/server.rb +19 -22
- data/lib/fog/compute/models/aws/tag.rb +1 -1
- data/lib/fog/compute/models/bluebox/server.rb +2 -18
- data/lib/fog/compute/models/brightbox/account.rb +1 -1
- data/lib/fog/compute/models/brightbox/server.rb +2 -2
- data/lib/fog/compute/models/go_grid/server.rb +2 -18
- data/lib/fog/compute/models/linode/server.rb +5 -5
- data/lib/fog/compute/models/ninefold/server.rb +2 -2
- data/lib/fog/compute/models/rackspace/server.rb +2 -18
- data/lib/fog/compute/models/server.rb +27 -0
- data/lib/fog/compute/models/slicehost/server.rb +2 -18
- data/lib/fog/compute/models/storm_on_demand/server.rb +3 -3
- data/lib/fog/compute/models/voxel/server.rb +2 -2
- data/lib/fog/compute/parsers/aws/describe_images.rb +15 -3
- data/lib/fog/compute/parsers/aws/describe_instances.rb +1 -1
- data/lib/fog/compute/parsers/aws/describe_security_groups.rb +31 -7
- data/lib/fog/compute/requests/aws/describe_images.rb +33 -14
- data/lib/fog/compute/requests/aws/describe_volumes.rb +1 -0
- data/lib/fog/compute/requests/aws/modify_image_attribute.rb +39 -0
- data/lib/fog/compute/requests/aws/modify_instance_attribute.rb +37 -0
- data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +10 -10
- data/lib/fog/compute/requests/aws/register_image.rb +54 -13
- data/lib/fog/compute/requests/aws/run_instances.rb +5 -0
- data/lib/fog/compute/requests/aws/stop_instances.rb +2 -1
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/create_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/destroy_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_interface.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_server_type.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_user.rb +2 -8
- data/lib/fog/compute/requests/brightbox/get_zone.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_api_clients.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_cloud_ips.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_images.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_load_balancers.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_server_types.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_servers.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_users.rb +2 -8
- data/lib/fog/compute/requests/brightbox/list_zones.rb +2 -8
- data/lib/fog/compute/requests/brightbox/map_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/shutdown_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/snapshot_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/start_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/stop_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_account.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_api_client.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_image.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_load_balancer.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_server.rb +2 -8
- data/lib/fog/compute/requests/brightbox/update_user.rb +2 -8
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/credentials.rb +1 -1
- data/lib/fog/core/errors.rb +3 -1
- data/lib/fog/core/json.rb +20 -0
- data/lib/fog/core/provider.rb +3 -1
- data/lib/fog/core/service.rb +5 -0
- data/lib/fog/dns.rb +8 -1
- data/lib/fog/dns/dynect.rb +80 -0
- data/lib/fog/dns/models/dynect/record.rb +67 -0
- data/lib/fog/dns/models/dynect/records.rb +53 -0
- data/lib/fog/dns/models/dynect/zone.rb +60 -0
- data/lib/fog/dns/models/dynect/zones.rb +29 -0
- data/lib/fog/dns/requests/dynect/delete_record.rb +24 -0
- data/lib/fog/dns/requests/dynect/delete_zone.rb +21 -0
- data/lib/fog/dns/requests/dynect/get_node_list.rb +23 -0
- data/lib/fog/dns/requests/dynect/get_record.rb +25 -0
- data/lib/fog/dns/requests/dynect/get_zone.rb +22 -0
- data/lib/fog/dns/requests/dynect/post_record.rb +27 -0
- data/lib/fog/dns/requests/dynect/post_session.rb +36 -0
- data/lib/fog/dns/requests/dynect/post_zone.rb +32 -0
- data/lib/fog/dns/requests/dynect/put_zone.rb +26 -0
- data/lib/fog/dns/zerigo.rb +1 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/providers/dynect.rb +14 -0
- data/lib/fog/providers/rackspace.rb +1 -0
- data/lib/fog/rackspace/load_balancers.rb +179 -0
- data/lib/fog/rackspace/models/load_balancers/access_rule.rb +39 -0
- data/lib/fog/rackspace/models/load_balancers/access_rules.rb +29 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +216 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancers.rb +27 -0
- data/lib/fog/rackspace/models/load_balancers/node.rb +58 -0
- data/lib/fog/rackspace/models/load_balancers/nodes.rb +29 -0
- data/lib/fog/rackspace/models/load_balancers/virtual_ip.rb +35 -0
- data/lib/fog/rackspace/models/load_balancers/virtual_ips.rb +32 -0
- data/lib/fog/rackspace/requests/load_balancers/create_access_rule.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +26 -0
- data/lib/fog/rackspace/requests/load_balancers/create_node.rb +27 -0
- data/lib/fog/rackspace/requests/load_balancers/create_virtual_ip.rb +20 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_access_rule.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_all_access_rules.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_load_balancer.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_node.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +17 -0
- data/lib/fog/rackspace/requests/load_balancers/delete_virtual_ip.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_connection_logging.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_connection_throttling.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_load_balancer.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/get_monitor.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_node.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_session_persistence.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/get_usage.rb +20 -0
- data/lib/fog/rackspace/requests/load_balancers/list_access_rules.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_algorithms.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_nodes.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_protocols.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_virtual_ips.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_connection_throttling.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_monitor.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_session_persistence.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_connection_logging.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/set_connection_throttling.rb +22 -0
- data/lib/fog/rackspace/requests/load_balancers/set_monitor.rb +31 -0
- data/lib/fog/rackspace/requests/load_balancers/set_session_persistence.rb +21 -0
- data/lib/fog/rackspace/requests/load_balancers/update_load_balancer.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/update_node.rb +26 -0
- data/lib/fog/storage.rb +5 -1
- data/lib/fog/storage/aws.rb +3 -0
- data/lib/fog/storage/models/aws/directory.rb +1 -3
- data/lib/fog/storage/models/aws/file.rb +1 -1
- data/lib/fog/storage/models/google/file.rb +1 -1
- data/lib/fog/storage/models/local/file.rb +8 -6
- data/lib/fog/storage/models/ninefold/file.rb +0 -1
- data/lib/fog/storage/requests/aws/copy_object.rb +1 -1
- data/lib/fog/storage/requests/aws/get_bucket.rb +14 -11
- data/lib/fog/storage/requests/aws/post_object_hidden_fields.rb +2 -4
- data/tests/aws/models/rds/server_tests.rb +4 -4
- data/tests/compute/models/aws/server_tests.rb +15 -1
- data/tests/compute/requests/aws/helper.rb +0 -4
- data/tests/compute/requests/aws/image_tests.rb +40 -9
- data/tests/compute/requests/brightbox/account_tests.rb +1 -1
- data/tests/compute/requests/brightbox/helper.rb +3 -0
- data/tests/compute/requests/brightbox/load_balancer_tests.rb +1 -1
- data/tests/compute/requests/voxel/server_tests.rb +2 -2
- data/tests/dns/helper.rb +18 -0
- data/tests/dns/models/record_tests.rb +3 -2
- data/tests/dns/models/records_tests.rb +2 -2
- data/tests/dns/models/zone_tests.rb +2 -2
- data/tests/dns/models/zones_tests.rb +1 -1
- data/tests/dns/requests/bluebox/dns_tests.rb +0 -12
- data/tests/dns/requests/dnsimple/dns_tests.rb +0 -12
- data/tests/dns/requests/dnsmadeeasy/dns_tests.rb +0 -12
- data/tests/dns/requests/dynect/dns_tests.rb +132 -0
- data/tests/dns/requests/linode/dns_tests.rb +1 -13
- data/tests/dns/requests/slicehost/dns_tests.rb +1 -13
- data/tests/helper.rb +1 -1
- data/tests/helpers/collection_helper.rb +2 -2
- data/tests/helpers/formats_helper.rb +2 -0
- data/tests/helpers/mock_helper.rb +4 -1
- data/tests/rackspace/helper.rb +24 -0
- data/tests/rackspace/load_balancer_tests.rb +21 -0
- data/tests/rackspace/models/access_list_tests.rb +12 -0
- data/tests/rackspace/models/access_lists_tests.rb +12 -0
- data/tests/rackspace/models/load_balancer_tests.rb +116 -0
- data/tests/rackspace/models/load_balancers_tests.rb +19 -0
- data/tests/rackspace/models/node_tests.rb +19 -0
- data/tests/rackspace/models/nodes_tests.rb +12 -0
- data/tests/rackspace/models/virtual_ip_tests.rb +16 -0
- data/tests/rackspace/models/virtual_ips_tests.rb +12 -0
- data/tests/rackspace/requests/access_list_tests.rb +56 -0
- data/tests/rackspace/requests/algorithm_tests.rb +19 -0
- data/tests/rackspace/requests/connection_logging_tests.rb +25 -0
- data/tests/rackspace/requests/connection_throttling_tests.rb +37 -0
- data/tests/rackspace/requests/helper.rb +112 -0
- data/tests/rackspace/requests/load_balancer_tests.rb +63 -0
- data/tests/rackspace/requests/load_balancer_usage_tests.rb +19 -0
- data/tests/rackspace/requests/monitor_tests.rb +46 -0
- data/tests/rackspace/requests/node_tests.rb +87 -0
- data/tests/rackspace/requests/protocol_tests.rb +21 -0
- data/tests/rackspace/requests/session_persistence_tests.rb +33 -0
- data/tests/rackspace/requests/usage_tests.rb +17 -0
- data/tests/rackspace/requests/virtual_ip_tests.rb +40 -0
- data/tests/storage/requests/aws/bucket_tests.rb +53 -0
- metadata +127 -8
- data/lib/fog/compute/requests/aws/modify_image_attributes.rb +0 -37
@@ -0,0 +1,59 @@
|
|
1
|
+
module Fog
|
2
|
+
module CDN
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/cdn/parsers/aws/get_streaming_distribution_list'
|
7
|
+
|
8
|
+
# List information about distributions in CloudFront
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash> - config arguments for list. Defaults to {}.
|
12
|
+
# * 'Marker'<~String> - limits object keys to only those that appear
|
13
|
+
# lexicographically after its value.
|
14
|
+
# * 'MaxItems'<~Integer> - limits number of object keys returned
|
15
|
+
#
|
16
|
+
# ==== Returns
|
17
|
+
# * response<~Excon::Response>:
|
18
|
+
# * body<~Hash>:
|
19
|
+
# * 'IsTruncated'<~Boolean> - Whether or not the listing is truncated
|
20
|
+
# * 'Marker'<~String> - Marker specified for query
|
21
|
+
# * 'MaxItems'<~Integer> - Maximum number of keys specified for query
|
22
|
+
# * 'NextMarker'<~String> - Marker to specify for next page (id of last result of current page)
|
23
|
+
# * 'StreamingDistributionSummary'<~Array>:
|
24
|
+
# * 'S3Origin'<~Hash>:
|
25
|
+
# * 'DNSName'<~String> - origin to associate with distribution, ie 'mybucket.s3.amazonaws.com'
|
26
|
+
# * 'OriginAccessIdentity'<~String> - Optional: Used when serving private content
|
27
|
+
# or
|
28
|
+
# * 'CustomOrigin'<~Hash>:
|
29
|
+
# * 'DNSName'<~String> - origin to associate with distribution, ie 'www.example.com'
|
30
|
+
# * 'HTTPPort'<~Integer> - HTTP port of origin, in [80, 443] or (1024...65535)
|
31
|
+
# * 'HTTPSPort'<~Integer> - HTTPS port of origin, in [80, 443] or (1024...65535)
|
32
|
+
# * 'OriginProtocolPolicy'<~String> - Policy on using http vs https, in ['http-only', 'match-viewer']
|
33
|
+
# * 'Comment'<~String> - comment associated with distribution
|
34
|
+
# * 'CNAME'<~Array> - array of associated cnames
|
35
|
+
# * 'Enabled'<~Boolean> - whether or not distribution is enabled
|
36
|
+
# * 'Id'<~String> - Id of distribution
|
37
|
+
# * 'LastModifiedTime'<~String> - Timestamp of last modification of distribution
|
38
|
+
# * 'Origin'<~String> - s3 origin bucket
|
39
|
+
# * 'Status'<~String> - Status of distribution
|
40
|
+
# * 'TrustedSigners'<~Array> - trusted signers
|
41
|
+
#
|
42
|
+
# ==== See Also
|
43
|
+
# http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/ListStreamingDistributions.html
|
44
|
+
|
45
|
+
def get_streaming_distribution_list(options = {})
|
46
|
+
request({
|
47
|
+
:expects => 200,
|
48
|
+
:idempotent => true,
|
49
|
+
:method => 'GET',
|
50
|
+
:parser => Fog::Parsers::CDN::AWS::GetStreamingDistributionList.new,
|
51
|
+
:path => "/streaming-distribution",
|
52
|
+
:query => options
|
53
|
+
})
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Fog
|
2
|
+
module CDN
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/cdn/parsers/aws/streaming_distribution'
|
7
|
+
|
8
|
+
# create a new streaming distribution in CloudFront
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash> - config for distribution. Defaults to {}.
|
12
|
+
# REQUIRED:
|
13
|
+
# * 'S3Origin'<~Hash>:
|
14
|
+
# * 'DNSName'<~String> - origin to associate with distribution, ie 'mybucket.s3.amazonaws.com'
|
15
|
+
# OPTIONAL:
|
16
|
+
# * 'CallerReference'<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
|
17
|
+
# * 'Comment'<~String> - Optional comment about distribution
|
18
|
+
# * 'CNAME'<~Array> - Optional array of strings to set as CNAMEs
|
19
|
+
# * 'Enabled'<~Boolean> - Whether or not distribution should accept requests, defaults to true
|
20
|
+
# * 'Logging'<~Hash>: Optional logging config
|
21
|
+
# * 'Bucket'<~String> - Bucket to store logs in, ie 'mylogs.s3.amazonaws.com'
|
22
|
+
# * 'Prefix'<~String> - Optional prefix for log filenames, ie 'myprefix/'
|
23
|
+
#
|
24
|
+
# ==== Returns
|
25
|
+
# * response<~Excon::Response>:
|
26
|
+
# * body<~Hash>:
|
27
|
+
# * 'Id'<~String> - Id of distribution
|
28
|
+
# * 'Status'<~String> - Status of distribution
|
29
|
+
# * 'LastModifiedTime'<~String> - Timestamp of last modification of distribution
|
30
|
+
# * 'DomainName'<~String>: Domain name of distribution
|
31
|
+
# * 'StreamingDistributionConfig'<~Array>:
|
32
|
+
# * 'CallerReference'<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
|
33
|
+
# * 'CNAME'<~Array> - array of associated cnames
|
34
|
+
# * 'Comment'<~String> - comment associated with distribution
|
35
|
+
# * 'Enabled'<~Boolean> - whether or not distribution is enabled
|
36
|
+
# * 'Logging'<~Hash>:
|
37
|
+
# * 'Bucket'<~String> - bucket logs are stored in
|
38
|
+
# * 'Prefix'<~String> - prefix logs are stored with
|
39
|
+
#
|
40
|
+
# ==== See Also
|
41
|
+
# http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/CreateStreamingDistribution.html
|
42
|
+
|
43
|
+
def post_streaming_distribution(options = {})
|
44
|
+
options['CallerReference'] = Time.now.to_i.to_s
|
45
|
+
data = '<?xml version="1.0" encoding="UTF-8"?>'
|
46
|
+
data << "<StreamingDistributionConfig xmlns=\"http://cloudfront.amazonaws.com/doc/#{@version}/\">"
|
47
|
+
for key, value in options
|
48
|
+
case value
|
49
|
+
when Array
|
50
|
+
for item in value
|
51
|
+
data << "<#{key}>#{item}</#{key}>"
|
52
|
+
end
|
53
|
+
when Hash
|
54
|
+
data << "<#{key}>"
|
55
|
+
for inner_key, inner_value in value
|
56
|
+
data << "<#{inner_key}>#{inner_value}</#{inner_key}>"
|
57
|
+
end
|
58
|
+
data << "</#{key}>"
|
59
|
+
else
|
60
|
+
data << "<#{key}>#{value}</#{key}>"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
data << "</StreamingDistributionConfig>"
|
64
|
+
request({
|
65
|
+
:body => data,
|
66
|
+
:expects => 201,
|
67
|
+
:headers => { 'Content-Type' => 'text/xml' },
|
68
|
+
:idempotent => true,
|
69
|
+
:method => 'POST',
|
70
|
+
:parser => Fog::Parsers::CDN::AWS::StreamingDistribution.new,
|
71
|
+
:path => "/streaming-distribution"
|
72
|
+
})
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Fog
|
2
|
+
module CDN
|
3
|
+
class AWS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/cdn/parsers/aws/streaming_distribution'
|
7
|
+
|
8
|
+
# update a streaming distribution in CloudFront
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * distribution_id<~String> - Id of distribution to update config for
|
12
|
+
# * options<~Hash> - config for distribution. Defaults to {}.
|
13
|
+
# REQUIRED:
|
14
|
+
# * 'S3Origin'<~Hash>:
|
15
|
+
# * 'DNSName'<~String> - origin to associate with distribution, ie 'mybucket.s3.amazonaws.com'
|
16
|
+
# OPTIONAL:
|
17
|
+
# * 'CallerReference'<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
|
18
|
+
# * 'Comment'<~String> - Optional comment about distribution
|
19
|
+
# * 'CNAME'<~Array> - Optional array of strings to set as CNAMEs
|
20
|
+
# * 'Enabled'<~Boolean> - Whether or not distribution should accept requests, defaults to true
|
21
|
+
# * 'Logging'<~Hash>: Optional logging config
|
22
|
+
# * 'Bucket'<~String> - Bucket to store logs in, ie 'mylogs.s3.amazonaws.com'
|
23
|
+
# * 'Prefix'<~String> - Optional prefix for log filenames, ie 'myprefix/'
|
24
|
+
#
|
25
|
+
# ==== Returns
|
26
|
+
# * response<~Excon::Response>:
|
27
|
+
# * body<~Hash>:
|
28
|
+
# * 'DomainName'<~String>: Domain name of distribution
|
29
|
+
# * 'Id'<~String> - Id of distribution
|
30
|
+
# * 'LastModifiedTime'<~String> - Timestamp of last modification of distribution
|
31
|
+
# * 'Status'<~String> - Status of distribution
|
32
|
+
# * 'StreamingDistributionConfig'<~Array>:
|
33
|
+
# * 'CallerReference'<~String> - Used to prevent replay, defaults to Time.now.to_i.to_s
|
34
|
+
# * 'CNAME'<~Array> - array of associated cnames
|
35
|
+
# * 'Comment'<~String> - comment associated with distribution
|
36
|
+
# * 'Enabled'<~Boolean> - whether or not distribution is enabled
|
37
|
+
# * 'Logging'<~Hash>:
|
38
|
+
# * 'Bucket'<~String> - bucket logs are stored in
|
39
|
+
# * 'Prefix'<~String> - prefix logs are stored with
|
40
|
+
# * 'Origin'<~String> - s3 origin bucket
|
41
|
+
# * 'TrustedSigners'<~Array> - trusted signers
|
42
|
+
#
|
43
|
+
# ==== See Also
|
44
|
+
# http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/PutStreamingDistribution.html
|
45
|
+
|
46
|
+
def put_streaming_distribution_config(distribution_id, etag, options = {})
|
47
|
+
data = '<?xml version="1.0" encoding="UTF-8"?>'
|
48
|
+
data << "<StreamingDistributionConfig xmlns=\"http://cloudfront.amazonaws.com/doc/#{@version}/\">"
|
49
|
+
for key, value in options
|
50
|
+
case value
|
51
|
+
when Array
|
52
|
+
for item in value
|
53
|
+
data << "<#{key}>#{item}</#{key}>"
|
54
|
+
end
|
55
|
+
when Hash
|
56
|
+
data << "<#{key}>"
|
57
|
+
for inner_key, inner_value in value
|
58
|
+
data << "<#{inner_key}>#{inner_value}</#{inner_key}>"
|
59
|
+
end
|
60
|
+
data << "</#{key}>"
|
61
|
+
else
|
62
|
+
data << "<#{key}>#{value}</#{key}>"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
data << "</StreamingDistributionConfig>"
|
66
|
+
request({
|
67
|
+
:body => data,
|
68
|
+
:expects => 200,
|
69
|
+
:headers => {
|
70
|
+
'Content-Type' => 'text/xml',
|
71
|
+
'If-Match' => etag
|
72
|
+
},
|
73
|
+
:idempotent => true,
|
74
|
+
:method => 'PUT',
|
75
|
+
:parser => Fog::Parsers::CDN::AWS::StreamingDistribution.new,
|
76
|
+
:path => "/streaming-distribution/#{distribution_id}/config"
|
77
|
+
})
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/fog/compute.rb
CHANGED
@@ -44,7 +44,7 @@ module Fog
|
|
44
44
|
when :vcloud
|
45
45
|
require 'fog/compute/vcloud'
|
46
46
|
Fog::Vcloud::Compute.new(attributes)
|
47
|
-
when
|
47
|
+
when :virtualbox
|
48
48
|
require 'fog/compute/virtual_box'
|
49
49
|
Fog::Compute::VirtualBox.new(attributes)
|
50
50
|
when :voxel
|
@@ -55,9 +55,13 @@ module Fog
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
def self.providers
|
59
|
+
Fog.services[:compute]
|
60
|
+
end
|
61
|
+
|
58
62
|
def self.servers
|
59
63
|
servers = []
|
60
|
-
for provider in
|
64
|
+
for provider in self.providers
|
61
65
|
begin
|
62
66
|
servers.concat(self[provider].servers)
|
63
67
|
rescue # ignore any missing credentials/etc
|
data/lib/fog/compute/aws.rb
CHANGED
@@ -70,7 +70,8 @@ module Fog
|
|
70
70
|
request :get_console_output
|
71
71
|
request :get_password_data
|
72
72
|
request :import_key_pair
|
73
|
-
request :
|
73
|
+
request :modify_image_attribute
|
74
|
+
request :modify_instance_attribute
|
74
75
|
request :modify_snapshot_attribute
|
75
76
|
request :purchase_reserved_instances_offering
|
76
77
|
request :reboot_instances
|
@@ -85,6 +86,16 @@ module Fog
|
|
85
86
|
request :monitor_instances
|
86
87
|
request :unmonitor_instances
|
87
88
|
|
89
|
+
# deprecation
|
90
|
+
class Real
|
91
|
+
|
92
|
+
def modify_image_attributes(*params)
|
93
|
+
Formatador.display_line("[yellow][WARN] modify_image_attributes is deprecated, use modify_image_attribute instead[/] [light_black](#{caller.first})[/]")
|
94
|
+
modify_image_attribute(*params)
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
88
99
|
class Mock
|
89
100
|
|
90
101
|
def self.data
|
@@ -97,17 +97,14 @@ module Fog
|
|
97
97
|
@connection = Fog::Connection.new(@api_url)
|
98
98
|
end
|
99
99
|
|
100
|
-
def request(
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
unless response.body.empty?
|
109
|
-
response = MultiJson.decode(response.body)
|
110
|
-
end
|
100
|
+
def request(method, url, expected_responses, options = nil)
|
101
|
+
request_options = {
|
102
|
+
:method => method.to_s.upcase,
|
103
|
+
:path => url,
|
104
|
+
:expects => expected_responses
|
105
|
+
}
|
106
|
+
request_options[:body] = MultiJson.encode(options) unless options.nil?
|
107
|
+
make_request(request_options)
|
111
108
|
end
|
112
109
|
|
113
110
|
def account
|
@@ -135,9 +132,22 @@ module Fog
|
|
135
132
|
return @oauth_token
|
136
133
|
end
|
137
134
|
|
135
|
+
def make_request(params)
|
136
|
+
begin
|
137
|
+
get_oauth_token if @oauth_token.nil?
|
138
|
+
response = authenticated_request(params)
|
139
|
+
rescue Excon::Errors::Unauthorized => e
|
140
|
+
get_oauth_token
|
141
|
+
response = authenticated_request(params)
|
142
|
+
end
|
143
|
+
unless response.body.empty?
|
144
|
+
response = MultiJson.decode(response.body)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
138
148
|
def authenticated_request(options)
|
139
149
|
headers = options[:headers] || {}
|
140
|
-
headers.merge!("Authorization" => "OAuth #{@oauth_token}")
|
150
|
+
headers.merge!("Authorization" => "OAuth #{@oauth_token}", "Content-Type" => "application/json")
|
141
151
|
options[:headers] = headers
|
142
152
|
@connection.request(options)
|
143
153
|
end
|
@@ -13,6 +13,7 @@ module Fog
|
|
13
13
|
attribute :description
|
14
14
|
attribute :location, :aliases => 'imageLocation'
|
15
15
|
attribute :owner_id, :aliases => 'imageOwnerId'
|
16
|
+
attribute :owner_alias, :aliases => 'imageOwnerAlias'
|
16
17
|
attribute :state, :aliases => 'imageState'
|
17
18
|
attribute :type, :aliases => 'imageType'
|
18
19
|
attribute :is_public, :aliases => 'isPublic'
|
@@ -36,6 +37,10 @@ module Fog
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
40
|
+
def ready?
|
41
|
+
state == 'available'
|
42
|
+
end
|
43
|
+
|
39
44
|
end
|
40
45
|
|
41
46
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'fog/
|
1
|
+
require 'fog/compute/models/server'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
5
5
|
class AWS
|
6
6
|
|
7
|
-
class Server < Fog::
|
7
|
+
class Server < Fog::Compute::Server
|
8
8
|
extend Fog::Deprecation
|
9
9
|
deprecate :ip_address, :public_ip_address
|
10
10
|
|
@@ -25,6 +25,7 @@ module Fog
|
|
25
25
|
attribute :created_at, :aliases => 'launchTime'
|
26
26
|
attribute :monitoring, :squash => 'state'
|
27
27
|
attribute :placement_group, :aliases => 'groupName'
|
28
|
+
attribute :platform, :aliases => 'platform'
|
28
29
|
attribute :product_codes, :aliases => 'productCodes'
|
29
30
|
attribute :private_dns_name, :aliases => 'privateDnsName'
|
30
31
|
attribute :private_ip_address, :aliases => 'privateIpAddress'
|
@@ -167,17 +168,29 @@ module Fog
|
|
167
168
|
|
168
169
|
data = connection.run_instances(image_id, 1, 1, options)
|
169
170
|
merge_attributes(data.body['instancesSet'].first)
|
171
|
+
|
172
|
+
if self.tags
|
173
|
+
for key, value in self.tags
|
174
|
+
connection.tags.create(
|
175
|
+
:key => key,
|
176
|
+
:resource_id => self.identity,
|
177
|
+
:value => value
|
178
|
+
)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
170
182
|
true
|
171
183
|
end
|
172
184
|
|
173
185
|
def setup(credentials = {})
|
174
|
-
requires :
|
186
|
+
requires :public_ip_address, :username
|
175
187
|
require 'multi_json'
|
188
|
+
require 'net/ssh'
|
176
189
|
|
177
190
|
commands = [
|
178
191
|
%{mkdir .ssh},
|
179
192
|
%{passwd -l #{username}},
|
180
|
-
%{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json}
|
193
|
+
%{echo "#{MultiJson.encode(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json}
|
181
194
|
]
|
182
195
|
if public_key
|
183
196
|
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
@@ -199,31 +212,15 @@ module Fog
|
|
199
212
|
Fog::SSH.new(public_ip_address, username, credentials).run(commands)
|
200
213
|
end
|
201
214
|
|
202
|
-
def ssh(commands)
|
203
|
-
requires :identity, :public_ip_address, :username
|
204
|
-
|
205
|
-
options = {}
|
206
|
-
options[:key_data] = [private_key] if private_key
|
207
|
-
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
208
|
-
end
|
209
|
-
|
210
|
-
def scp(local_path, remote_path, upload_options = {})
|
211
|
-
requires :public_ip_address, :username
|
212
|
-
|
213
|
-
scp_options = {}
|
214
|
-
scp_options[:key_data] = [private_key] if private_key
|
215
|
-
Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
|
216
|
-
end
|
217
|
-
|
218
215
|
def start
|
219
216
|
requires :id
|
220
217
|
connection.start_instances(id)
|
221
218
|
true
|
222
219
|
end
|
223
220
|
|
224
|
-
def stop
|
221
|
+
def stop(force = false)
|
225
222
|
requires :id
|
226
|
-
connection.stop_instances(id)
|
223
|
+
connection.stop_instances(id, force)
|
227
224
|
true
|
228
225
|
end
|
229
226
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog/
|
1
|
+
require 'fog/compute/models/server'
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
|
7
7
|
class BlockInstantiationError < StandardError; end
|
8
8
|
|
9
|
-
class Server < Fog::
|
9
|
+
class Server < Fog::Compute::Server
|
10
10
|
|
11
11
|
identity :id
|
12
12
|
|
@@ -120,22 +120,6 @@ module Fog
|
|
120
120
|
retry
|
121
121
|
end
|
122
122
|
|
123
|
-
def ssh(commands)
|
124
|
-
requires :identity, :ips, :username
|
125
|
-
|
126
|
-
options = {}
|
127
|
-
options[:key_data] = [private_key] if private_key
|
128
|
-
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
129
|
-
end
|
130
|
-
|
131
|
-
def scp(local_path, remote_path, upload_options = {})
|
132
|
-
requires :ips, :username
|
133
|
-
|
134
|
-
scp_options = {}
|
135
|
-
scp_options[:key_data] = [private_key] if private_key
|
136
|
-
Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
|
137
|
-
end
|
138
|
-
|
139
123
|
def username
|
140
124
|
@username ||= 'deploy'
|
141
125
|
end
|