Skip to content

Commit

Permalink
docs: update swift docs (#4327)
Browse files Browse the repository at this point in the history
* fix swift docs

* include compatible_services.md in SwiftBuilder
  • Loading branch information
zjregee authored Mar 6, 2024
1 parent 369b4a6 commit 2665e63
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 2 additions & 0 deletions core/src/services/swift/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use crate::raw::*;
use crate::*;

/// [OpenStack Swift](https://docs.openstack.org/api-ref/object-store/#)'s REST API support.
/// For more information about swift-compatible services, refer to [Compatible Services](#compatible-services).
#[doc = include_str!("docs.md")]
#[doc = include_str!("compatible_services.md")]
#[derive(Default, Clone)]
pub struct SwiftBuilder {
endpoint: Option<String>,
Expand Down
23 changes: 15 additions & 8 deletions website/docs/services/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
title: Swift
---

[OpenStack Swift](https://docs.openstack.org/api-ref/object-store/) service support.
[OpenStack Swift](https://docs.openstack.org/api-ref/object-store/) and compatible services support.

For more information about swift-compatible services, refer to [Compatible Services](#compatible-services).

import Docs from '../../../core/src/services/swift/docs.md'

Expand All @@ -25,13 +27,14 @@ use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
let mut map = HashMap::new();
map.insert("endpoint".to_string(), "http://127.0.0.1:8080".to_string());
map.insert("account".to_string(), "test_account".to_string());

map.insert("endpoint".to_string(), "http://127.0.0.1:8080/v1/AUTH_test".to_string());
map.insert("container".to_string(), "test_container".to_string());
map.insert("token".to_string(), "test_token".to_string());
map.insert("root".to_string(), "/".to_string());

let op: Operator = Operator::via_map(Scheme::Swift, map)?;

Ok(())
}
```
Expand All @@ -41,10 +44,10 @@ async fn main() -> Result<()> {

```javascript
import { Operator } from "opendal";

async function main() {
const op = new Operator("swift", {
endpoint: "http://127.0.0.1:8080",
account: "test_account",
endpoint: "http://127.0.0.1:8080/v1/AUTH_test",
container: "test_container",
token: "test_token",
root: "/",
Expand All @@ -57,14 +60,18 @@ async function main() {

```python
import opendal

op = opendal.Operator("swift",
endpoint="http://127.0.0.1:8080"
account="test_account",
endpoint="http://127.0.0.1:8080/v1/AUTH_test"
container="test_container",
token="test_token",
root="/",
)
```

</TabItem>
</Tabs>
</Tabs>

import CompatibleServices from '../../../core/src/services/swift/compatible_services.md'

<CompatibleServices components={props.components} />

0 comments on commit 2665e63

Please sign in to comment.