diff --git a/as3bigip.go b/as3bigip.go index 3abf44c..2ecb852 100644 --- a/as3bigip.go +++ b/as3bigip.go @@ -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 diff --git a/awaf.go b/awaf.go index 11ab512..948e51c 100644 --- a/awaf.go +++ b/awaf.go @@ -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"` } @@ -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"` } @@ -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"` @@ -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"` @@ -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 { @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/ltm.go b/ltm.go index 196a744..5f08df2 100644 --- a/ltm.go +++ b/ltm.go @@ -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 diff --git a/net.go b/net.go index 561bcc6..5bc3e4d 100644 --- a/net.go +++ b/net.go @@ -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) }