Skip to content

Commit e469511

Browse files
Merge pull request #9 from mcmluk-monster/http-check-validation
Add Validations field to HTTP Check
2 parents 0584d13 + ccb4035 commit e469511

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

syntheticsclientv2/common_models.go

+2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ type HttpCheckV2Response struct {
285285
UserAgent *string `json:"userAgent"`
286286
Verifycertificates bool `json:"verifyCertificates"`
287287
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
288+
Validations []Validations `json:"validations"`
288289
} `json:"test"`
289290
}
290291

@@ -303,6 +304,7 @@ type HttpCheckV2Input struct {
303304
UserAgent *string `json:"userAgent"`
304305
Verifycertificates bool `json:"verifyCertificates"`
305306
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
307+
Validations []Validations `json:"validations"`
306308
} `json:"test"`
307309
}
308310

syntheticsclientv2/create_httpcheckv2.go

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func parseCreateHttpCheckV2Response(response string) (*HttpCheckV2Response, erro
3333

3434
func (c Client) CreateHttpCheckV2(HttpCheckV2Details *HttpCheckV2Input) (*HttpCheckV2Response, *RequestDetails, error) {
3535

36+
if HttpCheckV2Details.Test.Validations == nil {
37+
validation := make([]Validations, 0)
38+
HttpCheckV2Details.Test.Validations = validation
39+
}
40+
3641
body, err := json.Marshal(HttpCheckV2Details)
3742
if err != nil {
3843
return nil, nil, err

syntheticsclientv2/integration_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,13 @@ func CreateHttpCheckV2(test string, c *Client) (int, error) {
245245
}
246246
fmt.Printf("\nReq was: \n%v\n", reqDetail)
247247
JsonPrint(res)
248+
inputHttpCheckV2Data = HttpCheckV2Input{}
248249

249250
return res.Test.ID, nil
250251
}
251252

252253
func UpdateHttpCheckV2(checkId int, test string, c *Client) error {
253-
254+
254255
err := json.Unmarshal([]byte(test), &inputHttpCheckV2Data)
255256
if err != nil {
256257
return err
@@ -263,6 +264,7 @@ func UpdateHttpCheckV2(checkId int, test string, c *Client) error {
263264
}
264265
fmt.Printf("\nReq was: \n%v\n", reqDetail)
265266
JsonPrint(res)
267+
inputHttpCheckV2Data = HttpCheckV2Input{}
266268

267269
return nil
268270
}

syntheticsclientv2/update_httpcheckv2.go

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func parseUpdateHttpCheckV2Response(response string) (*HttpCheckV2Response, erro
3333
}
3434

3535
func (c Client) UpdateHttpCheckV2(id int, HttpCheckV2Details *HttpCheckV2Input) (*HttpCheckV2Response, *RequestDetails, error) {
36+
if HttpCheckV2Details.Test.Validations == nil {
37+
validation := make([]Validations, 0)
38+
HttpCheckV2Details.Test.Validations = validation
39+
}
3640

3741
body, err := json.Marshal(HttpCheckV2Details)
3842
if err != nil {

0 commit comments

Comments
 (0)