use aws::common::region::Region;
use aws::errors::http::*;
use aws::s3::writeparse::*;
use aws::s3::object::*;
use aws::s3::policy::*;
use aws::s3::acl::*;
use aws::s3::header::*;
use aws::s3::grant::*;
#[derive(Debug, Default)]
pub struct TopicConfigurationDeprecated {
pub topic: TopicArn,
pub id: NotificationId,
pub event: Event,
pub events: EventList,
}
#[derive(Debug, Default)]
pub struct QueueConfigurationDeprecated {
pub queue: QueueArn,
pub events: EventList,
pub id: NotificationId,
pub event: Event,
}
#[derive(Debug, Default)]
pub struct CloudFunctionConfiguration {
pub invocation_role: CloudFunctionInvocationRole,
pub cloud_function: CloudFunction,
pub events: EventList,
pub id: NotificationId,
pub event: Event,
}
#[derive(Debug, Default)]
pub struct PutBucketReplicationRequest {
pub replication_configuration: ReplicationConfiguration,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct PutBucketNotificationRequest {
pub notification_configuration: NotificationConfigurationDeprecated,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct GetBucketLoggingRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct PutBucketLifecycleRequest {
pub lifecycle_configuration: Option<LifecycleConfiguration>,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct GetBucketCorsRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct GetBucketCorsOutput {
pub cors_rules: CORSRules,
}
#[derive(Debug, Default)]
pub struct GetBucketVersioningRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct GetBucketVersioningOutput {
pub status: BucketVersioningStatus,
pub mfa_delete: MFADeleteStatus,
}
#[derive(Debug, Default)]
pub struct PutBucketVersioningRequest {
pub mfa: Option<MFA>,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
pub versioning_configuration: VersioningConfiguration,
}
#[derive(Debug, Default)]
pub struct CORSRule {
pub allowed_headers: AllowedHeaders,
pub expose_headers: ExposeHeaders,
pub allowed_methods: AllowedMethods,
pub max_age_seconds: MaxAgeSeconds,
pub allowed_origins: AllowedOrigins,
}
#[derive(Debug, Default)]
pub struct VersioningConfiguration {
pub status: BucketVersioningStatus,
pub mfa_delete: MFADelete,
}
#[derive(Debug, Default)]
pub struct DeleteBucketCorsRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct NotificationConfiguration {
pub queue_configurations: QueueConfigurationList,
pub lambda_function_configurations: LambdaFunctionConfigurationList,
pub topic_configurations: TopicConfigurationList,
}
#[derive(Debug, Default)]
pub struct GetBucketNotificationConfigurationRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct DeleteBucketWebsiteRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct DeleteBucketTaggingRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct LifecycleConfiguration {
pub rules: Rules,
}
#[derive(Debug, Default)]
pub struct PutBucketPolicyRequest {
pub policy: Policy,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct RoutingRule {
pub redirect: Redirect,
pub condition: Option<Condition>,
}
#[derive(Debug, Default)]
pub struct CreateBucketRequest {
pub grant_full_control: Option<GrantFullControl>,
pub create_bucket_configuration: Option<CreateBucketConfiguration>,
pub grant_write_acp: Option<GrantWriteACP>,
pub bucket: BucketName,
pub acl: Option<CannedAcl>,
pub grant_write: Option<GrantWrite>,
pub grant_read: Option<GrantRead>,
pub grant_read_acp: Option<GrantReadACP>,
}
#[derive(Debug, Default)]
pub struct PutBucketLoggingRequest {
pub bucket_logging_status: BucketLoggingStatus,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct ReplicationConfiguration {
pub rules: ReplicationRules,
pub role: Role,
}
#[derive(Debug, Default)]
pub struct LoggingEnabled {
pub target_prefix: TargetPrefix,
pub target_bucket: TargetBucket,
pub target_grants: TargetGrants,
}
#[derive(Debug, Default)]
pub struct WebsiteConfiguration {
pub redirect_all_requests_to: RedirectAllRequestsTo,
pub index_document: IndexDocument,
pub error_document: ErrorDocument,
pub routing_rules: RoutingRules,
}
#[derive(Debug, Default)]
pub struct BucketLoggingStatus {
pub logging_enabled: LoggingEnabled,
}
#[derive(Debug, Default)]
pub struct Destination {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct PutBucketRequestPaymentRequest {
pub request_payment_configuration: RequestPaymentConfiguration,
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct Bucket {
pub creation_date: CreationDate,
pub name: BucketName,
}
#[derive(Debug, Default)]
pub struct HeadBucketRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct DeleteBucketRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct DeleteBucketPolicyRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct DeleteBucketReplicationRequest {
pub bucket: BucketName,
}
#[derive(Debug, Default)]
pub struct GetBucketLoggingOutput {
pub logging_enabled: LoggingEnabled,
}
#[derive(Debug, Default)]
pub struct GetBucketReplicationOutput {
pub replication_configuration: ReplicationConfiguration,
}
#[derive(Debug, Default)]
pub struct PutBucketWebsiteRequest {
pub content_md5: Option<ContentMD5>,
pub bucket: BucketName,
pub website_configuration: WebsiteConfiguration,
}
pub fn needs_create_bucket_config(region: Region) -> bool {
match region {
Region::UsEast1 => false,
_ => true,
}
}
pub fn create_bucket_config_xml(region: Region) -> Vec<u8> {
match region {
Region::UsEast1 => {
Vec::new() }
_ => {
let xml = format!("<CreateBucketConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">
<LocationConstraint>{}</LocationConstraint>
</CreateBucketConfiguration >", region);
xml.into_bytes()
}
}
}