diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 9930af62..326b67ac 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -79,6 +79,18 @@ "type": "gchararray", "writable": true }, + "force-path-style": { + "blurb": "Force client to use path-style addressing for buckets", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, "hlssink": { "blurb": "The underlying HLS sink being used", "conditionally-available": false, @@ -315,6 +327,18 @@ "type": "gboolean", "writable": true }, + "force-path-style": { + "blurb": "Force client to use path-style addressing for buckets", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, "key": { "blurb": "The key of the file to write", "conditionally-available": false, @@ -529,6 +553,18 @@ "type": "gchararray", "writable": true }, + "force-path-style": { + "blurb": "Force client to use path-style addressing for buckets", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, "key": { "blurb": "The key of the file to write", "conditionally-available": false, @@ -747,6 +783,18 @@ "type": "gchararray", "writable": true }, + "force-path-style": { + "blurb": "Force client to use path-style addressing for buckets", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, "request-timeout": { "blurb": "Timeout for each S3 request (in ms, set to -1 for infinity)", "conditionally-available": false, diff --git a/net/aws/src/s3hlssink/imp.rs b/net/aws/src/s3hlssink/imp.rs index 6302fdfd..2f35bb97 100644 --- a/net/aws/src/s3hlssink/imp.rs +++ b/net/aws/src/s3hlssink/imp.rs @@ -39,6 +39,7 @@ const S3_CHANNEL_SIZE: usize = 32; const S3_ACL_DEFAULT: ObjectCannedAcl = ObjectCannedAcl::Private; const DEFAULT_RETRY_ATTEMPTS: u32 = 5; const DEFAULT_TIMEOUT_IN_MSECS: u64 = 15000; +const DEFAULT_FORCE_PATH_STYLE: bool = false; struct Settings { access_key: Option, @@ -57,6 +58,7 @@ struct Settings { video_sink: bool, config: Option, endpoint_uri: Option, + force_path_style: bool, } impl Default for Settings { @@ -79,6 +81,7 @@ impl Default for Settings { video_sink: false, config: None, endpoint_uri: None, + force_path_style: DEFAULT_FORCE_PATH_STYLE, } } } @@ -376,6 +379,7 @@ impl S3HlsSink { let sdk_config = settings.config.as_ref().expect("SDK config must be set"); let config_builder = config::Builder::from(sdk_config) + .force_path_style(settings.force_path_style) .region(settings.s3_region.clone()) .retry_config(RetryConfig::standard().with_max_attempts(settings.retry_attempts)); @@ -529,6 +533,11 @@ impl ObjectImpl for S3HlsSink { .blurb("The S3 endpoint URI to use") .mutable_ready() .build(), + glib::ParamSpecBoolean::builder("force-path-style") + .nick("Force path style") + .blurb("Force client to use path-style addressing for buckets") + .default_value(DEFAULT_FORCE_PATH_STYLE) + .build(), ] }); @@ -586,6 +595,9 @@ impl ObjectImpl for S3HlsSink { .get::>() .expect("type checked upstream"); } + "force-path-style" => { + settings.force_path_style = value.get::().expect("type checked upstream"); + } _ => unimplemented!(), } } @@ -606,6 +618,7 @@ impl ObjectImpl for S3HlsSink { "request-timeout" => (settings.request_timeout.as_millis() as u64).to_value(), "stats" => self.create_stats().to_value(), "endpoint-uri" => settings.endpoint_uri.to_value(), + "force-path-style" => settings.force_path_style.to_value(), _ => unimplemented!(), } } diff --git a/net/aws/src/s3sink/multipartsink.rs b/net/aws/src/s3sink/multipartsink.rs index 5554fb09..38751546 100644 --- a/net/aws/src/s3sink/multipartsink.rs +++ b/net/aws/src/s3sink/multipartsink.rs @@ -38,6 +38,7 @@ use crate::s3utils::{self, duration_from_millis, duration_to_millis, WaitError}; use super::OnError; +const DEFAULT_FORCE_PATH_STYLE: bool = false; const DEFAULT_RETRY_ATTEMPTS: u32 = 5; const DEFAULT_BUFFER_SIZE: u64 = 5 * 1024 * 1024; const DEFAULT_MULTIPART_UPLOAD_ON_ERROR: OnError = OnError::DoNothing; @@ -114,6 +115,7 @@ struct Settings { multipart_upload_on_error: OnError, request_timeout: Duration, endpoint_uri: Option, + force_path_style: bool, } impl Settings { @@ -168,6 +170,7 @@ impl Default for Settings { multipart_upload_on_error: DEFAULT_MULTIPART_UPLOAD_ON_ERROR, request_timeout: Duration::from_millis(DEFAULT_REQUEST_TIMEOUT_MSEC), endpoint_uri: None, + force_path_style: DEFAULT_FORCE_PATH_STYLE, } } } @@ -524,6 +527,7 @@ impl S3Sink { })?; let config_builder = config::Builder::from(&sdk_config) + .force_path_style(settings.force_path_style) .retry_config(RetryConfig::standard().with_max_attempts(settings.retry_attempts)); let config = if let Some(ref uri) = settings.endpoint_uri { @@ -775,6 +779,11 @@ impl ObjectImpl for S3Sink { .nick("content-disposition") .blurb("Content-Disposition header to set for uploaded object") .build(), + glib::ParamSpecBoolean::builder("force-path-style") + .nick("Force path style") + .blurb("Force client to use path-style addressing for buckets") + .default_value(DEFAULT_FORCE_PATH_STYLE) + .build(), ] }); @@ -888,6 +897,9 @@ impl ObjectImpl for S3Sink { .get::>() .expect("type checked upstream"); } + "force-path-style" => { + settings.force_path_style = value.get::().expect("type checked upstream"); + } _ => unimplemented!(), } } @@ -929,6 +941,7 @@ impl ObjectImpl for S3Sink { "endpoint-uri" => settings.endpoint_uri.to_value(), "content-type" => settings.content_type.to_value(), "content-disposition" => settings.content_disposition.to_value(), + "force-path-style" => settings.force_path_style.to_value(), _ => unimplemented!(), } } diff --git a/net/aws/src/s3sink/putobjectsink.rs b/net/aws/src/s3sink/putobjectsink.rs index 8b13d5f3..fb3ecd35 100644 --- a/net/aws/src/s3sink/putobjectsink.rs +++ b/net/aws/src/s3sink/putobjectsink.rs @@ -36,6 +36,7 @@ const DEFAULT_FLUSH_INTERVAL_BUFFERS: u64 = 1; const DEFAULT_FLUSH_INTERVAL_BYTES: u64 = 0; const DEFAULT_FLUSH_INTERVAL_TIME: gst::ClockTime = gst::ClockTime::from_nseconds(0); const DEFAULT_FLUSH_ON_ERROR: bool = false; +const DEFAULT_FORCE_PATH_STYLE: bool = false; // General setting for create / abort requests const DEFAULT_REQUEST_TIMEOUT_MSEC: u64 = 15_000; @@ -80,6 +81,7 @@ struct Settings { retry_attempts: u32, request_timeout: Duration, endpoint_uri: Option, + force_path_style: bool, flush_interval_buffers: u64, flush_interval_bytes: u64, flush_interval_time: Option, @@ -136,6 +138,7 @@ impl Default for Settings { retry_attempts: DEFAULT_RETRY_ATTEMPTS, request_timeout: Duration::from_millis(DEFAULT_REQUEST_TIMEOUT_MSEC), endpoint_uri: None, + force_path_style: DEFAULT_FORCE_PATH_STYLE, flush_interval_buffers: DEFAULT_FLUSH_INTERVAL_BUFFERS, flush_interval_bytes: DEFAULT_FLUSH_INTERVAL_BYTES, flush_interval_time: Some(DEFAULT_FLUSH_INTERVAL_TIME), @@ -293,6 +296,7 @@ impl S3PutObjectSink { })?; let config_builder = config::Builder::from(&sdk_config) + .force_path_style(settings.force_path_style) .retry_config(RetryConfig::standard().with_max_attempts(settings.retry_attempts)); let config = if let Some(ref uri) = settings.endpoint_uri { @@ -446,6 +450,11 @@ impl ObjectImpl for S3PutObjectSink { .blurb("Whether to write out the data on error (like stopping without an EOS)") .default_value(DEFAULT_FLUSH_ON_ERROR) .build(), + glib::ParamSpecBoolean::builder("force-path-style") + .nick("Force path style") + .blurb("Force client to use path-style addressing for buckets") + .default_value(DEFAULT_FORCE_PATH_STYLE) + .build(), ] }); @@ -542,6 +551,9 @@ impl ObjectImpl for S3PutObjectSink { "flush-on-error" => { settings.flush_on_error = value.get::().expect("type checked upstream"); } + "force-path-style" => { + settings.force_path_style = value.get::().expect("type checked upstream"); + } _ => unimplemented!(), } } @@ -575,6 +587,7 @@ impl ObjectImpl for S3PutObjectSink { "flush-interval-bytes" => settings.flush_interval_bytes.to_value(), "flush-interval-time" => settings.flush_interval_time.to_value(), "flush-on-error" => settings.flush_on_error.to_value(), + "force-path-style" => settings.force_path_style.to_value(), _ => unimplemented!(), } } diff --git a/net/aws/src/s3src/imp.rs b/net/aws/src/s3src/imp.rs index bfb8b76f..25e6f7cd 100644 --- a/net/aws/src/s3src/imp.rs +++ b/net/aws/src/s3src/imp.rs @@ -29,6 +29,7 @@ use gst_base::subclass::prelude::*; use crate::s3url::*; use crate::s3utils::{self, duration_from_millis, duration_to_millis, WaitError}; +const DEFAULT_FORCE_PATH_STYLE: bool = false; const DEFAULT_RETRY_ATTEMPTS: u32 = 5; const DEFAULT_REQUEST_TIMEOUT_MSEC: u64 = 15000; const DEFAULT_RETRY_DURATION_MSEC: u64 = 60_000; @@ -53,6 +54,7 @@ struct Settings { retry_attempts: u32, request_timeout: Duration, endpoint_uri: Option, + force_path_style: bool, } impl Default for Settings { @@ -66,6 +68,7 @@ impl Default for Settings { retry_attempts: DEFAULT_RETRY_ATTEMPTS, request_timeout: duration, endpoint_uri: None, + force_path_style: DEFAULT_FORCE_PATH_STYLE, } } } @@ -128,6 +131,7 @@ impl S3Src { })?; let config_builder = config::Builder::from(&sdk_config) + .force_path_style(settings.force_path_style) .retry_config(RetryConfig::standard().with_max_attempts(settings.retry_attempts)); let config = if let Some(ref uri) = settings.endpoint_uri { @@ -316,6 +320,11 @@ impl ObjectImpl for S3Src { .nick("S3 endpoint URI") .blurb("The S3 endpoint URI to use") .build(), + glib::ParamSpecBoolean::builder("force-path-style") + .nick("Force path style") + .blurb("Force client to use path-style addressing for buckets") + .default_value(DEFAULT_FORCE_PATH_STYLE) + .build(), ] }); @@ -365,6 +374,9 @@ impl ObjectImpl for S3Src { .get::>() .expect("type checked upstream"); } + "force-path-style" => { + settings.force_path_style = value.get::().expect("type checked upstream"); + } _ => unimplemented!(), } } @@ -391,6 +403,7 @@ impl ObjectImpl for S3Src { } "retry-attempts" => settings.retry_attempts.to_value(), "endpoint-uri" => settings.endpoint_uri.to_value(), + "force-path-style" => settings.force_path_style.to_value(), _ => unimplemented!(), } }