1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Represents a summary of a Method resource, given a particular date and time.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct MethodSnapshot {
/// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
pub authorization_type: ::std::option::Option<::std::string::String>,
/// <p>Specifies whether the method requires a valid ApiKey.</p>
pub api_key_required: bool,
}
impl MethodSnapshot {
/// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
pub fn authorization_type(&self) -> ::std::option::Option<&str> {
self.authorization_type.as_deref()
}
/// <p>Specifies whether the method requires a valid ApiKey.</p>
pub fn api_key_required(&self) -> bool {
self.api_key_required
}
}
impl MethodSnapshot {
/// Creates a new builder-style object to manufacture [`MethodSnapshot`](crate::types::MethodSnapshot).
pub fn builder() -> crate::types::builders::MethodSnapshotBuilder {
crate::types::builders::MethodSnapshotBuilder::default()
}
}
/// A builder for [`MethodSnapshot`](crate::types::MethodSnapshot).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct MethodSnapshotBuilder {
pub(crate) authorization_type: ::std::option::Option<::std::string::String>,
pub(crate) api_key_required: ::std::option::Option<bool>,
}
impl MethodSnapshotBuilder {
/// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
pub fn authorization_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.authorization_type = ::std::option::Option::Some(input.into());
self
}
/// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
pub fn set_authorization_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.authorization_type = input;
self
}
/// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
pub fn get_authorization_type(&self) -> &::std::option::Option<::std::string::String> {
&self.authorization_type
}
/// <p>Specifies whether the method requires a valid ApiKey.</p>
pub fn api_key_required(mut self, input: bool) -> Self {
self.api_key_required = ::std::option::Option::Some(input);
self
}
/// <p>Specifies whether the method requires a valid ApiKey.</p>
pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
self.api_key_required = input;
self
}
/// <p>Specifies whether the method requires a valid ApiKey.</p>
pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
&self.api_key_required
}
/// Consumes the builder and constructs a [`MethodSnapshot`](crate::types::MethodSnapshot).
pub fn build(self) -> crate::types::MethodSnapshot {
crate::types::MethodSnapshot {
authorization_type: self.authorization_type,
api_key_required: self.api_key_required.unwrap_or_default(),
}
}
}