blob: 1fc5ae84c666462dac464395b63e62d9f36ac785 [file] [log] [blame]
giolekvaa4a153b2020-05-12 11:49:53 +04001package appmanager
2
3import (
4 "fmt"
5 "net/http"
6 "strings"
7)
8
9func InstallSchema(schema *Schema, apiAddr string) error {
10 if schema == nil || len(schema.Schema) == 0 {
11 return nil
12 }
13 resp, err := http.Post(apiAddr, "application/text", strings.NewReader(schema.Schema))
14 if err != nil {
15 return err
16 }
17 if resp.StatusCode != http.StatusOK {
18 return fmt.Errorf("Failed request with status code: %d", resp.StatusCode)
19 }
20 return nil
21}