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

Class: Seahorse::Client::Base

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

Direct Known Subclasses

Aws::ACM::Client, Aws::ACMPCA::Client, Aws::APIGateway::Client, Aws::AccessAnalyzer::Client, Aws::AlexaForBusiness::Client, Aws::Amplify::Client, Aws::ApiGatewayManagementApi::Client, Aws::ApiGatewayV2::Client, Aws::AppConfig::Client, Aws::AppMesh::Client, Aws::AppRegistry::Client, Aws::AppStream::Client, Aws::AppSync::Client, Aws::Appflow::Client, Aws::ApplicationAutoScaling::Client, Aws::ApplicationDiscoveryService::Client, Aws::ApplicationInsights::Client, Aws::Athena::Client, Aws::AugmentedAIRuntime::Client, Aws::AutoScaling::Client, Aws::AutoScalingPlans::Client, Aws::Backup::Client, Aws::Batch::Client, Aws::Braket::Client, Aws::Budgets::Client, Aws::Chime::Client, Aws::Client, Aws::Cloud9::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::CodeArtifact::Client, Aws::CodeBuild::Client, Aws::CodeCommit::Client, Aws::CodeDeploy::Client, Aws::CodeGuruProfiler::Client, Aws::CodeGuruReviewer::Client, Aws::CodePipeline::Client, Aws::CodeStar::Client, Aws::CodeStarNotifications::Client, Aws::CodeStarconnections::Client, Aws::CognitoIdentity::Client, Aws::CognitoIdentityProvider::Client, Aws::CognitoSync::Client, Aws::Comprehend::Client, Aws::ComprehendMedical::Client, Aws::ComputeOptimizer::Client, Aws::ConfigService::Client, Aws::Connect::Client, Aws::ConnectParticipant::Client, Aws::CostExplorer::Client, Aws::CostandUsageReportService::Client, Aws::DAX::Client, Aws::DLM::Client, Aws::DataExchange::Client, Aws::DataPipeline::Client, Aws::DataSync::Client, Aws::DatabaseMigrationService::Client, Aws::Detective::Client, Aws::DeviceFarm::Client, Aws::DirectConnect::Client, Aws::DirectoryService::Client, Aws::DocDB::Client, Aws::DynamoDB::Client, Aws::DynamoDBStreams::Client, Aws::EBS::Client, Aws::EC2::Client, Aws::EC2InstanceConnect::Client, Aws::ECR::Client, Aws::ECS::Client, Aws::EFS::Client, Aws::EKS::Client, Aws::EMR::Client, Aws::ElastiCache::Client, Aws::ElasticBeanstalk::Client, Aws::ElasticInference::Client, Aws::ElasticLoadBalancing::Client, Aws::ElasticLoadBalancingV2::Client, Aws::ElasticTranscoder::Client, Aws::ElasticsearchService::Client, Aws::EventBridge::Client, Aws::FMS::Client, Aws::FSx::Client, Aws::Firehose::Client, Aws::ForecastQueryService::Client, Aws::ForecastService::Client, Aws::FraudDetector::Client, Aws::GameLift::Client, Aws::Glacier::Client, Aws::GlobalAccelerator::Client, Aws::Glue::Client, Aws::GlueDataBrew::Client, Aws::Greengrass::Client, Aws::GroundStation::Client, Aws::GuardDuty::Client, Aws::Health::Client, Aws::Honeycode::Client, Aws::IAM::Client, Aws::IVS::Client, Aws::IdentityStore::Client, Aws::Imagebuilder::Client, Aws::ImportExport::Client, Aws::Inspector::Client, Aws::IoT1ClickDevicesService::Client, Aws::IoT1ClickProjects::Client, Aws::IoT::Client, Aws::IoTAnalytics::Client, Aws::IoTDataPlane::Client, Aws::IoTEvents::Client, Aws::IoTEventsData::Client, Aws::IoTJobsDataPlane::Client, Aws::IoTSecureTunneling::Client, Aws::IoTSiteWise::Client, Aws::IoTThingsGraph::Client, Aws::KMS::Client, Aws::Kafka::Client, Aws::Kendra::Client, Aws::Kinesis::Client, Aws::KinesisAnalytics::Client, Aws::KinesisAnalyticsV2::Client, Aws::KinesisVideo::Client, Aws::KinesisVideoArchivedMedia::Client, Aws::KinesisVideoMedia::Client, Aws::KinesisVideoSignalingChannels::Client, Aws::LakeFormation::Client, Aws::Lambda::Client, Aws::LambdaPreview::Client, Aws::Lex::Client, Aws::LexModelBuildingService::Client, Aws::LicenseManager::Client, Aws::Lightsail::Client, Aws::MQ::Client, Aws::MTurk::Client, Aws::MachineLearning::Client, Aws::Macie2::Client, Aws::Macie::Client, Aws::ManagedBlockchain::Client, Aws::MarketplaceCatalog::Client, Aws::MarketplaceCommerceAnalytics::Client, Aws::MarketplaceEntitlementService::Client, Aws::MarketplaceMetering::Client, Aws::MediaConnect::Client, Aws::MediaConvert::Client, Aws::MediaLive::Client, Aws::MediaPackage::Client, Aws::MediaPackageVod::Client, Aws::MediaStore::Client, Aws::MediaStoreData::Client, Aws::MediaTailor::Client, Aws::MigrationHub::Client, Aws::MigrationHubConfig::Client, Aws::Mobile::Client, Aws::Neptune::Client, Aws::NetworkFirewall::Client, Aws::NetworkManager::Client, Aws::OpsWorks::Client, Aws::OpsWorksCM::Client, Aws::Organizations::Client, Aws::Outposts::Client, Aws::PI::Client, Aws::Personalize::Client, Aws::PersonalizeEvents::Client, Aws::PersonalizeRuntime::Client, Aws::Pinpoint::Client, Aws::PinpointEmail::Client, Aws::PinpointSMSVoice::Client, Aws::Polly::Client, Aws::Pricing::Client, Aws::QLDB::Client, Aws::QLDBSession::Client, Aws::QuickSight::Client, Aws::RAM::Client, Aws::RDS::Client, Aws::RDSDataService::Client, Aws::Redshift::Client, Aws::RedshiftDataAPIService::Client, Aws::Rekognition::Client, Aws::ResourceGroups::Client, Aws::ResourceGroupsTaggingAPI::Client, Aws::RoboMaker::Client, Aws::Route53::Client, Aws::Route53Domains::Client, Aws::Route53Resolver::Client, Aws::S3::Client, Aws::S3Control::Client, Aws::S3Outposts::Client, Aws::SES::Client, Aws::SESV2::Client, Aws::SMS::Client, Aws::SNS::Client, Aws::SQS::Client, Aws::SSM::Client, Aws::SSO::Client, Aws::SSOAdmin::Client, Aws::SSOOIDC::Client, Aws::STS::Client, Aws::SWF::Client, Aws::SageMaker::Client, Aws::SageMakerRuntime::Client, Aws::SavingsPlans::Client, Aws::Schemas::Client, Aws::SecretsManager::Client, Aws::SecurityHub::Client, Aws::ServerlessApplicationRepository::Client, Aws::ServiceCatalog::Client, Aws::ServiceDiscovery::Client, Aws::ServiceQuotas::Client, Aws::Shield::Client, Aws::Signer::Client, Aws::SimpleDB::Client, Aws::Snowball::Client, Aws::States::Client, Aws::StorageGateway::Client, Aws::Support::Client, Aws::Synthetics::Client, Aws::Textract::Client, Aws::TimestreamQuery::Client, Aws::TimestreamWrite::Client, Aws::TranscribeService::Client, Aws::Transfer::Client, Aws::Translate::Client, Aws::WAF::Client, Aws::WAFRegional::Client, Aws::WAFV2::Client, Aws::WorkDocs::Client, Aws::WorkLink::Client, Aws::WorkMail::Client, Aws::WorkMailMessageFlow::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 'aws-sdk-core/lib/seahorse/client/base.rb', line 25

def config
  @config
end

#handlersHandlerList (readonly)

Returns:



28
29
30
# File '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:



130
131
132
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 130

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

.apiModel::Api

Returns:



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

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

.clear_pluginsvoid

This method returns an undefined value.



148
149
150
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 148

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:



190
191
192
193
194
195
196
197
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 190

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



100
101
102
103
104
105
106
107
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 100

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.



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

def plugins
  Array(@plugins).freeze
end

.remove_plugin(plugin) ⇒ void

This method returns an undefined value.



139
140
141
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 139

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

.set_api(api) ⇒ Model::Api

Parameters:

Returns:



180
181
182
183
184
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 180

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

.set_plugins(plugins) ⇒ void

This method returns an undefined value.

Parameters:

See Also:



158
159
160
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 158

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 '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(name) ⇒ Model::Operation

Parameters:

  • name (String)

Returns:



42
43
44
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 42

def operation(name)
  config.api.operation(name)
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.



54
55
56
# File 'aws-sdk-core/lib/seahorse/client/base.rb', line 54

def operation_names
  self.class.api.operation_names
end