Module: Fog::Storage::AWS::Utils

Included in:
Mock, Real
Defined in:
lib/fog/aws/storage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#regionObject

Returns the value of attribute region.



113
114
115
# File 'lib/fog/aws/storage.rb', line 113

def region
  @region
end

Instance Method Details

#cdnObject



115
116
117
118
119
120
121
# File 'lib/fog/aws/storage.rb', line 115

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



123
124
125
# File 'lib/fog/aws/storage.rb', line 123

def http_url(params, expires)
  signed_url(params.merge(:scheme => 'http'), expires)
end

#https_url(params, expires) ⇒ Object



127
128
129
# File 'lib/fog/aws/storage.rb', line 127

def https_url(params, expires)
  signed_url(params.merge(:scheme => 'https'), expires)
end

#request_url(params) ⇒ Object



136
137
138
139
# File 'lib/fog/aws/storage.rb', line 136

def request_url(params)
  params = request_params(params)
  params_to_url(params)
end

#signed_url(params, expires) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/fog/aws/storage.rb', line 141

def signed_url(params, expires)
  expires = expires.to_i
  if @aws_session_token
    params[:headers]||= {}
    params[:headers]['x-amz-security-token'] = @aws_session_token
  end
  signature = signature(params, expires)
  params = request_params(params)

  params[:query] = (params[:query] || {}).merge({
    'AWSAccessKeyId' => @aws_access_key_id,
    'Signature' => signature,
    'Expires' => expires,
  })
  params[:query]['x-amz-security-token'] = @aws_session_token if @aws_session_token

  params_to_url(params)
end

#url(params, expires) ⇒ Object



131
132
133
134
# File 'lib/fog/aws/storage.rb', line 131

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