Skip to content

Commit 3ee687a

Browse files
authored
Merge pull request #164 from replicatedhq/divolgin/ls
Faster channel list and channel rm for kots apps
2 parents 4924e96 + eac91b3 commit 3ee687a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

client/channel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (c *Client) ArchiveChannel(appID string, appType string, channelID string)
6060
} else if appType == "ship" {
6161
return errors.New("This feature is not currently supported for Ship applications.")
6262
} else if appType == "kots" {
63-
return errors.New("This feature is not currently supported for Kots applications.")
63+
return c.KotsClient.ArchiveChannel(channelID)
6464
}
6565
return errors.New("unknown app type")
6666

pkg/kotsclient/channel.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func (c *VendorV3Client) ListChannels(appID string, appSlug string, channelName
101101

102102
v := url.Values{}
103103
v.Set("channelName", channelName)
104+
v.Set("excludeDetail", "true")
104105

105106
url := fmt.Sprintf("/v3/app/%s/channels?%s", appID, v.Encode())
106107
err := c.DoJSON("GET", url, http.StatusOK, nil, &response)
@@ -253,3 +254,26 @@ func (c *GraphQLClient) GetChannel(appID string, channelID string) (*channels.Ap
253254
}
254255
return &channelDetail, nil, nil
255256
}
257+
258+
const archiveKotsChannelMutation = `
259+
mutation archiveKotsChannel($channelId: ID!) {
260+
archiveKotsChannel(channelId: $channelId)
261+
}
262+
`
263+
264+
func (c *GraphQLClient) ArchiveChannel(channelId string) error {
265+
response := graphql.ResponseErrorOnly{}
266+
267+
request := graphql.Request{
268+
Query: archiveKotsChannelMutation,
269+
Variables: map[string]interface{}{
270+
"channelId": channelId,
271+
},
272+
}
273+
274+
if err := c.ExecuteRequest(request, &response); err != nil {
275+
return err
276+
}
277+
278+
return nil
279+
}

0 commit comments

Comments
 (0)