mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-05-08 02:08:24 +00:00
* Rename `mizu` to `kubeshark` * Rename `up9inc` to `kubeshark` * Change the logo, title, motto and the main color * Replace the favicon * Update the docs link * Change the copyright text in C files * Remove a comment * Rewrite the `README.md` and update the logo and screenshots used in it * Add a `TODO` * Fix the grammar * Fix the bottom text in the filtering guide * Change the Docker Hub username of cross-compilation intermediate images * Add an install script * Fix `docker/login-action` in the CI * Delete `build-custom-branch.yml` GitHub workflow * Update `README.md` * Remove `install.sh` * Change the motto back to "Traffic viewer for Kubernetes"
43 lines
756 B
Go
43 lines
756 B
Go
package bucket
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/kubeshark/kubeshark/cli/utils"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type Provider struct {
|
|
url string
|
|
client *http.Client
|
|
}
|
|
|
|
const DefaultTimeout = 2 * time.Second
|
|
|
|
func NewProvider(url string, timeout time.Duration) *Provider {
|
|
return &Provider{
|
|
url: url,
|
|
client: &http.Client{
|
|
Timeout: timeout,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (provider *Provider) GetInstallTemplate(templateName string) (string, error) {
|
|
url := fmt.Sprintf("%s/%v", provider.url, templateName)
|
|
response, err := utils.Get(url, provider.client)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
defer response.Body.Close()
|
|
|
|
installTemplate, err := ioutil.ReadAll(response.Body)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return string(installTemplate), nil
|
|
}
|