Skip to content
Browse files

fix get distribution for streaming

  • Loading branch information...
1 parent 71243d0 commit 278de592ec6349c34643d64952350f7caaa1c560 @tellnes committed Apr 26, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/index.js
View
15 lib/index.js
@@ -252,7 +252,7 @@ CloudFront.prototype.createDistribution = function(config, callerReference, cb)
}
var req = this.request('POST', (config.streaming ? 'streaming-' : '') + 'distribution',
- itemFactory(this, Distribution, cb)
+ itemFactory(this, Distribution, config, cb)
);
req.write(this.generateDistributionXml(config));
req.end();
@@ -265,7 +265,7 @@ CloudFront.prototype.getDistribution = function(distribution, opts, cb) {
}
this.request('GET', (opts.streaming ? 'streaming-' : '') + 'distribution/' + distribution,
- itemFactory(this, Distribution, cb)
+ itemFactory(this, Distribution, opts, cb)
).end();
};
@@ -275,8 +275,10 @@ CloudFront.prototype.getDistributionConfig = function(distribution, opts, cb) {
opts = {};
}
+ opts.distribution = distribution;
+
this.request('GET', (opts.streaming ? 'streaming-' : '') + 'distribution/' + distribution + '/config',
- itemFactory(this, DistributionConfig, {distribution: distribution}, cb)
+ itemFactory(this, DistributionConfig, opts, cb)
).end();
};
@@ -293,7 +295,7 @@ CloudFront.prototype.setDistributionConfig = function(distribution, config, etag
var req = this.request('PUT', (config.streaming ? 'streaming-' : '') + 'distribution/' + distribution + '/config',
{'If-Match': config.etag},
- itemFactory(this, Distribution, cb)
+ itemFactory(this, Distribution, config, cb)
);
req.write(this.generateDistributionXml(config.config || config));
req.end();
@@ -322,7 +324,7 @@ CloudFront.prototype.listDistributions = function(opts, cb) {
}
this.request('GET', listOptsToPath('distribution', opts),
- listFactory(this, Distribution, {streaming: opts.streaming}, cb)
+ listFactory(this, Distribution, opts, cb)
).end();
};
@@ -568,6 +570,7 @@ function CFObject(client) {
function Distribution(client, info, data) {
CFObject.call(this, client);
+
this.streaming = !!info.streaming;
this.id = data.Id;
this.status = data.Status;
@@ -603,7 +606,7 @@ function Distribution(client, info, data) {
this.config = new DistributionConfig(this.client, {
distribution: this.id
- }, info.isList ? data : data.DistributionConfig);
+ }, info.isList ? data : data[(info.streaming ? 'Streaming' : '') + 'DistributionConfig']);
}
util.inherits(Distribution, CFObject);

0 comments on commit 278de59

Please sign in to comment.
Something went wrong with that request. Please try again.