Class: Amazon::Coral::Ec2Client

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon/coral/ec2client.rb

Overview

Client interface for calling Ec2.

The client supports two mechanisms to invoke each remote service call: a simple approach which directly calls the remote service, or a Call based mechanism that allows you to control aspects of the outgoing request such as request-id and identity attributes.

Each instance of a client interface is backed by an Orchestrator object which manages the processing of each request to the remote service. Clients can be instantiated with a custom orchestrator or with presets corresponding to particular protocols. Inputs and return values to the direct service-call methods and the Call.call methods are hashes.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orchestrator) ⇒ Ec2Client

Construct a new client. Takes an orchestrator through which to process requests. See additional constructors below to use pre-configured orchestrators for specific protocols.

[orchestrator] The Orchestrator is responsible for actually making the remote service call. Clients construct requests, hand them off to the orchestrator, and receive responses in return.



29
30
31
32
# File 'lib/amazon/coral/ec2client.rb', line 29

def initialize(orchestrator)
  @allocateAddressDispatcher = Dispatcher.new(orchestrator, 'Ec2', 'AllocateAddress')
  @associateAddressDispatcher = Dispatcher.new(orchestrator, 'Ec2', 'AssociateAddress')
end

Class Method Details

.new_aws_query(args) ⇒ Object

Instantiates the client with an orchestrator configured for use with AWS/QUERY. Use of this constructor is deprecated in favor of using the AwsQuery class:

client = Ec2Client.new(AwsQuery.new_orchestrator(args))


77
78
79
80
# File 'lib/amazon/coral/ec2client.rb', line 77

def Ec2Client.new_aws_query(args)
  require 'amazon/coral/awsquery'
  Ec2Client.new(AwsQuery.new_orchestrator(args))
end

Instance Method Details

#AllocateAddress(input = {}) ⇒ Object

Shorthand method to invoke the AllocateAddress operation:

Example usage:

my_client.AllocateAddress(my_input)


59
60
61
# File 'lib/amazon/coral/ec2client.rb', line 59

def AllocateAddress(input = {})
  newAllocateAddressCall.call(input)
end

#AssociateAddress(input = {}) ⇒ Object

Shorthand method to invoke the AssociateAddress operation:

Example usage:

my_client.AssociateAddress(my_input)


67
68
69
# File 'lib/amazon/coral/ec2client.rb', line 67

def AssociateAddress(input = {})
  newAssociateAddressCall.call(input)
end

#newAllocateAddressCallObject

Instantiates a call object to invoke the AllocateAddress operation:

Example usage:

my_call = my_client.newAllocateAddressCall
# set identity information if needed
my_call.identity[:aws_access_key] = my_access_key
my_call.identity[:aws_secret_key] = my_secret_key
# make the remote call
my_call.call(my_input)
# retrieve the request-id returned by the server
my_request_id = my_call.request_id


46
47
48
# File 'lib/amazon/coral/ec2client.rb', line 46

def newAllocateAddressCall
  Call.new(@allocateAddressDispatcher)
end

#newAssociateAddressCallObject



50
51
52
# File 'lib/amazon/coral/ec2client.rb', line 50

def newAssociateAddressCall
  Call.new(@associateAddressDispatcher)
end