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(services/cos): Move services cos back #884

Merged
merged 2 commits into from
Oct 18, 2021
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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ updates:
directory: "/services/bos"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/services/cos"
schedule:
interval: daily
40 changes: 40 additions & 0 deletions .github/workflows/services-test-cos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Services Test Cos"

on:
push:
paths:
- 'services/cos/**'
pull_request:
paths:
- 'services/cos/**'

jobs:
services_test_cos:
name: "Services Test Cos"
runs-on: self-hosted

strategy:
matrix:
go: [ "1.15", "1.16" ]

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Load secret
uses: 1password/load-secrets-action@v1
env:
STORAGE_COS_CREDENTIAL: op://Engineering/Cos/testing/credential
STORAGE_COS_NAME: op://Engineering/Cos/testing/name
STORAGE_COS_LOCATION: op://Engineering/Cos/testing/location

- name: Checkout repository
uses: actions/checkout@v2

- name: Test
env:
STORAGE_COS_INTEGRATION_TEST: on
working-directory: services/cos
run: make integration_test
7 changes: 7 additions & 0 deletions services/cos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage.*
bin/
Makefile.env

# Jetbrain IDE
.idea
*.iml
99 changes: 99 additions & 0 deletions services/cos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [v2.3.0] - 2021-09-13

### Changed

- ci: Enable auto merge on dependabot
- ci: Cleanup Service Integration Tests (#57)
- docs: Update README (#59)

### Upgraded

- ci: Upgrade Xuanwo/fetch-metadata
- build(deps): bump github.com/tencentyun/cos-go-sdk-v5 to 0.7.31 (#58)

## [v2.2.0] - 2021-07-17

### Added

- ci: Add gofmt action (#37)
- ci: Add dependabot auto build support (#40)
- ci: Add diff check action (#41)

### Changed

- storage: Update types in service.toml to golang types (#46)
- storage: Implement GSP-654 Unify List Behavior (#46)

### Fixed

- ci: Fix auto-build not work correctly

## [v2.1.0] - 2021-06-29

### Added

- *: Implement GSP-87 Feature Gates (#27)
- storage: Add CreateDir (#28)
- storage: Implement GSP-97 Add Restrictions in Storage Metadata (#32)

### Changed

- *: Implement GSP-109 Redesign Features (#32)
- *: Implement GSP-117 Rename Service to System as the Opposite to Global (#32)

### Upgraded

- build(deps): bump github.com/tencentyun/cos-go-sdk-v5 to 0.7.27 (#34)

## [v2.0.0] - 2021-05-24

### Added

- storage: Implement SSE support (#17)
- services: implement GSP-47 & GSP-51 (#21)
- storage: Implement multipart support (#23)

### Changed

- storage: Idempotent storager delete operation (#20)
- *: Implement GSP-73 Organization rename (#24)

## [v1.1.0] - 2021-04-24

### Added

- pair: Implement default pair support for service (#4)
- storage: Implement Create API (#13)
- *: Add UnimplementedStub (#15)
- tests: Introduce STORAGE_COS_INTEGRATION_TEST (#16)
- tests: Add docs for how to run tests
- storage: Implement GSP-40 (#18)

### Changed

- docs: Migrate zulip to matrix
- build: Fix build scripts
- ci: Only run Integration Test while push to master

### Upgraded

- build(deps): bump github.com/tencentyun/cos-go-sdk-v5 from 0.7.19 to 0.7.24

## v1.0.0 - 2021-02-08

### Added

- Implement cos services.

[v2.3.0]: https://github.com/beyondstorage/go-service-cos/compare/v2.2.0...v2.3.0
[v2.2.0]: https://github.com/beyondstorage/go-service-cos/compare/v2.1.0...v2.2.0
[v2.1.0]: https://github.com/beyondstorage/go-service-cos/compare/v2.0.0...v2.1.0
[v2.0.0]: https://github.com/beyondstorage/go-service-cos/compare/v1.1.0...v2.0.0
[v1.1.0]: https://github.com/beyondstorage/go-service-cos/compare/v1.0.0...v1.1.0
43 changes: 43 additions & 0 deletions services/cos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SHELL := /bin/bash

-include Makefile.env

.PHONY: all check format vet lint build test generate tidy

help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " check to do static check"
@echo " build to create bin directory and build"
@echo " generate to generate code"
@echo " test to run test"

check: vet

format:
go fmt ./...

vet:
go vet ./...

generate:
@echo "generate code"
go generate ./...
go fmt ./...

build: tidy generate check
go build ./...

test:
go test -race -coverprofile=coverage.txt -covermode=atomic -v .
go tool cover -html="coverage.txt" -o "coverage.html"

integration_test:
go test -count=1 -race -covermode=atomic -v ./tests

tidy:
go mod tidy
go mod verify

clean:
@echo "clean generated files"
find . -type f -name 'generated.go' -delete
4 changes: 4 additions & 0 deletions services/cos/Makefile.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export STORAGE_COS_INTEGRATION_TEST=on
export STORAGE_COS_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_COS_NAME=bucketname
export STORAGE_COS_LOCATION=bucketregion
35 changes: 35 additions & 0 deletions services/cos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[![Services Test Cos](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-cos.yml/badge.svg)](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-cos.yml)

# cos

[COS(Cloud Object Storage)](https://cloud.tencent.com/product/cos) service support for [go-storage](https://github.com/beyondstorage/go-storage).

## Install

```go
go get go.beyondstorage.io/services/cos/v3
```

## Usage

```go
import (
"log"

_ "go.beyondstorage.io/v5/services/cos/v3"
"go.beyondstorage.io/v5/services"
)

func main() {
store, err := services.NewStoragerFromString("cos://bucket_name/path/to/workdir?credential=hmac:<account_name>:<account_key>")
if err != nil {
log.Fatal(err)
}

// Write data from io.Reader into hello.txt
n, err := store.Write("hello.txt", r, length)
}
```

- See more examples in [go-storage-example](https://github.com/beyondstorage/go-storage-example).
- Read [more docs](https://beyondstorage.io/docs/go-storage/services/cos) about go-service-cos.
6 changes: 6 additions & 0 deletions services/cos/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Package cos provided support for Tencent Cloud's Cloud Object Storage (https://intl.cloud.tencent.com/product/cos)
*/
package cos

//go:generate go run -tags tools go.beyondstorage.io/v5/cmd/definitions service.toml
8 changes: 8 additions & 0 deletions services/cos/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package cos

import "go.beyondstorage.io/v5/services"

var (
// ErrServerSideEncryptionCustomerKeyInvalid will be returned while server-side encryption customer key is invalid.
ErrServerSideEncryptionCustomerKeyInvalid = services.NewErrorCode("invalid server-side encryption customer key")
)
Loading