pub struct Http { /* private fields */ }
Expand description
HTTP Read-only service support like Nginx and Caddy.
Capabilities
This service can be used to:
- read
-
write -
list -
scan -
presign - blocking
Notes
Only read
ans stat
are supported. We can use this service to visit any
HTTP Server like nginx, caddy.
Configuration
endpoint
: set the endpoint for httproot
: Set the work directory for backend
You can refer to HttpBuilder
’s docs for more information
Example
Via Builder
use anyhow::Result;
use opendal::services::Http;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// create backend builder
let mut builder = Http::default();
builder.endpoint("127.0.0.1");
let op: Operator = Operator::new(builder)?.finish();
Ok(())
}
Implementations§
source§impl HttpBuilder
impl HttpBuilder
sourcepub fn endpoint(&mut self, endpoint: &str) -> &mut Self
pub fn endpoint(&mut self, endpoint: &str) -> &mut Self
Set endpoint for http backend.
For example: https://example.com
sourcepub fn username(&mut self, username: &str) -> &mut Self
pub fn username(&mut self, username: &str) -> &mut Self
set password for http backend
default: no password
sourcepub fn password(&mut self, password: &str) -> &mut Self
pub fn password(&mut self, password: &str) -> &mut Self
set password for http backend
default: no password
sourcepub fn token(&mut self, token: &str) -> &mut Self
pub fn token(&mut self, token: &str) -> &mut Self
set bearer token for http backend
default: no access token
sourcepub fn http_client(&mut self, client: HttpClient) -> &mut Self
pub fn http_client(&mut self, client: HttpClient) -> &mut Self
Specify the http client that used by this service.
Notes
This API is part of OpenDAL’s Raw API. HttpClient
could be changed
during minor updates.
Trait Implementations§
source§impl Builder for HttpBuilder
impl Builder for HttpBuilder
source§impl Debug for HttpBuilder
impl Debug for HttpBuilder
source§impl Default for HttpBuilder
impl Default for HttpBuilder
source§fn default() -> HttpBuilder
fn default() -> HttpBuilder
Returns the “default value” for a type. Read more