#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Purchase {
pub currency_code: ::std::option::Option<crate::types::CurrencyCodeValues>,
pub duration: ::std::option::Option<i32>,
pub host_id_set: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub host_reservation_id: ::std::option::Option<::std::string::String>,
pub hourly_price: ::std::option::Option<::std::string::String>,
pub instance_family: ::std::option::Option<::std::string::String>,
pub payment_option: ::std::option::Option<crate::types::PaymentOption>,
pub upfront_price: ::std::option::Option<::std::string::String>,
}
impl Purchase {
pub fn currency_code(&self) -> ::std::option::Option<&crate::types::CurrencyCodeValues> {
self.currency_code.as_ref()
}
pub fn duration(&self) -> ::std::option::Option<i32> {
self.duration
}
pub fn host_id_set(&self) -> &[::std::string::String] {
self.host_id_set.as_deref().unwrap_or_default()
}
pub fn host_reservation_id(&self) -> ::std::option::Option<&str> {
self.host_reservation_id.as_deref()
}
pub fn hourly_price(&self) -> ::std::option::Option<&str> {
self.hourly_price.as_deref()
}
pub fn instance_family(&self) -> ::std::option::Option<&str> {
self.instance_family.as_deref()
}
pub fn payment_option(&self) -> ::std::option::Option<&crate::types::PaymentOption> {
self.payment_option.as_ref()
}
pub fn upfront_price(&self) -> ::std::option::Option<&str> {
self.upfront_price.as_deref()
}
}
impl Purchase {
pub fn builder() -> crate::types::builders::PurchaseBuilder {
crate::types::builders::PurchaseBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PurchaseBuilder {
pub(crate) currency_code: ::std::option::Option<crate::types::CurrencyCodeValues>,
pub(crate) duration: ::std::option::Option<i32>,
pub(crate) host_id_set: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) host_reservation_id: ::std::option::Option<::std::string::String>,
pub(crate) hourly_price: ::std::option::Option<::std::string::String>,
pub(crate) instance_family: ::std::option::Option<::std::string::String>,
pub(crate) payment_option: ::std::option::Option<crate::types::PaymentOption>,
pub(crate) upfront_price: ::std::option::Option<::std::string::String>,
}
impl PurchaseBuilder {
pub fn currency_code(mut self, input: crate::types::CurrencyCodeValues) -> Self {
self.currency_code = ::std::option::Option::Some(input);
self
}
pub fn set_currency_code(mut self, input: ::std::option::Option<crate::types::CurrencyCodeValues>) -> Self {
self.currency_code = input;
self
}
pub fn get_currency_code(&self) -> &::std::option::Option<crate::types::CurrencyCodeValues> {
&self.currency_code
}
pub fn duration(mut self, input: i32) -> Self {
self.duration = ::std::option::Option::Some(input);
self
}
pub fn set_duration(mut self, input: ::std::option::Option<i32>) -> Self {
self.duration = input;
self
}
pub fn get_duration(&self) -> &::std::option::Option<i32> {
&self.duration
}
pub fn host_id_set(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.host_id_set.unwrap_or_default();
v.push(input.into());
self.host_id_set = ::std::option::Option::Some(v);
self
}
pub fn set_host_id_set(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.host_id_set = input;
self
}
pub fn get_host_id_set(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.host_id_set
}
pub fn host_reservation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.host_reservation_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_host_reservation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.host_reservation_id = input;
self
}
pub fn get_host_reservation_id(&self) -> &::std::option::Option<::std::string::String> {
&self.host_reservation_id
}
pub fn hourly_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.hourly_price = ::std::option::Option::Some(input.into());
self
}
pub fn set_hourly_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.hourly_price = input;
self
}
pub fn get_hourly_price(&self) -> &::std::option::Option<::std::string::String> {
&self.hourly_price
}
pub fn instance_family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.instance_family = ::std::option::Option::Some(input.into());
self
}
pub fn set_instance_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.instance_family = input;
self
}
pub fn get_instance_family(&self) -> &::std::option::Option<::std::string::String> {
&self.instance_family
}
pub fn payment_option(mut self, input: crate::types::PaymentOption) -> Self {
self.payment_option = ::std::option::Option::Some(input);
self
}
pub fn set_payment_option(mut self, input: ::std::option::Option<crate::types::PaymentOption>) -> Self {
self.payment_option = input;
self
}
pub fn get_payment_option(&self) -> &::std::option::Option<crate::types::PaymentOption> {
&self.payment_option
}
pub fn upfront_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.upfront_price = ::std::option::Option::Some(input.into());
self
}
pub fn set_upfront_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.upfront_price = input;
self
}
pub fn get_upfront_price(&self) -> &::std::option::Option<::std::string::String> {
&self.upfront_price
}
pub fn build(self) -> crate::types::Purchase {
crate::types::Purchase {
currency_code: self.currency_code,
duration: self.duration,
host_id_set: self.host_id_set,
host_reservation_id: self.host_reservation_id,
hourly_price: self.hourly_price,
instance_family: self.instance_family,
payment_option: self.payment_option,
upfront_price: self.upfront_price,
}
}
}