简体   繁体   English

如何通过Clojure使用JClouds和Rackspace启用CDN?

[英]How to enable CDN with JClouds and Rackspace via Clojure?

I'm attempting to use JCLouds via Clojure and would like to use the blobstore abstraction to create containers and then enable CDN serving on those containers. 我正在尝试通过Clojure使用JCLouds,并希望使用Blobstore抽象来创建容器,然后在这些容器上启用CDN服务。 So far I haven't had much success. 到目前为止,我还没有取得太大的成功。

I'm not a Java programmer so I'm not quite sure how to approach this, but it does appear there is a method that does what I need. 我不是Java程序员,所以我不太确定如何解决这个问题,但是确实有一种方法可以满足我的需要。 That said, I'm unsure how to use that with org.jclouds.blobstore2 . 也就是说,我不确定如何在org.jclouds.blobstore2使用它。

What is the best way to achieve this in Clojure? 在Clojure中实现此目标的最佳方法是什么?

It turns out that via a Java example I was able to figure out the proper codepath for this in Clojure: 事实证明,通过Java示例,我能够在Clojure中找出正确的代码路径:

(defn- enable-cdn [bs container]
  (->
    (blobstore/blobstore-context bs)
    .unwrap
    .getApi
    (.enableCDN container)))

This will enable the CDN for a given container provided a valid blobstore instance. 如果提供了有效的Blobstore实例,这将启用给定容器的CDN。 Maybe this will save someone else some time later. 也许这样可以节省一些时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM