Struct aws_sdk_s3::model::CorsRule

source ·
#[non_exhaustive]
pub struct CorsRule { /* private fields */ }
Expand description

Specifies a cross-origin access rule for an Amazon S3 bucket.

Implementations§

Unique identifier for the rule. The value cannot be longer than 255 characters.

Headers that are specified in the Access-Control-Request-Headers header. These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, Amazon S3 returns any requested headers that are allowed.

An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, and DELETE.

One or more origins you want customers to be able to access the bucket from.

One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).

The time in seconds that your browser is to cache the preflight response for the specified resource.

Creates a new builder-style object to manufacture CorsRule.

Examples found in repository?
src/xml_deser.rs (line 3097)
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
pub fn deser_structure_crate_model_cors_rule(
    decoder: &mut aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::model::CorsRule, aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::model::CorsRule::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("ID") /* ID com.amazonaws.s3#CORSRule$ID */ =>  {
                let var_160 =
                    Some(
                        Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_id(var_160);
            }
            ,
            s if s.matches("AllowedHeader") /* AllowedHeaders com.amazonaws.s3#CORSRule$AllowedHeaders */ =>  {
                let var_161 =
                    Some(
                        Result::<std::vec::Vec<std::string::String>, aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_162 = builder.allowed_headers.take().unwrap_or_default();
                            list_162.push(
                                Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
                                    aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                                    .into()
                                )
                                ?
                            );
                            list_162
                        })
                        ?
                    )
                ;
                builder = builder.set_allowed_headers(var_161);
            }
            ,
            s if s.matches("AllowedMethod") /* AllowedMethods com.amazonaws.s3#CORSRule$AllowedMethods */ =>  {
                let var_163 =
                    Some(
                        Result::<std::vec::Vec<std::string::String>, aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_164 = builder.allowed_methods.take().unwrap_or_default();
                            list_164.push(
                                Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
                                    aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                                    .into()
                                )
                                ?
                            );
                            list_164
                        })
                        ?
                    )
                ;
                builder = builder.set_allowed_methods(var_163);
            }
            ,
            s if s.matches("AllowedOrigin") /* AllowedOrigins com.amazonaws.s3#CORSRule$AllowedOrigins */ =>  {
                let var_165 =
                    Some(
                        Result::<std::vec::Vec<std::string::String>, aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_166 = builder.allowed_origins.take().unwrap_or_default();
                            list_166.push(
                                Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
                                    aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                                    .into()
                                )
                                ?
                            );
                            list_166
                        })
                        ?
                    )
                ;
                builder = builder.set_allowed_origins(var_165);
            }
            ,
            s if s.matches("ExposeHeader") /* ExposeHeaders com.amazonaws.s3#CORSRule$ExposeHeaders */ =>  {
                let var_167 =
                    Some(
                        Result::<std::vec::Vec<std::string::String>, aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_168 = builder.expose_headers.take().unwrap_or_default();
                            list_168.push(
                                Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
                                    aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                                    .into()
                                )
                                ?
                            );
                            list_168
                        })
                        ?
                    )
                ;
                builder = builder.set_expose_headers(var_167);
            }
            ,
            s if s.matches("MaxAgeSeconds") /* MaxAgeSeconds com.amazonaws.s3#CORSRule$MaxAgeSeconds */ =>  {
                let var_169 =
                    Some(
                         {
                            <i32 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.s3#MaxAgeSeconds`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_max_age_seconds(var_169);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more