[PLT-8186] add support for ec2 instance profile authentication (#8243)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2018-03-01 00:12:11 +01:00
коммит произвёл Joram Wilander
родитель d2b70b8671
Коммит 6e024c45b5
6 изменённых файлов: 173 добавлений и 1 удалений

Просмотреть файл

@@ -198,6 +198,10 @@ func (c *Client4) GetTestEmailRoute() string {
return fmt.Sprintf("/email/test")
}
func (c *Client4) GetTestS3Route() string {
return fmt.Sprintf("/file/s3_test")
}
func (c *Client4) GetDatabaseRoute() string {
return fmt.Sprintf("/database")
}
@@ -2092,6 +2096,16 @@ func (c *Client4) TestEmail() (bool, *Response) {
}
}
// TestS3Connection will attempt to connect to the AWS S3.
func (c *Client4) TestS3Connection(config *Config) (bool, *Response) {
if r, err := c.DoApiPost(c.GetTestS3Route(), config.ToJson()); err != nil {
return false, BuildErrorResponse(r, err)
} else {
defer closeBody(r)
return CheckStatusOK(r), BuildResponse(r)
}
}
// GetConfig will retrieve the server config with some sanitized items.
func (c *Client4) GetConfig() (*Config, *Response) {
if r, err := c.DoApiGet(c.GetConfigRoute(), ""); err != nil {