-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
897 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule api-specs
updated
7 files
+163 −0 | audit/query_log.yml | |
+12 −0 | iam/delete_group.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY! | ||
|
||
package apis | ||
|
||
import ( | ||
"context" | ||
auth "github.com/qiniu/go-sdk/v7/auth" | ||
deletegroup "github.com/qiniu/go-sdk/v7/iam/apis/delete_group" | ||
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" | ||
"strings" | ||
"time" | ||
) | ||
|
||
type innerDeleteGroupRequest deletegroup.Request | ||
|
||
func (path *innerDeleteGroupRequest) buildPath() ([]string, error) { | ||
allSegments := make([]string, 0, 1) | ||
if path.Alias != "" { | ||
allSegments = append(allSegments, path.Alias) | ||
} else { | ||
return nil, errors.MissingRequiredFieldError{Name: "Alias"} | ||
} | ||
return allSegments, nil | ||
} | ||
|
||
type DeleteGroupRequest = deletegroup.Request | ||
type DeleteGroupResponse = deletegroup.Response | ||
|
||
// 删除用户分组 | ||
func (iam *Iam) DeleteGroup(ctx context.Context, request *DeleteGroupRequest, options *Options) (*DeleteGroupResponse, error) { | ||
if options == nil { | ||
options = &Options{} | ||
} | ||
innerRequest := (*innerDeleteGroupRequest)(request) | ||
serviceNames := []region.ServiceName{region.ServiceApi} | ||
if innerRequest.Credentials == nil && iam.client.GetCredentials() == nil { | ||
return nil, errors.MissingRequiredFieldError{Name: "Credentials"} | ||
} | ||
pathSegments := make([]string, 0, 4) | ||
pathSegments = append(pathSegments, "iam", "v1", "groups") | ||
if segments, err := innerRequest.buildPath(); err != nil { | ||
return nil, err | ||
} else { | ||
pathSegments = append(pathSegments, segments...) | ||
} | ||
path := "/" + strings.Join(pathSegments, "/") | ||
var rawQuery string | ||
uplogInterceptor, err := uplog.NewRequestUplog("deleteGroup", "", "", func() (string, error) { | ||
credentials := innerRequest.Credentials | ||
if credentials == nil { | ||
credentials = iam.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: "DELETE", ServiceNames: serviceNames, Path: path, RawQuery: rawQuery, Endpoints: options.OverwrittenEndpoints, Region: options.OverwrittenRegion, Interceptors: []httpclient.Interceptor{uplogInterceptor}, AuthType: auth.TokenQiniu, Credentials: innerRequest.Credentials, OnRequestProgress: options.OnRequestProgress} | ||
if options.OverwrittenEndpoints == nil && options.OverwrittenRegion == nil && iam.client.GetRegions() == nil { | ||
bucketHosts := httpclient.DefaultBucketHosts() | ||
|
||
req.Region = iam.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: iam.client.UseInsecureProtocol(), HostFreezeDuration: iam.client.GetHostFreezeDuration(), Resolver: iam.client.GetResolver(), Chooser: iam.client.GetChooser(), BeforeSign: iam.client.GetBeforeSignCallback(), AfterSign: iam.client.GetAfterSignCallback(), SignError: iam.client.GetSignErrorCallback(), BeforeResolve: iam.client.GetBeforeResolveCallback(), AfterResolve: iam.client.GetAfterResolveCallback(), ResolveError: iam.client.GetResolveErrorCallback(), BeforeBackoff: iam.client.GetBeforeBackoffCallback(), AfterBackoff: iam.client.GetAfterBackoffCallback(), BeforeRequest: iam.client.GetBeforeRequestCallback(), AfterResponse: iam.client.GetAfterResponseCallback()} | ||
if hostRetryConfig := iam.client.GetHostRetryConfig(); hostRetryConfig != nil { | ||
allRegionsOptions.RetryMax = hostRetryConfig.RetryMax | ||
allRegionsOptions.Backoff = hostRetryConfig.Backoff | ||
} | ||
credentials := innerRequest.Credentials | ||
if credentials == nil { | ||
credentials = iam.client.GetCredentials() | ||
} | ||
if req.Region, err = region.NewAllRegionsProvider(credentials, bucketHosts, &allRegionsOptions); err != nil { | ||
return nil, err | ||
} | ||
} | ||
} | ||
resp, err := iam.client.Do(ctx, &req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &DeleteGroupResponse{}, resp.Body.Close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY! | ||
|
||
// 删除用户分组 | ||
package delete_group | ||
|
||
import credentials "github.com/qiniu/go-sdk/v7/storagev2/credentials" | ||
|
||
// 调用 API 所用的请求 | ||
type Request struct { | ||
Alias string // 用户分组别名 | ||
Credentials credentials.CredentialsProvider // 鉴权参数,用于生成鉴权凭证,如果为空,则使用 HTTPClientOptions 中的 CredentialsProvider | ||
} | ||
|
||
// 获取 API 所用的响应 | ||
type Response struct{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.