generated from giantswarm/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: QuentinBisson <[email protected]>
- Loading branch information
1 parent
2b6ca91
commit 8006b06
Showing
8 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package alertmanager | ||
|
||
type AlertManager struct { | ||
Address string | ||
Address string | ||
TenantId string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package alertmanager | ||
|
||
import ( | ||
"io" | ||
"net/http" | ||
) | ||
|
||
type httpClient struct { | ||
c http.Client | ||
tenantId string | ||
} | ||
|
||
func (c *httpClient) Get(url string) (resp *http.Response, err error) { | ||
req, err := http.NewRequest("GET", url, nil) | ||
if err != nil { | ||
return nil, err | ||
|
||
} | ||
|
||
return c.Do(req) | ||
} | ||
|
||
func (c *httpClient) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) { | ||
req, err := http.NewRequest("POST", url, body) | ||
if err != nil { | ||
return nil, err | ||
|
||
} | ||
|
||
req.Header.Set("Content-Type", contentType) | ||
|
||
return c.Do(req) | ||
} | ||
|
||
func (c *httpClient) Delete(url, contentType string) (resp *http.Response, err error) { | ||
req, err := http.NewRequest("DELETE", url, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
req.Header.Add("Content-Type", contentType) | ||
|
||
return c.Do(req) | ||
} | ||
|
||
func (c *httpClient) Do(req *http.Request) (*http.Response, error) { | ||
if c.tenantId != "" { | ||
req.Header.Add("X-Scope-OrgID", c.tenantId) | ||
} | ||
return c.c.Do(req) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters