Skip to content
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
18 changes: 16 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,27 @@ func (c *Client) ListProject() (projectNames []string, err error) {
// the region is related with the client's endpoint
// ref https://www.alibabacloud.com/help/doc-detail/74955.htm
func (c *Client) ListProjectV2(offset, size int) (projects []LogProject, count, total int, err error) {
return c.ListProjectV3(&ListProjectRequest{
Offset: offset,
Size: size,
})
}

func (c *Client) ListProjectV3(req *ListProjectRequest) (projects []LogProject, count, total int, err error) {
h := map[string]string{
"x-log-bodyrawsize": "0",
}

urlVal := url.Values{}
urlVal.Add("offset", strconv.Itoa(offset))
urlVal.Add("size", strconv.Itoa(size))
if req.Offset > 0 {
urlVal.Add("offset", strconv.Itoa(req.Offset))
}
if req.Size > 0 {
urlVal.Add("size", strconv.Itoa(req.Size))
}
if req.Description != "" {
urlVal.Add("description", req.Description)
}
uri := fmt.Sprintf("/?%s", urlVal.Encode())
proj := convert(c, "")

Expand Down
1 change: 1 addition & 0 deletions client_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type ClientInterface interface {
// the region is related with the client's endpoint
// ref https://www.alibabacloud.com/help/doc-detail/74955.htm
ListProjectV2(offset, size int) (projects []LogProject, count, total int, err error)
ListProjectV3(req *ListProjectRequest) (projects []LogProject, count, total int, err error)
// CheckProjectExist check project exist or not
CheckProjectExist(name string) (bool, error)
// DeleteProject ...
Expand Down
6 changes: 6 additions & 0 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ type ListStoreViewsResponse struct {
StoreViews []string `json:"storeviews"`
}

type ListProjectRequest struct {
Offset int `json:"offset"`
Size int `json:"size"`
Description string `json:"description,omitempty"` // use it to filter projects by description, support fuzzy search
}

// If cursor is unknown, returns empty string
// If pullLogs with non-empty query or consumer with non-empty query, returns empty string
func (l *LogGroup) GetCursor() string {
Expand Down
10 changes: 10 additions & 0 deletions token_auto_update_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2140,3 +2140,13 @@ func (c *TokenAutoUpdateClient) GetStoreViewIndex(project string, storeViewName
}
return
}

func (c *TokenAutoUpdateClient) ListProjectV3(req *ListProjectRequest) (projects []LogProject, count, total int, err error) {
for i := 0; i < c.maxTryTimes; i++ {
projects, count, total, err = c.logClient.ListProjectV3(req)
if !c.processError(err) {
return
}
}
return
}