Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync master #1

Merged
merged 20 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5552c29
add additional fields to downtime definition,
platinummonkey May 15, 2019
1435c96
make generate
platinummonkey May 15, 2019
17da6ea
Merge pull request #239 from platinummonkey/downtime-improvements
May 16, 2019
1c30292
Add possibility to get/set metadata of graph requests on screenboards…
May 16, 2019
7ae8c23
Merge pull request #241 from bkabrda/dashboards-add-metadata
May 17, 2019
f80c46c
should update the passed downtime struct when updating
platinummonkey May 15, 2019
5ee52bf
Merge pull request #240 from platinummonkey/downtime-updates-replace
May 17, 2019
d479e19
Add CustomBgColor to ScreenWidgets (#242)
milanvdm May 21, 2019
16add28
Add monitor_id in Synthetics test config
gabsn May 29, 2019
e55ea7f
Merge pull request #243 from DataDog/gabin/synthetics/add-monitor-id
Jun 3, 2019
5786fcd
Update downtimes.go
blaketastic2 Jun 6, 2019
089b178
Merge pull request #245 from blaketastic2/patch-1
Jun 6, 2019
4c80106
Fix integration tests for downtimes and synthetics tests after recent…
Jun 10, 2019
9112038
Merge pull request #246 from bkabrda/fix-integration-tests
Jun 10, 2019
76a8050
Add support for new endpoints that manipulate individual PD service o…
Jun 14, 2019
1134ec0
Merge pull request #247 from bkabrda/pd-integration-individual-servic…
Jun 14, 2019
ddd27c7
As documentation states, PUT has to be used to create the PD integration
Jun 14, 2019
c9f7769
Merge pull request #248 from bkabrda/pd-integration-create-use-put
Jun 14, 2019
27dbfc0
Add functionality to manipulate application keys
Apr 16, 2019
7105890
Merge pull request #236 from bkabrda/app-keys
Jul 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions app_keys.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Datadog API for Go
*
* Please see the included LICENSE file for licensing information.
*
* Copyright 2019 by authors and contributors.
*/

package datadog

import (
"fmt"
)

// APPKey represents an APP key
type APPKey struct {
Owner *string `json:"owner,omitempty"`
Name *string `json:"name,omitemtpy"`
Hash *string `json:"hash,omitempty"`
}

// reqAPPKeys retrieves a slice of all APPKeys.
type reqAPPKeys struct {
APPKeys []APPKey `json:"application_keys,omitempty"`
}

// reqAPPKey is similar to reqAPPKeys, but used for values returned by
// /v1/application_key/<somekey> which contain one object (not list) "application_key"
// (not "application_keys") containing the found key
type reqAPPKey struct {
APPKey *APPKey `json:"application_key"`
}

// GetAPPKeys returns all APP keys or error on failure
func (client *Client) GetAPPKeys() ([]APPKey, error) {
var out reqAPPKeys
if err := client.doJsonRequest("GET", "/v1/application_key", nil, &out); err != nil {
return nil, err
}

return out.APPKeys, nil
}

// GetAPPKey returns a single APP key or error on failure
func (client *Client) GetAPPKey(hash string) (*APPKey, error) {
var out reqAPPKey
if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/application_key/%s", hash), nil, &out); err != nil {
return nil, err
}

return out.APPKey, nil
}

// CreateAPPKey creates an APP key from given name and fills the rest of its
// fields, or returns an error on failure
func (client *Client) CreateAPPKey(name string) (*APPKey, error) {
toPost := struct {
Name *string `json:"name,omitempty"`
}{
&name,
}
var out reqAPPKey
if err := client.doJsonRequest("POST", "/v1/application_key", toPost, &out); err != nil {
return nil, err
}
return out.APPKey, nil
}

// UpdateAPPKey updates given APP key (only Name can be updated), returns an error
func (client *Client) UpdateAPPKey(appkey *APPKey) error {
out := reqAPPKey{APPKey: appkey}
toPost := struct {
Name *string `json:"name,omitempty"`
}{
appkey.Name,
}
return client.doJsonRequest("PUT", fmt.Sprintf("/v1/application_key/%s", *appkey.Hash), toPost, &out)
}

// DeleteAPPKey deletes APP key given by hash, returns an error
func (client *Client) DeleteAPPKey(hash string) error {
return client.doJsonRequest("DELETE", fmt.Sprintf("/v1/application_key/%s", hash), nil, nil)
}
15 changes: 9 additions & 6 deletions dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ type GraphDefinitionRequest struct {
Style *GraphDefinitionRequestStyle `json:"style,omitempty"`

// For change type graphs
ChangeType *string `json:"change_type,omitempty"`
OrderDirection *string `json:"order_dir,omitempty"`
CompareTo *string `json:"compare_to,omitempty"`
IncreaseGood *bool `json:"increase_good,omitempty"`
OrderBy *string `json:"order_by,omitempty"`
ExtraCol *string `json:"extra_col,omitempty"`
ChangeType *string `json:"change_type,omitempty"`
OrderDirection *string `json:"order_dir,omitempty"`
CompareTo *string `json:"compare_to,omitempty"`
IncreaseGood *bool `json:"increase_good,omitempty"`
OrderBy *string `json:"order_by,omitempty"`
ExtraCol *string `json:"extra_col,omitempty"`
Metadata map[string]GraphDefinitionMetadata `json:"metadata,omitempty"`
}

type GraphDefinitionMetadata TileDefMetadata

type GraphDefinitionMarker struct {
Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
Expand Down
Loading