Skip to content

Commit

Permalink
example added
Browse files Browse the repository at this point in the history
  • Loading branch information
vikashkuma committed Nov 18, 2023
1 parent b586fe9 commit 32b1e90
Show file tree
Hide file tree
Showing 21 changed files with 729 additions and 264 deletions.
4 changes: 2 additions & 2 deletions catchpoint/catchpoint_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Thresholds struct {
type AuthenticationStruct struct {
AuthenticationMethodType GenericIdNameOmitEmpty `json:"authenticationMethodType,omitempty"`
PasswordStatus GenericIdNameOmitEmpty `json:"passwordStatus,omitempty"`
UserName string `json:"userName,omitempty"`
Username string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
PasswordIds []int `json:"passwordIds,omitempty"`
//Id int `json:"id,omitempty"`
Expand Down Expand Up @@ -547,7 +547,7 @@ func setTestRequestSettings(config *TestConfig) RequestSetting {
authenticationMethodType := GenericIdNameOmitEmpty{Id: config.AuthenticationType.Id, Name: config.AuthenticationType.Name}
passwordStatus := GenericIdNameOmitEmpty{Id: 1, Name: "Set"}
passwordIds := config.AuthenticationPasswordIds
authentication = AuthenticationStruct{AuthenticationMethodType: authenticationMethodType, PasswordStatus: passwordStatus, UserName: config.UserName, Password: config.Password, PasswordIds: passwordIds}
authentication = AuthenticationStruct{AuthenticationMethodType: authenticationMethodType, PasswordStatus: passwordStatus, Username: config.Username, Password: config.Password, PasswordIds: passwordIds}
}

requestSetting := RequestSetting{RequestSettingType: requestSettingType, HttpHeaderRequests: httpHeaderRequests, TokenIds: config.AuthenticationTokenIds, LibraryCertificateIds: config.AuthenticationCertificateIds}
Expand Down
2 changes: 1 addition & 1 deletion catchpoint/flatten_all_test_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func flattenAuthenticationStruct(authentication *AuthenticationStruct) []interfa
if authentication != nil {
authMap := map[string]interface{}{
"authentication_type": strings.ToLower(authentication.AuthenticationMethodType.Name),
"userName": authentication.UserName,
"username": authentication.Username,
"password": authentication.Password,
"password_ids": authentication.PasswordIds,
}
Expand Down
64 changes: 32 additions & 32 deletions catchpoint/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,22 @@ func getDnsQueryName(queryType int) string {
func getFrequencyId(frequency string) (int, string) {
frequencies := map[int]string{
0: "none",
1: "1 Minute",
2: "5 Minutes",
3: "10 Minutes",
4: "15 Minutes",
5: "20 Minutes",
6: "30 Minutes",
7: "60 Minutes",
8: "2 Hours",
9: "3 Hours",
10: "4 Hours",
11: "6 Hours",
12: "8 Hours",
13: "12 Hours",
14: "24 Hours",
15: "4 Minutes",
16: "2 Minutes",
1: "1 minute",
2: "5 minutes",
3: "10 minutes",
4: "15 minutes",
5: "20 minutes",
6: "30 minutes",
7: "60 minutes",
8: "2 hours",
9: "3 hours",
10: "4 hours",
11: "6 hours",
12: "8 hours",
13: "12 hours",
14: "24 hours",
15: "4 minutes",
16: "2 minutes",
}
for id, freq := range frequencies {
if freq == frequency {
Expand All @@ -400,22 +400,22 @@ func getFrequencyId(frequency string) (int, string) {
func getFrequencyName(frequency int) string {
frequencies := map[int]string{
0: "none",
1: "1 Minute",
2: "5 Minutes",
3: "10 Minutes",
4: "15 Minutes",
5: "20 Minutes",
6: "30 Minutes",
7: "60 Minutes",
8: "2 Hours",
9: "3 Hours",
10: "4 Hours",
11: "6 Hours",
12: "8 Hours",
13: "12 Hours",
14: "24 Hours",
15: "4 Minutes",
16: "2 Minutes",
1: "1 minute",
2: "5 minutes",
3: "10 minutes",
4: "15 minutes",
5: "20 minutes",
6: "30 minutes",
7: "60 minutes",
8: "2 hours",
9: "3 hours",
10: "4 hours",
11: "6 hours",
12: "8 hours",
13: "12 hours",
14: "24 hours",
15: "4 minutes",
16: "2 minutes",
}
for id, freq := range frequencies {
if id == frequency {
Expand Down
4 changes: 2 additions & 2 deletions catchpoint/test_section_setter.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ func setRequestSettings(testTypeId int, request_setting map[string]interface{},
if authentication_type_id == -1 {
return errors.New("invalid authentication_type provided. valid types are 'basic','ntlm','digest','login'")
}
userName := authentication["userName"].(string)
username := authentication["username"].(string)
password := authentication["password"].(string)
testConfig.AuthenticationType.Id = authentication_type_id
testConfig.AuthenticationType.Name = authentication_type_name
testConfig.UserName = userName
testConfig.Username = username
testConfig.Password = password

tfpassword_ids := authentication["password_ids"].([]interface{})
Expand Down
2 changes: 1 addition & 1 deletion catchpoint/test_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type TestConfig struct {
TestStatus int
RequestSettingType int
AuthenticationType IdName
UserName string
Username string
Password string
AuthenticationPasswordIds []int
AuthenticationTokenIds []int
Expand Down
Loading

0 comments on commit 32b1e90

Please sign in to comment.