pub struct Config { /* private fields */ }
Expand description
Service config.
Service configuration allows for customization of endpoints, region, credentials providers,
and retry configuration. Generally, it is constructed automatically for you from a shared
configuration loaded by the aws-config
crate. For example:
// Load a shared config from the environment
let shared_config = aws_config::from_env().load().await;
// The client constructor automatically converts the shared config into the service config
let client = Client::new(&shared_config);
The service config can also be constructed manually using its builder.
Implementations§
source§impl Config
impl Config
sourcepub fn retry_config(&self) -> Option<&RetryConfig>
pub fn retry_config(&self) -> Option<&RetryConfig>
Return a reference to the retry configuration contained in this config, if any.
Examples found in repository?
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf
.retry_config()
.cloned()
.unwrap_or_else(aws_smithy_types::retry::RetryConfig::disabled);
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let sleep_impl = conf.sleep_impl();
if (retry_config.has_retry() || timeout_config.has_timeouts()) && sleep_impl.is_none() {
panic!("An async sleep implementation is required for retries or timeouts to work. \
Set the `sleep_impl` on the Config passed into this function to fix this panic.");
}
let connector = conf.http_connector().and_then(|c| {
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let connector_settings =
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
);
c.connector(&connector_settings, conf.sleep_impl())
});
let builder = aws_smithy_client::Builder::new();
let builder = match connector {
// Use provided connector
Some(c) => builder.connector(c),
None => {
#[cfg(any(feature = "rustls", feature = "native-tls"))]
{
// Use default connector based on enabled features
builder.dyn_https_connector(
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
),
)
}
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
{
panic!("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.");
}
}
};
let mut builder = builder
.middleware(aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
))
.retry_config(retry_config.into())
.operation_timeout_config(timeout_config.into());
builder.set_sleep_impl(sleep_impl);
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
sourcepub fn sleep_impl(&self) -> Option<Arc<dyn AsyncSleep>>
pub fn sleep_impl(&self) -> Option<Arc<dyn AsyncSleep>>
Return a cloned Arc containing the async sleep implementation from this config, if any.
Examples found in repository?
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf
.retry_config()
.cloned()
.unwrap_or_else(aws_smithy_types::retry::RetryConfig::disabled);
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let sleep_impl = conf.sleep_impl();
if (retry_config.has_retry() || timeout_config.has_timeouts()) && sleep_impl.is_none() {
panic!("An async sleep implementation is required for retries or timeouts to work. \
Set the `sleep_impl` on the Config passed into this function to fix this panic.");
}
let connector = conf.http_connector().and_then(|c| {
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let connector_settings =
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
);
c.connector(&connector_settings, conf.sleep_impl())
});
let builder = aws_smithy_client::Builder::new();
let builder = match connector {
// Use provided connector
Some(c) => builder.connector(c),
None => {
#[cfg(any(feature = "rustls", feature = "native-tls"))]
{
// Use default connector based on enabled features
builder.dyn_https_connector(
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
),
)
}
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
{
panic!("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.");
}
}
};
let mut builder = builder
.middleware(aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
))
.retry_config(retry_config.into())
.operation_timeout_config(timeout_config.into());
builder.set_sleep_impl(sleep_impl);
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
sourcepub fn timeout_config(&self) -> Option<&TimeoutConfig>
pub fn timeout_config(&self) -> Option<&TimeoutConfig>
Return a reference to the timeout configuration contained in this config, if any.
Examples found in repository?
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf
.retry_config()
.cloned()
.unwrap_or_else(aws_smithy_types::retry::RetryConfig::disabled);
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let sleep_impl = conf.sleep_impl();
if (retry_config.has_retry() || timeout_config.has_timeouts()) && sleep_impl.is_none() {
panic!("An async sleep implementation is required for retries or timeouts to work. \
Set the `sleep_impl` on the Config passed into this function to fix this panic.");
}
let connector = conf.http_connector().and_then(|c| {
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let connector_settings =
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
);
c.connector(&connector_settings, conf.sleep_impl())
});
let builder = aws_smithy_client::Builder::new();
let builder = match connector {
// Use provided connector
Some(c) => builder.connector(c),
None => {
#[cfg(any(feature = "rustls", feature = "native-tls"))]
{
// Use default connector based on enabled features
builder.dyn_https_connector(
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
),
)
}
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
{
panic!("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.");
}
}
};
let mut builder = builder
.middleware(aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
))
.retry_config(retry_config.into())
.operation_timeout_config(timeout_config.into());
builder.set_sleep_impl(sleep_impl);
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
sourcepub fn app_name(&self) -> Option<&AppName>
pub fn app_name(&self) -> Option<&AppName>
Returns the name of the app that is using the client, if it was provided.
This optional name is used to identify the application in the user agent that gets sent along with requests.
Examples found in repository?
49 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::BatchGetRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::BatchGetRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/BatchGetRecord").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::BatchGetRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_batch_get_record(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::BatchGetRecord::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"BatchGetRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`BatchGetRecordInput`](crate::input::BatchGetRecordInput).
pub fn builder() -> crate::input::batch_get_record_input::Builder {
crate::input::batch_get_record_input::Builder::default()
}
}
/// See [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub mod delete_record_input {
/// A builder for [`DeleteRecordInput`](crate::input::DeleteRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record_identifier_value_as_string: std::option::Option<std::string::String>,
pub(crate) event_time: std::option::Option<std::string::String>,
}
impl Builder {
/// <p>The name of the feature group to delete the record from. </p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group to delete the record from. </p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// <p>The value for the <code>RecordIdentifier</code> that uniquely identifies the record, in string format. </p>
pub fn record_identifier_value_as_string(
mut self,
input: impl Into<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = Some(input.into());
self
}
/// <p>The value for the <code>RecordIdentifier</code> that uniquely identifies the record, in string format. </p>
pub fn set_record_identifier_value_as_string(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = input;
self
}
/// <p>Timestamp indicating when the deletion event occurred. <code>EventTime</code> can be used to query data at a certain point in time.</p>
pub fn event_time(mut self, input: impl Into<std::string::String>) -> Self {
self.event_time = Some(input.into());
self
}
/// <p>Timestamp indicating when the deletion event occurred. <code>EventTime</code> can be used to query data at a certain point in time.</p>
pub fn set_event_time(mut self, input: std::option::Option<std::string::String>) -> Self {
self.event_time = input;
self
}
/// Consumes the builder and constructs a [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub fn build(
self,
) -> Result<crate::input::DeleteRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteRecordInput {
feature_group_name: self.feature_group_name,
record_identifier_value_as_string: self.record_identifier_value_as_string,
event_time: self.event_time,
})
}
}
}
impl DeleteRecordInput {
/// Consumes the builder and constructs an Operation<[`DeleteRecord`](crate::operation::DeleteRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::DeleteRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::DeleteRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.feature_group_name;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::DeleteRecordInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
let inner_2 = &_input.record_identifier_value_as_string;
let inner_2 = inner_2.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
)
})?;
if inner_2.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
),
);
}
query.push_kv(
"RecordIdentifierValueAsString",
&aws_smithy_http::query::fmt_string(&inner_2),
);
let inner_3 = &_input.event_time;
let inner_3 = inner_3.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"event_time",
"cannot be empty or unset",
)
})?;
if inner_3.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"event_time",
"cannot be empty or unset",
),
);
}
query.push_kv("EventTime", &aws_smithy_http::query::fmt_string(&inner_3));
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
uri_query(input, &mut uri)?;
Ok(builder.method("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DeleteRecord::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub fn builder() -> crate::input::delete_record_input::Builder {
crate::input::delete_record_input::Builder::default()
}
}
/// See [`GetRecordInput`](crate::input::GetRecordInput).
pub mod get_record_input {
/// A builder for [`GetRecordInput`](crate::input::GetRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record_identifier_value_as_string: std::option::Option<std::string::String>,
pub(crate) feature_names: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl Builder {
/// <p>The name of the feature group in which you want to put the records.</p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group in which you want to put the records.</p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// <p>The value that corresponds to <code>RecordIdentifier</code> type and uniquely identifies the record in the <code>FeatureGroup</code>. </p>
pub fn record_identifier_value_as_string(
mut self,
input: impl Into<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = Some(input.into());
self
}
/// <p>The value that corresponds to <code>RecordIdentifier</code> type and uniquely identifies the record in the <code>FeatureGroup</code>. </p>
pub fn set_record_identifier_value_as_string(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = input;
self
}
/// Appends an item to `feature_names`.
///
/// To override the contents of this collection use [`set_feature_names`](Self::set_feature_names).
///
/// <p>List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.</p>
pub fn feature_names(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.feature_names.unwrap_or_default();
v.push(input.into());
self.feature_names = Some(v);
self
}
/// <p>List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.</p>
pub fn set_feature_names(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.feature_names = input;
self
}
/// Consumes the builder and constructs a [`GetRecordInput`](crate::input::GetRecordInput).
pub fn build(
self,
) -> Result<crate::input::GetRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetRecordInput {
feature_group_name: self.feature_group_name,
record_identifier_value_as_string: self.record_identifier_value_as_string,
feature_names: self.feature_names,
})
}
}
}
impl GetRecordInput {
/// Consumes the builder and constructs an Operation<[`GetRecord`](crate::operation::GetRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::GetRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::GetRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_4 = &_input.feature_group_name;
let input_4 = input_4.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_4,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::GetRecordInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
let inner_5 = &_input.record_identifier_value_as_string;
let inner_5 = inner_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
)
})?;
if inner_5.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
),
);
}
query.push_kv(
"RecordIdentifierValueAsString",
&aws_smithy_http::query::fmt_string(&inner_5),
);
if let Some(inner_6) = &_input.feature_names {
{
for inner_7 in inner_6 {
query.push_kv(
"FeatureName",
&aws_smithy_http::query::fmt_string(&inner_7),
);
}
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::GetRecord::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`GetRecordInput`](crate::input::GetRecordInput).
pub fn builder() -> crate::input::get_record_input::Builder {
crate::input::get_record_input::Builder::default()
}
}
/// See [`PutRecordInput`](crate::input::PutRecordInput).
pub mod put_record_input {
/// A builder for [`PutRecordInput`](crate::input::PutRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record: std::option::Option<std::vec::Vec<crate::model::FeatureValue>>,
}
impl Builder {
/// <p>The name of the feature group that you want to insert the record into.</p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group that you want to insert the record into.</p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// Appends an item to `record`.
///
/// To override the contents of this collection use [`set_record`](Self::set_record).
///
/// <p>List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:</p>
/// <ul>
/// <li> <p>Use <code>GetRecord</code> to retrieve the latest record.</p> </li>
/// <li> <p>Update the record returned from <code>GetRecord</code>. </p> </li>
/// <li> <p>Use <code>PutRecord</code> to update feature values.</p> </li>
/// </ul>
pub fn record(mut self, input: crate::model::FeatureValue) -> Self {
let mut v = self.record.unwrap_or_default();
v.push(input);
self.record = Some(v);
self
}
/// <p>List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:</p>
/// <ul>
/// <li> <p>Use <code>GetRecord</code> to retrieve the latest record.</p> </li>
/// <li> <p>Update the record returned from <code>GetRecord</code>. </p> </li>
/// <li> <p>Use <code>PutRecord</code> to update feature values.</p> </li>
/// </ul>
pub fn set_record(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::FeatureValue>>,
) -> Self {
self.record = input;
self
}
/// Consumes the builder and constructs a [`PutRecordInput`](crate::input::PutRecordInput).
pub fn build(
self,
) -> Result<crate::input::PutRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::PutRecordInput {
feature_group_name: self.feature_group_name,
record: self.record,
})
}
}
}
impl PutRecordInput {
/// Consumes the builder and constructs an Operation<[`PutRecord`](crate::operation::PutRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::PutRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::PutRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_8 = &_input.feature_group_name;
let input_8 = input_8.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_8,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::PutRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("PUT").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_put_record(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::PutRecord::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"PutRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
sourcepub fn http_connector(&self) -> Option<&HttpConnector>
pub fn http_connector(&self) -> Option<&HttpConnector>
Return an HttpConnector
to use when making requests, if any.
Examples found in repository?
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf
.retry_config()
.cloned()
.unwrap_or_else(aws_smithy_types::retry::RetryConfig::disabled);
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let sleep_impl = conf.sleep_impl();
if (retry_config.has_retry() || timeout_config.has_timeouts()) && sleep_impl.is_none() {
panic!("An async sleep implementation is required for retries or timeouts to work. \
Set the `sleep_impl` on the Config passed into this function to fix this panic.");
}
let connector = conf.http_connector().and_then(|c| {
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(aws_smithy_types::timeout::TimeoutConfig::disabled);
let connector_settings =
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
);
c.connector(&connector_settings, conf.sleep_impl())
});
let builder = aws_smithy_client::Builder::new();
let builder = match connector {
// Use provided connector
Some(c) => builder.connector(c),
None => {
#[cfg(any(feature = "rustls", feature = "native-tls"))]
{
// Use default connector based on enabled features
builder.dyn_https_connector(
aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
),
)
}
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
{
panic!("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.");
}
}
};
let mut builder = builder
.middleware(aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
))
.retry_config(retry_config.into())
.operation_timeout_config(timeout_config.into());
builder.set_sleep_impl(sleep_impl);
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
sourcepub fn new(config: &SdkConfig) -> Self
pub fn new(config: &SdkConfig) -> Self
Creates a new service config from a shared config
.
sourcepub fn signing_service(&self) -> &'static str
pub fn signing_service(&self) -> &'static str
The signature version 4 service signing name to use in the credential scope when signing requests.
The signing service may be overridden by the Endpoint
, or by specifying a custom
SigningService
during operation construction
Examples found in repository?
49 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::BatchGetRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::BatchGetRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/BatchGetRecord").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::BatchGetRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_batch_get_record(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::BatchGetRecord::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"BatchGetRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`BatchGetRecordInput`](crate::input::BatchGetRecordInput).
pub fn builder() -> crate::input::batch_get_record_input::Builder {
crate::input::batch_get_record_input::Builder::default()
}
}
/// See [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub mod delete_record_input {
/// A builder for [`DeleteRecordInput`](crate::input::DeleteRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record_identifier_value_as_string: std::option::Option<std::string::String>,
pub(crate) event_time: std::option::Option<std::string::String>,
}
impl Builder {
/// <p>The name of the feature group to delete the record from. </p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group to delete the record from. </p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// <p>The value for the <code>RecordIdentifier</code> that uniquely identifies the record, in string format. </p>
pub fn record_identifier_value_as_string(
mut self,
input: impl Into<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = Some(input.into());
self
}
/// <p>The value for the <code>RecordIdentifier</code> that uniquely identifies the record, in string format. </p>
pub fn set_record_identifier_value_as_string(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = input;
self
}
/// <p>Timestamp indicating when the deletion event occurred. <code>EventTime</code> can be used to query data at a certain point in time.</p>
pub fn event_time(mut self, input: impl Into<std::string::String>) -> Self {
self.event_time = Some(input.into());
self
}
/// <p>Timestamp indicating when the deletion event occurred. <code>EventTime</code> can be used to query data at a certain point in time.</p>
pub fn set_event_time(mut self, input: std::option::Option<std::string::String>) -> Self {
self.event_time = input;
self
}
/// Consumes the builder and constructs a [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub fn build(
self,
) -> Result<crate::input::DeleteRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteRecordInput {
feature_group_name: self.feature_group_name,
record_identifier_value_as_string: self.record_identifier_value_as_string,
event_time: self.event_time,
})
}
}
}
impl DeleteRecordInput {
/// Consumes the builder and constructs an Operation<[`DeleteRecord`](crate::operation::DeleteRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::DeleteRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::DeleteRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.feature_group_name;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::DeleteRecordInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
let inner_2 = &_input.record_identifier_value_as_string;
let inner_2 = inner_2.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
)
})?;
if inner_2.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
),
);
}
query.push_kv(
"RecordIdentifierValueAsString",
&aws_smithy_http::query::fmt_string(&inner_2),
);
let inner_3 = &_input.event_time;
let inner_3 = inner_3.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"event_time",
"cannot be empty or unset",
)
})?;
if inner_3.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"event_time",
"cannot be empty or unset",
),
);
}
query.push_kv("EventTime", &aws_smithy_http::query::fmt_string(&inner_3));
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
uri_query(input, &mut uri)?;
Ok(builder.method("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DeleteRecord::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`DeleteRecordInput`](crate::input::DeleteRecordInput).
pub fn builder() -> crate::input::delete_record_input::Builder {
crate::input::delete_record_input::Builder::default()
}
}
/// See [`GetRecordInput`](crate::input::GetRecordInput).
pub mod get_record_input {
/// A builder for [`GetRecordInput`](crate::input::GetRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record_identifier_value_as_string: std::option::Option<std::string::String>,
pub(crate) feature_names: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl Builder {
/// <p>The name of the feature group in which you want to put the records.</p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group in which you want to put the records.</p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// <p>The value that corresponds to <code>RecordIdentifier</code> type and uniquely identifies the record in the <code>FeatureGroup</code>. </p>
pub fn record_identifier_value_as_string(
mut self,
input: impl Into<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = Some(input.into());
self
}
/// <p>The value that corresponds to <code>RecordIdentifier</code> type and uniquely identifies the record in the <code>FeatureGroup</code>. </p>
pub fn set_record_identifier_value_as_string(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.record_identifier_value_as_string = input;
self
}
/// Appends an item to `feature_names`.
///
/// To override the contents of this collection use [`set_feature_names`](Self::set_feature_names).
///
/// <p>List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.</p>
pub fn feature_names(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.feature_names.unwrap_or_default();
v.push(input.into());
self.feature_names = Some(v);
self
}
/// <p>List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.</p>
pub fn set_feature_names(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.feature_names = input;
self
}
/// Consumes the builder and constructs a [`GetRecordInput`](crate::input::GetRecordInput).
pub fn build(
self,
) -> Result<crate::input::GetRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetRecordInput {
feature_group_name: self.feature_group_name,
record_identifier_value_as_string: self.record_identifier_value_as_string,
feature_names: self.feature_names,
})
}
}
}
impl GetRecordInput {
/// Consumes the builder and constructs an Operation<[`GetRecord`](crate::operation::GetRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::GetRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::GetRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_4 = &_input.feature_group_name;
let input_4 = input_4.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_4,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::GetRecordInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
let inner_5 = &_input.record_identifier_value_as_string;
let inner_5 = inner_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
)
})?;
if inner_5.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"record_identifier_value_as_string",
"cannot be empty or unset",
),
);
}
query.push_kv(
"RecordIdentifierValueAsString",
&aws_smithy_http::query::fmt_string(&inner_5),
);
if let Some(inner_6) = &_input.feature_names {
{
for inner_7 in inner_6 {
query.push_kv(
"FeatureName",
&aws_smithy_http::query::fmt_string(&inner_7),
);
}
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::GetRecord::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
/// Creates a new builder-style object to manufacture [`GetRecordInput`](crate::input::GetRecordInput).
pub fn builder() -> crate::input::get_record_input::Builder {
crate::input::get_record_input::Builder::default()
}
}
/// See [`PutRecordInput`](crate::input::PutRecordInput).
pub mod put_record_input {
/// A builder for [`PutRecordInput`](crate::input::PutRecordInput).
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) feature_group_name: std::option::Option<std::string::String>,
pub(crate) record: std::option::Option<std::vec::Vec<crate::model::FeatureValue>>,
}
impl Builder {
/// <p>The name of the feature group that you want to insert the record into.</p>
pub fn feature_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.feature_group_name = Some(input.into());
self
}
/// <p>The name of the feature group that you want to insert the record into.</p>
pub fn set_feature_group_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.feature_group_name = input;
self
}
/// Appends an item to `record`.
///
/// To override the contents of this collection use [`set_record`](Self::set_record).
///
/// <p>List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:</p>
/// <ul>
/// <li> <p>Use <code>GetRecord</code> to retrieve the latest record.</p> </li>
/// <li> <p>Update the record returned from <code>GetRecord</code>. </p> </li>
/// <li> <p>Use <code>PutRecord</code> to update feature values.</p> </li>
/// </ul>
pub fn record(mut self, input: crate::model::FeatureValue) -> Self {
let mut v = self.record.unwrap_or_default();
v.push(input);
self.record = Some(v);
self
}
/// <p>List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:</p>
/// <ul>
/// <li> <p>Use <code>GetRecord</code> to retrieve the latest record.</p> </li>
/// <li> <p>Update the record returned from <code>GetRecord</code>. </p> </li>
/// <li> <p>Use <code>PutRecord</code> to update feature values.</p> </li>
/// </ul>
pub fn set_record(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::FeatureValue>>,
) -> Self {
self.record = input;
self
}
/// Consumes the builder and constructs a [`PutRecordInput`](crate::input::PutRecordInput).
pub fn build(
self,
) -> Result<crate::input::PutRecordInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::PutRecordInput {
feature_group_name: self.feature_group_name,
record: self.record,
})
}
}
}
impl PutRecordInput {
/// Consumes the builder and constructs an Operation<[`PutRecord`](crate::operation::PutRecord)>
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::PutRecord,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let mut request = {
fn uri_base(
_input: &crate::input::PutRecordInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_8 = &_input.feature_group_name;
let input_8 = input_8.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
)
})?;
let feature_group_name = aws_smithy_http::label::fmt_string(
input_8,
aws_smithy_http::label::EncodingStrategy::Default,
);
if feature_group_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"feature_group_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/FeatureGroup/{FeatureGroupName}",
FeatureGroupName = feature_group_name
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::PutRecordInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("PUT").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_put_record(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
request
.properties_mut()
.insert::<aws_smithy_http::endpoint::Result>(
_config.endpoint_resolver.resolve_endpoint(&endpoint_params),
);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_provider(
&mut request.properties_mut(),
_config.credentials_provider.clone(),
);
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::PutRecord::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"PutRecord",
"sagemakerfeaturestoreruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
sourcepub fn credentials_provider(&self) -> SharedCredentialsProvider
pub fn credentials_provider(&self) -> SharedCredentialsProvider
Returns the credentials provider.