Skip to content

Commit

Permalink
Releases/v7.23.0 (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue authored Sep 24, 2024
1 parent e861b0b commit 07fefbd
Show file tree
Hide file tree
Showing 227 changed files with 13,917 additions and 2,973 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ jobs:
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
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
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
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
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
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
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
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
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
GOPATH=$GITHUB_WORKSPACE go get github.com/leodido/go-urn
GOPATH=$GITHUB_WORKSPACE go get github.com/go-playground/locales
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
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
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
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
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
GOPATH=$GITHUB_WORKSPACE go get github.com/iancoleman/strcase
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 7.23.0
* 新增
* 支持上传加速
* 多媒体处理库 [media](github.com/qiniu/go-sdk/v7/media/apis) 包,提供多媒体处理接口
* IAM [iam](github.com/qiniu/go-sdk/v7/iam/apis) 包,提供权限管理系统接口
* 获取下载 URL 的实用方法
* 提供文件夹分享接口
* 修复
* `downloader.DownloadDirectory` 下载根目录出错的 Bug

## 7.22.0
* 新增
* 新版存储客户端库 storagev2 包,包含
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ staticcheck:

generate:
go generate ./storagev2/
go generate ./iam/
go generate ./media/
go generate ./audit/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ github.com/qiniu/go-sdk
在您的项目中的 `go.mod` 文件内添加这行代码

```
require github.com/qiniu/go-sdk/v7 v7.22.0
require github.com/qiniu/go-sdk/v7 v7.23.0
```

并且在项目中使用 `"github.com/qiniu/go-sdk/v7"` 引用 Qiniu Go SDK。
Expand Down
2 changes: 1 addition & 1 deletion api-specs
Submodule api-specs updated 52 files
+161 −0 audit/query_log.yml
+67 −0 iam/create_group.yml
+136 −0 iam/create_policy.yml
+68 −0 iam/create_user.yml
+52 −0 iam/create_user_keypairs.yml
+12 −0 iam/delete_group.yml
+27 −0 iam/delete_group_policies.yml
+27 −0 iam/delete_group_users.yml
+12 −0 iam/delete_policy.yml
+12 −0 iam/delete_user.yml
+16 −0 iam/delete_user_keypair.yml
+28 −0 iam/delete_user_policy.yml
+17 −0 iam/disable_user_keypair.yml
+17 −0 iam/enable_user_keypair.yml
+86 −0 iam/get_actions.yml
+127 −0 iam/get_audits.yml
+56 −0 iam/get_group.yml
+115 −0 iam/get_group_policies.yml
+52 −0 iam/get_group_service_action_resources.yml
+87 −0 iam/get_group_users.yml
+77 −0 iam/get_groups.yml
+109 −0 iam/get_policies.yml
+88 −0 iam/get_policy.yml
+83 −0 iam/get_policy_groups.yml
+87 −0 iam/get_policy_users.yml
+33 −0 iam/get_services.yml
+60 −0 iam/get_user.yml
+28 −0 iam/get_user_available_services.yml
+83 −0 iam/get_user_groups.yml
+81 −0 iam/get_user_keypairs.yml
+115 −0 iam/get_user_policies.yml
+53 −0 iam/get_user_service_action_resources.yml
+87 −0 iam/get_users.yml
+28 −0 iam/modify_group.yml
+27 −0 iam/modify_group_policies.yml
+27 −0 iam/modify_group_users.yml
+137 −0 iam/modify_policy.yml
+75 −0 iam/modify_user.yml
+27 −0 iam/modify_user_policies.yml
+28 −0 iam/update_group_policies.yml
+28 −0 iam/update_group_users.yml
+28 −0 iam/update_policy_groups.yml
+28 −0 iam/update_policy_users.yml
+28 −0 iam/update_user_groups.yml
+28 −0 iam/update_user_policies.yml
+53 −0 media/pfop.yml
+98 −0 media/prefop.yml
+18 −0 storage/check_share.yml
+53 −0 storage/create_share.yml
+2 −0 storage/get_bucket_quota.yml
+2 −0 storage/set_bucket_remark.yml
+73 −0 storage/verify_share.yml
123 changes: 123 additions & 0 deletions audit/apis/api_query_log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY!

package apis

import (
"context"
querylog "github.com/qiniu/go-sdk/v7/audit/apis/query_log"
auth "github.com/qiniu/go-sdk/v7/auth"
uplog "github.com/qiniu/go-sdk/v7/internal/uplog"
errors "github.com/qiniu/go-sdk/v7/storagev2/errors"
httpclient "github.com/qiniu/go-sdk/v7/storagev2/http_client"
region "github.com/qiniu/go-sdk/v7/storagev2/region"
uptoken "github.com/qiniu/go-sdk/v7/storagev2/uptoken"
"net/url"
"strconv"
"strings"
"time"
)

type innerQueryLogRequest querylog.Request

func (query *innerQueryLogRequest) buildQuery() (url.Values, error) {
allQuery := make(url.Values)
if query.StartTime != "" {
allQuery.Set("start_time", query.StartTime)
} else {
return nil, errors.MissingRequiredFieldError{Name: "StartTime"}
}
if query.EndTime != "" {
allQuery.Set("end_time", query.EndTime)
} else {
return nil, errors.MissingRequiredFieldError{Name: "EndTime"}
}
if query.ServiceName != "" {
allQuery.Set("service_name", query.ServiceName)
}
if len(query.EventNames) > 0 {
for _, value := range query.EventNames {
allQuery.Add("event_names", value)
}
}
if query.PrincipalId != "" {
allQuery.Set("principal_id", query.PrincipalId)
}
if query.AccessKeyId != "" {
allQuery.Set("access_key_id", query.AccessKeyId)
}
if query.Limit != 0 {
allQuery.Set("limit", strconv.FormatInt(query.Limit, 10))
}
if query.NextMark != "" {
allQuery.Set("next_mark", query.NextMark)
}
return allQuery, nil
}

type QueryLogRequest = querylog.Request
type QueryLogResponse = querylog.Response

// 审计日志查询
func (audit *Audit) QueryLog(ctx context.Context, request *QueryLogRequest, options *Options) (*QueryLogResponse, error) {
if options == nil {
options = &Options{}
}
innerRequest := (*innerQueryLogRequest)(request)
serviceNames := []region.ServiceName{region.ServiceApi}
if innerRequest.Credentials == nil && audit.client.GetCredentials() == nil {
return nil, errors.MissingRequiredFieldError{Name: "Credentials"}
}
pathSegments := make([]string, 0, 2)
pathSegments = append(pathSegments, "audit", "log-query")
path := "/" + strings.Join(pathSegments, "/")
var rawQuery string
if query, err := innerRequest.buildQuery(); err != nil {
return nil, err
} else {
rawQuery += query.Encode()
}
uplogInterceptor, err := uplog.NewRequestUplog("queryLog", "", "", func() (string, error) {
credentials := innerRequest.Credentials
if credentials == nil {
credentials = audit.client.GetCredentials()
}
putPolicy, err := uptoken.NewPutPolicy("", time.Now().Add(time.Hour))
if err != nil {
return "", err
}
return uptoken.NewSigner(putPolicy, credentials).GetUpToken(ctx)
})
if err != nil {
return nil, err
}
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}
if options.OverwrittenEndpoints == nil && options.OverwrittenRegion == nil && audit.client.GetRegions() == nil {
bucketHosts := httpclient.DefaultBucketHosts()

req.Region = audit.client.GetAllRegions()
if req.Region == nil {
if options.OverwrittenBucketHosts != nil {
if bucketHosts, err = options.OverwrittenBucketHosts.GetEndpoints(ctx); err != nil {
return nil, err
}
}
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()}
if hostRetryConfig := audit.client.GetHostRetryConfig(); hostRetryConfig != nil {
allRegionsOptions.RetryMax = hostRetryConfig.RetryMax
allRegionsOptions.Backoff = hostRetryConfig.Backoff
}
credentials := innerRequest.Credentials
if credentials == nil {
credentials = audit.client.GetCredentials()
}
if req.Region, err = region.NewAllRegionsProvider(credentials, bucketHosts, &allRegionsOptions); err != nil {
return nil, err
}
}
}
var respBody QueryLogResponse
if err := audit.client.DoAndAcceptJSON(ctx, &req, &respBody); err != nil {
return nil, err
}
return &respBody, nil
}
27 changes: 27 additions & 0 deletions audit/apis/apis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY!

package apis

import (
httpclient "github.com/qiniu/go-sdk/v7/storagev2/http_client"
region "github.com/qiniu/go-sdk/v7/storagev2/region"
)

// API 客户端
type Audit struct {
client *httpclient.Client
}

// 创建 API 客户端
func NewAudit(options *httpclient.Options) *Audit {
return &Audit{client: httpclient.NewClient(options)}
}

// API 客户端选项
type Options struct {
OverwrittenBucketHosts region.EndpointsProvider
OverwrittenBucketName string
OverwrittenEndpoints region.EndpointsProvider
OverwrittenRegion region.RegionsProvider
OnRequestProgress func(uint64, uint64)
}
Loading

0 comments on commit 07fefbd

Please sign in to comment.