-
Notifications
You must be signed in to change notification settings - Fork 8
/
rbac.go
28 lines (22 loc) · 882 Bytes
/
rbac.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
package config
import (
"fmt"
"io"
"net/http"
)
const OceanSparkDeployYamlUrl = "https://spotinst-public.s3.amazonaws.com/integrations/kubernetes/ocean-spark/templates/ocean-spark-deploy.yaml"
func GetDeploymentYaml() (string, error) {
resp, err := http.Get(OceanSparkDeployYamlUrl)
if err != nil {
return "", fmt.Errorf("error fetching the ocean-spark-deploy.yaml from %s: %w", OceanSparkDeployYamlUrl, err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("could not read ocean-spark-deploy.yaml from %s: unexpected status code %d: %s", OceanSparkDeployYamlUrl, resp.StatusCode, http.StatusText(resp.StatusCode))
}
data, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("error reading response body for ocean-spark-deploy.yaml from %s: %w", OceanSparkDeployYamlUrl, err)
}
return string(data), nil
}