Skip to content

Commit 32dd831

Browse files
greatestusernameBrian Gustafsongreatestusername-splunk
authored
Getting changes from Main into v2 (#14)
* SYN-3197: Custom Properties * adds custom properties to integration tests. * add new CLA workflow * update readme and contributing docs * docs change --------- Co-authored-by: Brian Gustafson <bgustafson@splunk.com> Co-authored-by: greatestusername-splunk <83726369+greatestusername-splunk@users.noreply.github.com>
1 parent 47d07ac commit 32dd831

18 files changed

+242
-122
lines changed

.github/workflows/cla.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened, closed, synchronize]
7+
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
8+
permissions:
9+
actions: write
10+
contents: write
11+
pull-requests: write
12+
statuses: write
13+
jobs:
14+
CLAAssistant:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: "CLA Assistant"
18+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
19+
uses: contributor-assistant/github-action@v2.3.0
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
# the below token should have repo scope and must be manually added by you in the repository's secret
23+
# This token is required only if you have configured to store the signatures in a remote repository/organization
24+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
25+
with:
26+
path-to-signatures: 'signatures/version1/cla.json'
27+
path-to-document: 'https://github.com/splunk/cla-agreement/blob/main/CLA.md' # e.g. a CLA or a DCO document
28+
# branch should not be protected
29+
branch: 'main'
30+
allowlist: dependabot[bot]
31+
remote-organization-name: splunk
32+
remote-repository-name: cla-agreement
33+
CodeOfConduct:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: "COC Assistant"
37+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the Code of Conduct and I hereby accept the Terms') || github.event_name == 'pull_request_target'
38+
uses: cla-assistant/github-action@v2.3.0
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
42+
with:
43+
path-to-signatures: "signatures/version1/coc.json"
44+
path-to-document: "https://github.com/splunk/cla-agreement/blob/main/CODE_OF_CONDUCT.md" # e.g. a COC or a DCO document
45+
branch: "main"
46+
allowlist: dependabot[bot]
47+
remote-organization-name: splunk
48+
remote-repository-name: cla-agreement
49+
custom-pr-sign-comment: "I have read the Code of Conduct and I hereby accept the Terms"
50+
create-file-commit-message: "For example: Creating file for storing COC Signatures"
51+
signed-commit-message: "$contributorName has signed the COC in #$pullRequestNo"
52+
custom-notsigned-prcomment: "All contributors have NOT signed the COC Document"
53+
custom-allsigned-prcomment: "****CLA Assistant Lite bot**** All contributors have signed the COC ✍️ ✅"

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@
3030

3131
.DS_Store
3232
.vscode/settings.json
33+
34+
# Jetbrains IDEs
35+
.idea

CONTRIBUTING.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you are reporting a bug or issues, please include:
1313

