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

Class: Seahorse::Client::Base

Inherits:
Object
  • Object
show all
Includes:
HandlerBuilder
Defined in:
gems/aws-sdk-core/lib/seahorse/client/base.rb

Direct Known Subclasses

Aws::ACM::Client, Aws::APIGateway::Client, Aws::AppStream::Client, Aws::ApplicationAutoScaling::Client, Aws::ApplicationDiscoveryService::Client, Aws::Athena::Client, Aws::AutoScaling::Client, Aws::Batch::Client, Aws::Budgets::Client, Aws::CloudDirectory::Client, Aws::CloudFormation::Client, Aws::CloudFront::Client, Aws::CloudHSM::Client, Aws::CloudHSMV2::Client, Aws::CloudSearch::Client, Aws::CloudSearchDomain::Client, Aws::CloudTrail::Client, Aws::CloudWatch::Client, Aws::CloudWatchEvents::Client, Aws::CloudWatchLogs::Client, Aws::CodeBuild::Client, Aws::CodeCommit::Client, Aws::CodeDeploy::Client, Aws::CodePipeline::Client, Aws::CodeStar::Client, Aws::CognitoIdentity::Client, Aws::CognitoIdentityProvider::Client, Aws::CognitoSync::Client, Aws::ConfigService::Client, Aws::CostandUsageReportService::Client, Aws::DAX::Client, Aws::DataPipeline::Client, Aws::DatabaseMigrationService::Client, Aws::DeviceFarm::Client, Aws::DirectConnect::Client, Aws::DirectoryService::Client, Aws::DynamoDB::Client, Aws::DynamoDBStreams::Client, Aws::EC2::Client, Aws::ECR::Client, Aws::ECS::Client, Aws::EFS::Client, Aws::EMR::Client, Aws::ElastiCache::Client, Aws::ElasticBeanstalk::Client, Aws::ElasticLoadBalancing::Client, Aws::ElasticLoadBalancingV2::Client, Aws::ElasticTranscoder::Client, Aws::ElasticsearchService::Client, Aws::Firehose::Client, Aws::GameLift::Client, Aws::Glacier::Client, Aws::Glue::Client, Aws::Greengrass::Client, Aws::Health::Client, Aws::IAM::Client, Aws::ImportExport::Client, Aws::Inspector::Client, Aws::IoT::Client, Aws::IoTDataPlane::Client, Aws::KMS::Client, Aws::Kinesis::Client, Aws::KinesisAnalytics::Client, Aws::Lambda::Client, Aws::LambdaPreview::Client, Aws::Lex::Client, Aws::LexModelBuildingService::Client, Aws::LexRuntimeService::Client, Aws::Lightsail::Client, Aws::MTurk::Client, Aws::MachineLearning::Client, Aws::MarketplaceCommerceAnalytics::Client, Aws::MarketplaceEntitlementService::Client, Aws::MarketplaceMetering::Client, Aws::MigrationHub::Client, Aws::Mobile::Client, Aws::OpsWorks::Client, Aws::OpsWorksCM::Client, Aws::Organizations::Client, Aws::Pinpoint::Client, Aws::Polly::Client, Aws::RDS::Client, Aws::Redshift::Client, Aws::Rekognition::Client, Aws::ResourceGroupsTaggingAPI::Client, Aws::Route53::Client, Aws::Route53Domains::Client, Aws::S3::Client, Aws::SES::Client, Aws::SFN::Client, Aws::SMS::Client, Aws::SNS::Client, Aws::SQS::Client, Aws::SSM::Client, Aws::STS::Client, Aws::SWF::Client, Aws::ServiceCatalog::Client, Aws::Shield::Client, Aws::SimpleDB::Client, Aws::Snowball::Client, Aws::States::Client, Aws::StorageGateway::Client, Aws::Support::Client, Aws::WAF::Client, Aws::WAFRegional::Client, Aws::WorkDocs::Client, Aws::WorkSpaces::Client, Aws::XRay::Client

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HandlerBuilder

#handle, #handle_request, #handle_response

Instance Attribute Details

#configConfiguration<Struct> (readonly)

Returns:



25
26
27
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 25

def config
  @config
end

#handlersHandlerList (readonly)

Returns:



28
29
30
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 28

def handlers
  @handlers
end

Class Method Details

.add_plugin(plugin) ⇒ void

This method returns an undefined value.

Registers a plugin with this client.

Examples:

Register a plugin


ClientClass.add_plugin(PluginClass)

Register a plugin by name


ClientClass.add_plugin('gem-name.PluginClass')

Register a plugin with an object


plugin = MyPluginClass.new(options)
ClientClass.add_plugin(plugin)

Parameters:

  • plugin (Class, Symbol, String, Object)

See Also:



124
125
126
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 124

def add_plugin(plugin)
  @plugins.add(plugin)
end

.apiModel::Api

Returns:



168
169
170
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 168

def api
  @api ||= Model::Api.new
end

.clear_pluginsvoid

This method returns an undefined value.



142
143
144
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 142

def clear_plugins
  @plugins.set([])
end

.define(options = {}) ⇒ Class<Client::Base> Also known as: extend

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :api (Model::Api, Hash) — default: {}
  • :plugins (Array<Plugin>) — default: []

    A list of plugins to add to the client class created.

Returns:



184
185
186
187
188
189
190
191
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 184

def define(options = {})
  subclass = Class.new(self)
  subclass.set_api(options[:api] || api)
  Array(options[:plugins]).each do |plugin|
    subclass.add_plugin(plugin)
  end
  subclass
end

.new(options = {}) ⇒ Object



94
95
96
97
98
99
100
101
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 94

def new(options = {})
  plugins = build_plugins
  options = options.dup
  before_initialize(plugins, options)
  client = allocate
  client.send(:initialize, plugins, options)
  client
end

.pluginsArray<Plugin>

Returns the list of registered plugins for this Client. Plugins are inherited from the client super class when the client is defined.



163
164
165
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 163

def plugins
  Array(@plugins).freeze
end

.remove_plugin(plugin) ⇒ void

This method returns an undefined value.



133
134
135
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 133

def remove_plugin(plugin)
  @plugins.remove(plugin)
end

.set_api(api) ⇒ Model::Api

Parameters:

Returns:



174
175
176
177
178
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 174

def set_api(api)
  @api = api
  define_operation_methods
  @api
end

.set_plugins(plugins) ⇒ void

This method returns an undefined value.

Parameters:

See Also:



152
153
154
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 152

def set_plugins(plugins)
  @plugins.set(plugins)
end

Instance Method Details

#build_request(operation_name, params = {}) ⇒ Request

Builds and returns a Request for the named operation. The request will not have been sent.

Parameters:

  • operation_name (Symbol, String)

Returns:



34
35
36
37
38
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 34

def build_request(operation_name, params = {})
  Request.new(
    @handlers.for(operation_name),
    context_for(operation_name, params))
end

#operation_namesArray<Symbol>

Returns a list of valid request operation names. These are valid arguments to #build_request and are also valid methods.

Returns:

  • (Array<Symbol>)

    Returns a list of valid request operation names. These are valid arguments to #build_request and are also valid methods.



48
49
50
# File 'gems/aws-sdk-core/lib/seahorse/client/base.rb', line 48

def operation_names
  self.class.api.operation_names
end