Update go-datadog-api vendored dependency

This commit is contained in:
Colin Saliceti 2016-10-04 16:46:13 +01:00
parent 4548e2430e
commit 982a065863
7 changed files with 38 additions and 54 deletions

View File

@ -1,2 +0,0 @@
*.sublime*
cmd

View File

@ -1,21 +0,0 @@
language: go
go:
- 1.5
- 1.6
- tip
env:
- "PATH=/home/travis/gopath/bin:$PATH"
script:
- go get -u github.com/golang/lint/golint
- golint ./...
- test `gofmt -l . | wc -l` = 0
- make test
install:
- go get -v -t . && make updatedeps
matrix:
allow_failures:
- go: tip

View File

@ -12,6 +12,7 @@ mostly used for automating dashboards/alerting and retrieving data (events, etc)
The source API documentation is here: <http://docs.datadoghq.com/api/>
## USAGE
To use this project, include it in your code like:

View File

@ -1,22 +0,0 @@
package datadog_test
import (
"testing"
"github.com/zorkian/go-datadog-api"
)
func TestCheckStatus(T *testing.T) {
if datadog.OK != 0 {
T.Error("status OK must be 0 to satisfy Datadog's API")
}
if datadog.WARNING != 1 {
T.Error("status WARNING must be 1 to satisfy Datadog's API")
}
if datadog.CRITICAL != 2 {
T.Error("status CRITICAL must be 2 to satisfy Datadog's API")
}
if datadog.UNKNOWN != 3 {
T.Error("status UNKNOWN must be 3 to satisfy Datadog's API")
}
}

View File

@ -12,18 +12,25 @@ import (
"fmt"
)
// GraphDefinitionRequest represents the requests passed into each graph.
type GraphDefinitionRequest struct {
Query string `json:"q"`
Stacked bool `json:"stacked"`
Aggregator string
ConditionalFormats []DashboardConditionalFormat `json:"conditional_formats,omitempty"`
Type string `json:"type,omitempty"`
Style struct {
Palette string `json:"palette,omitempty"`
} `json:"style,omitempty"`
}
// Graph represents a graph that might exist on a dashboard.
type Graph struct {
Title string `json:"title"`
Events []struct{} `json:"events"`
Definition struct {
Viz string `json:"viz"`
Requests []struct {
Query string `json:"q"`
Stacked bool `json:"stacked"`
Aggregator string
ConditionalFormats []DashboardConditionalFormat `json:"conditional_formats,omitempty"`
} `json:"requests"`
Viz string `json:"viz"`
Requests []GraphDefinitionRequest `json:"requests"`
} `json:"definition"`
}

View File

@ -29,6 +29,25 @@ func (self *Client) InviteUsers(emails []string) error {
reqInviteUsers{Emails: emails}, nil)
}
// CreateUser creates an user account for an email address
func (self *Client) CreateUser(handle, name string) (*User, error) {
in := struct {
Handle string `json:"handle"`
Name string `json:"name"`
}{
Handle: handle,
Name: name,
}
out := struct {
*User `json:"user"`
}{}
if err := self.doJsonRequest("POST", "/v1/user", in, &out); err != nil {
return nil, err
}
return out.User, nil
}
// internal type to retrieve users from the api
type usersData struct {
Users []User `json:"users"`

4
vendor/vendor.json vendored
View File

@ -1951,8 +1951,10 @@
"revision": "75ce5fbba34b1912a3641adbd58cf317d7315821"
},
{
"checksumSHA1": "jBiNbkwHKwnuGfkaccnLc/1rzto=",
"path": "github.com/zorkian/go-datadog-api",
"revision": "af9919d4fd020eba6daada1cbba9310f5d7b44a8"
"revision": "f9f89391f35f5c8eafed4b75b5797b9b23851908",
"revisionTime": "2016-10-04T18:54:04Z"
},
{
"path": "golang.org/x/crypto/curve25519",