1414
- Operating system name and version.
1515
- Any details about your local setup that might be helpful
16-
in troubleshooting (E.G. Python version if using a python script, Terraform version if you're using a Terraform script.).
16+
in troubleshooting
1717
- Detailed steps to reproduce the bug.
1818

1919
### Fix Bugs
@@ -23,17 +23,16 @@ a "bug" ticket type is open to whoever wants to implement it.
2323

2424
### Implement Features
2525

26-
If you have a great set of dashboards, detectors, API scripts for sending metrics, or any other content
27-
you believe will be of use to others, please contribute it!
28-
29-
Or check the Issues for this repo on GitHub. Anything tagged with "enhancement"
26+
Please file an issue or check the issues for this repo on GitHub. Anything tagged with "enhancement"
3027
and "help wanted" is open to whoever wants to implement it.
3128

29+
Once issues are posted and triaged please include their issue number in any PRs related to that work
30+
3231
### Write Documentation
3332

3433
Submissions and `README.md` files could always use more documentation. Documentation can always use an update or tweak in the official docs, in docstrings of scripts, comments in configs, or anywhere a bit of clarity may be useful..
3534

36-
### Submit Feedback
35+
### Submit Issues / Feedback
3736

3837
If you are proposing a feature:
3938

@@ -47,9 +46,5 @@ If you are proposing a feature:
4746

4847
Before you submit a pull request, check that it meets these guidelines:
4948

50-
1. The pull request should include a `README.md` for any new submission.
51-
2. If the pull request adds functionality, the `README.md` docs for that component or submission should be updated.
52-
Put your new functionality into a function with a docstring, and add
53-
the feature to the list in README.md.
54-
3. Terraform submissions should work with the most current version of the included Terraform Provider.
55-
4. Python submissions should work for Python3
49+
1. The pull request should include documentation and example changes for any new functionality.
50+
2. If the pull request adds functionality, the tests should be updated.

README.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntheticsclient
2-
A Splunk Synthetics (Formerly Rigor) client for golang.
2+
A Splunk Synthetics for Splunk Observability (Formerly Rigor) client for golang.
33

44
## Installation
55
`go get https://github.com/splunk/syntheticsclient.git`
@@ -52,4 +52,23 @@ func main() {
5252
API Docs are [available here](https://dev.splunk.com/observability/reference)
5353

5454
## Additional Information
55-
This client is largely a copypasta mutation of the [go-victor](https://github.com/victorops/go-victorops) client for Splunk On-Call (formerly known as VictorOps).
55+
This client is largely a copypasta mutation of the [go-victor](https://github.com/victorops/go-victorops) client for Splunk On-Call (formerly known as VictorOps).
56+
57+
## Contributions
58+
Contributions are welcome and encouraged!
59+
60+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details on contributing to this repository.
61+
62+
Before your contribution can be accepted, you will be asked to sign our
63+
[Splunk Contributor License Agreement (CLA)](https://github.com/splunk/cla-agreement/blob/main/CLA.md).
64+
65+
To agree to the CLA and COC please comment these in **separate individual messages** on your PR:
66+
67+
CLA:
68+
```
69+
I have read the CLA Document and I hereby sign the CLA
70+
```
71+
72+
Code of Conduct:
73+
```
74+
I have read the Code of Conduct and I hereby accept the Terms

syntheticsclientv2/common_models.go

+99-85
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,16 @@ type Validations struct {
140140
}
141141

142142
type Tests []struct {
143-
Active bool `json:"active"`
144-
Createdat time.Time `json:"createdAt"`
145-
Frequency int `json:"frequency"`
146-
ID int `json:"id"`
147-
Locationids []string `json:"locationIds"`
148-
Name string `json:"name"`
149-
Schedulingstrategy string `json:"schedulingStrategy"`
150-
Type string `json:"type"`
151-
Updatedat time.Time `json:"updatedAt"`
143+
Active bool `json:"active"`
144+
Createdat time.Time `json:"createdAt"`
145+
Frequency int `json:"frequency"`
146+
ID int `json:"id"`
147+
Locationids []string `json:"locationIds"`
148+
Name string `json:"name"`
149+
Schedulingstrategy string `json:"schedulingStrategy"`
150+
Type string `json:"type"`
151+
Updatedat time.Time `json:"updatedAt"`
152+
Customproperties []CustomProperties `json:"customProperties"`
152153
}
153154

154155
type GetChecksV2Options struct {
@@ -237,86 +238,91 @@ type ChecksV2Response struct {
237238

238239
type PortCheckV2Response struct {
239240
Test struct {
240-
ID int `json:"id"`
241-
Name string `json:"name"`
242-
Active bool `json:"active"`
243-
Frequency int `json:"frequency"`
244-
SchedulingStrategy string `json:"schedulingStrategy"`
245-
CreatedAt time.Time `json:"createdAt"`
246-
UpdatedAt time.Time `json:"updatedAt"`
247-
LocationIds []string `json:"locationIds"`
248-
Type string `json:"type"`
249-
Protocol string `json:"protocol"`
250-
Host string `json:"host"`
251-
Port int `json:"port"`
241+
ID int `json:"id"`
242+
Name string `json:"name"`
243+
Active bool `json:"active"`
244+
Frequency int `json:"frequency"`
245+
SchedulingStrategy string `json:"schedulingStrategy"`
246+
CreatedAt time.Time `json:"createdAt"`
247+
UpdatedAt time.Time `json:"updatedAt"`
248+
LocationIds []string `json:"locationIds"`
249+
Type string `json:"type"`
250+
Protocol string `json:"protocol"`
251+
Host string `json:"host"`
252+
Port int `json:"port"`
253+
Customproperties []CustomProperties `json:"customProperties"`
252254
} `json:"test"`
253255
}
254256

255257
type PortCheckV2Input struct {
256258
Test struct {
257-
Name string `json:"name"`
258-
Type string `json:"type"`
259-
URL string `json:"url"`
260-
Port int `json:"port"`
261-
Protocol string `json:"protocol"`
262-
Host string `json:"host"`
263-
LocationIds []string `json:"locationIds"`
264-
Frequency int `json:"frequency"`
265-
SchedulingStrategy string `json:"schedulingStrategy"`
266-
Active bool `json:"active"`
259+
Name string `json:"name"`
260+
Type string `json:"type"`
261+
URL string `json:"url"`
262+
Port int `json:"port"`
263+
Protocol string `json:"protocol"`
264+
Host string `json:"host"`
265+
LocationIds []string `json:"locationIds"`
266+
Frequency int `json:"frequency"`
267+
SchedulingStrategy string `json:"schedulingStrategy"`
268+
Active bool `json:"active"`
269+
Customproperties []CustomProperties `json:"customProperties"`
267270
} `json:"test"`
268271
}
269272

270273
type HttpCheckV2Response struct {
271274
Test struct {
272-
ID int `json:"id"`
273-
Name string `json:"name"`
274-
Active bool `json:"active"`
275-
Frequency int `json:"frequency"`
276-
SchedulingStrategy string `json:"schedulingStrategy"`
277-
CreatedAt time.Time `json:"createdAt,omitempty"`
278-
UpdatedAt time.Time `json:"updatedAt,omitempty"`
279-
LocationIds []string `json:"locationIds"`
280-
Type string `json:"type"`
281-
URL string `json:"url"`
282-
RequestMethod string `json:"requestMethod"`
283-
Body string `json:"body,omitempty"`
284-
Authentication *Authentication `json:"authentication"`
285-
UserAgent *string `json:"userAgent"`
286-
Verifycertificates bool `json:"verifyCertificates"`
287-
HttpHeaders []HttpHeaders `json:"headers"`
288-
Validations []Validations `json:"validations"`
275+
ID int `json:"id"`
276+
Name string `json:"name"`
277+
Active bool `json:"active"`
278+
Frequency int `json:"frequency"`
279+
SchedulingStrategy string `json:"schedulingStrategy"`
280+
CreatedAt time.Time `json:"createdAt,omitempty"`
281+
UpdatedAt time.Time `json:"updatedAt,omitempty"`
282+
LocationIds []string `json:"locationIds"`
283+
Type string `json:"type"`
284+
URL string `json:"url"`
285+
RequestMethod string `json:"requestMethod"`
286+
Body string `json:"body,omitempty"`
287+
Authentication *Authentication `json:"authentication"`
288+
UserAgent *string `json:"userAgent"`
289+
Verifycertificates bool `json:"verifyCertificates"`
290+
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
291+
Validations []Validations `json:"validations"`
292+
Customproperties []CustomProperties `json:"customProperties"`
289293
} `json:"test"`
290294
}
291295

292296
type HttpCheckV2Input struct {
293297
Test struct {
294-
Name string `json:"name"`
295-
Type string `json:"type"`
296-
URL string `json:"url"`
297-
LocationIds []string `json:"locationIds"`
298-
Frequency int `json:"frequency"`
299-
SchedulingStrategy string `json:"schedulingStrategy"`
300-
Active bool `json:"active"`
301-
RequestMethod string `json:"requestMethod"`
302-
Body string `json:"body,omitempty"`
303-
Authentication *Authentication `json:"authentication"`
304-
UserAgent *string `json:"userAgent"`
305-
Verifycertificates bool `json:"verifyCertificates"`
306-
HttpHeaders []HttpHeaders `json:"headers"`
307-
Validations []Validations `json:"validations"`
298+
Name string `json:"name"`
299+
Type string `json:"type"`
300+
URL string `json:"url"`
301+
LocationIds []string `json:"locationIds"`
302+
Frequency int `json:"frequency"`
303+
SchedulingStrategy string `json:"schedulingStrategy"`
304+
Active bool `json:"active"`
305+
RequestMethod string `json:"requestMethod"`
306+
Body string `json:"body,omitempty"`
307+
Authentication *Authentication `json:"authentication"`
308+
UserAgent *string `json:"userAgent"`
309+
Verifycertificates bool `json:"verifyCertificates"`
310+
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
311+
Validations []Validations `json:"validations"`
312+
Customproperties []CustomProperties `json:"customProperties"`
308313
} `json:"test"`
309314
}
310315

311316
type ApiCheckV2Input struct {
312317
Test struct {
313-
Active bool `json:"active"`
314-
Deviceid int `json:"deviceId"`
315-
Frequency int `json:"frequency"`
316-
Locationids []string `json:"locationIds"`
317-
Name string `json:"name"`
318-
Requests []Requests `json:"requests"`
319-
Schedulingstrategy string `json:"schedulingStrategy"`
318+
Active bool `json:"active"`
319+
Deviceid int `json:"deviceId"`
320+
Frequency int `json:"frequency"`
321+
Locationids []string `json:"locationIds"`
322+
Name string `json:"name"`
323+
Requests []Requests `json:"requests"`
324+
Schedulingstrategy string `json:"schedulingStrategy"`
325+
Customproperties []CustomProperties `json:"customProperties"`
320326
} `json:"test"`
321327
}
322328

@@ -325,14 +331,15 @@ type ApiCheckV2Response struct {
325331
Active bool `json:"active"`
326332
Createdat time.Time `json:"createdAt"`
327333
Device `json:"device,omitempty"`
328-
Frequency int `json:"frequency,omitempty"`
329-
ID int `json:"id,omitempty"`
330-
Locationids []string `json:"locationIds,omitempty"`
331-
Name string `json:"name,omitempty"`
332-
Requests []Requests `json:"requests,omitempty"`
333-
Schedulingstrategy string `json:"schedulingStrategy,omitempty"`
334-
Type string `json:"type,omitempty"`
335-
Updatedat time.Time `json:"updatedAt,omitempty"`
334+
Frequency int `json:"frequency,omitempty"`
335+
ID int `json:"id,omitempty"`
336+
Locationids []string `json:"locationIds,omitempty"`
337+
Name string `json:"name,omitempty"`
338+
Requests []Requests `json:"requests,omitempty"`
339+
Schedulingstrategy string `json:"schedulingStrategy,omitempty"`
340+
Type string `json:"type,omitempty"`
341+
Updatedat time.Time `json:"updatedAt,omitempty"`
342+
Customproperties []CustomProperties `json:"customProperties"`
336343
}
337344
}
338345

@@ -348,6 +355,7 @@ type BrowserCheckV2Input struct {
348355
Schedulingstrategy string `json:"schedulingStrategy"`
349356
Active bool `json:"active"`
350357
Advancedsettings `json:"advancedSettings,omitempty"`
358+
Customproperties []CustomProperties `json:"customProperties"`
351359
} `json:"test"`
352360
}
353361

@@ -357,13 +365,19 @@ type BrowserCheckV2Response struct {
357365
Advancedsettings `json:"advancedSettings"`
358366
Createdat time.Time `json:"createdAt"`
359367
Device `json:"device"`
360-
Frequency int `json:"frequency"`
361-
ID int `json:"id"`
362-
Locationids []string `json:"locationIds"`
363-
Name string `json:"name"`
364-
Schedulingstrategy string `json:"schedulingStrategy"`
365-
Transactions []Transactions `json:"transactions"`
366-
Type string `json:"type"`
367-
Updatedat time.Time `json:"updatedAt"`
368+
Frequency int `json:"frequency"`
369+
ID int `json:"id"`
370+
Locationids []string `json:"locationIds"`
371+
Name string `json:"name"`
372+
Schedulingstrategy string `json:"schedulingStrategy"`
373+
Transactions []Transactions `json:"transactions"`
374+
Type string `json:"type"`
375+
Updatedat time.Time `json:"updatedAt"`
376+
Customproperties []CustomProperties `json:"customProperties"`
368377
} `json:"test"`
369378
}
379+
380+
type CustomProperties struct {
381+
Key string `json:"key"`
382+
Value string `json:"value"`
383+
}

syntheticsclientv2/create_apicheckv2_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
var (
29-
createApiV2Body = `{"test":{"active":true,"device_id":1,"frequency":5,"location_ids":["aws-us-east-1"],"name":"boop-test","scheduling_strategy":"round_robin","requests":[{"configuration":{"name":"Get-Test","requestMethod":"GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/489","headers":{"X-SF-TOKEN":"jinglebellsbatmanshells", "beep":"boop"},"body":null},"setup":[{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"$.requests","variable":"custom-varz"}],"validations":[{"name":"Assert response code equals 200","type":"assert_numeric","actual":"{{response.code}}","expected":"200","comparator":"equals"}]}]}}`
29+
createApiV2Body = `{"test":{"customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "active":true,"device_id":1,"frequency":5,"location_ids":["aws-us-east-1"],"name":"boop-test","scheduling_strategy":"round_robin","requests":[{"configuration":{"name":"Get-Test","requestMethod":"GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/489","headers":{"X-SF-TOKEN":"jinglebellsbatmanshells", "beep":"boop"},"body":null},"setup":[{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"$.requests","variable":"custom-varz"}],"validations":[{"name":"Assert response code equals 200","type":"assert_numeric","actual":"{{response.code}}","expected":"200","comparator":"equals"}]}]}}`
3030
inputData = ApiCheckV2Input{}
3131
)
3232

@@ -79,4 +79,7 @@ func TestCreateApiCheckV2(t *testing.T) {
7979
t.Errorf("returned \n\n%#v want \n\n%#v", resp.Test.Schedulingstrategy, inputData.Test.Schedulingstrategy)
8080
}
8181

82+
if !reflect.DeepEqual(resp.Test.Customproperties, inputData.Test.Customproperties) {
83+
t.Errorf("returned \n\n%#v want \n\n%#v", resp.Test.Customproperties, inputData.Test.Customproperties)
84+
}
8285
}

0 commit comments

Comments
 (0)