Skip to content

Commit

Permalink
chore(httpPost): Adding http post method in httpProbe (#332)
Browse files Browse the repository at this point in the history
Signed-off-by: shubhamchaudhary <[email protected]>
  • Loading branch information
ispeakc0de authored Feb 15, 2021
1 parent 85bb0ad commit ac7adcd
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 8 deletions.
33 changes: 30 additions & 3 deletions deploy/chaos_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,36 @@ spec:
insecureSkipVerify:
type: boolean
minLength: 1
expectedResponseCode:
type: string
minLength: 1
method:
type: object
minProperties: 1
maxProperties: 1
properties:
get:
type: object
properties:
criteria:
type: string
minLength: 1
responseCode:
type: string
minLength: 1
post:
type: object
properties:
contentType:
type: string
minLength: 1
body:
type: string
bodyPath:
type: string
criteria:
type: string
minLength: 1
responseCode:
type: string
minLength: 1
promProbe/inputs:
type: object
properties:
Expand Down
33 changes: 30 additions & 3 deletions deploy/crds/chaosengine_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,36 @@ spec:
insecureSkipVerify:
type: boolean
minLength: 1
expectedResponseCode:
type: string
minLength: 1
method:
type: object
minProperties: 1
maxProperties: 1
properties:
get:
type: object
properties:
criteria:
type: string
minLength: 1
responseCode:
type: string
minLength: 1
post:
type: object
properties:
contentType:
type: string
minLength: 1
body:
type: string
bodyPath:
type: string
criteria:
type: string
minLength: 1
responseCode:
type: string
minLength: 1
promProbe/inputs:
type: object
properties:
Expand Down
34 changes: 32 additions & 2 deletions pkg/apis/litmuschaos/v1alpha1/chaosengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,38 @@ type HTTPProbeInputs struct {
URL string `json:"url,omitempty"`
// InsecureSkipVerify flag to skip certificate checks
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
// Expected response code from the given url
ExpectedResponseCode string `json:"expectedResponseCode,omitempty"`
// Method define the http method, it can be get or post
Method HTTPMethod `json:"method,omitempty"`
}

// HTTPMethod define the http method details
type HTTPMethod struct {
Get GetMethod `json:"get,omitempty"`
Post PostMethod `json:"post,omitempty"`
}

// GetMethod define the http Get method
type GetMethod struct {
// Criteria for matching data
// it supports == != operations
Criteria string `json:"criteria,omitempty"`
// Value contains relative value for criteria
ResponseCode string `json:"responseCode,omitempty"`
}

// PostMethod define the http Post method
type PostMethod struct {
// ContentType contains content type for http body data
ContentType string `json:"contentType,omitempty"`
// Body contains http body for post request
Body string `json:"body,omitempty"`
// BodyPath contains filePath, which contains http body
BodyPath string `json:"bodyPath,omitempty"`
// Criteria for matching data
// it supports == != operations
Criteria string `json:"criteria,omitempty"`
// Value contains relative value for criteria
ResponseCode string `json:"responseCode,omitempty"`
}

//RunProperty contains timeout, retry and interval for the probe
Expand Down
51 changes: 51 additions & 0 deletions pkg/apis/litmuschaos/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac7adcd

Please sign in to comment.