-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BED-3995 - New role "Power User" (#343)
Co-authored-by: Mistah J <[email protected]>
- Loading branch information
1 parent
dcdd8ae
commit b364762
Showing
8 changed files
with
412 additions
and
59 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
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,43 @@ | ||
package apiclient | ||
|
||
import ( | ||
"github.com/specterops/bloodhound/src/api" | ||
v2 "github.com/specterops/bloodhound/src/api/v2" | ||
"github.com/specterops/bloodhound/src/model" | ||
"net/http" | ||
) | ||
|
||
func (s Client) ListSavedQueries() (model.SavedQueries, error) { | ||
var queries model.SavedQueries | ||
if response, err := s.Request(http.MethodGet, "api/v2/saved-queries", nil, nil); err != nil { | ||
return queries, err | ||
} else { | ||
defer response.Body.Close() | ||
|
||
if api.IsErrorResponse(response) { | ||
return queries, ReadAPIError(response) | ||
} | ||
|
||
return queries, api.ReadAPIV2ResponsePayload(&queries, response) | ||
} | ||
} | ||
|
||
func (s Client) CreateSavedQuery() (model.SavedQuery, error) { | ||
var query model.SavedQuery | ||
payload := v2.CreateSavedQueryRequest{ | ||
Query: "Match(q:Question {life: 1, universe: 1, everything: 1}) return q", | ||
Name: "AnswerToLifeUniverseEverything", | ||
} | ||
|
||
if response, err := s.Request(http.MethodPost, "api/v2/saved-queries", nil, payload); err != nil { | ||
return query, err | ||
} else { | ||
defer response.Body.Close() | ||
|
||
if api.IsErrorResponse(response) { | ||
return query, ReadAPIError(response) | ||
} | ||
|
||
return query, api.ReadAPIV2ResponsePayload(&query, response) | ||
} | ||
} |
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
Oops, something went wrong.