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.



109
110
111
# File 'lib/fog/aws/storage.rb', line 109

def region
  @region
end

Instance Method Details

#cdnObject



111
112
113
114
115
116
117
# File 'lib/fog/aws/storage.rb', line 111

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



119
120
121
# File 'lib/fog/aws/storage.rb', line 119

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

#https_url(params, expires) ⇒ Object



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

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

#request_url(params) ⇒ Object



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

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

#signed_url(params, expires) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/fog/aws/storage.rb', line 137

def signed_url(params, expires)
  expires = expires.to_i
  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



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

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