Class: Aws::Polly::Presigner
- Inherits:
-
Object
- Object
- Aws::Polly::Presigner
- Defined in:
- lib/aws-sdk-polly/presigner.rb
Overview
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Presigner
constructor
A new instance of Presigner.
- #synthesize_speech_presigned_url(params = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Presigner
Returns a new instance of Presigner.
39 40 41 42 43 44 45 46 |
# File 'lib/aws-sdk-polly/presigner.rb', line 39 def initialize( = {}) if !(.keys - [:credentials, :region, :client]).empty? raise ArgumentError, ':options may only contain :client, :region, :credentials '\ 'keys. Please use the :client option instead.' end @client = [:client] || Aws::Polly::Client.new() end |
Instance Method Details
#synthesize_speech_presigned_url(params = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/aws-sdk-polly/presigner.rb', line 50 def synthesize_speech_presigned_url(params = {}) req = @client.build_request(:synthesize_speech, params) context = req.context parts = [] req.context.operation.input.shape.members.each do |name, ref| parts << [ ref, params[name] ] unless params[name].nil? end query = Aws::Rest::Request::QuerystringBuilder.new.build(parts) endpoint_params = Aws::Polly::EndpointParameters.new( region: context.config.region, use_dual_stack: context.config.use_dualstack_endpoint, use_fips: context.config.use_fips_endpoint ) endpoint = context.config.endpoint_provider .resolve_endpoint(endpoint_params) auth_scheme = Aws::Endpoints.resolve_auth_scheme(context, endpoint) signer = Aws::Plugins::Sign.signer_for( auth_scheme, context.config ) pre_signed_url = signer.presign_url( http_method: 'GET', url: "#{endpoint.url}/v1/speech?#{query}", body: '', expires_in: 900 ).to_s end |