Module: Fog::Storage::AWS::Utils
Instance Attribute Summary collapse
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
- #cdn ⇒ Object
- #http_url(params, expires) ⇒ Object
- #https_url(params, expires) ⇒ Object
- #request_url(params) ⇒ Object
- #signed_url(params, expires) ⇒ Object
- #url(params, expires) ⇒ Object
Instance Attribute Details
#region ⇒ Object
Returns the value of attribute region.
112 113 114 |
# File 'lib/fog/aws/storage.rb', line 112 def region @region end |
Instance Method Details
#cdn ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/fog/aws/storage.rb', line 114 def cdn @cdn ||= Fog::AWS::CDN.new( :aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :use_iam_profile => @use_iam_profile ) end |
#http_url(params, expires) ⇒ Object
122 123 124 |
# File 'lib/fog/aws/storage.rb', line 122 def http_url(params, expires) signed_url(params.merge(:scheme => 'http'), expires) end |
#https_url(params, expires) ⇒ Object
126 127 128 |
# File 'lib/fog/aws/storage.rb', line 126 def https_url(params, expires) signed_url(params.merge(:scheme => 'https'), expires) end |
#request_url(params) ⇒ Object
135 136 137 138 |
# File 'lib/fog/aws/storage.rb', line 135 def request_url(params) params = request_params(params) params_to_url(params) end |
#signed_url(params, expires) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/fog/aws/storage.rb', line 140 def signed_url(params, expires) #convert expires from a point in time to a delta to now now = Fog::Time.now expires = expires.to_i - now.to_i params[:headers] ||= {} params[:query]||= {} params[:query]['X-Amz-Expires'] = expires params[:query]['X-Amz-Date'] = now.to_iso8601_basic if @aws_session_token params[:query]['X-Amz-Security-Token'] = @aws_session_token end params = request_params(params) params[:headers][:host] = params[:host] signature = @signer.signature_parameters(params, now, "UNSIGNED-PAYLOAD") params[:query] = (params[:query] || {}).merge(signature) params_to_url(params) end |
#url(params, expires) ⇒ Object
130 131 132 133 |
# File 'lib/fog/aws/storage.rb', line 130 def url(params, expires) Fog::Logger.deprecation("Fog::Storage::AWS => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]") https_url(params, expires) end |