Skip to content

Commit

Permalink
adding vendor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RavinderReddyF5 committed Jan 30, 2023
1 parent 30be93e commit bd969c4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
3 changes: 2 additions & 1 deletion as3bigip.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func (b *BigIP) PostAs3Bigip(as3NewJson string, tenantFilter string) (error, str
return fmt.Errorf("Error :%+v", fastTask["results"].([]interface{})[0].(map[string]interface{})["errors"]), "", respID
}
if len(fastTask["results"].([]interface{})) == 1 && fastTask["results"].([]interface{})[0].(map[string]interface{})["message"].(string) != "success" && fastTask["results"].([]interface{})[0].(map[string]interface{})["message"].(string) != "no change" {
return fmt.Errorf("Error:%+v", fastTask["results"].([]interface{})[0].(map[string]interface{})["message"]), "", respID
j, _ := json.MarshalIndent(fastTask["results"].([]interface{}), "", "\t")
return fmt.Errorf("Tenant Creation failed with Response: %+v", string(j)), "", respID
}
i := tenant_count - 1
success_count := 0
Expand Down
37 changes: 33 additions & 4 deletions awaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type Filetype struct {
RequestLength int `json:"requestLength,omitempty"`
ResponseCheck bool `json:"responseCheck,omitempty"`
Type string `json:"type,omitempty"`
WildcardOrder int `json:"wildcardOrder,omitempty"`
URLLength int `json:"urlLength,omitempty"`
}

Expand Down Expand Up @@ -163,6 +164,11 @@ type SignatureType struct {
Type string `json:"type,omitempty"`
}

type HostName struct {
IncludeSubdomains bool `json:"includeSubdomains,omitempty"`
Name string `json:"name,omitempty"`
}

type WafSignaturesets struct {
WafSignaturesets []SignatureSet `json:"items"`
}
Expand Down Expand Up @@ -196,6 +202,10 @@ type PolicyStruct struct {
Policy WafPolicy `json:"policy,omitempty"`
Modifications []interface{} `json:"modifications,omitempty"`
}
type PolicyStructobject struct {
Policy interface{} `json:"policy,omitempty"`
Modifications []interface{} `json:"modifications,omitempty"`
}

