Skip to content

Commit 07fefbd

Browse files
authored
Releases/v7.23.0 (#142)
1 parent e861b0b commit 07fefbd

File tree

227 files changed

+13917
-2973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+13917
-2973
lines changed

.github/workflows/ci-test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@ jobs:
4343
rm -rf $GITHUB_WORKSPACE/src/github.com/prometheus/procfs && git clone -b v0.0.6 --depth 1 https://github.com/prometheus/procfs.git $GITHUB_WORKSPACE/src/github.com/prometheus/procfs
4444
rm -rf $GITHUB_WORKSPACE/src/howett.net/plist && git clone -b v1.0.0 --depth 1 https://github.com/DHowett/go-plist.git $GITHUB_WORKSPACE/src/howett.net/plist
4545
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/sys && git clone -b v0.13.0 --depth 1 https://github.com/golang/sys $GITHUB_WORKSPACE/src/golang.org/x/sys
46+
rm -rf $GITHUB_WORKSPACE/src/github.com/jessevdk/go-flags && git clone -b v1.4.0 --depth 1 https://github.com/jessevdk/go-flags.git $GITHUB_WORKSPACE/src/github.com/jessevdk/go-flags
4647
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/crypto && git clone -b v0.10.0 --depth 1 https://go.googlesource.com/crypto $GITHUB_WORKSPACE/src/golang.org/x/crypto
47-
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/text && git clone -b v0.10.0 --depth 1 https://github.com/golang/text $GITHUB_WORKSPACE/src/golang.org/x/text
48-
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/sync && git clone -b v0.3.0 --depth 1 https://github.com/golang/sync $GITHUB_WORKSPACE/src/golang.org/x/sync
48+
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/text && git clone -b v0.10.0 --depth 1 https://github.com/golang/text.git $GITHUB_WORKSPACE/src/golang.org/x/text
49+
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/sync && git clone -b v0.3.0 --depth 1 https://github.com/golang/sync.git $GITHUB_WORKSPACE/src/golang.org/x/sync
4950
5051
GOPATH=$GITHUB_WORKSPACE go get github.com/leodido/go-urn
5152
GOPATH=$GITHUB_WORKSPACE go get github.com/go-playground/locales
5253
53-
rm -rf $GITHUB_WORKSPACE/src/github.com/dave/jennifer && git clone -b v1.6.1 --depth 1 https://github.com/dave/jennifer $GITHUB_WORKSPACE/src/github.com/dave/jennifer
54+
rm -rf $GITHUB_WORKSPACE/src/github.com/dave/jennifer && git clone -b v1.6.1 --depth 1 https://github.com/dave/jennifer.git $GITHUB_WORKSPACE/src/github.com/dave/jennifer
5455
rm -rf $GITHUB_WORKSPACE/src/modernc.org/fileutil && git clone -b v1.0.0 --depth 1 https://gitlab.com/cznic/fileutil.git $GITHUB_WORKSPACE/src/modernc.org/fileutil
55-
rm -rf $GITHUB_WORKSPACE/src/github.com/gorilla/mux && git clone -b v1.7.4 --depth 1 https://github.com/gorilla/mux $GITHUB_WORKSPACE/src/github.com/gorilla/mux
56+
rm -rf $GITHUB_WORKSPACE/src/github.com/gorilla/mux && git clone -b v1.7.4 --depth 1 https://github.com/gorilla/mux.git $GITHUB_WORKSPACE/src/github.com/gorilla/mux
5657
5758
GOPATH=$GITHUB_WORKSPACE go get github.com/iancoleman/strcase
5859

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 7.23.0
4+
* 新增
5+
* 支持上传加速
6+
* 多媒体处理库 [media](github.com/qiniu/go-sdk/v7/media/apis) 包,提供多媒体处理接口
7+
* IAM [iam](github.com/qiniu/go-sdk/v7/iam/apis) 包,提供权限管理系统接口
8+
* 获取下载 URL 的实用方法
9+
* 提供文件夹分享接口
10+
* 修复
11+
* `downloader.DownloadDirectory` 下载根目录出错的 Bug
12+
313
## 7.22.0
414
* 新增
515
* 新版存储客户端库 storagev2 包,包含

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ staticcheck:
1212

1313
generate:
1414
go generate ./storagev2/
15+
go generate ./iam/
16+
go generate ./media/
17+
go generate ./audit/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ github.com/qiniu/go-sdk
1717
在您的项目中的 `go.mod` 文件内添加这行代码
1818

1919
```
20-
require github.com/qiniu/go-sdk/v7 v7.22.0
20+
require github.com/qiniu/go-sdk/v7 v7.23.0
2121
```
2222

2323
并且在项目中使用 `"github.com/qiniu/go-sdk/v7"` 引用 Qiniu Go SDK。

audit/apis/api_query_log.go

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY!
2+
3+
package apis
4+
5+
import (
6+
"context"
7+
querylog "github.com/qiniu/go-sdk/v7/audit/apis/query_log"
8+
auth "github.com/qiniu/go-sdk/v7/auth"
9+
uplog "github.com/qiniu/go-sdk/v7/internal/uplog"
10+
errors "github.com/qiniu/go-sdk/v7/storagev2/errors"
11+
httpclient "github.com/qiniu/go-sdk/v7/storagev2/http_client"
12+
region "github.com/qiniu/go-sdk/v7/storagev2/region"
13+
uptoken "github.com/qiniu/go-sdk/v7/storagev2/uptoken"
14+
"net/url"
15+
"strconv"
16+
"strings"
17+
"time"
18+
)
19+
20+
type innerQueryLogRequest querylog.Request
21+
22+
func (query *innerQueryLogRequest) buildQuery() (url.Values, error) {
23+
allQuery := make(url.Values)
24+
if query.StartTime != "" {
25+
allQuery.Set("start_time", query.StartTime)
26+
} else {
27+
return nil, errors.MissingRequiredFieldError{Name: "StartTime"}
28+
}
29+
if query.EndTime != "" {
30+
allQuery.Set("end_time", query.EndTime)
31+
} else {
32+
return nil, errors.MissingRequiredFieldError{Name: "EndTime"}
33+
}
34+
if query.ServiceName != "" {
35+
allQuery.Set("service_name", query.ServiceName)
36+
}
37+
if len(query.EventNames) > 0 {
38+
for _, value := range query.EventNames {
39+
allQuery.Add("event_names", value)
40+
}
41+
}
42+
if query.PrincipalId != "" {
43+
allQuery.Set("principal_id", query.PrincipalId)
44+
}
45+
if query.AccessKeyId != "" {
46+
allQuery.Set("access_key_id", query.AccessKeyId)
47+
}
48+
if query.Limit != 0 {
49+
allQuery.Set("limit", strconv.FormatInt(query.Limit, 10))
50+
}
51+
if query.NextMark != "" {
52+
allQuery.Set("next_mark", query.NextMark)
53+
}
54+
return allQuery, nil
55+
}
56+
57+
type QueryLogRequest = querylog.Request
58+
type QueryLogResponse = querylog.Response
59+
60+
// 审计日志查询
61+
func (audit *Audit) QueryLog(ctx context.Context, request *QueryLogRequest, options *Options) (*QueryLogResponse, error) {
62+
if options == nil {
63+
options = &Options{}
64+
}
65+
innerRequest := (*innerQueryLogRequest)(request)
66+
serviceNames := []region.ServiceName{region.ServiceApi}
67+
if innerRequest.Credentials == nil && audit.client.GetCredentials() == nil {
68+
return nil, errors.MissingRequiredFieldError{Name: "Credentials"}
69+
}
70+
pathSegments := make([]string, 0, 2)
71+
pathSegments = append(pathSegments, "audit", "log-query")
72+
path := "/" + strings.Join(pathSegments, "/")
73+
var rawQuery string
74+
if query, err := innerRequest.buildQuery(); err != nil {
75+
return nil, err
76+
} else {
77+
rawQuery += query.Encode()
78+
}
79+
uplogInterceptor, err := uplog.NewRequestUplog("queryLog", "", "", func() (string, error) {
80+
credentials := innerRequest.Credentials
81+
if credentials == nil {
82+
credentials = audit.client.GetCredentials()
83+
}
84+
putPolicy, err := uptoken.NewPutPolicy("", time.Now().Add(time.Hour))
85+
if err != nil {
86+
return "", err
87+
}
88+
return uptoken.NewSigner(putPolicy, credentials).GetUpToken(ctx)
89+
})
90+
if err != nil {
91+
return nil, err
92+
}
93+
req := httpclient.Request{Method: "GET", ServiceNames: serviceNames, Path: path, RawQuery: rawQuery, Endpoints: options.OverwrittenEndpoints, Region: options.OverwrittenRegion, Interceptors: []httpclient.Interceptor{uplogInterceptor}, AuthType: auth.TokenQiniu, Credentials: innerRequest.Credentials, BufferResponse: true, OnRequestProgress: options.OnRequestProgress}
94+
if options.OverwrittenEndpoints == nil && options.OverwrittenRegion == nil && audit.client.GetRegions() == nil {
95+
bucketHosts := httpclient.DefaultBucketHosts()
96+
97+
req.Region = audit.client.GetAllRegions()
98+
if req.Region == nil {
99+
if options.OverwrittenBucketHosts != nil {
100+
if bucketHosts, err = options.OverwrittenBucketHosts.GetEndpoints(ctx); err != nil {
101+
return nil, err
102+
}
103+
}
104+
allRegionsOptions := region.AllRegionsProviderOptions{UseInsecureProtocol: audit.client.UseInsecureProtocol(), HostFreezeDuration: audit.client.GetHostFreezeDuration(), Resolver: audit.client.GetResolver(), Chooser: audit.client.GetChooser(), BeforeSign: audit.client.GetBeforeSignCallback(), AfterSign: audit.client.GetAfterSignCallback(), SignError: audit.client.GetSignErrorCallback(), BeforeResolve: audit.client.GetBeforeResolveCallback(), AfterResolve: audit.client.GetAfterResolveCallback(), ResolveError: audit.client.GetResolveErrorCallback(), BeforeBackoff: audit.client.GetBeforeBackoffCallback(), AfterBackoff: audit.client.GetAfterBackoffCallback(), BeforeRequest: audit.client.GetBeforeRequestCallback(), AfterResponse: audit.client.GetAfterResponseCallback()}
105+
if hostRetryConfig := audit.client.GetHostRetryConfig(); hostRetryConfig != nil {
106+
allRegionsOptions.RetryMax = hostRetryConfig.RetryMax
107+
allRegionsOptions.Backoff = hostRetryConfig.Backoff
108+
}
109+
credentials := innerRequest.Credentials
110+
if credentials == nil {
111+
credentials = audit.client.GetCredentials()
112+
}
113+
if req.Region, err = region.NewAllRegionsProvider(credentials, bucketHosts, &allRegionsOptions); err != nil {
114+
return nil, err
115+
}
116+
}
117+
}
118+
var respBody QueryLogResponse
119+
if err := audit.client.DoAndAcceptJSON(ctx, &req, &respBody); err != nil {
120+
return nil, err
121+
}
122+
return &respBody, nil
123+
}

audit/apis/apis.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY!
2+
3+
package apis
4+
5+
import (
6+
httpclient "github.com/qiniu/go-sdk/v7/storagev2/http_client"
7+
region "github.com/qiniu/go-sdk/v7/storagev2/region"
8+
)
9+
10+
// API 客户端
11+
type Audit struct {
12+
client *httpclient.Client
13+
}
14+
15+
// 创建 API 客户端
16+
func NewAudit(options *httpclient.Options) *Audit {
17+
return &Audit{client: httpclient.NewClient(options)}
18+
}
19+
20+
// API 客户端选项
21+
type Options struct {
22+
OverwrittenBucketHosts region.EndpointsProvider
23+
OverwrittenBucketName string
24+
OverwrittenEndpoints region.EndpointsProvider
25+
OverwrittenRegion region.RegionsProvider
26+
OnRequestProgress func(uint64, uint64)
27+
}

0 commit comments

Comments
 (0)