-
Notifications
You must be signed in to change notification settings - Fork 3
/
marketplace_generated.go
44 lines (38 loc) · 1.1 KB
/
marketplace_generated.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Copyright (c) Fortanix, Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package sdkms
import (
"context"
"fmt"
"net/http"
)
type GetMarketplaceParams struct {
RepoURL string `json:"repo_url"`
}
func (x GetMarketplaceParams) urlEncode(v map[string][]string) error {
v["repo_url"] = []string{fmt.Sprintf("%v", x.RepoURL)}
return nil
}
type MarketplacePlugin struct {
Name string `json:"name"`
Versions map[PluginVersion]*string `json:"versions"`
}
// Gets all the plugins from the input url.
func (c *Client) GetMarketplace(ctx context.Context, queryParameters *GetMarketplaceParams) ([]MarketplacePlugin, error) {
u := "/sys/v1/marketplace"
if queryParameters != nil {
q, err := encodeURLParams(queryParameters)
if err != nil {
return nil, err
}
u = fmt.Sprintf("%v?%v", u, q)
}
var r []MarketplacePlugin
if err := c.fetch(ctx, http.MethodGet, u, nil, &r); err != nil {
return nil, err
}
return r, nil
}