type WafPolicy struct {
Name string `json:"name,omitempty"`
Expand All @@ -205,6 +215,7 @@ type WafPolicy struct {
ID string `json:"id,omitempty"`
Template struct {
Name string `json:"name,omitempty"`
Link string `json:"link,omitempty"`
} `json:"template,omitempty"`
HasParent bool `json:"hasParent,omitempty"`
ApplicationLanguage string `json:"applicationLanguage,omitempty"`
Expand Down Expand Up @@ -239,6 +250,24 @@ type WafPolicy struct {
OpenAPIFiles []OpenApiLink `json:"open-api-files,omitempty"`
SignatureSets []SignatureSet `json:"signature-sets,omitempty"`
VirtualServers []interface{} `json:"virtualServers,omitempty"`
DataGuard struct {
Enabled bool `json:"enabled,omitempty"`
EnforcementMode string `json:"enforcementMode,omitempty"`
} `json:"data-guard,omitempty"`
IpIntelligence struct {
Enabled bool `json:"enabled,omitempty"`
} `json:"ip-intelligence,omitempty"`
HostNames []HostName `json:"host-names,omitempty"`
General struct {
AllowedResponseCodes []int `json:"allowedResponseCodes,omitempty"`
EnableEventCorrelation bool `json:"enableEventCorrelation,omitempty"`
EnforcementReadinessPeriod int `json:"enforcementReadinessPeriod,omitempty"`
MaskCreditCardNumbersInRequest bool `json:"maskCreditCardNumbersInRequest,omitempty"`
PathParameterHandling string `json:"pathParameterHandling,omitempty"`
TriggerAsmIruleEvent string `json:"triggerAsmIruleEvent,omitempty"`
TrustXff bool `json:"trustXff,omitempty"`
UseDynamicSessionIdInUrl bool `json:"useDynamicSessionIdInUrl,omitempty"`
} `json:"general,omitempty"`
}

type ImportStatus struct {
Expand Down Expand Up @@ -367,7 +396,7 @@ func (b *BigIP) GetWafPolicyQuery(wafPolicyName string, partition string) (*WafP

func (b *BigIP) GetWafPolicy(policyID string) (*WafPolicy, error) {
var wafPolicy WafPolicy
log.Printf("WAF policy get with ID:%+v", policyID)
log.Printf("[DEBUG] WAF policy get with ID:%+v", policyID)
err, _ := b.getForEntity(&wafPolicy, uriMgmt, uriTm, uriAsm, uriWafPol, policyID)
if err != nil {
return nil, err
Expand Down Expand Up @@ -414,7 +443,7 @@ func (b *BigIP) ExportPolicyFull(policyID string) (*string, error) {
exportPayload.Inline = true
exportPayload.PolicyReference.Link = fmt.Sprintf("https://localhost/mgmt/tm/asm/policies/%s", policyID)

log.Printf("[INFO]payload:%+v", exportPayload)
log.Printf("[INFO] payload:%+v", exportPayload)
resp, err := b.postReq(exportPayload, uriMgmt, uriTm, uriAsm, uriTasks, uriExportpolicy)
if err != nil {
return nil, err
Expand Down Expand Up @@ -548,7 +577,7 @@ func (b *BigIP) ImportAwafJson(awafPolicyName, awafJsonContent, policyID string)
//FullPath: awafPolicyName,
PolicyReference: policyPath,
}
log.Printf("import policy:%+v", policy)
log.Printf("[DEBUG] Import policy:%+v", policy)
resp, err := b.postReq(policy, uriMgmt, uriTm, uriAsm, uriTasks, uriImportpolicy)
if err != nil {
return "", err
Expand All @@ -560,7 +589,7 @@ func (b *BigIP) ImportAwafJson(awafPolicyName, awafJsonContent, policyID string)
}
return taskStatus.ID, nil
}
log.Printf("import policy:%+v", applywaf)
log.Printf("[DEBUG] Import policy:%+v", applywaf)
resp, err := b.postReq(applywaf, uriMgmt, uriTm, uriAsm, uriTasks, uriImportpolicy)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion ltm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ func (b *BigIP) DeleteVirtualAddress(vaddr string) error {
// Monitors returns a list of all HTTP, HTTPS, Gateway ICMP, ICMP, and TCP monitors.
func (b *BigIP) Monitors() ([]Monitor, error) {
var monitors []Monitor
monitorUris := []string{"http", "https", "icmp", "gateway-icmp", "tcp", "tcp-half-open", "ftp", "udp", "postgresql", "mysql", "mssql", "ldap"}
monitorUris := []string{"http", "https", "icmp", "gateway-icmp", "tcp", "tcp-half-open", "ftp", "udp", "postgresql", "mysql", "mssql", "ldap", "smtp"}

for _, name := range monitorUris {
var m Monitors
Expand Down
15 changes: 10 additions & 5 deletions net.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,17 @@ func (b *BigIP) Vlan(name string) (*Vlan, error) {
return &vlan, nil
}

//// CreateVlan adds a new VLAN to the BIG-IP system.
//func (b *BigIP) CreateVlan(name string, tag int) error {
// config := &Vlan{
// Name: name,
// Tag: tag,
// }
// return b.post(config, uriNet, uriVlan)
//}

// CreateVlan adds a new VLAN to the BIG-IP system.
func (b *BigIP) CreateVlan(name string, tag int) error {
config := &Vlan{
Name: name,
Tag: tag,
}
func (b *BigIP) CreateVlan(config *Vlan) error {
return b.post(config, uriNet, uriVlan)
}

Expand Down

0 comments on commit bd969c4

Please sign in to comment.