Sha256: 8b4b484043f29c037bdcc64d9e36959a4a7c02801d85c5cfc60e38a45287124c

Contents?: true

Size: 1.76 KB

Versions: 79

Compression:

Stored size: 1.76 KB

Contents

module Fog
  module CDN
    class HP
      class Real

        # enable CDN for a container
        #
        # ==== Parameters
        # * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
        # # options<~Hash>:
        #   * 'X-CDN-Enabled'<~Boolean> - cdn status for container
        #   * 'X-CDN-URI'<~String> - cdn url for this container
        #   * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 900 (15 min.) to 1577836800 (50 years)
        #   * 'X-Log-Retention'<~Boolean> - ?
        def put_container(name, options = {})
          response = request(
            :expects  => [201, 202],
            :headers  => options,
            :method   => 'PUT',
            :path     => Fog::HP.escape(name)
          )
          response
        end

      end

      class Mock # :nodoc:all
        def put_container(name, options = {})
          response = Excon::Response.new
          container_id = Fog::Mock.random_hex(33)
          data = {
            'x-cdn-ssl-uri' => "https://a111.cdn.net/cdn-test.net/#{container_id}/abc",
            'cdn_enabled'   => true,
            'name'          => name,
            'x-cdn-uri'     => "http://#{container_id}.cdn-test.net",
            'ttl'           => 86400,
            'log_retention' => false
          }
          response.headers = {
            "X-Cdn-Ssl-Uri" => "https://a111.cdn.net/cdn-test.net/#{container_id}/abc",
            "X-Cdn-Uri"     => "http://#{container_id}.cdn-test.net",
            "X-Trans-Id"    => Fog::Mock.random_hex(34)
          }
          response.status = 201
          response.body = "201 Created\n\n\n\n   "
          self.data[:cdn_containers][name] = data
          response
        end
      end

    end
  end
end

Version data entries

79 entries across 79 versions & 12 rubygems

Version Path
fog-1.22.0 lib/fog/hp/requests/cdn/put_container.rb
fog-1.21.0 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/hp/requests/cdn/put_container.rb
fog-1.20.0 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/hp/requests/cdn/put_container.rb
fog-1.19.0 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/hp/requests/cdn/put_container.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/hp/requests/cdn/put_container.rb