Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add google cloud in oss #11

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# OSS

QOR OSS aims to provide a common interface to operate files with any kinds of storages, like cloud storages, FTP, file system etc
[![Go Report Card](https://goreportcard.com/badge/github.com/casdoor/oss)](https://goreportcard.com/report/github.com/casdoor/oss)
[![Go](https://github.com/casdoor/oss/actions/workflows/ci.yml/badge.svg)](https://github.com/casdoor/oss/actions/workflows/ci.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/casdoor/oss.svg)](https://pkg.go.dev/github.com/casdoor/oss)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/casdoor/oss)

Casdoor OSS aims to provide a common interface to operate files with any kinds of storages, like cloud storages, FTP, file system etc

- [Local File System](https://github.com/casdoor/oss/tree/master/filesystem)
- [MinIO (Open Source)](https://min.io)
- [AWS S3](https://aws.amazon.com/s3)
- [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs)
- [Google Cloud - Cloud Storage](https://cloud.google.com/storage)
- [Alibaba Cloud OSS & CDN](https://cn.aliyun.com/product/oss)
- [Tencent Cloud COS](https://cloud.tencent.com/product/cos)
- [Qiniu Cloud Kodo](https://www.qiniu.com/products/kodo)

# Usage

Currently, QOR OSS provides support for file system, S3, Aliyun and Qiniu., You can easily implement your own storage strategies by implementing the interface.
## Installation

Use `go get` to install:

```
go get github.com/casdoor/oss
```

## Create Client

Different oss providers need to provide different configuration, but we support a unit API as below to create the oss client.

```go
func New(config *Config) (*Client, error)
```

The config generally includes the following information:

- `AccessID`: The access ID for authentication.
- `AccessKey`: The access key for authentication.
- `Bucket`: The name of the bucket where the data is stored.
- `Endpoint`: The endpoint for accessing the storage service.

Please note that the actual configuration may vary depending on the specific storage service being used.

## Operation

Currently, QOR OSS provides support for file system, S3, Aliyun and so on, You can easily implement your own storage strategies by implementing the interface.

```go
type StorageInterface interface {
Expand All @@ -18,6 +59,8 @@ type StorageInterface interface {
}
```

## Example

Here's an example of how to use [QOR OSS](https://github.com/qor/oss) with S3. After initializing the s3 storage, The functions in the interface are available.

```go
Expand Down Expand Up @@ -51,6 +94,6 @@ func main() {
}
```

## License
# License

Released under the [MIT License](http://opensource.org/licenses/MIT).
31 changes: 26 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,38 @@ require (
)

require (
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/storage v1.31.0 // indirect
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.13.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.134.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
Loading
Loading