You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Stubbing::Protocols::EC2

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/stubbing/protocols/ec2.rb

Instance Method Summary collapse

Instance Method Details

#stub_data(api, operation, data) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'gems/aws-sdk-core/lib/aws-sdk-core/stubbing/protocols/ec2.rb', line 6

def stub_data(api, operation, data)
  resp = Seahorse::Client::Http::Response.new
  resp.status_code = 200
  resp.body = build_body(api, operation, data) if operation.output
  resp.headers['Content-Length'] = resp.body.size
  resp.headers['Content-Type'] = 'text/xml;charset=UTF-8'
  resp.headers['Server'] = 'AmazonEC2'
  resp
end

#stub_error(error_code) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'gems/aws-sdk-core/lib/aws-sdk-core/stubbing/protocols/ec2.rb', line 16

def stub_error(error_code)
  http_resp = Seahorse::Client::Http::Response.new
  http_resp.status_code = 400
  http_resp.body = <<-XML.strip
<ErrorResponse>
  <Error>
    <Code>#{error_code}</Code>
    <Message>stubbed-response-error-message</Message>
  </Error>
</ErrorResponse>
  XML
  http_resp
end