pub struct StorageProviderS3 {Show 17 fields
pub url: Option<String>,
pub bucket: Option<String>,
pub region: Option<String>,
pub key: Option<String>,
pub secret: Option<String>,
pub base_path: Option<String>,
pub endpoint: Option<String>,
pub use_vhost_request: Option<bool>,
pub token: Option<String>,
pub kms: Option<String>,
pub use_bucket_key: Option<bool>,
pub multipart_threshold: ByteSize,
pub multipart_part_size: ByteSize,
pub use_https: Option<bool>,
pub use_signatures: Option<bool>,
pub use_payload_signatures: Option<bool>,
pub startup_check: bool,
}Expand description
S3 storage provider
Stores media in an S3-compatible object store: AWS S3, or another
service reached through endpoint.
<ID>: your name for this provider. Media uses a provider only whenmedia.storage_providers(default["media"]) lists it;media.store_on_providersandmedia.import.conduit.source_providername providers the same way. Listing an undefined id fails startup.mediais the built-in local provider, and amediaentry replaces it. Use one backend (local,s3orgcs) per<ID>. Bare keys may useA-Z a-z 0-9 _ -; anything else must be quoted ([global.storage_provider."my.media".s3]), and an unquoted dot splits the name into nested tables.
Set url or bucket; with neither, the entry is skipped, even when
media.storage_providers lists it. Skipping it is an error only when no
enabled provider is left to receive uploads. Keys left unset fall back
to the standard AWS_* environment variables.
Example:
[global.storage_provider.s3_media.s3]
bucket = "my-media-bucket"
region = "us-west-2"
key = "CHANGE_ME"
secret = "CHANGE_ME"Tips:
media.storage_providers = ["media", "s3_media"]withmedia.store_on_providers = ["s3_media"]writes new media to S3 and still reads older media frommedia. Withoutstore_on_providers, every upload goes to both (startup warns).- The path in an
s3://bucket/pathurlis not used as a prefix; setbase_pathinstead. - Providers are built once at startup, so a config reload that adds, removes or changes a provider section is refused; restart instead.
Fields§
§url: Option<String>Sets the bucket, and for some forms the region, from an S3 URL.
An s3://bucket URL supplies only the bucket, and its path is ignored,
so set base_path for a prefix within the bucket. An AWS https:// URL
that names a region (https://s3.<region>.amazonaws.com/<bucket> or
https://<bucket>.s3.<region>.amazonaws.com) supplies it too, a
Cloudflare R2 URL sets it to auto, and values taken from the URL
override bucket and region.
example: “s3://my-media-bucket”
bucket: Option<String>The name of the S3 bucket. e.g. “bucketname-123456789-us-west-2-an”.
region: Option<String>The region of the S3 bucket. e.g. “us-west-2”.
default: “us-east-1”
key: Option<String>Your amazon IAM Key ID with access granted to this bucket. e.g. “ABCDEFG1X1ZZYYXXWWVV”
secret: Option<String>The secret key component which is approx 40 characters of base64.
default: display: sensitive
base_path: Option<String>Optional path prefix within the bucket where all our operations will take place.
endpoint: Option<String>(expert use) Sets the S3 endpoint for self-hosted or other compatible services.
A dual-stack AWS or Cloudflare R2 url sets its own endpoint, which
overrides this value.
use_vhost_request: Option<bool>(expert use) Turns virtual-hosted-style requests on or off, which some self-hosted services need.
A virtual-hosted AWS url (https://<bucket>.s3.<region>.amazonaws.com)
turns them on regardless of this value.
token: Option<String>(expert use) Alternative session-token authentication method.
display: sensitive default:
kms: Option<String>(expert use) Associated SSE-KMS key material.
display: sensitive
use_bucket_key: Option<bool>(expert use) When configured for the bucket it should be reflected here.
multipart_threshold: ByteSize(expert use) Threshold size for switching to Multi-part uploads. This is a quirk of the S3 protocol which requires us to use a different approach for “large” uploads. This value determines what a “large” upload is. The default value should be sufficient for most providers. The value is a parsed string allowing SI or IEC units for convenience.
default: “100 MiB”
multipart_part_size: ByteSize(expert use) Size of each individual part within a Multi-part upload.
Once an upload exceeds multipart_threshold the payload is split into
parts of this size, each sent as a separate HTTP PUT. Smaller values
keep individual requests under per-request timeouts on slow uplinks at
the cost of more round-trips. S3 requires every part except the last
to be at least 5 MiB. The value is a parsed string allowing SI or IEC
units for convenience.
default: “10 MiB”
use_https: Option<bool>(developer use) Allows relaxing default requirement forcing HTTPS.
default: true
use_signatures: Option<bool>(developer_use) Allows skipping request header signatures (will be reejected by AWS).
default: true
use_payload_signatures: Option<bool>(developer_use) Allows disabling request payload signatures.
default: true
startup_check: bool(developer use) Enables checks performed at startup such as pinging the provider. Failures are considered critical startup errors which abort startup. When set to false, faulty providers are only discovered with first use and will not be fatal errors.
Only set this to false if you expect a provider to be down at startup or for development/testing purposes; checks are disabled when the server is started in ‘–maintenance’ mode.
default: true
Implementations§
Source§impl StorageProviderS3
impl StorageProviderS3
pub(crate) fn fmt_config(&self, out: &mut Formatter<'_>) -> Result
Source§impl StorageProviderS3
impl StorageProviderS3
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Reports whether this S3 provider is enabled.
Setting neither url nor bucket disables the entry.
Trait Implementations§
Source§impl Clone for StorageProviderS3
impl Clone for StorageProviderS3
Source§impl Debug for StorageProviderS3
impl Debug for StorageProviderS3
Source§impl Default for StorageProviderS3
impl Default for StorageProviderS3
Source§impl<'de> Deserialize<'de> for StorageProviderS3
impl<'de> Deserialize<'de> for StorageProviderS3
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for StorageProviderS3
impl Display for StorageProviderS3
impl Eq for StorageProviderS3
Source§impl PartialEq for StorageProviderS3
impl PartialEq for StorageProviderS3
impl StructuralPartialEq for StorageProviderS3
Auto Trait Implementations§
impl Freeze for StorageProviderS3
impl RefUnwindSafe for StorageProviderS3
impl Send for StorageProviderS3
impl Sync for StorageProviderS3
impl Unpin for StorageProviderS3
impl UnsafeUnpin for StorageProviderS3
impl UnwindSafe for StorageProviderS3
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
rhs with checked arithmetic. Read more